Referencing Rhino Geometry in Grasshopper C#

Hi everyone

I want to create a component for grasshopper in C#. the component has to be able to select a curve from rhino (as you know there is a Curve parameter in grasshopper that we can select set one curve /set multiple curves and then we are able to select a curve from rhino i showed in the image below) .I want to know If in my component I need to select a curve from rhino what should I write for that in C# ?

Thanks a lot in advance!

Why would you need or want to do that? Why not just take the curve(s) input in to your component from the grasshopper curve parameter component which is the one you showed on the screen shot. Take advantage of the workflow that is readily available and rather invest your time in doing more interesting stuff.

1 Like

thanks for replying.
Excuse me I think i didn’t understand correctly. I wanna know if i wanted to use "Curve parameter " in my code , how should i write this . whats the name of its class in grasshopper api?

Are you talking a component from the script editor component or from visual studio?

1 Like

Hi Michael
component from visual studio (C#)

A Curve Parameter is a Grasshopper component it’s not a RhinoCommon or Grasshopper class. Behind the scenes that parameter component is a wrapper to the RhinoCommon Curve class. So 2 things are happening. There is a GH_Curve class that implements GH_GeometricGoo<Curve> . Then there is another class let’s say GH_CurveParam which implements GH_PersistentParam<GH_Curve> , IGH_PreviewObject and IGH_PreviewData This class is what actually makes it presentable as a Grasshopper Parameter component.

So I still don’t understand what you want to do and why does the Curve Parameter component not work for you.

1 Like

You can make your input like:

pManager.AddCurveParameter(“InputName”, “InputAbbreviation”, “InputDescription”, GH_ParamAccess.item);

or for list like:

pManager.AddCurveParameter(“InputName”, “InputAbbreviation”, “InputDescription”, GH_ParamAccess.list);

This will make your input as a curve input which will have the “set curve” right click option.

1 Like