Help ~ how to copy "Rhino.DocObjects.RhinoObject"?

As title. I find that it just could copy geometry or attribute…etc, but I can’t copy
entire RhinoObject.


you might use DuplicateGeometry to copy geometry. To make a copy with attributes (color, material, layer) etc. you can get them from the source object and assign them when adding the duplicate to the document.

In case of python this seems to work:

from System import *
from Rhino import *
from Rhino.Commands import *
from Rhino.DocObjects import *
from Rhino.Input import *
from scriptcontext import doc

def RunCommand():

  rc, obj_ref = RhinoGet.GetOneObject("Select", False, ObjectType.AnyObject)
  if rc <> Result.Success:
    return rc
  rhino_object = obj_ref.Object()
  geometry_base = rhino_object.DuplicateGeometry()
  if geometry_base <> None:
    if doc.Objects.Add(geometry_base, rhino_object.Attributes) <> Guid.Empty:

  return Result.Success

if __name__ == "__main__":


Hi Jerry,

You cannot directly copy a runtime RhinoObject. You can, however, quickly duplicate one as follows:

protected override Result RunCommand(RhinoDoc doc, RunMode mode)
  ObjRef obj_ref = null;
  var rc = RhinoGet.GetOneObject("Select object to copy", false, ObjectType.AnyObject, out obj_ref);
  if (rc == Result.Success)
    var obj = obj_ref.Object();
    if (null != obj)
      RhinoApp.WriteLine("Selected object id: {0}", obj.Id);
      var new_id = doc.Objects.Add(obj.Geometry, obj.Attributes);
      RhinoApp.WriteLine("New object id: {0}", new_id);
  return Result.Success;

Any reason why you want to copy the runtime RhinoObject and not just the geometry and/or attributes?

– Dale