Intersects the provided solid from the current solid. :param toIntersect: a solid object, or a Workplane object having a solid :param clean: call :meth:`clean` afterwards to have a clean shape :param tol: tolerance value for fuzzy bool operation mode (default None)
(
self: T,
toIntersect: Union["Workplane", Solid, Compound],
clean: bool = True,
tol: Optional[float] = None,
)
| 3427 | return self.cut(other) |
| 3428 | |
| 3429 | def intersect( |
| 3430 | self: T, |
| 3431 | toIntersect: Union["Workplane", Solid, Compound], |
| 3432 | clean: bool = True, |
| 3433 | tol: Optional[float] = None, |
| 3434 | ) -> T: |
| 3435 | """ |
| 3436 | Intersects the provided solid from the current solid. |
| 3437 | |
| 3438 | :param toIntersect: a solid object, or a Workplane object having a solid |
| 3439 | :param clean: call :meth:`clean` afterwards to have a clean shape |
| 3440 | :param tol: tolerance value for fuzzy bool operation mode (default None) |
| 3441 | :raises ValueError: if there is no solid to intersect with in the chain |
| 3442 | :return: a Workplane object with the resulting object selected |
| 3443 | """ |
| 3444 | |
| 3445 | # look for parents to intersect with |
| 3446 | solidRef = self.findSolid(searchStack=True, searchParents=True) |
| 3447 | |
| 3448 | solidToIntersect: Sequence[Shape] |
| 3449 | |
| 3450 | if isinstance(toIntersect, Workplane): |
| 3451 | solidToIntersect = _selectShapes(toIntersect.vals()) |
| 3452 | self._mergeTags(toIntersect) |
| 3453 | elif isinstance(toIntersect, (Solid, Compound)): |
| 3454 | solidToIntersect = (toIntersect,) |
| 3455 | else: |
| 3456 | raise ValueError("Cannot intersect type '{}'".format(type(toIntersect))) |
| 3457 | |
| 3458 | newS = solidRef.intersect(*solidToIntersect, tol=tol) |
| 3459 | |
| 3460 | if clean: |
| 3461 | newS = newS.clean() |
| 3462 | |
| 3463 | return self.newObject([newS]) |
| 3464 | |
| 3465 | @deprecate() |
| 3466 | def __and__(self: T, other: Union["Workplane", Solid, Compound]) -> T: |