Grasshopper

algorithmic modeling for Rhino

Hi All,

 

Am new to grasshopper & am tearing my hair out trying to rearrange a data tree, so I'm hoping someone can help!  It's all the more frustrating because I feel this should be easy but it's somehow not...

 

I have point data in twelve branches as per the attached shot. What I want to do is rearrange the data so that it becomes 47 branches of 12, and the matching logic will be to take the first in each branch, then the last, then the second, then the second last etc.

You can see that each branch has a different length - the length of these branches will/could change depending upon parameters within the gh definition.

 

The logic as I see it would be to take all index = 0; cull the list, reverse it, then repeat until it's all done, except there is no looping component. Do I need to learn some VB script or is this possible in the path mapper? (I tried to look at this, but couldn't see how the syntax applied to my data tree).

 

Any hints on how to approach it?

 

Views: 1500

Attachments:

Replies to This Discussion

The Flip Matrix Component is what you need it swaps rows for columns in the Data Tree.

Note that you will get Null Values for branches that are not long enough after the flip. see image for highlighted panel

oh,

 

i miss understood him, as it seems.

I thought he wants something like this:

 

path with 12 items: 1,2,3,4,5,6,7,8,9,10,11,12

rerange with: 1,12,2,11,3,10,4,9,5,8,6,7

 

I do not know how to do it mathimatically, but i got an drawing soultion :-)

 

Is there a easier way to get somthing lik this, Danny?

 

Best Regards

DeDackel

Attachments:

Sorry, you are right I missed a crucial sentence. I'll have another look.

 

What happens to the Nulls? are they included in the list

Attachments:

Thanks Danny & DeDackel!

 

The nulls are culled once the sort is done.  To give a bit of context the script is trying to generate cross bracing lines @ fixed centres across a series of curves of descending length.  If I do a straight flip matrix then the cross bracing is out of whack up one end of the series, so I thought it best to start the bracing from either end & the bracing elements in the centre would be roughly horizontal, but shortest.

 

I've figured out how to do it so that the numbers are equal for the time being... (see attached).

 

EDIT: wow nice one Danny, thanks!  What is the component with the hazmat like icon?

Attachments:

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service