Documentation RhinoCommon API
Python_III_RhinoCommon - Copy Object:
- Open file: “course_copy_objects.ghx”
Copying objects is necessary when you want to transform an object for example orient chairs from xy plane to a target plane
# import what we need only
from Rhino.Geometry import Plane, Brep, Transform
breps = []
for i in range(len(planes)): # iterate planes
copy = brep.DuplicateBrep() # copy a chair BRep
transformation = Transform.PlaneToPlane(Plane.WorldXY, planes[i]) # create a transformation
copy.Transform(transformation) # apply the transformation to the copy
breps.append(copy) # append the copy to the list
a = breps # output to grasshopper
Copy Rhino Objects as GUIDs:
import Rhino
from Rhino.Geometry import Plane, Transform
if(run):
for i in range(len(planes)):
for current_guid in guid:
transformation = Transform.PlaneToPlane(Plane.WorldXY, planes[i])
Rhino.RhinoDoc.ActiveDoc.Objects.Transform(current_guid,transformation,False)