kopia lustrzana https://github.com/inkstitch/inkstitch
Allow to hatch filled paths
rodzic
b9d08f87ce
commit
e80f5f4003
|
@ -7,6 +7,7 @@
|
|||
<param name="row_spacing_mm" type="float" min="0.01" max="5.00" _gui-text="Row spacing (mm)">0.40</param>
|
||||
<param name="max_stitch_len_mm" type="float" min="0.1" max="10.0" _gui-text="Maximum stitch length (mm)">3.0</param>
|
||||
<param name="preserve_order" type="boolean" _gui-text="Preserve stacking order" description="if false, sorts by color, which saves thread changes. True preserves stacking order, important if you're laying colors over each other.">false</param>
|
||||
<param name="hatch_filled_paths" type="boolean" _gui-text="Hatch filled paths" description="If false, filled paths are filled using equally-spaced lines. If true, filled paths are filled using hatching lines.">false</param>
|
||||
<param name="output_format" type="optiongroup" _gui-text="Output file format" appearance="minimal">
|
||||
<_option value="melco">Melco</_option>
|
||||
<_option value="csv">Embroidermodder 2 CSV</_option>
|
||||
|
|
16
embroider.py
16
embroider.py
|
@ -432,6 +432,11 @@ class Embroider(inkex.Effect):
|
|||
choices=["true","false"],
|
||||
dest="preserve_order", default="false",
|
||||
help="Sort by stacking order instead of color")
|
||||
self.OptionParser.add_option("-H", "--hatch_filled_paths",
|
||||
action="store", type="choice",
|
||||
choices=["true","false"],
|
||||
dest="hatch_filled_paths", default="false",
|
||||
help="Use hatching lines instead of equally-spaced lines to fill paths")
|
||||
self.OptionParser.add_option("-O", "--output_format",
|
||||
action="store", type="choice",
|
||||
choices=["melco", "csv"],
|
||||
|
@ -482,6 +487,8 @@ class Embroider(inkex.Effect):
|
|||
def intersect_region_with_grating(self, shpath):
|
||||
dbg.write("bounds = %s\n" % str(shpath.bounds))
|
||||
bbox = shpath.bounds
|
||||
hatching = self.options.hatch_filled_paths == "true"
|
||||
dbg.write("hatching is %s\n" % hatching)
|
||||
|
||||
delta = self.row_spacing_px/2.0
|
||||
bbox_sz = (bbox[2]-bbox[0],bbox[3]-bbox[1])
|
||||
|
@ -498,11 +505,20 @@ class Embroider(inkex.Effect):
|
|||
p_inc = PyEmb.Point(0, self.row_spacing_px)
|
||||
count = (bbox[3]-bbox[1])/self.row_spacing_px + 2
|
||||
|
||||
if hatching:
|
||||
count *= 2
|
||||
|
||||
rows = []
|
||||
steps = 0
|
||||
while (steps < count):
|
||||
try:
|
||||
steps += 1
|
||||
if hatching:
|
||||
if steps % 2 == 1:
|
||||
p1 += p_inc
|
||||
else:
|
||||
p0 += p_inc
|
||||
else:
|
||||
p0 += p_inc
|
||||
p1 += p_inc
|
||||
endpoints = [p0.as_tuple(), p1.as_tuple()]
|
||||
|
|
Ładowanie…
Reference in New Issue