Grasshopper

algorithmic modeling for Rhino

This component doesnt work (obviously). I assume that I made a mistake in this part of code, so could you tell me where it is ? I want to supply it with one mesh (as mesh) and multiple points (as datatree of points). As far as I found, I have to use Grasshopper.Kernel.Data.GH_Structure rather than datatree, but cant convert this code to it. VS shows no errors, party starts when running in GH and supplying inputs with data.

 

Beginning:

 

Protected Overrides Sub RegisterInputParams(ByVal pManager As Grasshopper.Kernel.GH_Component.GH_InputParamManager)
pManager.Register_MeshParam("Mesh", "M", "Mesh to relax")
pManager.Register_PointParam("Points", "P", "Points to relax", GH_ParamAccess.tree)
pManager.Register_IntegerParam("Steps", "N", "Number of steps")
End Sub

Protected Overrides Sub RegisterOutputParams(ByVal pManager As Grasshopper.Kernel.GH_Component.GH_OutputParamManager)
pManager.Register_MeshParam("Mesh", "Mr", "Relaxed mesh")
pManager.Register_PointParam("Points", "Pr", "Relaxed points")
End Sub

Protected Overrides Sub SolveInstance(ByVal DA As Grasshopper.Kernel.IGH_DataAccess)

'decalare variables
Dim msh As Rhino.Geometry.Mesh = Nothing
Dim stp As Integer
Dim pts As Grasshopper.Kernel.Data.GH_Structure(Of Grasshopper.Kernel.Types.GH_Point) = Nothing

'security
If (Not DA.GetData(0, msh)) Then Return
If (Not DA.GetDataTree(1, pts)) Then Return
If (Not DA.GetData(2, stp)) Then Return

If (Not msh.IsValid) Then Return

 

 

And this is other place where I would search for bugs :

 

'exit data
DA.SetData(0, msh)
DA.SetDataTree(1, pts)

 

 

 

Views: 360

Replies to This Discussion

Can't see a mistake in that code (which is not to say there isn't one). You can send me the full code privately if you want, or post a simple case which also fails here.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

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