kopia lustrzana https://github.com/inkstitch/inkstitch
add fill underlay settings to embroider_params and embroider_update extensions
rodzic
a28dbd2c2d
commit
6cdf990c76
20
embroider.py
20
embroider.py
|
@ -478,20 +478,20 @@ class AutoFill(Fill):
|
|||
return self.get_float_param("running_stitch_length_mm")
|
||||
|
||||
@property
|
||||
def underlay(self):
|
||||
return self.get_boolean_param("underlay")
|
||||
def fill_underlay(self):
|
||||
return self.get_boolean_param("fill_underlay")
|
||||
|
||||
@property
|
||||
def underlay_angle(self):
|
||||
return math.radians(self.get_float_param("underlay_angle", self.angle + 90.0))
|
||||
def fill_underlay_angle(self):
|
||||
return math.radians(self.get_float_param("fill_underlay_angle", self.angle + 90.0))
|
||||
|
||||
@property
|
||||
def underlay_row_spacing(self):
|
||||
return self.get_float_param("underlay_row_spacing", self.row_spacing * 3)
|
||||
def fill_underlay_row_spacing(self):
|
||||
return self.get_float_param("fill_underlay_row_spacing_mm", self.row_spacing * 3)
|
||||
|
||||
@property
|
||||
def underlay_max_stitch_length(self):
|
||||
return self.get_float_param("underlay_max_stitch_length", self.max_stitch_length)
|
||||
def fill_underlay_max_stitch_length(self):
|
||||
return self.get_float_param("fill_underlay_max_stitch_length_mm", self.max_stitch_length)
|
||||
|
||||
def is_same_run(self, segment1, segment2):
|
||||
if shgeo.Point(segment1[0]).distance(shgeo.Point(segment2[0])) > self.max_stitch_length:
|
||||
|
@ -590,8 +590,8 @@ class AutoFill(Fill):
|
|||
else:
|
||||
last_stitch = last_patch.stitches[-1]
|
||||
|
||||
if self.underlay:
|
||||
patches.extend(self.auto_fill(self.underlay_angle, self.underlay_row_spacing, self.underlay_max_stitch_length, last_stitch))
|
||||
if self.fill_underlay:
|
||||
patches.extend(self.auto_fill(self.fill_underlay_angle, self.fill_underlay_row_spacing, self.fill_underlay_max_stitch_length, last_stitch))
|
||||
last_stitch = patches[-1].stitches[-1]
|
||||
|
||||
patches.extend(self.auto_fill(self.angle, self.row_spacing, self.max_stitch_length, last_stitch))
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<param name="row_spacing_mm" type="string" _gui-text="Row spacing (mm)"></param>
|
||||
<param name="max_stitch_length_mm" type="string" _gui-text="Maximum stitch length for fills (mm)"></param>
|
||||
<param name="repeats" type="string" _gui-text="Repeats (stroke only)"></param>
|
||||
<param name="angle" type="string" _gui-text="Angle for lines in fills"></param>
|
||||
<param name="angle" type="string" _gui-text="Angle for lines in fills (degrees)"></param>
|
||||
<param name="pull_compensation_mm" type="string" _gui-text="Pull compensation for satin column (mm)"></param>
|
||||
<param name="flip" type="string" _gui-text="Flip fill? (yes/no)"></param>
|
||||
<param name="satin_column" type="string" _gui-text="Satin Column? (yes/no)"></param>
|
||||
|
@ -22,6 +22,10 @@
|
|||
<param name="zigzag_spacing_mm" type="string" _gui-text="Zigzag underlay spacing (mm)"></param>
|
||||
<param name="zigzag_underlay_inset_mm" type="string" _gui-text="Inset for zigzag underlay (mm)"></param>
|
||||
<param name="stroke_first" type="string" _gui-text="Stitch stroke before fill? (yes/no)"></param>
|
||||
<param name="fill_underlay" type="string" _gui-text="Underlay for fill stitch? (yes/no)"></param>
|
||||
<param name="fill_underlay_angle" type="string" _gui-text="Angle for lines in fill underlay (degrees)"></param>
|
||||
<param name="fill_underlay_row_spacing_mm" type="string" _gui-text="Row spacing for fill underlay (mm)"></param>
|
||||
<param name="fill_underlay_max_stitch_length_mm" type="string" _gui-text="Maximum stitch length for fill underlay (mm)"></param>
|
||||
<effect>
|
||||
<object-type>all</object-type>
|
||||
<effects-menu>
|
||||
|
|
|
@ -32,6 +32,10 @@ class EmbroiderParams(inkex.Effect):
|
|||
"center_walk_underlay_stitch_length_mm",
|
||||
"zigzag_underlay",
|
||||
"zigzag_underlay_inset_mm",
|
||||
"fill_underlay",
|
||||
"fill_underlay_angle",
|
||||
"fill_underlay_row_spacing_mm",
|
||||
"fill_underlay_max_stitch_length_mm",
|
||||
]
|
||||
|
||||
for param in self.params:
|
||||
|
|
|
@ -7,6 +7,7 @@ import sys
|
|||
sys.path.append("/usr/share/inkscape/extensions")
|
||||
import os
|
||||
import inkex
|
||||
import simplestyle
|
||||
|
||||
PIXELS_PER_MM = 10
|
||||
|
||||
|
@ -41,6 +42,12 @@ class EmbroiderParams(inkex.Effect):
|
|||
if 'embroider_zigzag_underlay_spacing_mm' in node.attrib:
|
||||
node.set('embroider_zigzag_underlay', 'yes')
|
||||
|
||||
style = simplestyle.parseStyle(node.get('style'))
|
||||
|
||||
if style.get('fill', 'none') != 'none' and \
|
||||
'embroider_auto_fill' not in node.attrib:
|
||||
node.set('embroider_auto_fill', 'no')
|
||||
|
||||
if __name__ == '__main__':
|
||||
e = EmbroiderParams()
|
||||
e.affect()
|
||||
|
|
Ładowanie…
Reference in New Issue