kopia lustrzana https://github.com/inkstitch/inkstitch
major refactor
Split into classes for Fill, Stroke, and SatinColumn. Renamed params to be the same across XML attributes and OptionParser. Added distinct stitch length params for satin underlay. Renamed "satin underlay" to "contour underlay" and split out "center walk underlay" and "zigzag underlay". The code is ten times more readable, parameters make more sense, and everything is specified by the user in millimeters. Basically, everything is way better.pull/2/merge
rodzic
9249a3ae77
commit
841e9196ba
5
PyEmb.py
5
PyEmb.py
|
@ -60,6 +60,11 @@ class Point:
|
||||||
def __cmp__(self, other):
|
def __cmp__(self, other):
|
||||||
return cmp(self.as_tuple(), other.as_tuple())
|
return cmp(self.as_tuple(), other.as_tuple())
|
||||||
|
|
||||||
|
def __getitem__(self, item):
|
||||||
|
return self.as_tuple()[item]
|
||||||
|
|
||||||
|
def __len__(self):
|
||||||
|
return 2
|
||||||
|
|
||||||
class Stitch(Point):
|
class Stitch(Point):
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<id>jonh.embroider</id>
|
<id>jonh.embroider</id>
|
||||||
<dependency type="executable" location="extensions">embroider.py</dependency>
|
<dependency type="executable" location="extensions">embroider.py</dependency>
|
||||||
<dependency type="executable" location="extensions">inkex.py</dependency>
|
<dependency type="executable" location="extensions">inkex.py</dependency>
|
||||||
<param name="pixels_per_mm" type="float" min="1" max="100" precision="2" _gui-text="How many pixels on-screen equal one millimeter in embroidery output">10</param>
|
<param name="pixels_per_mm" type="float" min="1" max="100" precision="2" _gui-text="Pixels per millimeter">10</param>
|
||||||
<param name="zigzag_spacing_mm" type="float" min="0.01" max="5.00" precision="2" _gui-text="Zigzag spacing (mm)">1.00</param>
|
<param name="zigzag_spacing_mm" type="float" min="0.01" max="5.00" precision="2" _gui-text="Zigzag spacing (mm)">1.00</param>
|
||||||
<param name="row_spacing_mm" type="float" min="0.01" max="5.00" precision="2" _gui-text="Row spacing (mm)">0.40</param>
|
<param name="row_spacing_mm" type="float" min="0.01" max="5.00" precision="2" _gui-text="Row spacing (mm)">0.40</param>
|
||||||
<param name="max_stitch_len_mm" type="float" min="0.1" max="100.0" _gui-text="Maximum stitch length (mm)">3.0</param>
|
<param name="max_stitch_len_mm" type="float" min="0.1" max="100.0" _gui-text="Maximum stitch length (mm)">3.0</param>
|
||||||
|
|
1624
embroider.py
1624
embroider.py
Plik diff jest za duży
Load Diff
Plik diff jest za duży
Load Diff
|
@ -4,20 +4,23 @@
|
||||||
<id>jonh.embroider.params</id>
|
<id>jonh.embroider.params</id>
|
||||||
<dependency type="executable" location="extensions">embroider_params.py</dependency>
|
<dependency type="executable" location="extensions">embroider_params.py</dependency>
|
||||||
<dependency type="executable" location="extensions">inkex.py</dependency>
|
<dependency type="executable" location="extensions">inkex.py</dependency>
|
||||||
<param name="zigzag_spacing" type="string" _gui-text="Zigzag spacing (mm)"></param>
|
<param name="zigzag_spacing_mm" type="string" _gui-text="Zigzag spacing (mm)"></param>
|
||||||
<param name="stitch_length" type="string" _gui-text="Running stitch length (mm)"></param>
|
<param name="running_stitch_length_mm" type="string" _gui-text="Running stitch length (mm)"></param>
|
||||||
<param name="row_spacing" type="string" _gui-text="Row spacing (mm)"></param>
|
<param name="row_spacing_mm" type="string" _gui-text="Row spacing (mm)"></param>
|
||||||
<param name="max_stitch_length" type="string" _gui-text="Maximum stitch length (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="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"></param>
|
||||||
<param name="pull_compensation" type="string" _gui-text="Pull compensation for satin column (mm)"></param>
|
<param name="pull_compensation_mm" type="string" _gui-text="Pull compensation for satin column (mm)"></param>
|
||||||
<param name="hatching" type="string" _gui-text="Hatching? (yes/no)"></param>
|
|
||||||
<param name="flip" type="string" _gui-text="Flip fill? (yes/no)"></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>
|
<param name="satin_column" type="string" _gui-text="Satin Column? (yes/no)"></param>
|
||||||
<param name="satin_underlay" type="string" _gui-text="Edge-walk underlay for satin Column? (yes/no)"></param>
|
<param name="contour_underlay" type="string" _gui-text="Edge-walk underlay for satin Column? (yes/no)"></param>
|
||||||
<param name="satin_underlay_inset" type="string" _gui-text="Inset for satin colum underlay (mm)"></param>
|
<param name="contour_underlay_inset_mm" type="string" _gui-text="Inset for satin colum underlay (mm)"></param>
|
||||||
<param name="satin_center_walk" type="string" _gui-text="Satin center walk underlay? (yes/no)"></param>
|
<param name="contour_underlay_stitch_length_mm" type="string" _gui-text="Stitch length (mm) for contour underlay (defaults to running stitch length)"></param>
|
||||||
<param name="satin_zigzag_underlay_spacing" type="string" _gui-text="Zigzag underlay spacing (mm)"></param>
|
<param name="center_walk_underlay" type="string" _gui-text="Satin center walk underlay? (yes/no)"></param>
|
||||||
|
<param name="center_walk_underlay_stitch_length_mm" type="string" _gui-text="Stitch length (mm) for center walk underlay (defaults to running stitch length)"></param>
|
||||||
|
<param name="zigzag_underlay" type="string" _gui-text="Zig-Zag underlay for satin Column? (yes/no)"></param>
|
||||||
|
<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="stroke_first" type="string" _gui-text="Stitch stroke before fill? (yes/no)"></param>
|
||||||
<effect>
|
<effect>
|
||||||
<object-type>all</object-type>
|
<object-type>all</object-type>
|
||||||
|
|
|
@ -15,21 +15,23 @@ class EmbroiderParams(inkex.Effect):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
inkex.Effect.__init__(self)
|
inkex.Effect.__init__(self)
|
||||||
|
|
||||||
self.params = ["zigzag_spacing",
|
self.params = ["zigzag_spacing_mm",
|
||||||
"stitch_length",
|
"running_stitch_length_mm",
|
||||||
"row_spacing",
|
"row_spacing_mm",
|
||||||
"max_stitch_length",
|
"max_stitch_length_mm",
|
||||||
"repeats",
|
"repeats",
|
||||||
"angle",
|
"angle",
|
||||||
"hatching",
|
|
||||||
"flip",
|
"flip",
|
||||||
"satin_column",
|
"satin_column",
|
||||||
"stroke_first",
|
"stroke_first",
|
||||||
"pull_compensation",
|
"pull_compensation_mm",
|
||||||
"satin_underlay",
|
"contour_underlay",
|
||||||
"satin_underlay_inset",
|
"contour_underlay_inset_mm",
|
||||||
"satin_center_walk",
|
"contour_underlay_stitch_length_mm",
|
||||||
"satin_zigzag_underlay_spacing",
|
"center_walk_underlay",
|
||||||
|
"center_walk_underlay_stitch_length_mm",
|
||||||
|
"zigzag_underlay",
|
||||||
|
"zigzag_underlay_inset_mm",
|
||||||
]
|
]
|
||||||
|
|
||||||
for param in self.params:
|
for param in self.params:
|
||||||
|
|
Ładowanie…
Reference in New Issue