@@ -383,13 +383,16 @@ def convex_hull(self) -> Mesh:
383383 # ==============================================================================
384384
385385 @classmethod
386- def from_step (cls , filename : Union [str , pathlib .Path ]) -> "OCCBrep" :
386+ def from_step (cls , filename : Union [str , pathlib .Path ], solid : bool = True ) -> "OCCBrep" :
387387 """
388388 Conctruct a BRep from the data contained in a STEP file.
389389
390390 Parameters
391391 ----------
392392 filename : str | pathlib.Path
393+ The file.
394+ solid : bool, optional
395+ If True, convert shells to solids when possible.
393396
394397 Returns
395398 -------
@@ -399,16 +402,21 @@ def from_step(cls, filename: Union[str, pathlib.Path]) -> "OCCBrep":
399402 shape = DataExchange .read_step_file (str (filename ))
400403 brep = cls .from_native (shape ) # type: ignore
401404 brep .heal ()
405+ if solid :
406+ brep .make_solid ()
402407 return brep
403408
404409 @classmethod
405- def from_iges (cls , filename : Union [str , pathlib .Path ]) -> "OCCBrep" :
410+ def from_iges (cls , filename : Union [str , pathlib .Path ], solid : bool = True ) -> "OCCBrep" :
406411 """
407412 Conctruct a BRep from the data contained in a IGES file.
408413
409414 Parameters
410415 ----------
411416 filename : str | pathlib.Path
417+ The file.
418+ solid : bool, optional
419+ If True, convert shells to solids when possible.
412420
413421 Returns
414422 -------
@@ -418,6 +426,8 @@ def from_iges(cls, filename: Union[str, pathlib.Path]) -> "OCCBrep":
418426 shape = DataExchange .read_iges_file (str (filename ))
419427 brep = cls .from_native (shape ) # type: ignore
420428 brep .heal ()
429+ if solid :
430+ brep .make_solid ()
421431 return brep
422432
423433 def to_step (self , filepath : Union [str , pathlib .Path ], schema : str = "AP203" , unit : str = "MM" ) -> None :
@@ -1762,44 +1772,6 @@ def simplify(
17621772 shape = simplifier .Shape ()
17631773 self .native_brep = shape
17641774
1765- def transform (self , matrix : compas .geometry .Transformation ) -> None :
1766- """
1767- Transform this Brep.
1768-
1769- Parameters
1770- ----------
1771- matrix : :class:`compas.geometry.Transformation`
1772- A transformation matrix.
1773-
1774- Returns
1775- -------
1776- None
1777-
1778- """
1779- trsf = compas_transformation_to_trsf (matrix )
1780- builder = BRepBuilderAPI .BRepBuilderAPI_Transform (self .occ_shape , trsf , True )
1781- shape = builder .ModifiedShape (self .occ_shape )
1782- self ._occ_shape = shape
1783-
1784- def transformed (self , matrix : compas .geometry .Transformation ) -> "OCCBrep" :
1785- """
1786- Return a transformed copy of the Brep.
1787-
1788- Parameters
1789- ----------
1790- matrix : :class:`compas.geometry.Transformation`
1791- A transformation matrix.
1792-
1793- Returns
1794- -------
1795- :class:`OCCBrep`
1796-
1797- """
1798- trsf = compas_transformation_to_trsf (matrix )
1799- builder = BRepBuilderAPI .BRepBuilderAPI_Transform (self .occ_shape , trsf , True )
1800- shape = builder .ModifiedShape (self .occ_shape )
1801- return OCCBrep .from_shape (shape )
1802-
18031775 def slice (self , plane : compas .geometry .Plane ) -> Union ["OCCBrep" , None ]:
18041776 """Slice a BRep with a plane.
18051777
@@ -1842,15 +1814,53 @@ def split(self, other: "OCCBrep") -> list["OCCBrep"]:
18421814 splitter .AddTool (other .occ_shape )
18431815 splitter .Perform ()
18441816 shape = splitter .Shape ()
1845- results = []
1817+ results : list [ OCCBrep ] = []
18461818 if isinstance (shape , TopoDS .TopoDS_Compound ):
18471819 it = TopoDS .TopoDS_Iterator (shape )
18481820 while it .More ():
1849- results .append (it .Value ())
1821+ results .append (OCCBrep . from_shape ( it .Value () ))
18501822 it .Next ()
18511823 else :
1852- results .append (shape )
1853- return [OCCBrep .from_shape (result ) for result in results ]
1824+ results .append (OCCBrep .from_shape (shape ))
1825+ return results
1826+
1827+ def transform (self , matrix : compas .geometry .Transformation ) -> None :
1828+ """
1829+ Transform this Brep.
1830+
1831+ Parameters
1832+ ----------
1833+ matrix : :class:`compas.geometry.Transformation`
1834+ A transformation matrix.
1835+
1836+ Returns
1837+ -------
1838+ None
1839+
1840+ """
1841+ trsf = compas_transformation_to_trsf (matrix )
1842+ builder = BRepBuilderAPI .BRepBuilderAPI_Transform (self .occ_shape , trsf , True )
1843+ shape = builder .ModifiedShape (self .occ_shape )
1844+ self ._occ_shape = shape
1845+
1846+ def transformed (self , matrix : compas .geometry .Transformation ) -> "OCCBrep" :
1847+ """
1848+ Return a transformed copy of the Brep.
1849+
1850+ Parameters
1851+ ----------
1852+ matrix : :class:`compas.geometry.Transformation`
1853+ A transformation matrix.
1854+
1855+ Returns
1856+ -------
1857+ :class:`OCCBrep`
1858+
1859+ """
1860+ trsf = compas_transformation_to_trsf (matrix )
1861+ builder = BRepBuilderAPI .BRepBuilderAPI_Transform (self .occ_shape , trsf , True )
1862+ shape = builder .ModifiedShape (self .occ_shape )
1863+ return OCCBrep .from_shape (shape )
18541864
18551865 def trim (self , plane : compas .geometry .Plane ) -> None :
18561866 """Trim a Brep with a plane.
0 commit comments