From 624189b2fa4c9574603e138bb14efb07f57caf38 Mon Sep 17 00:00:00 2001 From: Mario Voigt Date: Fri, 14 May 2021 02:51:13 +0200 Subject: [PATCH] fixed inkpacking to be compatible for lasercutters --- extensions/fablabchemnitz/inkpacking.py | 900 ++++++++++++------------ 1 file changed, 464 insertions(+), 436 deletions(-) diff --git a/extensions/fablabchemnitz/inkpacking.py b/extensions/fablabchemnitz/inkpacking.py index 991c9f8c..e55f9403 100644 --- a/extensions/fablabchemnitz/inkpacking.py +++ b/extensions/fablabchemnitz/inkpacking.py @@ -110,178 +110,183 @@ class inkpacking(inkex.EffectExtension): box_id = self.svg.get_unique_id('box') self.box = g = etree.SubElement(self.svg.get_current_layer(), 'g', {'id':box_id}) - line_style = str(inkex.Style(({ 'stroke': '#000000', 'fill': 'none', 'stroke-width':'0.1' }))) + cut_line_style = str(inkex.Style(({ 'stroke': '#000000', 'fill': 'none', 'stroke-width':'0.3px' }))) + engrave_line_style = str(inkex.Style(({ 'stroke': '#ff0000', 'fill': 'none', 'stroke-width':'0.3px' }))) + gflapoffy = (gflapsize / sin( (gflapangle / 360) * 6.28 )) * sin( ((90 - gflapangle) / 360 ) * 6.28) # Side Glueflap if not gfmirror: line_path = [ - [ 'M', [ 0 , 0 ] ], - [ 'L', [ gflapsize * -1, gflapoffy ] ], - [ 'L', [ gflapsize * -1, boxH - gflapoffy ] ], - [ 'L', [ 0, boxH ] ], - [ 'M', [ 0 , 0 ] ], - [ 'Z', [] ] + [ 'M', [0, 0]], + [ 'L', [gflapsize * -1, gflapoffy]], + [ 'L', [gflapsize * -1, boxH - gflapoffy]], + [ 'L', [0, boxH]], + [ 'M', [0, 0]] ] if gfmirror: line_path = [ - [ 'M', [ boxW+boxD+boxW+boxD - thck, 0 ] ], - [ 'L', [ boxW+boxD+boxW+boxD - thck + gflapsize , gflapoffy ] ], - [ 'L', [ boxW+boxD+boxW+boxD - thck + gflapsize , boxH - gflapoffy ] ], - [ 'L', [ boxW+boxD+boxW+boxD - thck, boxH ] ], - [ 'M', [ boxW+boxD+boxW+boxD - thck, 0 ] ], - [ 'Z', [] ] + [ 'M', [boxW+boxD+boxW+boxD - thck, 0]], + [ 'L', [boxW+boxD+boxW+boxD - thck + gflapsize, gflapoffy]], + [ 'L', [boxW+boxD+boxW+boxD - thck + gflapsize, boxH - gflapoffy]], + [ 'L', [boxW+boxD+boxW+boxD - thck, boxH]], + [ 'M', [boxW+boxD+boxW+boxD - thck, 0]] ] - - line_atts = { 'style':line_style, 'id':box_id+'-sideglueflap', 'd':str(Path(line_path)) } + line_atts = { 'style':cut_line_style, 'id':box_id+'-sideglueflap', 'd':str(Path(line_path)) } etree.SubElement(g, inkex.addNS('path','svg'), line_atts ) - # MainBody line_path = [ - [ 'M', [ 0 , 0 ] ], - [ 'L', [ 0 , boxH ] ], - [ 'M', [ boxW , 0 ] ], - [ 'L', [ boxW , boxH ] ], - [ 'M', [ boxW + boxD , 0 ] ], - [ 'L', [ boxW + boxD, boxH ] ], - [ 'M', [ boxW + boxD + boxW , 0 ] ], - [ 'L', [ boxW + boxD + boxW, boxH ] ], - [ 'M', [ boxW + boxD + boxW + boxD - thck , 0 ] ], - [ 'L', [ boxW + boxD + boxW + boxD - thck, boxH ] ], - [ 'M', [ 0, 0 ] ], - [ 'Z', [] ] + [ 'M', [0, 0]], + [ 'L', [0, boxH]] ] - line_atts = { 'style':line_style, 'id':box_id+'-body', 'd':str(Path(line_path)) } + if gfmirror: + style = cut_line_style + else: + style = engrave_line_style + line_atts = { 'style':style, 'id':box_id+'-body-left', 'd':str(Path(line_path)) } + etree.SubElement(g, inkex.addNS('path','svg'), line_atts ) + + line_path = [ + [ 'M', [boxW, 0]], + [ 'L', [boxW, boxH]], + + [ 'M', [boxW + boxD, 0]], + [ 'L', [boxW + boxD, boxH]], + + [ 'M', [boxW + boxD + boxW, 0]], + [ 'L', [boxW + boxD + boxW, boxH]] + ] + line_atts = { 'style':engrave_line_style, 'id':box_id+'-body-mid', 'd':str(Path(line_path)) } + etree.SubElement(g, inkex.addNS('path','svg'), line_atts ) + + if gfmirror: + style = engrave_line_style + else: + style = cut_line_style + line_path = [ + [ 'M', [boxW + boxD + boxW + boxD - thck, 0]], + [ 'L', [boxW + boxD + boxW + boxD - thck, boxH]], + ] + line_atts = { 'style':style, 'id':box_id+'-body-left', 'd':str(Path(line_path)) } etree.SubElement(g, inkex.addNS('path','svg'), line_atts ) # No Top Option if tpsc == "notp": if not fingergrepa and not fingergrepb: line_path = [ - [ 'M', [ 0 , 0 ] ], - [ 'L', [ boxW, 0 ] ], - [ 'L', [ boxW + boxD , 0 ] ], - [ 'L', [ boxW + boxD + boxW, 0 ] ], - [ 'L', [ boxW + boxD + boxW + boxD - thck, 0 ] ], - [ 'Z', [] ] + [ 'M', [0, 0]], + [ 'L', [boxW, 0]], + [ 'L', [boxW + boxD, 0]], + [ 'L', [boxW + boxD + boxW, 0]], + [ 'L', [boxW + boxD + boxW + boxD - thck, 0]] ] if fingergrepa and not fingergrepb: line_path = [ - [ 'M', [ 0 , 0 ] ], - [ 'L', [ boxW / 2 - fingergrepr , 0 ] ], - [ 'A', [ fingergrepr, fingergrepr , 0 , 1, 0, boxW - boxW / 2 + fingergrepr, 0] ], - [ 'L', [ boxW , 0 ] ], - [ 'L', [ boxW + boxD, 0 ] ], - [ 'L', [ boxW + boxD + boxW / 2 - fingergrepr , 0 ] ], - [ 'A', [ fingergrepr, fingergrepr , 0 , 1, 0, boxW + boxD + boxW - boxW / 2 + fingergrepr, 0] ], - [ 'L', [ boxW + boxD + boxW , 0 ] ], - [ 'L', [ boxW + boxD + boxW + boxD - thck , 0 ] ], - [ 'M', [ 0 , 0] ], - [ 'Z', [] ] + [ 'M', [0, 0]], + [ 'L', [boxW / 2 - fingergrepr, 0]], + [ 'A', [fingergrepr, fingergrepr, 0, 1, 0, boxW - boxW / 2 + fingergrepr, 0]], + [ 'L', [boxW, 0]], + [ 'L', [boxW + boxD, 0]], + [ 'L', [boxW + boxD + boxW / 2 - fingergrepr, 0]], + [ 'A', [fingergrepr, fingergrepr, 0, 1, 0, boxW + boxD + boxW - boxW / 2 + fingergrepr, 0]], + [ 'L', [boxW + boxD + boxW, 0]], + [ 'L', [boxW + boxD + boxW + boxD - thck, 0]] ] if fingergrepa and fingergrepb: line_path = [ - [ 'M', [ 0 , 0 ] ], - [ 'L', [ boxW / 2 - fingergrepr , 0 ] ], - [ 'A', [ fingergrepr, fingergrepr , 0 , 1, 0, boxW - boxW / 2 + fingergrepr, 0] ], - [ 'L', [ boxW , 0 ] ], - [ 'L', [ boxW + boxD / 2 - fingergrepr, 0 ] ], - [ 'A', [ fingergrepr, fingergrepr , 0 , 1, 0, boxW + boxD - boxD / 2 + fingergrepr, 0] ], - [ 'L', [ boxW + boxD , 0 ] ], - [ 'L', [ boxW + boxD + boxW / 2 - fingergrepr , 0 ] ], - [ 'A', [ fingergrepr, fingergrepr , 0 , 1, 0, boxW + boxD + boxW - boxW / 2 + fingergrepr, 0] ], - [ 'L', [ boxW + boxD + boxW , 0 ] ], - [ 'L', [ boxW + boxD + boxW + boxD - thck - ( (boxD - thck) / 2 ) - fingergrepr, 0 ] ], - [ 'A', [ fingergrepr, fingergrepr , 0 , 1, 0, boxW + boxD + boxW - thck + boxD - ( ( boxD - thck ) / 2 ) + fingergrepr , 0] ], - [ 'L', [ boxW + boxD + boxW + boxD - thck , 0 ] ], - [ 'M', [ 0 , 0] ], - [ 'Z', [] ] + [ 'M', [0, 0]], + [ 'L', [boxW / 2 - fingergrepr, 0]], + [ 'A', [fingergrepr, fingergrepr, 0, 1, 0, boxW - boxW / 2 + fingergrepr, 0]], + [ 'L', [boxW, 0]], + [ 'L', [boxW + boxD / 2 - fingergrepr, 0]], + [ 'A', [fingergrepr, fingergrepr, 0, 1, 0, boxW + boxD - boxD / 2 + fingergrepr, 0]], + [ 'L', [boxW + boxD, 0]], + [ 'L', [boxW + boxD + boxW / 2 - fingergrepr, 0]], + [ 'A', [fingergrepr, fingergrepr, 0, 1, 0, boxW + boxD + boxW - boxW / 2 + fingergrepr, 0]], + [ 'L', [boxW + boxD + boxW, 0]], + [ 'L', [boxW + boxD + boxW + boxD - thck - ( (boxD - thck) / 2 ) - fingergrepr, 0]], + [ 'A', [fingergrepr, fingergrepr, 0, 1, 0, boxW + boxD + boxW - thck + boxD - ( ( boxD - thck ) / 2 ) + fingergrepr , 0]], + [ 'L', [boxW + boxD + boxW + boxD - thck, 0]] ] if not fingergrepa and fingergrepb: line_path = [ - [ 'M', [ 0 , 0 ] ], - [ 'L', [ boxW , 0 ] ], - [ 'L', [ boxW + boxD / 2 - fingergrepr, 0 ] ], - [ 'A', [ fingergrepr, fingergrepr , 0 , 1, 0, boxW + boxD - boxD / 2 + fingergrepr, 0] ], - [ 'L', [ boxW + boxD , 0 ] ], - [ 'L', [ boxW + boxD + boxW , 0 ] ], - [ 'L', [ boxW + boxD + boxW + boxD - thck - ( (boxD - thck) / 2 ) - fingergrepr, 0 ] ], - [ 'A', [ fingergrepr, fingergrepr , 0 , 1, 0, boxW + boxD + boxW - thck + boxD - ( ( boxD - thck ) / 2 ) + fingergrepr , 0] ], - [ 'L', [ boxW + boxD + boxW + boxD - thck , 0 ] ], - [ 'M', [ 0 , 0] ], - [ 'Z', [] ] + [ 'M', [0, 0]], + [ 'L', [boxW, 0]], + [ 'L', [boxW + boxD / 2 - fingergrepr, 0]], + [ 'A', [fingergrepr, fingergrepr, 0, 1, 0, boxW + boxD - boxD / 2 + fingergrepr, 0]], + [ 'L', [boxW + boxD, 0]], + [ 'L', [boxW + boxD + boxW, 0]], + [ 'L', [boxW + boxD + boxW + boxD - thck - ( (boxD - thck) / 2 ) - fingergrepr, 0]], + [ 'A', [fingergrepr, fingergrepr, 0, 1, 0, boxW + boxD + boxW - thck + boxD - ( ( boxD - thck ) / 2 ) + fingergrepr , 0]], + [ 'L', [boxW + boxD + boxW + boxD - thck, 0]] ] - line_atts = { 'style':line_style, 'id':box_id+'-topdraw', 'd':str(Path(line_path)) } + line_atts = { 'style':cut_line_style, 'id':box_id+'-topdraw', 'd':str(Path(line_path)) } etree.SubElement(g, inkex.addNS('path','svg'), line_atts ) # No Bottom Option if btsc == "nobt": if not fingergrepa and not fingergrepb: line_path = [ - [ 'M', [ 0 , boxH ] ], - [ 'L', [ boxW, boxH ] ], - [ 'L', [ boxW + boxD , boxH ] ], - [ 'L', [ boxW + boxD + boxW, boxH ] ], - [ 'L', [ boxW + boxD + boxW + boxD - thck, boxH ] ], - [ 'Z', [] ] + [ 'M', [0, boxH]], + [ 'L', [boxW, boxH]], + [ 'L', [boxW + boxD, boxH]], + [ 'L', [boxW + boxD + boxW, boxH]], + [ 'L', [boxW + boxD + boxW + boxD - thck, boxH]] ] if fingergrepa and not fingergrepb: line_path = [ - [ 'M', [ 0 , boxH ] ], - [ 'L', [ boxW / 2 - fingergrepr , boxH ] ], - [ 'A', [ fingergrepr, fingergrepr , 0 , 1, 1, boxW - boxW / 2 + fingergrepr, boxH] ], - [ 'L', [ boxW , boxH ] ], - [ 'L', [ boxW + boxD, boxH ] ], - [ 'L', [ boxW + boxD + boxW / 2 - fingergrepr , boxH ] ], - [ 'A', [ fingergrepr, fingergrepr , 0 , 1, 1, boxW + boxD + boxW - boxW / 2 + fingergrepr, boxH] ], - [ 'L', [ boxW + boxD + boxW , boxH ] ], - [ 'L', [ boxW + boxD + boxW + boxD - thck , boxH ] ], - [ 'M', [ 0 , boxH ] ], - [ 'Z', [] ] + [ 'M', [0, boxH]], + [ 'L', [boxW / 2 - fingergrepr, boxH]], + [ 'A', [fingergrepr, fingergrepr, 0, 1, 1, boxW - boxW / 2 + fingergrepr, boxH]], + [ 'L', [boxW, boxH]], + [ 'L', [boxW + boxD, boxH]], + [ 'L', [boxW + boxD + boxW / 2 - fingergrepr, boxH]], + [ 'A', [fingergrepr, fingergrepr, 0, 1, 1, boxW + boxD + boxW - boxW / 2 + fingergrepr, boxH]], + [ 'L', [boxW + boxD + boxW, boxH]], + [ 'L', [boxW + boxD + boxW + boxD - thck, boxH]], + [ 'M', [0, boxH]] ] if fingergrepa and fingergrepb: line_path = [ - [ 'M', [ 0 , boxH ] ], - [ 'L', [ boxW / 2 - fingergrepr , boxH ] ], - [ 'A', [ fingergrepr, fingergrepr , 0 , 1, 1, boxW - boxW / 2 + fingergrepr, boxH] ], - [ 'L', [ boxW , boxH ] ], - [ 'L', [ boxW + boxD / 2 - fingergrepr, boxH ] ], - [ 'A', [ fingergrepr, fingergrepr , 0 , 1, 1, boxW + boxD - boxD / 2 + fingergrepr, boxH] ], - [ 'L', [ boxW + boxD , boxH ] ], - [ 'L', [ boxW + boxD + boxW / 2 - fingergrepr , boxH ] ], - [ 'A', [ fingergrepr, fingergrepr , 0 , 1, 1, boxW + boxD + boxW - boxW / 2 + fingergrepr, boxH ] ], - [ 'L', [ boxW + boxD + boxW , boxH ] ], - [ 'L', [ boxW + boxD + boxW + boxD - thck - ( (boxD - thck) / 2 ) - fingergrepr, boxH ] ], - [ 'A', [ fingergrepr, fingergrepr , 0 , 1, 1, boxW + boxD + boxW - thck + boxD - ( ( boxD - thck ) / 2 ) + fingergrepr , boxH ] ], - [ 'L', [ boxW + boxD + boxW + boxD - thck , boxH ] ], - [ 'M', [ 0 , boxH ] ], - [ 'Z', [] ] + [ 'M', [0, boxH]], + [ 'L', [boxW / 2 - fingergrepr, boxH]], + [ 'A', [fingergrepr, fingergrepr, 0, 1, 1, boxW - boxW / 2 + fingergrepr, boxH]], + [ 'L', [boxW, boxH]], + [ 'L', [boxW + boxD / 2 - fingergrepr, boxH]], + [ 'A', [fingergrepr, fingergrepr, 0, 1, 1, boxW + boxD - boxD / 2 + fingergrepr, boxH]], + [ 'L', [boxW + boxD, boxH]], + [ 'L', [boxW + boxD + boxW / 2 - fingergrepr, boxH]], + [ 'A', [fingergrepr, fingergrepr, 0, 1, 1, boxW + boxD + boxW - boxW / 2 + fingergrepr, boxH]], + [ 'L', [boxW + boxD + boxW, boxH]], + [ 'L', [boxW + boxD + boxW + boxD - thck - ( (boxD - thck) / 2 ) - fingergrepr, boxH]], + [ 'A', [fingergrepr, fingergrepr, 0, 1, 1, boxW + boxD + boxW - thck + boxD - ( ( boxD - thck ) / 2 ) + fingergrepr , boxH]], + [ 'L', [boxW + boxD + boxW + boxD - thck, boxH]], + [ 'M', [0, boxH]] ] if not fingergrepa and fingergrepb: line_path = [ - [ 'M', [ 0 , boxH ] ], - [ 'L', [ boxW , boxH ] ], - [ 'L', [ boxW + boxD / 2 - fingergrepr, boxH ] ], - [ 'A', [ fingergrepr, fingergrepr , 0 , 1, 1, boxW + boxD - boxD / 2 + fingergrepr, boxH ] ], - [ 'L', [ boxW + boxD , boxH ] ], - [ 'L', [ boxW + boxD + boxW , boxH ] ], - [ 'L', [ boxW + boxD + boxW + boxD - thck - ( (boxD - thck) / 2 ) - fingergrepr, boxH ] ], - [ 'A', [ fingergrepr, fingergrepr , 0 , 1, 1, boxW + boxD + boxW - thck + boxD - ( ( boxD - thck ) / 2 ) + fingergrepr , boxH ] ], - [ 'L', [ boxW + boxD + boxW + boxD - thck , boxH ] ], - [ 'M', [ 0 , boxH ] ], - [ 'Z', [] ] + [ 'M', [0, boxH]], + [ 'L', [boxW, boxH]], + [ 'L', [boxW + boxD / 2 - fingergrepr, boxH]], + [ 'A', [fingergrepr, fingergrepr, 0, 1, 1, boxW + boxD - boxD / 2 + fingergrepr, boxH]], + [ 'L', [boxW + boxD, boxH]], + [ 'L', [boxW + boxD + boxW, boxH]], + [ 'L', [boxW + boxD + boxW + boxD - thck - ( (boxD - thck) / 2 ) - fingergrepr, boxH]], + [ 'A', [fingergrepr, fingergrepr, 0, 1, 1, boxW + boxD + boxW - thck + boxD - ( ( boxD - thck ) / 2 ) + fingergrepr , boxH]], + [ 'L', [boxW + boxD + boxW + boxD - thck, boxH]], + [ 'M', [0, boxH]] ] - line_atts = { 'style':line_style, 'id':box_id+'-botdraw', 'd':str(Path(line_path)) } + line_atts = { 'style':cut_line_style, 'id':box_id+'-botdraw', 'd':str(Path(line_path)) } etree.SubElement(g, inkex.addNS('path','svg'), line_atts ) # Flat Bottom with Lock Flaps @@ -292,48 +297,52 @@ class inkpacking(inkex.EffectExtension): desloc = boxW + boxD inicut = 0 line_path = [ - [ 'M', [ desloc,boxH ] ], - [ 'l', [ 0, boxD * 1] ], - [ 'l', [ 6, 0 ] ], - [ 'l', [ 0, thck * -2] ], - [ 'm', [ 0, thck * 1] ], - [ 'l', [ boxW - 12, 0] ], - [ 'm', [ 0, thck * -1] ], - [ 'l', [ 0, thck * 2] ], - [ 'l', [6, 0 ] ], - [ 'l', [0, boxD * -1] ], - [ 'M', [desloc, boxH ] ], - [ 'm', [0, boxD *1] ], - [ 'm', [thck, 0] ], - [ 'l', [ lockroff , (boxL - thck) * 1 ] ], - [ 'l', [boxW - lockroff - lockroff - thck - thck, 0] ], - [ 'l', [lockroff , (boxL - thck) * -1 ] ], - [ 'M', [desloc,boxH + thck * 1] ], - [ 'l', [boxW,0] ], - [ 'Z', [] ] + [ 'M', [desloc,boxH]], + [ 'l', [0, boxD]], + [ 'm', [6, 0]], + [ 'l', [0, thck * -2]], + [ 'm', [0, thck]], + [ 'l', [boxW - 12, 0]], + [ 'm', [0, thck * -1]], + [ 'l', [0, thck * 2]], + [ 'm', [6, 0]], + [ 'l', [0, boxD * -1]], + [ 'M', [desloc, boxH]], + [ 'm', [0, boxD *1]], + [ 'm', [thck, 0]], + [ 'l', [lockroff, (boxL - thck)]], + [ 'l', [boxW - lockroff - lockroff - thck - thck, 0]], + [ 'l', [lockroff, (boxL - thck) * -1]] ] - line_atts = { 'style':line_style, 'id':box_id+'-bothead', 'd':str(Path(line_path)) } + line_atts = { 'style':cut_line_style, 'id':box_id+'-bothead', 'd':str(Path(line_path)) } + etree.SubElement(g, inkex.addNS('path','svg'), line_atts ) + + line_path = [ + [ 'M', [desloc, boxH + boxD]], + [ 'l', [6, 0]], + [ 'M', [desloc + boxW - 6, boxH + boxD]], + [ 'l', [6, 0]], + [ 'M', [desloc,boxH + thck]], + [ 'l', [boxW,0]] + ] + line_atts = { 'style':engrave_line_style, 'id':box_id+'-bothead', 'd':str(Path(line_path)) } etree.SubElement(g, inkex.addNS('path','svg'), line_atts ) if fingergrepa: line_path = [ ["M", [inicut, boxH]], - ["l", [boxW / 2 - fingergrepr, 0] ], - ["a", [fingergrepr, fingergrepr, 0, 0, 1, fingergrepr * 2,0] ], - ["l", [boxW / 2 - fingergrepr, 0] ], - ["M", [0,0] ], - ["Z", [] ] + ["l", [boxW / 2 - fingergrepr, 0]], + ["a", [fingergrepr, fingergrepr, 0, 0, 1, fingergrepr * 2,0]], + ["l", [boxW / 2 - fingergrepr, 0]] ] - line_atts = { 'style':line_style, 'id':box_id+'-botcut', 'd':str(Path(line_path)) } + line_atts = { 'style':cut_line_style, 'id':box_id+'-botcut', 'd':str(Path(line_path)) } etree.SubElement(g, inkex.addNS('path','svg'), line_atts ) if not fingergrepa: line_path = [ ["M", [inicut, boxH]], - ["l", [boxW , 0] ], - ["M", [0,0] ], - ["Z", [] ] + ["l", [boxW, 0]] ] - line_atts = { 'style':line_style, 'id':box_id+'-botcut', 'd':str(Path(line_path)) } + line_atts = { 'style':cut_line_style, 'id':box_id+'-botcut', 'd':str(Path(line_path)) } etree.SubElement(g, inkex.addNS('path','svg'), line_atts ) @@ -345,48 +354,53 @@ class inkpacking(inkex.EffectExtension): desloc = boxW + boxD inicut = 0 line_path = [ - [ 'M', [ desloc,0 ] ], - [ 'l', [ 0, boxD * -1] ], - [ 'l', [ 6, 0 ] ], - [ 'l', [ 0, thck * 2] ], - [ 'm', [ 0, thck * -1] ], - [ 'l', [ boxW - 12, 0] ], - [ 'm', [ 0, thck] ], - [ 'l', [ 0, thck * -2] ], - [ 'l', [6, 0 ] ], - [ 'l', [0, boxD] ], - [ 'M', [desloc, 0 ] ], - [ 'm', [0, boxD *-1] ], - [ 'm', [thck, 0] ], - [ 'l', [ lockroff , (boxL - thck) * -1 ] ], - [ 'l', [boxW - lockroff - lockroff - thck - thck, 0] ], - [ 'l', [lockroff , (boxL - thck) ] ], - [ 'M', [desloc,thck * -1] ], - [ 'l', [boxW,0] ], - [ 'Z', [] ] + [ 'M', [desloc,0]], + [ 'l', [0, boxD * -1]], + [ 'm', [6, 0]], + [ 'l', [0, thck * 2]], + [ 'm', [0, thck * -1]], + [ 'l', [boxW - 12, 0]], + [ 'm', [0, thck]], + [ 'l', [0, thck * -2]], + [ 'm', [6, 0]], + [ 'l', [0, boxD]], + [ 'M', [desloc, 0]], + [ 'm', [0, boxD *-1]], + [ 'm', [thck, 0]], + [ 'l', [lockroff, (boxL - thck) * -1]], + [ 'l', [boxW - lockroff - lockroff - thck - thck, 0]], + [ 'l', [lockroff, (boxL - thck)]] + ] - line_atts = { 'style':line_style, 'id':box_id+'-tophead', 'd':str(Path(line_path)) } + line_atts = { 'style':cut_line_style, 'id':box_id+'-tophead', 'd':str(Path(line_path)) } + etree.SubElement(g, inkex.addNS('path','svg'), line_atts ) + + line_path = [ + [ 'M', [desloc, boxD * -1]], + [ 'l', [6, 0]], + [ 'M', [desloc + boxW - 6, boxD * -1]], + [ 'l', [6, 0]], + [ 'M', [desloc,thck * -1]], + [ 'l', [boxW,0]] + ] + line_atts = { 'style':engrave_line_style, 'id':box_id+'-tophead', 'd':str(Path(line_path)) } etree.SubElement(g, inkex.addNS('path','svg'), line_atts ) if fingergrepa: line_path = [ ["M", [inicut,0]], - ["l", [boxW / 2 - fingergrepr, 0] ], - ["a", [fingergrepr, fingergrepr, 0, 0, 0, fingergrepr * 2,0] ], - ["l", [boxW / 2 - fingergrepr, 0] ], - ["M", [0,0] ], - ["Z", [] ] + ["l", [boxW / 2 - fingergrepr, 0]], + ["a", [fingergrepr, fingergrepr, 0, 0, 0, fingergrepr * 2,0]], + ["l", [boxW / 2 - fingergrepr, 0]] ] - line_atts = { 'style':line_style, 'id':box_id+'-topcut', 'd':str(Path(line_path)) } + line_atts = { 'style':cut_line_style, 'id':box_id+'-topcut', 'd':str(Path(line_path)) } etree.SubElement(g, inkex.addNS('path','svg'), line_atts ) if not fingergrepa: line_path = [ ["M", [inicut,0]], - ["l", [boxW , 0] ], - ["M", [0,0] ], - ["Z", [] ] + ["l", [boxW, 0]] ] - line_atts = { 'style':line_style, 'id':box_id+'-topcut', 'd':str(Path(line_path)) } + line_atts = { 'style':cut_line_style, 'id':box_id+'-topcut', 'd':str(Path(line_path)) } etree.SubElement(g, inkex.addNS('path','svg'), line_atts ) # Rounded Bottom with Lock Flaps @@ -397,48 +411,52 @@ class inkpacking(inkex.EffectExtension): desloc = boxW + boxD inicut = 0 line_path = [ - [ 'M', [ desloc,boxH ] ], - [ 'l', [ 0, boxD * 1] ], - [ 'l', [ 6, 0 ] ], - [ 'l', [ 0, thck * -2] ], - [ 'm', [ 0, thck * 1] ], - [ 'l', [ boxW - 12, 0] ], - [ 'm', [ 0, thck * -1] ], - [ 'l', [ 0, thck * 2] ], - [ 'l', [6, 0 ] ], - [ 'l', [0, boxD * -1] ], - [ 'M', [desloc, boxH ] ], - [ 'm', [0, boxD * 1] ], - [ 'm', [thck, 0] ], - [ 'a', [lockrr , lockrr , 0 , 0 , 0, lockroff , (boxL - thck) * 1 ] ], - [ 'l', [boxW - lockroff - lockroff - thck - thck, 0] ], - [ 'a', [lockrr , lockrr , roto , 0 , 0, lockroff , (boxL - thck) * - 1 ] ], - [ 'M', [desloc,boxH + thck * 1] ], - [ 'l', [boxW,0] ], - [ 'Z', [] ] + [ 'M', [desloc,boxH]], + [ 'l', [0, boxD]], + [ 'm', [6, 0]], + [ 'l', [0, thck * -2]], + [ 'm', [0, thck]], + [ 'l', [boxW - 12, 0]], + [ 'm', [0, thck * -1]], + [ 'l', [0, thck * 2]], + [ 'm', [6, 0]], + [ 'l', [0, boxD * -1]], + [ 'M', [desloc, boxH]], + [ 'm', [0, boxD]], + [ 'm', [thck, 0]], + [ 'a', [lockrr , lockrr, 0, 0, 0, lockroff, (boxL - thck)]], + [ 'l', [boxW - lockroff - lockroff - thck - thck, 0]], + [ 'a', [lockrr, lockrr, roto, 0, 0, lockroff, (boxL - thck) * - 1]] ] - line_atts = { 'style':line_style, 'id':box_id+'-bothead', 'd':str(Path(line_path)) } + line_atts = { 'style':cut_line_style, 'id':box_id+'-bothead', 'd':str(Path(line_path)) } + etree.SubElement(g, inkex.addNS('path','svg'), line_atts ) + + line_path = [ + [ 'M', [desloc, boxH + boxD]], + [ 'l', [6, 0]], + [ 'M', [desloc + boxW - 6, boxH + boxD]], + [ 'l', [6, 0]], + [ 'M', [desloc,boxH + thck]], + [ 'l', [boxW,0]] + ] + line_atts = { 'style':engrave_line_style, 'id':box_id+'-bothead', 'd':str(Path(line_path)) } etree.SubElement(g, inkex.addNS('path','svg'), line_atts ) if fingergrepa: line_path = [ ["M", [inicut,boxH]], - ["l", [boxW / 2 - fingergrepr, 0] ], - ["a", [fingergrepr, fingergrepr, 0, 0, 1, fingergrepr * 2,0] ], - ["l", [boxW / 2 - fingergrepr, 0] ], - ["M", [0,0] ], - ["Z", [] ] + ["l", [boxW / 2 - fingergrepr, 0]], + ["a", [fingergrepr, fingergrepr, 0, 0, 1, fingergrepr * 2,0]], + ["l", [boxW / 2 - fingergrepr, 0]] ] - line_atts = { 'style':line_style, 'id':box_id+'-botcut', 'd':str(Path(line_path)) } + line_atts = { 'style':cut_line_style, 'id':box_id+'-botcut', 'd':str(Path(line_path)) } etree.SubElement(g, inkex.addNS('path','svg'), line_atts ) if not fingergrepa: line_path = [ ["M", [inicut,boxH]], - ["l", [boxW , 0] ], - ["M", [0,0] ], - ["Z", [] ] + ["l", [boxW, 0]] ] - line_atts = { 'style':line_style, 'id':box_id+'-botcut', 'd':str(Path(line_path)) } + line_atts = { 'style':cut_line_style, 'id':box_id+'-botcut', 'd':str(Path(line_path)) } etree.SubElement(g, inkex.addNS('path','svg'), line_atts ) # Rounded Top with Lock Flaps @@ -449,150 +467,154 @@ class inkpacking(inkex.EffectExtension): desloc = boxW + boxD inicut = 0 line_path = [ - [ 'M', [ desloc,0 ] ], - [ 'l', [ 0, boxD * -1] ], - [ 'l', [ 6, 0 ] ], - [ 'l', [ 0, thck * 2] ], - [ 'm', [ 0, thck * -1] ], - [ 'l', [ boxW - 12, 0] ], - [ 'm', [ 0, thck] ], - [ 'l', [ 0, thck * -2] ], - [ 'l', [6, 0 ] ], - [ 'l', [0, boxD] ], - [ 'M', [desloc, 0 ] ], - [ 'm', [0, boxD *-1] ], - [ 'm', [thck, 0] ], - [ 'a', [lockrr , lockrr , 0 , 0 , 1, lockroff , (boxL - thck) * -1 ] ], - [ 'l', [boxW - lockroff - lockroff - thck - thck, 0] ], - [ 'a', [lockrr , lockrr , roto , 0 , 1, lockroff , (boxL - thck) ] ], - [ 'M', [desloc,thck * -1] ], - [ 'l', [boxW,0] ], - [ 'Z', [] ] + [ 'M', [desloc,0]], + [ 'l', [0, boxD * -1]], + [ 'm', [6, 0]], + [ 'l', [0, thck * 2]], + [ 'm', [0, thck * -1]], + [ 'l', [boxW - 12, 0]], + [ 'm', [0, thck]], + [ 'l', [0, thck * -2]], + [ 'm', [6, 0]], + [ 'l', [0, boxD]], + [ 'M', [desloc, 0]], + [ 'm', [0, boxD *-1]], + [ 'm', [thck, 0]], + [ 'a', [lockrr , lockrr, 0, 0, 1, lockroff, (boxL - thck) * -1]], + [ 'l', [boxW - lockroff - lockroff - thck - thck, 0]], + [ 'a', [lockrr, lockrr, roto, 0, 1, lockroff, (boxL - thck)]] ] - line_atts = { 'style':line_style, 'id':box_id+'-tophead', 'd':str(Path(line_path)) } + line_atts = { 'style':cut_line_style, 'id':box_id+'-tophead', 'd':str(Path(line_path)) } + etree.SubElement(g, inkex.addNS('path','svg'), line_atts ) + + line_path = [ + [ 'M', [desloc, boxD * -1]], + [ 'l', [6, 0]], + [ 'M', [desloc + boxW - 6, boxD * -1]], + [ 'l', [6, 0]], + [ 'M', [desloc,thck * -1]], + [ 'l', [boxW,0]] + ] + line_atts = { 'style':engrave_line_style, 'id':box_id+'-tophead', 'd':str(Path(line_path)) } etree.SubElement(g, inkex.addNS('path','svg'), line_atts ) - if fingergrepa: line_path = [ ["M", [inicut,0]], - ["l", [boxW / 2 - fingergrepr, 0] ], - ["a", [fingergrepr, fingergrepr, 0, 0, 0, fingergrepr * 2,0] ], - ["l", [boxW / 2 - fingergrepr, 0] ], - ["M", [0,0] ], - ["Z", [] ] + ["l", [boxW / 2 - fingergrepr, 0]], + ["a", [fingergrepr, fingergrepr, 0, 0, 0, fingergrepr * 2,0]], + ["l", [boxW / 2 - fingergrepr, 0]] ] - line_atts = { 'style':line_style, 'id':box_id+'-topcut', 'd':str(Path(line_path)) } + line_atts = { 'style':cut_line_style, 'id':box_id+'-topcut', 'd':str(Path(line_path)) } etree.SubElement(g, inkex.addNS('path','svg'), line_atts ) if not fingergrepa: line_path = [ ["M", [inicut,0]], - ["l", [boxW , 0] ], - ["M", [0,0] ], - ["Z", [] ] + ["l", [boxW, 0]] ] - line_atts = { 'style':line_style, 'id':box_id+'-topcut', 'd':str(Path(line_path)) } + line_atts = { 'style':cut_line_style, 'id':box_id+'-topcut', 'd':str(Path(line_path)) } etree.SubElement(g, inkex.addNS('path','svg'), line_atts ) # HotMelt Top if tpsc == "fwnf": if tfal: - line_path = [ - [ 'M', [ 0 , 0 ] ], - [ 'L', [ 0, boxD * -1 ] ], - [ 'L', [ boxW, boxD * -1 ] ], - [ 'L', [ boxW, 0 ] ], - [ 'M', [ boxW, boxD * -1 / 2 ] ], - [ 'M', [ boxW + boxD, boxD * -1 / 2 ] ], - [ 'M', [ boxW + boxD, 0 ] ], - [ 'L', [ boxW + boxD, boxD * -1 * hotmeltp ] ], - [ 'L', [ boxW + boxD + boxW, boxD * -1 * hotmeltp ] ], - [ 'L', [ boxW + boxD + boxW, 0 ] ], - [ 'M', [ boxW + boxD + boxW, boxD * -1 /2 ] ], - [ 'M', [ boxW + boxD + boxW + boxD - thck, boxD * -1 /2 ] ], - [ 'M', [ boxW + boxD + boxW + boxD - thck, 0 ] ], - [ 'M', [ 0 , 0 - thck ] ], - [ 'L', [ boxW , 0 - thck ] ], - [ 'M', [ boxW + boxD , 0 - thck ] ], - [ 'L', [ boxW + boxD + boxW , 0 - thck ] ], - [ 'Z', [] ] + cut_line_path = [ + [ 'M', [0, 0]], + [ 'L', [0, boxD * -1]], + [ 'L', [boxW, boxD * -1]], + [ 'L', [boxW, 0]], + [ 'M', [boxW, boxD * -1 / 2]], + [ 'M', [boxW + boxD, boxD * -1 / 2]], + [ 'M', [boxW + boxD, 0]], + [ 'L', [boxW + boxD, boxD * -1 * hotmeltp]], + [ 'L', [boxW + boxD + boxW, boxD * -1 * hotmeltp]], + [ 'L', [boxW + boxD + boxW, 0]], + [ 'M', [boxW + boxD + boxW, boxD * -1 /2]], + [ 'M', [boxW + boxD + boxW + boxD - thck, boxD * -1 /2]], + [ 'M', [boxW + boxD + boxW + boxD - thck, 0]] + ] + engrave_line_path = [ + [ 'M', [0, 0 - thck]], + [ 'L', [boxW, 0 - thck]], + [ 'M', [boxW + boxD, 0 - thck]], + [ 'L', [boxW + boxD + boxW, 0 - thck]] ] - line_atts = { 'style':line_style, 'id':box_id+'-topdraw', 'd':str(Path(line_path)) } - etree.SubElement(g, inkex.addNS('path','svg'), line_atts ) - if not tfal: - line_path = [ - [ 'M', [ 0 , 0 ] ], - [ 'L', [ 0, boxD * -1 * hotmeltp ] ], - [ 'L', [ boxW, boxD * -1 * hotmeltp ] ], - [ 'L', [ boxW, 0 ] ], - [ 'M', [ boxW, boxD * -1 / 2 ] ], - [ 'M', [ boxW + boxD, boxD * -1 / 2 ] ], - [ 'M', [ boxW + boxD, 0 ] ], - [ 'L', [ boxW + boxD, boxD * -1 ] ], - [ 'L', [ boxW + boxD + boxW, boxD * -1 ] ], - [ 'L', [ boxW + boxD + boxW, 0 ] ], - [ 'M', [ boxW + boxD + boxW, boxD * -1 /2 ] ], - [ 'M', [ boxW + boxD + boxW + boxD - thck, boxD * -1 /2 ] ], - [ 'M', [ boxW + boxD + boxW + boxD - thck, 0 ] ], - [ 'M', [ 0 , 0 - thck ] ], - [ 'L', [ boxW , 0 - thck ] ], - [ 'M', [ boxW + boxD , 0 - thck ] ], - [ 'L', [ boxW + boxD + boxW , 0 - thck ] ], - [ 'Z', [] ] + cut_line_path = [ + [ 'M', [0, 0]], + [ 'L', [0, boxD * -1 * hotmeltp]], + [ 'L', [boxW, boxD * -1 * hotmeltp]], + [ 'L', [boxW, 0]], + [ 'M', [boxW, boxD * -1 / 2]], + [ 'M', [boxW + boxD, boxD * -1 / 2]], + [ 'M', [boxW + boxD, 0]], + [ 'L', [boxW + boxD, boxD * -1]], + [ 'L', [boxW + boxD + boxW, boxD * -1]], + [ 'L', [boxW + boxD + boxW, 0]], + [ 'M', [boxW + boxD + boxW, boxD * -1 /2]], + [ 'M', [boxW + boxD + boxW + boxD - thck, boxD * -1 /2]], + [ 'M', [boxW + boxD + boxW + boxD - thck, 0]] ] - line_atts = { 'style':line_style, 'id':box_id+'-topdraw', 'd':str(Path(line_path)) } - etree.SubElement(g, inkex.addNS('path','svg'), line_atts ) - + engrave_line_path = [ + [ 'M', [0, 0 - thck]], + [ 'L', [boxW, 0 - thck]], + [ 'M', [boxW + boxD, 0 - thck]], + [ 'L', [boxW + boxD + boxW, 0 - thck]] + ] + line_atts = { 'style':cut_line_style, 'id':box_id+'-topdraw_cut', 'd':str(Path(cut_line_path)) } + etree.SubElement(g, inkex.addNS('path','svg'), line_atts ) + line_atts = { 'style':engrave_line_style, 'id':box_id+'-topdraw_engrave', 'd':str(Path(engrave_line_path)) } + etree.SubElement(g, inkex.addNS('path','svg'), line_atts ) # HotMelt Bottom if btsc == "fwnf": if bfal: - line_path = [ - [ 'M', [ 0 , boxH ] ], - [ 'L', [ 0, boxH + boxD * 1 ] ], - [ 'L', [ boxW, boxH + boxD * 1 ] ], - [ 'L', [ boxW, boxH ] ], - [ 'M', [ boxW, boxH + boxD * 1 / 2 ] ], - [ 'M', [ boxW + boxD, boxH + boxD * 1 / 2 ] ], - [ 'M', [ boxW + boxD, boxH ] ], - [ 'L', [ boxW + boxD, boxH + boxD * 1 * hotmeltp ] ], - [ 'L', [ boxW + boxD + boxW, boxH + boxD * 1 * hotmeltp ] ], - [ 'L', [ boxW + boxD + boxW, boxH ] ], - [ 'M', [ boxW + boxD + boxW, boxH + boxD * 1 /2 ] ], - [ 'M', [ boxW + boxD + boxW + boxD - thck, boxH + boxD * 1 /2 ] ], - [ 'M', [ boxW + boxD + boxW + boxD - thck, boxH ] ], - [ 'M', [ 0 , boxH + thck ] ], - [ 'L', [ boxW , boxH + thck ] ], - [ 'M', [ boxW + boxD , boxH + thck ] ], - [ 'L', [ boxW + boxD + boxW , boxH + thck ] ], - [ 'Z', [] ] - ] - line_atts = { 'style':line_style, 'id':box_id+'-botdraw', 'd':str(Path(line_path)) } - etree.SubElement(g, inkex.addNS('path','svg'), line_atts ) + cut_line_path = [ + [ 'M', [0, boxH]], + [ 'L', [0, boxH + boxD]], + [ 'L', [boxW, boxH + boxD]], + [ 'L', [boxW, boxH]], + [ 'M', [boxW, boxH + boxD / 2]], + [ 'M', [boxW + boxD, boxH + boxD / 2]], + [ 'M', [boxW + boxD, boxH]], + [ 'L', [boxW + boxD, boxH + boxD * hotmeltp]], + [ 'L', [boxW + boxD + boxW, boxH + boxD * hotmeltp]], + [ 'L', [boxW + boxD + boxW, boxH]], + [ 'M', [boxW + boxD + boxW, boxH + boxD /2]], + [ 'M', [boxW + boxD + boxW + boxD - thck, boxH + boxD /2]], + [ 'M', [boxW + boxD + boxW + boxD - thck, boxH]] + ] + engrave_line_path = [ + [ 'M', [0, boxH + thck]], + [ 'L', [boxW, boxH + thck]], + [ 'M', [boxW + boxD, boxH + thck]], + [ 'L', [boxW + boxD + boxW, boxH + thck]] + ] if not bfal: - line_path = [ - [ 'M', [ 0 , boxH ] ], - [ 'L', [ 0, boxH + boxD * 1 * hotmeltp ] ], - [ 'L', [ boxW, boxH + boxD * 1 * hotmeltp ] ], - [ 'L', [ boxW, boxH ] ], - [ 'M', [ boxW, boxH + boxD * 1 / 2 ] ], - [ 'M', [ boxW + boxD, boxH + boxD * 1 / 2 ] ], - [ 'M', [ boxW + boxD, boxH ] ], - [ 'L', [ boxW + boxD, boxH + boxD * 1 ] ], - [ 'L', [ boxW + boxD + boxW, boxH + boxD * 1 ] ], - [ 'L', [ boxW + boxD + boxW, boxH ] ], - [ 'M', [ boxW + boxD + boxW, boxH + boxD * 1 /2 ] ], - [ 'M', [ boxW + boxD + boxW + boxD - thck, boxH + boxD * 1 /2 ] ], - [ 'M', [ boxW + boxD + boxW + boxD - thck, boxH ] ], - [ 'M', [ 0 , boxH + thck ] ], - [ 'L', [ boxW , boxH + thck ] ], - [ 'M', [ boxW + boxD , boxH + thck ] ], - [ 'L', [ boxW + boxD + boxW , boxH + thck ] ], - [ 'Z', [] ] + cut_line_path = [ + [ 'M', [0, boxH]], + [ 'L', [0, boxH + boxD * hotmeltp]], + [ 'L', [boxW, boxH + boxD * hotmeltp]], + [ 'L', [boxW, boxH]], + [ 'M', [boxW, boxH + boxD / 2]], + [ 'M', [boxW + boxD, boxH + boxD / 2]], + [ 'M', [boxW + boxD, boxH]], + [ 'L', [boxW + boxD, boxH + boxD]], + [ 'L', [boxW + boxD + boxW, boxH + boxD]], + [ 'L', [boxW + boxD + boxW, boxH]], + [ 'M', [boxW + boxD + boxW, boxH + boxD /2]], + [ 'M', [boxW + boxD + boxW + boxD - thck, boxH + boxD /2]], + [ 'M', [boxW + boxD + boxW + boxD - thck, boxH]] ] - line_atts = { 'style':line_style, 'id':box_id+'-botdraw', 'd':str(Path(line_path)) } - etree.SubElement(g, inkex.addNS('path','svg'), line_atts ) - + engrave_line_path = [ + [ 'M', [0, boxH + thck]], + [ 'L', [boxW, boxH + thck]], + [ 'M', [boxW + boxD, boxH + thck]], + [ 'L', [boxW + boxD + boxW, boxH + thck]] + ] + line_atts = { 'style':cut_line_style, 'id':box_id+'-botdraw_cut', 'd':str(Path(cut_line_path)) } + etree.SubElement(g, inkex.addNS('path','svg'), line_atts ) + line_atts = { 'style':engrave_line_style, 'id':box_id+'-botdraw_engrave', 'd':str(Path(engrave_line_path)) } + etree.SubElement(g, inkex.addNS('path','svg'), line_atts ) thck2 = thck / 2 # Top Glue Flaps @@ -601,68 +623,70 @@ class inkpacking(inkex.EffectExtension): if tpsc == "fwnf": desclock = 0 if tfal: - line_path = [ - [ 'M', [ boxW , 0 ] ], - [ 'l', [ 0, glueflapinoff * -1] ], - [ 'l', [ glueflapin45, glueflapin45 * -1] ], - [ 'l', [ glueflapindesl, ((boxD + boxL) / 2 - glueflapinoff - glueflapin45) * -1 + thck2] ], - [ 'M', [ boxW + boxD , 0 ] ], - [ 'l', [ desclock * -1, 0 ] ], - [ 'l', [ 0, glueflapouoff * -1] ], - [ 'l', [ glueflapou45 * -1, glueflapou45 * -1] ], - [ 'l', [ glueflapoudesl * -1, ((boxD + boxL) / 2 - glueflapouoff - glueflapou45) * -1 + thck2] ], - [ 'l', [ (boxD - glueflapindesl - glueflapoudesl - glueflapin45 - glueflapou45 - desclock) * -1, 0 ] ], - [ 'M', [ boxW , 0 ] ], - [ 'l', [ boxD - desclock , 0 ] ], - [ 'M', [ boxW + boxW + boxD + boxD - thck , 0 ] ], - [ 'l', [ 0, glueflapinoff * -1] ], - [ 'l', [ glueflapin45 * -1, glueflapin45 * -1] ], - [ 'l', [ glueflapindesl * -1 , ((boxD + boxL) / 2 - glueflapinoff - glueflapin45) * -1 + thck2] ], - [ 'M', [ boxW + boxD + boxW , 0 ] ], - [ 'l', [ desclock , 0 ] ], - [ 'l', [ 0, glueflapouoff * -1] ], - [ 'l', [ glueflapou45 , glueflapou45 * -1] ], - [ 'l', [ glueflapoudesl , ((boxD + boxL) / 2 - glueflapouoff - glueflapou45) * -1 + thck2] ], - [ 'l', [ (boxD - glueflapindesl - glueflapoudesl - glueflapin45 - glueflapou45 - desclock -thck ) , 0 ] ], - [ 'M', [ boxW + boxD + boxW + desclock , 0 ] ], - [ 'l', [ boxD - thck - desclock , 0 ] ], - [ 'Z', [] ] + cut_line_path = [ + [ 'M', [boxW, 0]], + [ 'l', [0, glueflapinoff * -1]], + [ 'l', [glueflapin45, glueflapin45 * -1]], + [ 'l', [glueflapindesl, ((boxD + boxL) / 2 - glueflapinoff - glueflapin45) * -1 + thck2]], + [ 'M', [boxW + boxD, 0]], + [ 'l', [desclock * -1, 0]], + [ 'l', [0, glueflapouoff * -1]], + [ 'l', [glueflapou45 * -1, glueflapou45 * -1]], + [ 'l', [glueflapoudesl * -1, ((boxD + boxL) / 2 - glueflapouoff - glueflapou45) * -1 + thck2]], + [ 'l', [(boxD - glueflapindesl - glueflapoudesl - glueflapin45 - glueflapou45 - desclock) * -1, 0]], + [ 'M', [boxW + boxW + boxD + boxD - thck, 0]], + [ 'l', [0, glueflapinoff * -1]], + [ 'l', [glueflapin45 * -1, glueflapin45 * -1]], + [ 'l', [glueflapindesl * -1, ((boxD + boxL) / 2 - glueflapinoff - glueflapin45) * -1 + thck2]], + [ 'M', [boxW + boxD + boxW, 0]], + [ 'l', [desclock, 0]], + [ 'l', [0, glueflapouoff * -1]], + [ 'l', [glueflapou45, glueflapou45 * -1]], + [ 'l', [glueflapoudesl, ((boxD + boxL) / 2 - glueflapouoff - glueflapou45) * -1 + thck2]], + [ 'l', [(boxD - glueflapindesl - glueflapoudesl - glueflapin45 - glueflapou45 - desclock -thck ), 0]] + ] + engrave_line_path = [ + [ 'M', [boxW, 0]], + [ 'l', [boxD - desclock, 0]], + [ 'M', [boxW + boxD + boxW + desclock, 0]], + [ 'l', [boxD - thck - desclock, 0]] ] if not tfal: - line_path = [ - [ 'M', [ boxW + boxD, 0 ] ], - - [ 'l', [ 0, glueflapinoff * -1] ], - [ 'l', [ glueflapin45 * -1, glueflapin45 * -1] ], - [ 'l', [ glueflapindesl * -1 , ((boxD + boxL) / 2 - glueflapinoff - glueflapin45) * -1 + thck2] ], - [ 'M', [ boxW , 0 ] ], - [ 'l', [ desclock , 0 ] ], - [ 'l', [ 0, glueflapouoff * -1] ], - [ 'l', [ glueflapou45 , glueflapou45 * -1] ], - [ 'l', [ glueflapoudesl , ((boxD + boxL) / 2 - glueflapouoff - glueflapou45) * -1 + thck2] ], - [ 'l', [ (boxD - glueflapindesl - glueflapoudesl - glueflapin45 - glueflapou45 - desclock) , 0 ] ], - [ 'M', [ boxW + desclock , 0 ] ], - [ 'l', [ boxD - desclock , 0 ] ], - - [ 'M', [ boxW + boxD + boxW , 0 ] ], - [ 'l', [ 0, glueflapinoff * -1] ], - [ 'l', [ glueflapin45, glueflapin45 * -1] ], - [ 'l', [ glueflapindesl, ((boxD + boxL) / 2 - glueflapinoff - glueflapin45) * -1 + thck2] ], - [ 'M', [ boxW + boxD + boxW + boxD - thck , 0 ] ], - [ 'l', [ desclock * -1, 0 ] ], - [ 'l', [ 0, glueflapouoff * -1] ], - [ 'l', [ glueflapou45 * -1, glueflapou45 * -1] ], - [ 'l', [ glueflapoudesl * -1, ((boxD + boxL) / 2 - glueflapouoff - glueflapou45) * -1 + thck2] ], - [ 'l', [ (boxD - glueflapindesl - glueflapoudesl - glueflapin45 - glueflapou45 - desclock -thck) * -1, 0 ] ], - [ 'M', [ boxW + boxD + boxW , 0 ] ], - [ 'l', [ boxD -thck - desclock , 0 ] ], - [ 'Z', [] ] + cut_line_path = [ + [ 'M', [boxW + boxD, 0]], + [ 'l', [0, glueflapinoff * -1]], + [ 'l', [glueflapin45 * -1, glueflapin45 * -1]], + [ 'l', [glueflapindesl * -1, ((boxD + boxL) / 2 - glueflapinoff - glueflapin45) * -1 + thck2]], + [ 'M', [boxW, 0]], + [ 'l', [desclock, 0]], + [ 'l', [0, glueflapouoff * -1]], + [ 'l', [glueflapou45, glueflapou45 * -1]], + [ 'l', [glueflapoudesl, ((boxD + boxL) / 2 - glueflapouoff - glueflapou45) * -1 + thck2]], + [ 'l', [(boxD - glueflapindesl - glueflapoudesl - glueflapin45 - glueflapou45 - desclock), 0]], + [ 'M', [boxW + boxD + boxW, 0]], + [ 'l', [0, glueflapinoff * -1]], + [ 'l', [glueflapin45, glueflapin45 * -1]], + [ 'l', [glueflapindesl, ((boxD + boxL) / 2 - glueflapinoff - glueflapin45) * -1 + thck2]], + [ 'M', [boxW + boxD + boxW + boxD - thck, 0]], + [ 'l', [desclock * -1, 0]], + [ 'l', [0, glueflapouoff * -1]], + [ 'l', [glueflapou45 * -1, glueflapou45 * -1]], + [ 'l', [glueflapoudesl * -1, ((boxD + boxL) / 2 - glueflapouoff - glueflapou45) * -1 + thck2]], + [ 'l', [(boxD - glueflapindesl - glueflapoudesl - glueflapin45 - glueflapou45 - desclock -thck) * -1, 0]] + ] + engrave_line_path = [ + [ 'M', [boxW + desclock, 0]], + [ 'l', [boxD - desclock, 0]], + [ 'M', [boxW + boxD + boxW, 0]], + [ 'l', [boxD -thck - desclock, 0]] ] - - line_atts = { 'style':line_style, 'id':box_id+'-topglueflap', 'd':str(Path(line_path)) } + line_atts = { 'style':cut_line_style, 'id':box_id+'-topglueflap_cut', 'd':str(Path(cut_line_path)) } etree.SubElement(g, inkex.addNS('path','svg'), line_atts ) + line_atts = { 'style':engrave_line_style, 'id':box_id+'-topglueflap_engrave', 'd':str(Path(engrave_line_path)) } + etree.SubElement(g, inkex.addNS('path','svg'), line_atts ) + # Bottom Glue Flaps if not usetop: @@ -678,67 +702,71 @@ class inkpacking(inkex.EffectExtension): if btsc == "fwnf": desclock = 0 if bfal: - line_path = [ - [ 'M', [ boxW , boxH ] ], - [ 'l', [ 0, glueflapinoff * 1] ], - [ 'l', [ glueflapin45, glueflapin45 * 1] ], - [ 'l', [ glueflapindesl, ((boxD + boxL) / 2 - glueflapinoff - glueflapin45) * 1 -thck2] ], - [ 'M', [ boxW + boxD , boxH ] ], - [ 'l', [ desclock * -1, 0 ] ], - [ 'l', [ 0, glueflapouoff * 1] ], - [ 'l', [ glueflapou45 * -1, glueflapou45 * 1] ], - [ 'l', [ glueflapoudesl * -1, ((boxD + boxL) / 2 - glueflapouoff - glueflapou45) * 1 -thck2 ] ], - [ 'l', [ (boxD - glueflapindesl - glueflapoudesl - glueflapin45 - glueflapou45 - desclock) * -1, 0 ] ], - [ 'M', [ boxW , boxH ] ], - [ 'l', [ boxD - desclock , 0 ] ], - [ 'M', [ boxW + boxW + boxD + boxD - thck , boxH ] ], - [ 'l', [ 0, glueflapinoff * 1] ], - [ 'l', [ glueflapin45 * -1, glueflapin45 * 1] ], - [ 'l', [ glueflapindesl * -1 , ((boxD + boxL) / 2 - glueflapinoff - glueflapin45) * 1 - thck2] ], - [ 'M', [ boxW + boxD + boxW , boxH ] ], - [ 'l', [ desclock , 0 ] ], - [ 'l', [ 0, glueflapouoff * 1] ], - [ 'l', [ glueflapou45 , glueflapou45 * 1] ], - [ 'l', [ glueflapoudesl , ((boxD + boxL) / 2 - glueflapouoff - glueflapou45) * 1 -thck2] ], - [ 'l', [ (boxD - glueflapindesl - glueflapoudesl - glueflapin45 - glueflapou45 - desclock -thck ) , 0 ] ], - [ 'M', [ boxW + boxD + boxW + desclock , boxH ] ], - [ 'l', [ boxD - thck - desclock , 0 ] ], - [ 'Z', [] ] + cut_line_path = [ + [ 'M', [boxW, boxH]], + [ 'l', [0, glueflapinoff]], + [ 'l', [glueflapin45, glueflapin45]], + [ 'l', [glueflapindesl, ((boxD + boxL) / 2 - glueflapinoff - glueflapin45) -thck2]], + [ 'M', [boxW + boxD, boxH]], + [ 'l', [desclock * -1, 0]], + [ 'l', [0, glueflapouoff]], + [ 'l', [glueflapou45 * -1, glueflapou45]], + [ 'l', [glueflapoudesl * -1, ((boxD + boxL) / 2 - glueflapouoff - glueflapou45) -thck2]], + [ 'l', [(boxD - glueflapindesl - glueflapoudesl - glueflapin45 - glueflapou45 - desclock) * -1, 0]], + [ 'M', [boxW + boxW + boxD + boxD - thck, boxH]], + [ 'l', [0, glueflapinoff]], + [ 'l', [glueflapin45 * -1, glueflapin45]], + [ 'l', [glueflapindesl * -1, ((boxD + boxL) / 2 - glueflapinoff - glueflapin45) - thck2]], + [ 'M', [boxW + boxD + boxW, boxH]], + [ 'l', [desclock, 0]], + [ 'l', [0, glueflapouoff]], + [ 'l', [glueflapou45, glueflapou45]], + [ 'l', [glueflapoudesl, ((boxD + boxL) / 2 - glueflapouoff - glueflapou45) -thck2]], + [ 'l', [(boxD - glueflapindesl - glueflapoudesl - glueflapin45 - glueflapou45 - desclock -thck ), 0]] + ] + engrave_line_path = [ + [ 'M', [boxW, boxH]], + [ 'l', [boxD - desclock, 0]], + [ 'M', [boxW + boxD + boxW + desclock, boxH]], + [ 'l', [boxD - thck - desclock, 0]] ] if not bfal: - line_path = [ - [ 'M', [ boxW + boxD, boxH ] ], + cut_line_path = [ + [ 'M', [boxW + boxD, boxH]], - [ 'l', [ 0, glueflapinoff * 1] ], - [ 'l', [ glueflapin45 * -1, glueflapin45 * 1] ], - [ 'l', [ glueflapindesl * -1 , ((boxD + boxL) / 2 - glueflapinoff - glueflapin45) * 1 - thck2] ], - [ 'M', [ boxW , boxH ] ], - [ 'l', [ desclock , 0 ] ], - [ 'l', [ 0, glueflapouoff * 1] ], - [ 'l', [ glueflapou45 , glueflapou45 * 1] ], - [ 'l', [ glueflapoudesl , ((boxD + boxL) / 2 - glueflapouoff - glueflapou45) * 1 - thck2] ], - [ 'l', [ (boxD - glueflapindesl - glueflapoudesl - glueflapin45 - glueflapou45 - desclock) , 0 ] ], - [ 'M', [ boxW + desclock , boxH ] ], - [ 'l', [ boxD - desclock , 0 ] ], - - [ 'M', [ boxW + boxD + boxW , boxH ] ], - [ 'l', [ 0, glueflapinoff * 1] ], - [ 'l', [ glueflapin45, glueflapin45 * 1] ], - [ 'l', [ glueflapindesl, ((boxD + boxL) / 2 - glueflapinoff - glueflapin45) * 1 - thck2] ], - [ 'M', [ boxW + boxD + boxW + boxD - thck , boxH ] ], - [ 'l', [ desclock * -1, 0 ] ], - [ 'l', [ 0, glueflapouoff * 1] ], - [ 'l', [ glueflapou45 * -1, glueflapou45 * 1] ], - [ 'l', [ glueflapoudesl * -1, ((boxD + boxL) / 2 - glueflapouoff - glueflapou45) * 1 - thck2] ], - [ 'l', [ (boxD - glueflapindesl - glueflapoudesl - glueflapin45 - glueflapou45 - desclock -thck) * -1, 0 ] ], - [ 'M', [ boxW + boxD + boxW , boxH ] ], - [ 'l', [ boxD -thck - desclock , 0 ] ], - [ 'Z', [] ] + [ 'l', [0, glueflapinoff]], + [ 'l', [glueflapin45 * -1, glueflapin45]], + [ 'l', [glueflapindesl * -1, ((boxD + boxL) / 2 - glueflapinoff - glueflapin45) - thck2]], + [ 'M', [boxW, boxH]], + [ 'l', [desclock, 0]], + [ 'l', [0, glueflapouoff]], + [ 'l', [glueflapou45, glueflapou45]], + [ 'l', [glueflapoudesl, ((boxD + boxL) / 2 - glueflapouoff - glueflapou45) - thck2]], + [ 'l', [(boxD - glueflapindesl - glueflapoudesl - glueflapin45 - glueflapou45 - desclock), 0]], + [ 'M', [boxW + boxD + boxW, boxH]], + [ 'l', [0, glueflapinoff]], + [ 'l', [glueflapin45, glueflapin45]], + [ 'l', [glueflapindesl, ((boxD + boxL) / 2 - glueflapinoff - glueflapin45) - thck2]], + [ 'M', [boxW + boxD + boxW + boxD - thck, boxH]], + [ 'l', [desclock * -1, 0]], + [ 'l', [0, glueflapouoff]], + [ 'l', [glueflapou45 * -1, glueflapou45]], + [ 'l', [glueflapoudesl * -1, ((boxD + boxL) / 2 - glueflapouoff - glueflapou45) - thck2]], + [ 'l', [(boxD - glueflapindesl - glueflapoudesl - glueflapin45 - glueflapou45 - desclock -thck) * -1, 0]] + ] + engrave_line_path = [ + [ 'M', [boxW + desclock, boxH]], + [ 'l', [boxD - desclock, 0]], + [ 'M', [boxW + boxD + boxW, boxH]], + [ 'l', [boxD -thck - desclock, 0]] ] - line_atts = { 'style':line_style, 'id':box_id+'-botglueflap', 'd':str(Path(line_path)) } + line_atts = { 'style':cut_line_style, 'id':box_id+'-botglueflap_cut', 'd':str(Path(cut_line_path)) } etree.SubElement(g, inkex.addNS('path','svg'), line_atts ) + line_atts = { 'style':engrave_line_style, 'id':box_id+'-botglueflap_engrave', 'd':str(Path(engrave_line_path)) } + etree.SubElement(g, inkex.addNS('path','svg'), line_atts ) + if __name__ == '__main__': inkpacking().run() \ No newline at end of file