Grasshopper

algorithmic modeling for Rhino

So by now I'm quite comfortable using the path mapper to manipulate data trees, but there are a couple annoying things I always find myself having to work around, and I wondered if anyone had found better approaches to either situation. 

I frequently have to partially flatten a tree by discarding one or more of the branch levels. (i.e. {A;B;C} -> {A;B}). It is fine to do this with the path mapper, except that it is a slight pain to look up and match the exact incoming structure. It also must be redone every time the data structure of the input changes. Is there a dynamic way to do this, with the path mapper, some combination of components, or a vb.net script?

The second problem involves the removal of extraneous branch levels. Many components seem to add an additional "0" to every path, resulting in a lot of paths that look like {0;A;0;0;0;0;B;0;C;0;0}. I know simplify can tackle the 0s at the beginning, and I can use the path mapper in any individual case, but is there any smart way to remove the other internal levels of 0s dynamically? 

I would think that there must be at least a vb.net solution for both of these, but my understanding of data tree manipulation in vb is pretty limited.

Thanks for any suggestions!


Andrew

Views: 1898

Replies to This Discussion

Andrew,

I'm not saying this is the easiest way to go about it, but the old school [Replace Branches] can be used for dynamic path mapping when need.

This old discussion is when I was first trying to figure it out, but you'll get the idea... It could definitely be easier to use:

http://www.grasshopper3d.com/forum/topics/split-list-every-nth

A more recent example:

http://www.grasshopper3d.com/forum/topics/3d-interference-field-que...

The internal zeros... that's a tough one. It's not as easy as searching for "0" and removing it since the A, B and C levels may (or may not) also contain a zero. I'd need to ponder that but the scripters may have an approach.

Well, I post here, but this is a wish needed on a daily basis: when dealing with changeable data tree structure, trying to build definitions that cover all the posibilities of matching data, I always need to use lots of path mappers according to the same number of possibilities. Is it that difficult (David) to turn that component into a more dynamic tool? Is it expected in a future release?

thanks!

+1

I agree, a responsive path mapper would be fantastic.

It does look like the 0.9* update reduces the extra branches so less need to be simplifying structures down.

I also try to use the replace branches instead of path mapper whenever possible...here are three common examples matching variable data structures.  The "complex" mapping illustrated is for specific instances when you are matching up data but there are branches missing from the original data structure (although when I captured the image there happens to be no branches missing).  

Attachments:

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service