The title of this video is point loop. So we're going to start with where we left off with the simple incremental loop, and I've just made a few changes to this. One of them is that in defining x in terms of i, I've just set y and z equal to zero. The only reason I've done that is to give clarity in the code, that we understand these as point values. One of the things that we can do with this is if I run this, so I'm creating my points along my x-axis here. What if we wanted to display our point values in that space and do that, we could add a TextDot inside the loop here. If we think back to some of the earlier lessons where I was taking a list of points, either input or returned for something, and then I was using my AddTextDot to either identify their position in the lists or their coordinate values. Now I can do it in a much simpler, straightforward, it's not necessarily simpler, but I can do it in the loop, which is more efficient than writing out one line at a time. I can write essentially all of the points within the loop. I can label in one line of code. So you really start to see with looping and really start to see the power of writing things in code. If we run that, so now I'm identifying in space and write on space, my coordinate values of those points in sequence. Now what we could also do, is we could save those point values in a list to be able to do something with them later in the code, we're just using this loop to generate the points. Then we'll do something later in the code with that list of points. So in order to do that, I have to create an empty list. So we'll do that up here at the top of our code. Call point list SQL to close bracket, and then we're going to save our point values in that list. That doesn't really change anything in the running of the code at all. It's going to run exactly the same. I'm not really doing anything with that point list yet. You notice here too that I've also written out the values of my point, keeping it in a tuple. This is really creating a list of lists or a list of tuples. So each tuple defining each point, and we will print that out and look at that structure. So undo what I did in Rhino space. Let's now loop through that point list, and let's uncomment that, "Shift Control U". So the first thing I'm going to do is I'm going to print out that point list. Now in this situation, I talked about this in the lesson on iteration, but we haven't used it in a code yet using the function len. So the function len returns the length of this list and that it's using that length value as my range input. Now someone might say, well, why don't you just use 10? It's 10 up here because that's what you use to create the point list. I could do that, but what if I at some point change that later in the code? Some point down, I could always change this value and maybe I have no idea what the length of that point list is. So why not just use len to find that out? I don't need to know what that number is in order to use it. So that's going to print out or index value i and just putting this colon in, in-between just for legibility. So that's going to separate out and then this is going to print out the tuple that's being held in that index slot i. Let's do that. Down at the bottom here, my output, it's now showing index value 0 of point list. It's holding the tuples 000 and the next one 5, 10, so on. It's holding these in that list. Now, we could also change this here, we could turn off or printing out or showing our coordinates by commenting that. Instead, we could AddTextDot for our point list index values. So now I could label each point as it's generated with its index value instead of its coordinate value. So what I was doing in some of the earlier video lessons where I was having to do that manually. Now I've just done it using a loop. So using the AddTextDot function in a loop to label these points in their sequence that they're generated. I could also do that if I input a bunch of points as I should in some of the earlier videos. I could also use a loop to print out their location and space their index value location on the point and space. Let's do something with this point list. Let's create some transformation of some geometry and let's use it rather than creating the geometry within the scene, we will take an input. I'm going to input a curve or a line in this case. So I've drawn this, just a simple straight line and we're going to first take that line, and we're going to copy it to each point in the list. We're going to do it while we're inside of this loop. So to do that, I need to find a point on this line, we're going to use the midpoint and then we're going to do a translation from that midpoint to each point within the list. Let's uncomment that first section here and I'm doing this copy object here. So we're finding the midpoint, we're calculating a translation. Our endpoint that we're going to is the point list, i and minus our midpoint. So remember the translation is between two points and then the copy object just needs the endpoint and it needs that translation. Let's run this. So select the curve to transform, select that line. So this is throwing an error, unsupported operand types for a tuple and a 3D point, and the trace back is line 32. So it's a problem with the translation. This is often a problem, so I'm feeding it a tuple and I'm feeding it a 3D point. Yeah, I know this is a tuple because that's the structure I saved it in. Then this is returning also a list of values, but it identifies it as a 3D point. So it's having a problem with that calculation, and this is often a problem with doing the translation. So one workaround for it is to pull out each x, y, and z value from these lists and do this subtraction separately for each one of those and then put them back together, which essentially means putting them in their own parenthesis, creating a new tuple out of that. Then saving that in the [inaudible] uncomment, saving them in the variable translation. So we know point list is a list of tuples, and so the first time I'm through the loop, index value zero. The first coordinate for slot is the x, which is zero index value, and so that's the x value that I'm pulling out of there. Just to help you remember that, let's do this. I'm just going to comment that out for a second and we'll print this TextDot out again and we can see the structure. So here's that structure. So that's the index value, and then that first index value in that tuple that's being saved is the x, and then slot 1 would be the y and slot 2 would be the z. So essentially I'm accessing that data in a nested list, and the way I do that is put the index value of that tuple first and then the index value of the information in the tuple next. So that's what I'm doing here, so uncomment that. So that's the x value minus the x value of the midpoint, which is just a simple tuple, and then separated by a comma, and then the next one, this is the y value minus the y value and midpoint, and then point list. That's the z minus that. So that's saved in translation, and that's my translation from the midpoint of this line to each one of these points as it goes through the loop. So let's run that. Okay, so now it's a copying those lines to those points. Then lastly, let's do a rotation. So we're going to rotate the line using i as an angle multiplier. Or we can just use it straight up as the angle. So it's going to start at zero and then angle 1, 2, 3, so on, and it's going to rotate that newly copied line, which I've overwritten here. So I run it again, select the line, and now it's rotating around that point. So one thing I can change in this is the number of points that are being generated. If I brought that up to 50, this is still going to work fine, and then I'm going to get a greater degree of rotation within the line. So you could start to see some of the transformation things that we did in our transform sections in lesson 1. If you added looping to that, you can really start to do a lot in terms of automatic or looped transformations of different forms, and so this could be obviously more complex than just a straight up line.