algorithmic modeling for Rhino
Hi David,
Can you share your thoughts on the casting of Rhino Geometry to Grasshopper geometry in a custom VB.net component? I seem to running into some overhead in my custom component where I create some geometry using the RhinoCommon library and eventually output these geometry to Grasshopper lists.
For example,
for xp in Plane_List
'creating new geometry and storing it in a list ready to be output
output_List.Add(New Cylinder(New Circle(xp, 32), 100).ToNurbsSurface)
next x
'this cast from rhino geometry to GH geometry doesn't seem to be trivial
Da.setdatalist(1, output_list)
Any thoughts on speeding up the cast from Rhino geometry to GH geometry? Should we be casting as we go so we are storing only GH geometry or leave the casting till the end when we are ready to call the da.setdata function?
Any thoughts would be helpful.
Thanks.
Tags:
Casting is about as fast as I can make it. If you want to shave a few nanoseconds off the type-guid jump table, then you can create a list of GH_Surface or GH_Brep instead. Have you profiled your code to see how long it takes to run in comparison to the entire component?
--
David Rutten
david@mcneel.com
Poprad, Slovakia
Hi David,
Thanks for the reply. I have timed the code execution and it appears that it takes about 2 secs for the rhinocommon geometry creation loop and another 2 secs for the DA.SetDataList etc to execute.
All GH geometry is essentially created by using the CASTFROM function and we should be using RhinoCommon calls to create the manipulated geometry to be casted. Is this the correct understanding?
Thanks.
CastFrom is probably a wee bit slower than the functions available in the Grasshopper.Kernel.GH_Convert class. How many cylinders are you creating in 2 seconds? If the code you pasted above is all there's to it, I imagine it's thousands and thousands no?
--
David Rutten
david@mcneel.com
Poprad, Slovakia
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