Cast RhinoObject to CurveObject


#1

Hi!

I’m using C# and VS2015 to build a FEM plugin for Rhino.

In one of my scripts I need to create many lines and add them to a CurveObject List.

When creating the line, I do:

Guid tmp = doc.Objects.AddLine(point1, point2);

So, tmp represents the Line Guid but no the Line itself. The only way i found to get a reference the Line itself as an object is:

Rhino.DocObjects.RhinoObject temp = doc.Objects.Find(tmp);

But of course, I cant add this RhinoObject to my CurveObject list. So, my question is if is there a way to cast my RhinoObject to a CurveObject or maybe I’m just missing a way to get a reference to the line as a CurveObject?

Thanks


(Dale Fugier) #2

Hi Germán,

If you really want a Rhino.DocObjects.CurveObject, then you can do this:

CurveObject curve_object = doc.Objects.Find(id) as CurveObject;

– Dale