import rhinoscriptsyntax as rs
import scriptcontext
#Get the Cuve
guid = rs.GetObject("Get Curve", rs.filter.curve)
#Get the Instance of the document that ran this script. This is always the
#same as Rhino.RhinoDoc.ActiveDoc on Windows, but on Mac this may not
#be the case
doc = scriptcontext.doc
#Get the Object from the current Active Doc
object = doc.Objects.Find(guid)
#Get the curve geometry from the object
crv = object.CurveGeometry
# make absolutely sure that the curve is a "private" copy
# and is not still under the control of the RhinoDoc
crv.EnsurePrivateCopy()
#Now delete the Original Object
rs.DeleteObject(guid)
# ...do some things...
#Create the Curve again (with a new ID)
newObject = doc.Objects.AddCurve(crv)