Grasshopper

algorithmic modeling for Rhino

Hi everybody,

I am facing a problem for some time connecting points with each other.

I aim to connect

point 0 with 1,

point 1 with 2,

point 2 with 3,.......

after I used the series component.

I am wondering if there is a more elegant way to solve this problem than using the tree explode component and then connecting the outputs one by one (see file attached).

This solution is ok for 10 points but not for 1000 points. ;)

Any suggestions would be great!!!!

Thank you in advance!!!!

Views: 700

Attachments:

Replies to This Discussion

Another solution (See attached)

Other suggestions are welcome!!!!!

Attachments:

Instead of exploding the tree, you should instead make 2 lists of points, each offset by 1 from the other. You can do this through using the shift list component. You need to shift one list by +1 and one list by -1 while disabling index wrapping. Essentially, this removes the first item from one list and the last item from the other list. Conceptually, these are your lists:

Source List: [0, 1, 2, 3, 4, 5]

Shift List 1: [0, 1, 2, 3, 4]

Shift List 2: [1, 2, 3, 4, 5]

If you input these lists into a Line component, you will connect each respective list item with the other, essentially 0-1, 1-2, 2-3, etc.

Attachments:

Thank you Christian and Vongsawat!!!!

Really appreciate your comments.

Using shift list plus a line to connect is a quick/good solution.

:)

Shift List + Ln is the best general solution, can be used for a variety of cases.
an alternative solution specific to this case could be to just use PLine + Explode.

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service