Skip to content

Commit

Permalink
Covering Face properties corner case
Browse files Browse the repository at this point in the history
  • Loading branch information
gumyr committed Feb 13, 2025
1 parent fd44037 commit 36e7958
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/build123d/topology/two_d.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
from OCP.BRepOffsetAPI import BRepOffsetAPI_MakeFilling, BRepOffsetAPI_MakePipeShell
from OCP.BRepTools import BRepTools, BRepTools_ReShape
from OCP.GProp import GProp_GProps
from OCP.Geom import Geom_BezierSurface, Geom_Surface
from OCP.Geom import Geom_BezierSurface, Geom_Surface, Geom_RectangularTrimmedSurface
from OCP.GeomAPI import GeomAPI_PointsToBSplineSurface, GeomAPI_ProjectPointOnSurf
from OCP.GeomAbs import GeomAbs_C0
from OCP.Precision import Precision
Expand Down Expand Up @@ -554,15 +554,21 @@ def length(self) -> None | float:
@property
def radius(self) -> None | float:
"""Return the radius of a cylinder or sphere, otherwise None"""
if self.geom_type in [GeomType.CYLINDER, GeomType.SPHERE]:
if (
self.geom_type in [GeomType.CYLINDER, GeomType.SPHERE]
and type(self.geom_adaptor()) != Geom_RectangularTrimmedSurface
):
return self.geom_adaptor().Radius()
else:
return None

@property
def rotational_axis(self) -> None | Axis:
"""Get the rotational axis of a cylinder"""
if self.geom_type == GeomType.CYLINDER:
if (
self.geom_type == GeomType.CYLINDER
and type(self.geom_adaptor()) != Geom_RectangularTrimmedSurface
):
return Axis(self.geom_adaptor().Cylinder().Axis())
else:
return None
Expand Down

0 comments on commit 36e7958

Please sign in to comment.