Grasshopper

algorithmic modeling for Rhino

Basically i have a 2 data trees that contains points in the layout of straight panels, and i want to add one into the other starting from the next consecutive branch number from the first.

I tried insert items but because they're grafted to insert an index made the final points not merge as one

so the resulting branches should be 0,1,2,3,4,5... rather than the common branches, (0,1,2,3,4) merging with each other

Capture.PNG

Views: 14182

Replies to This Discussion

This is actually a fairly tricky operation...It's doable with native components, but a script will perform this operation much more simply.

The code inside the script:

Private Sub RunScript(ByVal Pi As Integer, ByVal T1 As DataTree(Of Object), ByVal T2 As DataTree(Of Object), ByRef A As Object)

Dim NP As New GH_Path(T1.Paths.Last)

For P As Int32 = 0 To T2.Paths.Count - 1
    Dim PathAppend As New GH_Path(NP)
    PathAppend.Indices(Pi) = NP.Indices(Pi) + 1 + P
    T1.AddRange(T2.Branch(P), PathAppend)
Next

A = T1

End Sub

Attachments:

Thanks david this helped alot! The script works like a charm

David, i use a same component in RCE( my plugin) but my component use only grasshopper's component. It is a bit slow ....

Can I use your script instead? It is much faster and more efficient to execute...

Of course! I'm probably going to add it to Tree Sloth as well, but by all means use it.

Thanks.

All VB components on the trees are interesting.

This allows to better manage data tree.

Best,

This might also do the trick, however it can't beat David's script.

Cool! You're using Tree Sloth!

another possible solution ...

Thanks! that worked for me

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service