diff --git a/cadquery/cq.py b/cadquery/cq.py index eabacdf4..74c09494 100644 --- a/cadquery/cq.py +++ b/cadquery/cq.py @@ -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)) diff --git a/tests/TestCadQuery.py b/tests/TestCadQuery.py index 516e23aa..c583399a 100644 --- a/tests/TestCadQuery.py +++ b/tests/TestCadQuery.py @@ -368,6 +368,7 @@ class TestCadQuery(BaseTest): Tests construction of splines """ pts = [ + (0, 0), (0, 1), (1, 2), (2, 4) @@ -394,6 +395,10 @@ class TestCadQuery(BaseTest): path_const = Workplane("XZ").spline(pts,tangents=((0,1),(1,0))).val() 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): """ @@ -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