CreateInterpolatedCurve

Hi all. Rhino5 last release . If i would like to select in the active document one curve, then delete it and rebuild what should i have to do?

var gx = new Rhino.Input.Custom.GetObject();
gx.SetCommandPrompt("Select one curve");
gx.GeometryFilter = Rhino.DocObjects.ObjectType.Curve;
gx.GetMultiple(1, 1);
if (gx.CommandResult() != Rhino.Commands.Result.Success..
for (int i = 0; i < gx.ObjectCount; i++)
{
    //retrieving nurb
    var  curve_objref = ...
    var curve_id = ....
    var curve_rhobj =.....
    var nurb = curve_rhobj.Geometry as Rhino.Geometry.NurbsCurve;
    // 1)question:  is the following control necessary?
    if(nurb ==null)
    {
       var curve = curve_rhobj.Geometry as Rhino.Geometry.Curve;
       nurb = curve.ToNurbsCurve();
    }
    //deleting id
    Rhino.RhinoDoc.ActiveDoc.Objects.Delete(curve_id, true);
    //2) question :how to build it again as it was before???? 
}

( Obviously i would like to build it by reconstructing it with interpolated curve or control point curve not with a simple doc.Objects.AddCurve(nurb) )

If you want to really rebuild a curve, you might use Rhino.Geometry.Curve.Rebuld.

http://developer.rhino3d.com/api/RhinoCommonWin/html/M_Rhino_Geometry_Curve_Rebuild.htm

– Dale