generative modeling for Rhino
Tags: branches, combination, data, paths, structures, trees

Permalink Reply by taz on October 5, 2009 at 7:35pm
Permalink Reply by gabriel on November 16, 2010 at 7:27am
Permalink Reply by phillip on March 20, 2012 at 1:39pm 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
Permalink Reply by Danny Boyes on March 20, 2012 at 2:49pm
Permalink Reply by phillip on March 21, 2012 at 1:41am 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
Permalink Reply by phillip on March 21, 2012 at 1:59pm 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
Permalink Reply by Vicente Soler on March 21, 2012 at 2:36pm 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
Permalink Reply by phillip on March 21, 2012 at 3:36pm
Permalink Reply by Vicente Soler on March 21, 2012 at 3:41pm 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'.
Permalink Reply by phillip on March 22, 2012 at 1:22am 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
Permalink Reply by Vicente Soler on March 22, 2012 at 6:42am Yes, sorry. When I said "data tree" I meant "tree access".
© 2013 Created by Scott Davidson.
Powered by