Merged changes in close()

This commit is contained in:
adam-urbanczyk
2018-12-23 22:18:47 +01:00
parent 39bf4ed2bd
commit 1866d51330

View File

@ -1874,7 +1874,14 @@ class Workplane(CQ):
s = Workplane().lineTo(1,0).lineTo(1,1).close().extrude(0.2)
"""
self.lineTo(self.ctx.firstPoint.x, self.ctx.firstPoint.y)
endPoint = self._findFromPoint(True)
startPoint = self.ctx.firstPoint
# Check if there is a distance between startPoint and endPoint
# that is larger than what is considered a numerical error.
# If so; add a line segment between endPoint and startPoint
if endPoint.sub(startPoint).Length > 1e-6:
self.lineTo(self.ctx.firstPoint.x, self.ctx.firstPoint.y)
# Need to reset the first point after closing a wire
self.ctx.firstPoint = None