summaryrefslogtreecommitdiff
path: root/lib/elements/satin_column.py
diff options
context:
space:
mode:
authorGeorge Steel <george.steel@gmail.com>2024-05-05 13:55:33 -0400
committerGitHub <noreply@github.com>2024-05-05 13:55:33 -0400
commitd32a8fd4661331da0affb15623a2ec9a9eac5c44 (patch)
tree6ac6a11c099a5b6b5463c9ff46bc7fb87d6ba888 /lib/elements/satin_column.py
parentedbe382914bc45a3f953c6e0258ff1feb05d8c95 (diff)
Add randomized running and fill stitches (#2830)
Add a mode to running stitch that uses randomized phase and stitch length instead of even spacing. This greatly reduces moire effects when stitching closely-spaced curves in running-stitch-based fills. Add option for randomized running stitch to: ripple stitch circular fill contour fill guided fill auto-fill When is randomization is not selected, ripple stitch will use even running stitch when staggers are set to 0 (default) and the stagger algorithm from guided fill (which does not look nice with a stagger period of 0) when staggers is nonzero. Also includes fix for satin contour underlays (missing tolerance default) mentioned in #2814. This sets the default tolerance to 0.2mm, which is the largest tolerance guaranteed to be backwards-compatible with existing designs using the default inset of 0.4mm. Original commits: * fix satin underlay tolerance default * Add randomized running stitch, make available in ripple stitch, circular, and contour * add randomized guided fill * make ripple stitch use even stitching when not staggering or randomizing. * add random auto-fill and switch jitter parameter to a percentage (matches satin) * fix comments
Diffstat (limited to 'lib/elements/satin_column.py')
-rw-r--r--lib/elements/satin_column.py18
1 files changed, 10 insertions, 8 deletions
diff --git a/lib/elements/satin_column.py b/lib/elements/satin_column.py
index a33afb8b..9cf7bc73 100644
--- a/lib/elements/satin_column.py
+++ b/lib/elements/satin_column.py
@@ -372,10 +372,11 @@ class SatinColumn(EmbroideryElement):
unit='mm',
group=_('Contour Underlay'),
type='float',
+ default=0.2,
)
def contour_underlay_stitch_tolerance(self):
- tolerance = self.get_float_param("contour_underlay_stitch_tolerance_mm", self.contour_underlay_stitch_length)
- return max(tolerance, 0.01)
+ tolerance = self.get_float_param("contour_underlay_stitch_tolerance_mm", 0.2)
+ return max(tolerance, 0.01 * PIXELS_PER_MM) # sanity check to prevent crash from excessively-small values
@property
@param('contour_underlay_inset_mm',
@@ -428,11 +429,12 @@ class SatinColumn(EmbroideryElement):
),
unit='mm',
group=_('Center-Walk Underlay'),
- type='float'
+ type='float',
+ default=0.2
)
def center_walk_underlay_stitch_tolerance(self):
- tolerance = self.get_float_param("center_walk_underlay_stitch_tolerance_mm", self.contour_underlay_stitch_length)
- return max(tolerance, 0.01)
+ tolerance = self.get_float_param("center_walk_underlay_stitch_tolerance_mm", 0.2)
+ return max(tolerance, 0.01 * PIXELS_PER_MM)
@property
@param('center_walk_underlay_repeats',
@@ -1171,12 +1173,12 @@ class SatinColumn(EmbroideryElement):
self.contour_underlay_stitch_tolerance,
-self.contour_underlay_inset_px, -self.contour_underlay_inset_percent/100)
- first_side = running_stitch.running_stitch(
+ first_side = running_stitch.even_running_stitch(
[points[0] for points in pairs],
self.contour_underlay_stitch_length,
self.contour_underlay_stitch_tolerance
)
- second_side = running_stitch.running_stitch(
+ second_side = running_stitch.even_running_stitch(
[points[1] for points in pairs],
self.contour_underlay_stitch_length,
self.contour_underlay_stitch_tolerance
@@ -1209,7 +1211,7 @@ class SatinColumn(EmbroideryElement):
(0, 0), inset_prop)
points = [points[0] for points in pairs]
- stitches = running_stitch.running_stitch(points, self.center_walk_underlay_stitch_length, self.center_walk_underlay_stitch_tolerance)
+ stitches = running_stitch.even_running_stitch(points, self.center_walk_underlay_stitch_length, self.center_walk_underlay_stitch_tolerance)
for i in range(self.center_walk_underlay_repeats - 1):
if i % 2 == 0: