Change Line Start and End Point using the old SDK



I am getting multiple lines (2 control points, degree 1 -> staight line) from a specific layer in rhino using my plugin.
I am looping over these objs and do a cast on each obj:

MRhinoCurveObject pobj = MRhinoCurveObject.Cast(obj);

I am also creating start and end coordinates for each obj:

On3dPoint end_pt = new On3dPoint(trgPts[index1][0], trgPts[index1][1], trgPts[index1][2]);
On3dPoint start_pt = new On3dPoint(trgPts[index2][0], trgPts[index2][1], trgPts[index2][2]);
I would like to set these coordinates as new start and end points for each line using c# and the old SDK. Could someone please provide a sample code in which I can see how to solve this. Any help is very much appreciated.


(Steve Baer) #2
var line_curve = new OnLineCurve(start_pt, end_pt);
var objref = new MRhinoObjRef(pobj);
doc.ReplaceObject(objref, line_curve);


Thanks Steve! Simpler than expected… Works perfectly!