algorithmic modeling for Rhino
Following this post
I could use the functions of a pluggin in rhino grasshopper components.
Only the method used does not allow me to manage one object at a time.
If there are several objects then the command is repeated as many times as object.
I wish to send by this method a list of objects.
Exemple:
Private Sub RunScript(ByVal x As Mesh, ByVal y As Mesh, ByRef A As Object)
'Add the objects to Rhino
Dim idMeshA As Guid = doc.Objects.AddMesh(x)
Dim idMeshB As Guid = doc.Objects.AddMesh(y)
Dim runtimeEvent As UInteger = New Rhino.DocObjects.ObjRef(idMeshB).RuntimeSerialNumber'Create the command macro
Dim command As String = "MeshBooleanDifference"
Dim macro As String = String.Format("!_-{0} _SelID ""{1}"" _Enter _SelID ""{2}"" _Enter", command, idMeshA, idMeshB)'Run the macro
Rhino.RhinoApp.RunScript("_SelNone", False)
Rhino.RhinoApp.RunScript(macro, True)'Harvest new meshes
Dim objs As Rhino.DocObjects.RhinoObject() = doc.Objects.AllObjectsSince(runtimeEvent)
Dim rc As New List(Of Mesh)
For Each obj As Rhino.DocObjects.RhinoObject In objs
Dim m As Mesh = Nothing
GH_Convert.ToMesh(obj.Geometry, m, GH_Conversion.Both)If (m Is Nothing) Then Continue For
rc.Add(m.DuplicateMesh())doc.Objects.Delete(obj.Id, True)
NextA = rc
End Sub
Tags:
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
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by