Implemented tapered cutBlind
This commit is contained in:
@ -2397,7 +2397,7 @@ class Workplane(CQ):
|
|||||||
|
|
||||||
return self.newObject([newS])
|
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.
|
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,
|
:type distanceToCut: float, >0 means in the positive direction of the workplane normal,
|
||||||
<0 means in the negative direction
|
<0 means in the negative direction
|
||||||
:param boolean clean: call :py:meth:`clean` afterwards to have a clean shape
|
: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
|
:raises: ValueError if there is no solid to subtract from in the chain
|
||||||
:return: a CQ object with the resulting object selected
|
:return: a CQ object with the resulting object selected
|
||||||
|
|
||||||
@ -2417,7 +2418,7 @@ class Workplane(CQ):
|
|||||||
Cut Up to Surface
|
Cut Up to Surface
|
||||||
"""
|
"""
|
||||||
# first, make the object
|
# first, make the object
|
||||||
toCut = self._extrude(distanceToCut)
|
toCut = self._extrude(distanceToCut, taper=taper)
|
||||||
|
|
||||||
# now find a solid in the chain
|
# now find a solid in the chain
|
||||||
|
|
||||||
|
@ -1700,8 +1700,14 @@ class TestCadQuery(BaseTest):
|
|||||||
(0., 0., 2. * h),
|
(0., 0., 2. * h),
|
||||||
decimal_places)
|
decimal_places)
|
||||||
|
|
||||||
|
def testTaperedExtrudeCutBlind(self):
|
||||||
|
|
||||||
|
h = 1.
|
||||||
|
r = 1.
|
||||||
|
t = 5
|
||||||
|
|
||||||
# extrude with a positive taper
|
# 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")
|
top_face = s.faces(">Z")
|
||||||
bottom_face = s.faces("<Z")
|
bottom_face = s.faces("<Z")
|
||||||
@ -1712,7 +1718,7 @@ class TestCadQuery(BaseTest):
|
|||||||
self.assertTrue(delta < 0)
|
self.assertTrue(delta < 0)
|
||||||
|
|
||||||
# extrude with a negative taper
|
# extrude with a negative taper
|
||||||
s = Workplane("XY").circle(r).extrude(h, taper=-5)
|
s = Workplane("XY").circle(r).extrude(h, taper=-t)
|
||||||
|
|
||||||
top_face = s.faces(">Z")
|
top_face = s.faces(">Z")
|
||||||
bottom_face = s.faces("<Z")
|
bottom_face = s.faces("<Z")
|
||||||
@ -1722,6 +1728,14 @@ class TestCadQuery(BaseTest):
|
|||||||
|
|
||||||
self.assertTrue(delta > 0)
|
self.assertTrue(delta > 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):
|
def testClose(self):
|
||||||
# Close without endPoint and startPoint coincide.
|
# Close without endPoint and startPoint coincide.
|
||||||
# Create a half-circle
|
# Create a half-circle
|
||||||
|
Reference in New Issue
Block a user