diff --git a/cadquery/cq.py b/cadquery/cq.py index fcaf5b62..982e0a47 100644 --- a/cadquery/cq.py +++ b/cadquery/cq.py @@ -2397,7 +2397,7 @@ class Workplane(CQ): return self.newObject([newS]) - def cutBlind(self, distanceToCut, clean=True): + def cutBlind(self, distanceToCut, clean=True, taper=None): """ Use all un-extruded wires in the parent chain to create a prismatic cut from existing solid. @@ -2408,6 +2408,7 @@ class Workplane(CQ): :type distanceToCut: float, >0 means in the positive direction of the workplane normal, <0 means in the negative direction :param boolean clean: call :py:meth:`clean` afterwards to have a clean shape + :param float taper: angle for optional tapered extrusion :raises: ValueError if there is no solid to subtract from in the chain :return: a CQ object with the resulting object selected @@ -2417,7 +2418,7 @@ class Workplane(CQ): Cut Up to Surface """ # first, make the object - toCut = self._extrude(distanceToCut) + toCut = self._extrude(distanceToCut, taper=taper) # now find a solid in the chain diff --git a/tests/TestCadQuery.py b/tests/TestCadQuery.py index 939ff9eb..329f02cb 100644 --- a/tests/TestCadQuery.py +++ b/tests/TestCadQuery.py @@ -1699,9 +1699,15 @@ class TestCadQuery(BaseTest): self.assertTupleAlmostEquals(delta.toTuple(), (0., 0., 2. * h), decimal_places) - + + def testTaperedExtrudeCutBlind(self): + + h = 1. + r = 1. + t = 5 + # extrude with a positive taper - s = Workplane("XY").circle(r).extrude(h, taper=5) + s = Workplane("XY").circle(r).extrude(h, taper=t) top_face = s.faces(">Z") bottom_face = s.faces("Z") bottom_face = s.faces(" 0) + + # cut a tapered hole + s = Workplane("XY").rect(2*r,2*r).extrude(2*h).faces('>Z').workplane()\ + .rect(r,r).cutBlind(-h, taper=t) + + middle_face = s.faces('>Z[-2]') + + self.assertTrue(middle_face.val().Area() < 1) def testClose(self): # Close without endPoint and startPoint coincide.