gears.py: Support non closed line segments in drawPoints()

This commit is contained in:
Florian Festi 2016-10-12 21:53:21 +02:00
parent 33681db645
commit accb6eb45d
1 changed files with 4 additions and 3 deletions

View File

@ -384,13 +384,13 @@ class Gears():
dest="undercut_alert", default=False, dest="undercut_alert", default=False,
help="Let the user confirm a warning dialog if undercut occurs. This dialog also shows helpful hints against undercut") help="Let the user confirm a warning dialog if undercut occurs. This dialog also shows helpful hints against undercut")
def drawPoints(self, lines, kerfdir=1): def drawPoints(self, lines, kerfdir=1, close=True):
if not lines: if not lines:
return return
if kerfdir != 0: if kerfdir != 0:
lines = kerf(lines, self.boxes.burn*kerfdir) lines = kerf(lines, self.boxes.burn*kerfdir, closed=close)
self.boxes.ctx.save() self.boxes.ctx.save()
self.boxes.ctx.move_to(*lines[0]) self.boxes.ctx.move_to(*lines[0])
@ -398,6 +398,7 @@ class Gears():
for x, y in lines[1:]: for x, y in lines[1:]:
self.boxes.ctx.line_to(x, y) self.boxes.ctx.line_to(x, y)
if close:
self.boxes.ctx.line_to(*lines[0]) self.boxes.ctx.line_to(*lines[0])
self.boxes.ctx.restore() self.boxes.ctx.restore()