@@ -65,6 +65,9 @@ def __init__(self, brep=None):
6565 super (RhinoBrep , self ).__init__ ()
6666 self ._brep = brep or Rhino .Geometry .Brep ()
6767
68+ def __deepcopy__ (self , * args , ** kwargs ):
69+ return self .copy ()
70+
6871 # ==============================================================================
6972 # Data
7073 # ==============================================================================
@@ -88,6 +91,17 @@ def data(self, data):
8891 RhinoBrepFace .from_data (f_data , builder )
8992 self ._brep = builder .result
9093
94+ def copy (self , cls = None ):
95+ """Creates a deep-copy of this Brep using the native Rhino.Geometry.Brep copying mechanism.
96+
97+ Returns
98+ -------
99+ :class:`~compas_rhino.geometry.RhinoBrep`
100+
101+ """
102+ # Avoid reconstruction when just copying. for sake of efficiency and stability
103+ return RhinoBrep .from_native (self ._brep .DuplicateBrep ())
104+
91105 # ==============================================================================
92106 # Properties
93107 # ==============================================================================
@@ -219,7 +233,7 @@ def trim(self, trimming_plane, tolerance=TOLERANCE):
219233 Parameters
220234 ----------
221235 trimming_plane : :class:`~compas.geometry.Frame` or :class:`~compas.geometry.Plane`
222- The frame or plane to use when trimming.
236+ The frame or plane to use when trimming. The discarded bit is in the direction of the frame's normal.
223237
224238 tolerance : float
225239 The precision to use for the trimming operation.
@@ -232,7 +246,6 @@ def trim(self, trimming_plane, tolerance=TOLERANCE):
232246 if isinstance (trimming_plane , Plane ):
233247 trimming_plane = Frame .from_plane (trimming_plane )
234248 rhino_frame = frame_to_rhino (trimming_plane )
235- rhino_frame .Flip ()
236249 results = self ._brep .Trim (rhino_frame , tolerance )
237250 if not results :
238251 raise BrepTrimmingError ("Trim operation ended with no result" )
0 commit comments