Skip to content
This repository has been archived by the owner on Feb 9, 2021. It is now read-only.

Commit

Permalink
Use local coordinates and not global coordinates in close()
Browse files Browse the repository at this point in the history
When getting the endPoint in close() ; use local coordinates and not global coordinates.

It does matter when the origin of the workplane is moved.
  • Loading branch information
gntech committed Apr 26, 2018
1 parent d458dcb commit 679eb21
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cadquery/cq.py
Original file line number Diff line number Diff line change
Expand Up @@ -1773,7 +1773,7 @@ def close(self):
s = Workplane().lineTo(1,0).lineTo(1,1).close().extrude(0.2)
"""
endPoint = self._findFromPoint(False)
endPoint = self._findFromPoint(True)
startPoint = self.ctx.firstPoint

# Check if there is a distance between startPoint and endPoint
Expand Down
10 changes: 10 additions & 0 deletions tests/TestCadQuery.py
Original file line number Diff line number Diff line change
Expand Up @@ -1607,3 +1607,13 @@ def testClose(self):

# The b shape shall have twice the volume of the a shape.
self.assertAlmostEqual(a.val().wrapped.Volume * 2.0, b.val().wrapped.Volume)

# Testcase 3 from issue #238
thickness = 3
length = 10
width = 5

obj = Workplane('XY', origin=(0, 0, -thickness / 2)) \
.moveTo(length / 2, 0).threePointArc((0, width / 2), (-length / 2, 0)) \
.threePointArc((0, -width / 2), (length / 2, 0)) \
.close().extrude(thickness)

0 comments on commit 679eb21

Please sign in to comment.