Grasshopper

algorithmic modeling for Rhino

Hi,

I know how to shift an item on a list. But how do I shift an item consecutively from one sublist to the next as shown in the image below? thanks in advance

Views: 1155

Replies to This Discussion

More of something like this....

So you want to move the first item from every list to the first element in the next list?

You might be able to use the Path Mapper with a clever expression to do it:

--

David Rutten

david@mcneel.com

Poprad, Slovakia

And if you want the last item to wrap around, you can add a modulus to the expression as well:

--

David Rutten

david@mcneel.com

Poprad, Slovakia

I dont need it to wrap. Im trying to get familiar with the path mapper. did you type exactly what is in the image above into the "source" and the "target" in the path mpaper window?

Yes. The Source field is always easy to fill in because you don't have a choice. You have to reproduce your data tree paths accurately. Your only choice is whether to omit the item index. In my case the only valid source text would have been:

  • {A}
  • {A}(i)

Since I needed the item index for the logic I had to go for the latter.

The target is the hard bit. I want to keep the same index for every item, so I can reproduce the (i) bit:

{somethingdifficultgoeshere}(i)

The path of the item however depends on the item index. The first item in every list (first item always has index = 0) needs to go to the next list. Since my lists are well numbered ({0}, {1}, {2} etc.) I can just add 1 to the list number to always get the next list. That's where the A+1 comes in. The if statement is there to make sure that only the first item in each list goes into the next list. Thus

{ If(i=0, A+1, A }(i)

translates to "The new list number depends on the item index. If the index equals zero, then the target list number is the source list number plus one. If the index does not equal zero, then the target list number is the same as the source list number."

--

David Rutten

david@mcneel.com

Poprad, Slovakia

that description was helpful. Thank you

this is exactly what im trying to do. how did you do that!

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service