Move Certain Points in an Array of Points


(Williamjb741) #1

I have an array of points. I want to leave the points with even indexes where they are. I want to move the points with an odd index, BUT I want to move point 1 up (in the Y direction) and point 3 down (in the Y direction), point 5 up, point 7 down. The amount moved down will be the negative of the amount moved up, and the amount will be the same for all points (except for the negative/positive thing).

Now the number of segments can vary. So, I’m looking for a way to do this no matter how many segments are selected (I’ll probably have the segments go from 2 to 10).

I currently am arriving at the array of points literally with an Array object (the second method in my attached screen shot). I can arrive at the same array of points using divide (I just realized that), but the array indexes are flipped.

I don’t think it matters how I arrive at the array of points, but just in case it does…


Simple. (no model posted but I’ll make a rare exception to my rule in this case…) (8.7 KB) (12.2 KB)

(Williamjb741) #3

That’s awesome. Thank you!! The IntCrv connecting all the points is the solution I was looking for…but the Nurbs solution is cool to know about.

I’m totally a noob to grasshopper (but not to 3D or programming)…I just started playing around with it like last week, and I did search, but I kept looking for ways to “iterate” over the list, which usually landed me with a C# solution, but I felt certain it was something grasshopper could handle easily without C#.

Now I’m looking at your second solution, and I’m thinking, well, dang, it’s just a sine wave or something.

Thanks again!


Instead of two copies of Cull, one with its ‘P’ (Pattern) input inverted/reversed, I could have used Dispatch: (10.5 KB)