algorithmic modeling for Rhino
Hello,
I am an extreme rookie (just opened the program for the first time yesterday) and have a dumb question. I am making a series of lines that have specific edge and interior conditions (they are derived from research about shoulder and lane widths of various roads). In order to create adjustable lanes of road, all with the same ( but adjustable) width, I used array. I would like to figure out how to select the last line arrayed to create the final edge (shoulder) condition. I have uploaded the file for reference. Thanx
Tags:
Hi Diana,
Unfortunately I have an older version of GH with me so I cannot open your reference file correctly, but from what you wrote about it sounds like you simply need a List Item button to extract the line from the list created by the array.
When I am at my newer version of GH then I will take a look to make sure I'm suggesting something that is still useable.
Cheers,
Andrew
Thank you for getting back to me so quickly. I am unclear how I would select the last item on a list that varies. I have included a screen shot, if that helps.
Here's the proper logic, not using the cheat I mentioned in my earlier reply:
As mentioned below, by using an index of -1 and wrapping set to True, we can get rid of two components. I suppose you could say there's a proper way of doing it and a smart way of doing it.
--
David Rutten
david@mcneel.com
Tirol, Austria
Hi Diana,
you can use the [List Item] component to select specific elements in a list (i.e. array) of data. The official way to select the last item would be to measure the length of the list (11 in your case), then subtract one and select the item at that index. Remember that items in lists are accessed using a zero-based system, so the first item is at index 0, the second item at index 1 and so on.
It's easier however to cheat and use an index of -1 and make sure Wrap is set to True. This will allow you to select the last item in a list without measuring the length of the list first. If you use -2 you'll select the second to last item, and so on and so forth.
--
David Rutten
david@mcneel.com
Tirol, Austria
That worked perfectly. Thank you sooooo much :)
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by