Grasshopper

algorithmic modeling for Rhino

Grasshopper should match multiple input trees more intelligently

I'm dividing up two surfaces into UV coordinates and using the coordinates to draw curves on the surfaces. I put the two surfaces into a graft, so that one is at {0:0} and the other is at {0:1}. Then I create trees of UV points for the lines with two points at every branch. This tree has branches
{0:0:0:0}, {0:0:0:1}, ..., {0:0:0:35},
{0:1:0:0}, {0:1:0:1}, ..., {0:1:0:35}
(the first two numbers in the path correspond to the surface). What I want it to do is draw curves for UV points {0:0:0:*} on surface {0:0}, and draw curves for UV points {0:1:0:*} on surface {0:1}. But when I put the surface tree and UV point tree into a CrvOnSrf (longest list, no flattening), they don't match up properly. Instead it draws all the curves on surface {0:0}. I thought the whole point of trees was to make what I was expecting happen automatically.

To work around this problem, I created a new tree where branches {0:0:0:0}, {0:0:0:1}, ..., {0:0:0:35} each had one copy of surface {0:0} and branches {0:1:0:0}, {0:1:0:1}, ..., {0:1:0:35} each had one copy of surface {0:1}. Thankfully Grasshopper matches this tree correctly because paths of these surfaces match the paths of the points exactly. But it's such an inelegant solution and it shouldn't be necessary. Grasshopper should match tree branches more intelligently (and allow the user to select different schemes). To state the scheme I am describing precisely: whenever a component has two input trees, branch {A:B:...:X} of the smaller tree should be matched with branches {A:B:...:X:*:*:...:*} of the larger tree. I think that would be what users want in most cases.

Views: 3600

Attachments:

Replies to This Discussion

Hi Andy,

you are not being ignored, I just don't have an answer for you yet. I need to think this over.

--
David Rutten
david@mcneel.com
Seattle, WA
Andy,

Without speaking to your question about the organizational logic of matching data structures (leaving that for David...) you could consider an alternate approach where branches do behave as expected. I couldn't open your 3dm file (you have a higher version than me...), but from using two of my own surfaces it seems like your definition is creating outlines around surface subdivisions.

In general I would tend to think of data matching as only for list data. In most cases when dealing with tree structure the user needs to look at the path names to make sure everything is matching up correctly. At this point, dealing with data trees is a much more manual operation and the Parameter Viewer is a very necessary tool.

I'm not sure that it makes intuitive sense that lists and data trees are dealt with separately, but it is a reality of the WIP nature of Grasshopper. Trees are the new kids on the block...

-taz

just found this conversation after encountering a similar data problem...i agree with your concept of the basic scheme. maybe for now it would suffice to have a better tool for 'merging' data streams; it could do more custom merging operations as well as just 'mapping one to another' like andy and i want to do.

Hi there,

I am trying to intersect two sets of BReps, where the structure doesn´t match excactly and I can´t flaten the data tree.

Quite sure there is a good solution meanwhile, but I can´t really figure out how.

Its been late here... Could please someone post a smarter solution than mine.

Thanks,

Phillip

Attachments:
Hi Phillip,
I would say that you're almost there. However the param viewer --> list length --> duplicate --> flatten --> replace branches could be shortened to just param viewer --> replace branches as the list length of all the unjoinsrfs is 1 so you're not actually duplicating anything.

Hi Danny,

thanks. I knew, I can count on you.

So there is actually no better way than duplicating the data, I guess...

Weird , its so hard to just access the path.

Anyhow -  Thanks,

Phillip

Hi,

me again. I found out that actually not solve all the issues with the definition posted.

So my problem now:

I want to access a specific branch again and now it doesn´t matter how many items there are in the branch, but how many sub branches there are.

So to  speak: I´d like duplicate the data in  the branch of List A depending on the amount of subbranches with the same structure in List B.

Almost the same question as yesterday. I know. Still looking for a broader solution though.

???

Thanks,

Phillip

Attachments:

I haven't tested this much but seems to work. It's probably not the best way of doing it though.

Create a VB component, set the x and y inputs as "data tree" and paste this code:

Dim dt As New datatree(Of Object)
For j As Integer = 0 To y.BranchCount - 1
For i As Integer = 0 To x.BranchCount - 1
If y.Path(j).IsAncestor(x.Path(i), 0) Then
dt.addrange(x.Branch(i).ToArray, y.Path(j))
Exit For
End If
Next
Next
a = dt
Thanks, I will take a look at it tommorow. 
I dont know much about vb, but I am not sure if this is what I am looking for.
What I'd actually like to do is have two input of data then one input for the path, where I can say, match this Tree to that. 
E. g.: match (duplicate data) of path 1 {a;b;c;} up to the level of "e"  regarding path 2 {a;b;c;d;e;}
thanks, 
phillip

I think that is what my definition is doing.

The 'x' input is the shorter data tree and the 'y' input is the longer one. The script duplicates branches from the 'x' input so that it matches the data structure of 'y'.

Hi Vincente,

in the latest Gh ther is no hint datatree, so you need to set it to system object and change item access to tree access.

And see there it works! Great.Great.

Saved my day, thanks a lot!

Best,

Phillip

Yes, sorry. When I said "data tree" I meant "tree access".

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