Which type of API should I choose in order to enhance efficiency

Hi~I’m using c# in visual studio to create some gh components,but I’m not sure which type of API I should choose to raise efficiency in GH,RH or GH?

For example,if I want to create a rectangle,should I create a Rectangle3d or GH_Rectangle?Or no matter which type I choose in the middle of codes dosen’t matter,the influential part is the one set to DA.SetData?

Please help me~

Hi,

The conversion from GH_Types to RhinoCommon types really only occurs when going inside and outside the custom component. That is, through GetData and SetData.
If you don’t need to manipulate objects in your code, you could stay with GH_Types all the way. This is especially true if you have components that deal with data tree structures, but not geometry.

But if you need to run RC methods on your objects, probably best to stick with RC types until the end.

For items and lists, you can also let GH do the conversion automatically. That is, you can pass a Rectangle3d to SetData and it will encapsulate it for you in a GH_Rectangle.

1 Like

Thanks a lot!
It’s helpful~