This video is titled, curves and lists. And I just want to start by talking about something I missed in the last video, and that's the fact that it's important that I was using 5 points. For some reason if I selected, let's say, I only selected 4, And ran this, I'm going to get an index out of range here. So it's throwing this error, my trace back is coming from line 16, and that's because if I've only input 4 points, right? I only have 0, 1, 2, 3, I only have those points within those index values. And in line 16, it's asking for point ID that's being held in index 4 and it doesn't exist, and that's why it's throwing an index out of range error. So it's important that the way that I have this code set up that I'm selecting 5 points, I could give it 6 points or more, and it wouldn't break. Okay, the reason it's not breaking, it's not using that 6 point, you see It's not labelling it or anything. It's because I'm not trying to refer to it in any way in the code, I only refer up to point 4. If I did this, if I did add curve here between all of the points, that should work okay. Let's comment this out. Undo that and run this again. So select 6 points, right? Now it's drawing that last curve to that 6 points, it still doesn't label it because I don't have that setup up here, but it's not breaking, it's not throwing an error or anything. So that's something to keep in mind. So I just change this in the code before I uploaded it, select 5 points because that's the way it going to work, okay? So if you set it up with 3 points or 6 points, you might write this code differently or amend this code for other points, that could be a good exercise to do. Okay, let's talk about curves and lists. And so, I've created some curves here, three different types, we have a 3 degree NURBS curve, a line between 2 points, and then we have a closed, planar shape. And we're going to use Getobjects to import those, and we're going to filter them. And let's print out the IDs, So when we do all those, and it's collecting those IDs, and it's putting them within a list just like it did with the points. So first order of business is how do I label them to find out their order? So if I want to use the TextDot, problem is with curves, I don't have a point, I need to point to add TextDot. So, I would need to first derive a point from these curves to label them, so that's what I've done down here in this next part of the code, Shift+Ctrl+U. I'm introducing one of the ways in which we can use lists, so here I'm creating an empty list called midpoints. And then I'm using the method append to that list, finding the curve midpoint of each one of the curves in that list. Again, this is like the last one, this is dependent on me just using three curves. So take those three curves, and then I mainly use AddTextDot, and then I'm gona label them like I did with the points at their mid points. So it's going to put those TextDots at the midpoints of the curves that it finds. So we'll run that, select everything, and then it shows me the order of their creation. So the shape was first, and then I drew the line, and then I drew the curve. Again, these are in the order in which I constructed them in Rhino. Okay, next I'm going to generate some points from the curves by using DivideCurve. Now we've already looked at a bunch of different functions for finding points from lines, and curves, and shapes. So CurveMidPoint was one of them, CurveEndPoint, and CurveStartPoint were some other ones. So DivideCurve we've shown manually, but we can use it in the code, and it's actually a bit of code that we use quite a bit in a lot of the stuff that we're going to do in the course. So, Shift+Ctrl+U to uncomment that, and let's take a look at what it asks for, what sort of arguments does it need. So DivideCurve, so under parameters, it needs an ID. So it wants to know the curve object, it wants to know the number of segments that it's going to divide it up into, and then the next two things it's going to do are optional. So and there's a distinction here, which should be familiar from what's the point lesson, and that's between either creating points or returning points. So it's telling me these are optional, but if create_points is omitted, then points are not created, and then return_points if omitted, or true points are returned. And so what this distinction is create_points means, do I want to visualize the points within the scene? return_points is typically once referring to return, it means it's returning a value, so do I want to return the value of the point? So default is it's not going to generate render the points within the scene, it's not going to create them, but it is going to return the values of the points. Because typically in coding, they're going to be the more sort of useful thing to me. But what we're going to do is we're going to set both of these to true, because I want to see them, and then I also want to return them. So that's how we'll write it out in this first part. So DivideCurve, I am going to divide the curvy curve, I think that was number 2, we can always change that, we're going to divide it into five segments. And we're both creating points, and returning points, and then we're going to print those points out. I can comment this out, I don't need that, line 6. And it's okay, we're still labeling them, let's go ahead and run it, hit Play, select the curves Okay, so yeah, number two is the curvy curve, and it's showing me points now that it's used to divide that curve. Something to point out about, This number, so 5 by 5 here. And that is the number of segments. So I have one, it doesn't actually divide the curve. But it's dividing the distance of the curve into five equal segments, and then it's putting a point at the nexus of each one of those measurements, those segments. So what it really creates is six points. So if I have five segments, I have six points. And we could see that for the other curves, if I set this to 1, Do that. Okay, set that to 1. And then in the DivideCurve, set it to Curve. ID is 1, hit Play. Select all the curves. Okay, now it's dividing the line. And Ctrl+C to undo that, whoops. Now it doesn't want to go back, okay. And 0 should do the shape. Okay, one thing to point out about the shape is, if you count the number of points, one, two, three, four, five, it only has five points. And that's because it's a closed shape. So my first point and my last point are the same, so it's only going to generate five points. Okay, let's go back to our curvy curve. So that was curve GUIDS 2. And let's label our points. So I'm going to turn off our section where we're identifying the order of the curves, so I don't confuse those TextDots. So Shift+Ctrl+C, comment that out. And then we'll Shift+Ctrl+U to uncomment that. And we're going to label the points that we generate from DivideCurve, and take a look at their order. Okay, so their order here is from bottom to top. And that order is driven by the direction that I drew the curve in. So if I select the curve and type in Dir in the command line, I'll see the direction is from bottom to top. So that's the direction in which I constructed that curve. Again, that could be how I drew it within the scene. But it could also be if I constructed this curve through code. It's the sequence of the points that I gave it to construct the curve that determine its direction, like I showed in the last video. And so, And let's run it on DivideCurve on our shape, our closed shape, and we'll see what that returns. So that is showing me it's only five points. And it's just dividing that into equal segments, but those segments don't match up with my edit points have my shape, which are revealed when I click on it. So the question is if I wanted to extract points from those corner points at the segments, and I didn't want to use sort of DivideCurve, I would need to use a different function to do that. So let's turn this off Ctrl+C, and we're going to use a different function to do that. We'll use CurveEditPoints. So CurveEditPoints just takes a curve. And that's crvGUIDs. It's the one we're dealing with. It's going to return EditPoints. Now, since I'm doing 0, all I have to do is select that first curve. I don't need to keep windowing all these. If I just select one of these curves, that's going to be crvGUIDs because it's the only curve in the list. And then I'm going to print out using the function len. I'm going to find out the length of the EditPoints. How many points is it returning? So let's run that. I'll just select that shape. Hit Enter. And it's telling me it's returning six points. So this EditPoints is six points long. This is one, two, three, four, five, six, so the first and last overlap. And I can label those here using TextDot again. And it shows me the first and last ones overlap here. Right, so actually, I have two TextDots, one on top of the other. And you'll notice too, it's not, i'm not outputting points. I'm not rendering them out. What this returns, EditPoints returns, which I haven't printed out. Let's print it out, take a look at it, EditPoints. So what it's returning is a 3 point object. It's returning values. Okay, it's not returning an ID and i'm not rendering those out. I did want to render them out to see them. because remember that when they use divide curve, that's an option I can do it. I could render them out or not, this would need to use a function like add point and plug those values in from edit points if I wanted to see them. But it's not really necessary. I have those values, If I wanted to do something with them later in the code I could. I don't necessarily need to see the points. Let's do one more thing with that shape, I'm going to comment this out, Shift+Ctrl+C, and I'm going to explode that shape, Shift+Ctrl+U, I'm going to explode it into segments. So let's do that and we will ExplodeCurves, takes true arguments. So it's taking, it needs to know the curve. And it looks like it's telling me it will take multiple objects to explode. And then the second is a Boolean, second argument is a Boolean. Which is optional, whether or not I want to delete the input, do I want to delete the original curve, connected curve, and just ended up with a series of segments? So I can choose to keep that or not. I've chosen True. I've put it in there. Again, that's optional to delete it. So we'll run it and then see that what it's returning is a list of IDs of those individual segments. And then if I wanted to identify the order of the segments, I could do something similar to what I did up top here, essentially just cutting and pasting the same code, the midpoint code, adding a little bit to it, finding the midpoint of the segments and then using that midpoint to label the segment. Again if I had something that didn't have this number of segments to it, if it was less I would get an error here, my index would be out of range if I was asking for 4 and I didn't have it. So this is dependent on the geometry. Just keep that in mind when you're doing this. Forgot to undo, because it's broken up, it exploded it. So let's undo that. Now it's whole again, okay? So run that. So now it's showing me the order of the segments. And this is really the order in which I drew this shape. I started here and I went clockwise when I constructed it and when I explode it, that's the order of my segments. Okay, so that's a little bit about working with curves and points and lists. And in the next lesson we're going to start to use some of this knowledge to produce more complex geometry with using simple geometry as an input. And using our lists and points to derive that new geometry within the code from those inputs.