Cuts the provided solid from the current solid, IE, perform a solid subtraction. :param toCut: 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
(
self: T,
toCut: Union["Workplane", Solid, Compound],
clean: bool = True,
tol: Optional[float] = None,
)
| 3377 | return self.union(other) |
| 3378 | |
| 3379 | def cut( |
| 3380 | self: T, |
| 3381 | toCut: Union["Workplane", Solid, Compound], |
| 3382 | clean: bool = True, |
| 3383 | tol: Optional[float] = None, |
| 3384 | ) -> T: |
| 3385 | """ |
| 3386 | Cuts the provided solid from the current solid, IE, perform a solid subtraction. |
| 3387 | |
| 3388 | :param toCut: a solid object, or a Workplane object having a solid |
| 3389 | :param clean: call :meth:`clean` afterwards to have a clean shape |
| 3390 | :param tol: tolerance value for fuzzy bool operation mode (default None) |
| 3391 | :raises ValueError: if there is no solid to subtract from in the chain |
| 3392 | :return: a Workplane object with the resulting object selected |
| 3393 | """ |
| 3394 | |
| 3395 | # look for parents to cut from |
| 3396 | solidRef = self.findSolid(searchStack=True, searchParents=True) |
| 3397 | |
| 3398 | solidToCut: Sequence[Shape] |
| 3399 | |
| 3400 | if isinstance(toCut, Workplane): |
| 3401 | solidToCut = _selectShapes(toCut.vals()) |
| 3402 | self._mergeTags(toCut) |
| 3403 | elif isinstance(toCut, (Solid, Compound)): |
| 3404 | solidToCut = (toCut,) |
| 3405 | else: |
| 3406 | raise ValueError("Cannot cut type '{}'".format(type(toCut))) |
| 3407 | |
| 3408 | newS = solidRef.cut(*solidToCut, tol=tol) |
| 3409 | |
| 3410 | if clean: |
| 3411 | newS = newS.clean() |
| 3412 | |
| 3413 | return self.newObject([newS]) |
| 3414 | |
| 3415 | def __sub__(self: T, other: Union["Workplane", Solid, Compound]) -> T: |
| 3416 | """ |