algorithmic modeling for Rhino

Hi David,

Can you share your thoughts on the casting of Rhino Geometry to Grasshopper geometry in a custom 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.


Views: 477

Reply to This

Replies to This Discussion

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

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?


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

Poprad, Slovakia






  • Add Photos
  • View All

© 2019   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service