Grasshopper

algorithmic modeling for Rhino

The following code takes geometry and puts it into the rhinoDocument, baking it basically. I just don't seem to be able to get  this to working in a component....

 

     doc.UnselectAll

      For i As Integer = 0 To meshObject.Count - 1
        Dim mMeshObj As New MRhinoMeshObject

        mMeshObj = doc.AddMeshObject(meshObject(i))
        mMeshObj.Select()
      Next

 

Any ideas......I'm using this so far, which i know is wrong

 

pManager.Register_MeshParam("Mesh", "meshObject", "Mesh To Export") 


 



Dim meshObject As New List(Of Rhino.Geometry.Mesh)


 


If (Not DA.GetData(0, meshObject)) Then Return


 

Views: 571

Replies to This Discussion

Sorry, I'm a c# coder, but translating to VB shouldn't be difficult (only difference is syntax).

 

You're original script looks like v4 sdk, Grasshopper is now based on Rhino common, a new dotNet sdk for v5.

 

Hope this helps,

 

Rhino.RhinoDoc.ActiveDoc.Objects.UnselectAll;

for (int i = 0; i < meshObject.Count; i++)

{

  Guid id = Rhino.RhinoDoc.ActiveDoc.Objects.AddMesh(meshObject[i]);  Rhino.RhinoDoc.ActiveDoc.Objects.Select(id);

}

Wow, Thanks very much, that helps a lot....... I'm still receiving an error that says

 "You cannot call IGN_DataAccess.GetDataList() on an Item Parameter"

 

But I have included GH_ParamAccess.list in the code below, what is going on.....

 

 


Protected Overrides Sub RegisterInputParams(ByVal pManager As Grasshopper.Kernel.GH_Component.GH_InputParamManager)

 

 

pManager.Register_MeshParam("Mesh", "meshObject", "Mesh To Export",GH_ParamAccess.list)

End Sub

 

 


 

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

 

 

Dim meshObject As New List(Of Rhino.Geometry.Mesh)


If (Not DA.GetDataList(0, meshObject)) Then Return

 

 

 

 

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