diff --git a/src/build123d/topology/shape_core.py b/src/build123d/topology/shape_core.py index 6402c3e..d366ead 100644 --- a/src/build123d/topology/shape_core.py +++ b/src/build123d/topology/shape_core.py @@ -1327,7 +1327,7 @@ class Shape(NodeMixin, Generic[TOPODS]): def intersect( self, *to_intersect: Shape | Vector | Location | Axis | Plane - ) -> None | Self | ShapeList[Self]: + ) -> None | ShapeList[Self]: """Intersection of the arguments and this shape Args: @@ -1335,8 +1335,8 @@ class Shape(NodeMixin, Generic[TOPODS]): intersect with Returns: - Self | ShapeList[Self]: Resulting object may be of a different class than self - or a ShapeList if multiple non-Compound object created + None | ShapeList[Self]: Resulting ShapeList may contain different class + than self """ def _to_vertex(vec: Vector) -> Vertex: @@ -1380,15 +1380,12 @@ class Shape(NodeMixin, Generic[TOPODS]): # Find the shape intersections intersect_op = BRepAlgoAPI_Common() - shape_intersections = self._bool_op((self,), objs, intersect_op) - if isinstance(shape_intersections, ShapeList) and not shape_intersections: - return None - if ( - not isinstance(shape_intersections, ShapeList) - and shape_intersections.is_null - ): - return None - return shape_intersections + intersections = self._bool_op((self,), objs, intersect_op) + if isinstance(intersections, ShapeList): + return intersections or None + if isinstance(intersections, Shape) and not intersections.is_null: + return ShapeList([intersections]) + return None def is_equal(self, other: Shape) -> bool: """Returns True if two shapes are equal, i.e. if they share the same