mirror of
https://github.com/gumyr/build123d.git
synced 2025-12-06 02:30:55 -08:00
Conform Shape.intersect to None | ShapeList
This commit is contained in:
parent
315605f485
commit
069b691964
1 changed files with 9 additions and 12 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue