From 36e795857411e302641e7eca9686d44041fa5d54 Mon Sep 17 00:00:00 2001 From: gumyr Date: Wed, 12 Feb 2025 20:55:26 -0500 Subject: [PATCH] Covering Face properties corner case --- src/build123d/topology/two_d.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/build123d/topology/two_d.py b/src/build123d/topology/two_d.py index 38a2b952..c9869bad 100644 --- a/src/build123d/topology/two_d.py +++ b/src/build123d/topology/two_d.py @@ -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 @@ -554,7 +554,10 @@ 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 @@ -562,7 +565,10 @@ def radius(self) -> None | float: @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