Added tests for includeCurrent
This commit is contained in:
@ -1916,11 +1916,13 @@ class Workplane(CQ):
|
||||
|
||||
if includeCurrent:
|
||||
startPoint = self._findFromPoint(False)
|
||||
points = listOfXYTuple
|
||||
else:
|
||||
startPoint = self.plane.toWorldCoords(listOfXYTuple[0])
|
||||
points = listOfXYTuple[1:]
|
||||
|
||||
# Draw a line for each set of points, starting from the from-point of the original CQ object
|
||||
for curTuple in listOfXYTuple[1:]:
|
||||
for curTuple in points:
|
||||
endPoint = self.plane.toWorldCoords(curTuple)
|
||||
|
||||
edges.append(Edge.makeLine(startPoint, endPoint))
|
||||
|
@ -368,6 +368,7 @@ class TestCadQuery(BaseTest):
|
||||
Tests construction of splines
|
||||
"""
|
||||
pts = [
|
||||
(0, 0),
|
||||
(0, 1),
|
||||
(1, 2),
|
||||
(2, 4)
|
||||
@ -395,6 +396,10 @@ class TestCadQuery(BaseTest):
|
||||
self.assertFalse(path.tangentAt(0) == path_const.tangentAt(0))
|
||||
self.assertFalse(path.tangentAt(1) == path_const.tangentAt(1))
|
||||
|
||||
# test include current
|
||||
path1 = Workplane("XZ").spline(pts[1:],includeCurrent=True).val()
|
||||
self.assertAlmostEqual(path.Length(),path1.Length())
|
||||
|
||||
def testSweep(self):
|
||||
"""
|
||||
Tests the operation of sweeping a wire(s) along a path
|
||||
@ -1080,6 +1085,13 @@ class TestCadQuery(BaseTest):
|
||||
self.assertEqual(1, r.wires().size())
|
||||
self.assertEqual(18, r.edges().size())
|
||||
|
||||
# try the same with includeCurrent=True
|
||||
r = Workplane("XY").polyline(points[1:],includeCurrent=True).mirrorX()
|
||||
|
||||
self.assertEqual(1, r.wires().size())
|
||||
self.assertEqual(18, r.edges().size())
|
||||
|
||||
|
||||
def testChainedMirror(self):
|
||||
"""
|
||||
Tests whether or not calling mirrorX().mirrorY() works correctly
|
||||
|
Reference in New Issue
Block a user