algorithmic modeling for Rhino
Tags:
Hello, I am having similiar trouble. I am trying to flatten an input of points or vectors (which could be an item, list, or tree), into a list. I tried to rewrite the sample in VB.
The error:
"You cannot call IGH_DataAccess.GetDataTree() on a List Parameter"
Protected Overrides Sub RegisterInputParams(ByVal pManager As Grasshopper.Kernel.GH_Component.GH_InputParamManager)
pManager.Register_BooleanParam("Overwrite Points", "Overwrite", "Overwrite the analysis node file.", 0, GH_ParamAccess.item)
pManager.Register_PointParam("Analysis Nodes", "Points", "The new analysis nodes/points.", GH_ParamAccess.tree)
pManager.Register_VectorParam("Analysis Direction", "Vectors", "The vector direction of each analysis point, default is up.", GH_ParamAccess.tree)
pManager(1).Optional = True
pManager(2).Optional = True
End Sub
Protected Overrides Sub RegisterOutputParams(ByVal pManager As Grasshopper.Kernel.GH_Component.GH_OutputParamManager)
pManager.Register_StringParam("Output Message", "Out", "Output Message")
End Sub
Protected Overrides Sub SolveInstance(ByVal DA As Grasshopper.Kernel.IGH_DataAccess)
Dim Overwrite_points As Boolean = 0
Dim errorlist As New List(Of String)
Dim pts_tree As GH_Structure(Of GH_Point) = Nothing
Dim vec_tree As GH_Structure(Of GH_Vector) = Nothing
If (Not DA.GetDataTree(1, pts_tree)) Then Return
If (Not DA.GetDataTree(2, vec_tree)) Then Return
pts_tree = pts_tree.ShallowDuplicate()
pts_tree.Flatten()
Dim points As New List(Of Point3d)
For i As Integer = 0 To pts_tree(0).Count() - 1
points.Add(pts_tree.Branch(0)(i))
Next
vec_tree = vec_tree.ShallowDuplicate()
vec_tree.Flatten()
Dim vectors As New List(Of Vector3d)
For i As Integer = 0 To vec_tree(0).Count() - 1
vectors.Add(vec_tree.Branch(0)(i))
Next
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