@@ -302,6 +302,39 @@ def from_cylinder(cls, cylinder):
302302 rhino_cylinder = cylinder_to_rhino (cylinder )
303303 return cls .from_native (rhino_cylinder .ToBrep (True , True ))
304304
305+ @classmethod
306+ def from_curves (cls , curves ):
307+ """Create a RhinoBreps from a list of planar face boundary curves.
308+
309+ Parameters
310+ ----------
311+ curves : list of :class:`~compas.geometry.Curve` or :class:`~compas.geometry.Polyline`
312+ The planar curves that make up the face borders of brep faces.
313+
314+ Returns
315+ -------
316+ list of :class:`~compas_rhino.geometry.RhinoBrep`
317+
318+ """
319+ if not isinstance (curves , list ):
320+ curves = [curves ]
321+ faces = []
322+ for curve in curves :
323+ if isinstance (curve , Polyline ):
324+ rhino_curve = polyline_to_rhino_curve (curve )
325+ else :
326+ rhino_curve = curve_to_rhino (curve )
327+ face = Rhino .Geometry .Brep .CreatePlanarBreps (rhino_curve , TOL .absolute )
328+ if face is None :
329+ raise BrepError ("Failed to create face from curve: {} " .format (curve ))
330+ if len (face ) > 1 :
331+ raise BrepError ("Failed to create single face from curve: {} " .format (curve ))
332+ faces .append (face [0 ])
333+ rhino_brep = Rhino .Geometry .Brep .JoinBreps (faces , TOL .absolute )
334+ if rhino_brep is None :
335+ raise BrepError ("Failed to create Brep from faces: {} " .format (faces ))
336+ return [cls .from_native (brep ) for brep in rhino_brep ]
337+
305338 @classmethod
306339 def from_extrusion (cls , curve , vector , cap_ends = True ):
307340 """Create a RhinoBrep from an extrusion.
0 commit comments