algorithmic modeling for Rhino
Tags:
Hey Dan,
Here's the approach using the branched index map that I mentioned. It just requires that each geometry has a dedicated path to place it's points prior to flattening and removing duplicates. The rebuilt tree should be identical to the input so as long as the incoming assorted geometry is organized by type, you can be as specific as you like with rebuilding certain geometries.
Hi David,
Sorry, I should have specified - I'm talking about a compiled component.
So I'm looking particularly for examples of how to use DA.GetDataTree
Thanks anyway for the quick reply
oops. i completely missed the "custom component" part of the discussion title. i'll blame astigmatism.
Dim data As Data.GH_Structure(Of IGH_GeometricGoo) = Nothing
If (Not DA.GetDataTree(0, data)) Then Return
This should give you a tree with data types that implement IGH_GeometricGoo. These could for example be GH_Point, GH_Mesh, GH_Brep, and possibly even (in rare cases) GH_GeometricGooWrapper.
I think you can just compare every item type to GH_Point, then cast it and change the location.
btw. When you get a GH_Structure out of a parameter, you get a pointer to the *actual* data stored inside the param. So any changes made to the tree will propagate upstream. This is a bad thing. If you intend to change the tree, you should copy it first.
data = data.ShallowDuplicate()
Then iterate over all branches and items to modify your points:
For Each branch As List(Of IGH_GeometricGoo) In tree.Branches
For i As Int32 = 0 To branch.Count - 1
If (branch(i) Is Nothing) Then Continue For
If (TypeOf branch(i) Is GH_Point) Then
Dim pt As GH_Point = DirectCast(branch(i), GH_Point)
pt = New GH_Point(pt.Value + Rhino.Geometry.Vector3d.ZAxis)
branch(i) = pt
End If
Next
Next
--
David Rutten
david@mcneel.com
Delft, NL
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by