summaryrefslogtreecommitdiff
path: root/lib/elements
diff options
context:
space:
mode:
authorKaalleen <36401965+kaalleen@users.noreply.github.com>2020-03-16 18:38:10 +0100
committerGitHub <noreply@github.com>2020-03-16 18:38:10 +0100
commit975691893316aa2f8d393cc4b95b6be0b82603d8 (patch)
treecf86f59001de99edfee5602f541860abbae99b26 /lib/elements
parent5f3e97a8e5e418544d05443b3c2a3d8a39fa28f4 (diff)
multiple underlays for fill
Diffstat (limited to 'lib/elements')
-rw-r--r--lib/elements/auto_fill.py41
1 files changed, 24 insertions, 17 deletions
diff --git a/lib/elements/auto_fill.py b/lib/elements/auto_fill.py
index a37078b8..04da3288 100644
--- a/lib/elements/auto_fill.py
+++ b/lib/elements/auto_fill.py
@@ -60,18 +60,24 @@ class AutoFill(Fill):
@property
@param('fill_underlay_angle',
_('Fill angle'),
- tooltip=_('default: fill angle + 90 deg'),
+ tooltip=_('Default: fill angle + 90 deg. Insert comma-seperated list for multiple layers.'),
unit='deg',
group=_('AutoFill Underlay'),
type='float')
@cache
def fill_underlay_angle(self):
- underlay_angle = self.get_float_param("fill_underlay_angle")
-
- if underlay_angle is not None:
- return math.radians(underlay_angle)
+ underlay_angles = self.get_param('fill_underlay_angle', None)
+ default_value = [self.angle + math.pi / 2.0]
+ if underlay_angles is not None:
+ underlay_angles = underlay_angles.strip().split(',')
+ try:
+ underlay_angles = [math.radians(float(angle)) for angle in underlay_angles]
+ except (TypeError, ValueError):
+ return default_value
else:
- return self.angle + math.pi / 2.0
+ underlay_angles = default_value
+
+ return underlay_angles
@property
@param('fill_underlay_row_spacing_mm',
@@ -193,17 +199,18 @@ class AutoFill(Fill):
try:
if self.fill_underlay:
- stitches.extend(auto_fill(self.underlay_shape,
- self.fill_underlay_angle,
- self.fill_underlay_row_spacing,
- self.fill_underlay_row_spacing,
- self.fill_underlay_max_stitch_length,
- self.running_stitch_length,
- self.staggers,
- self.fill_underlay_skip_last,
- starting_point,
- underpath=self.underlay_underpath))
- starting_point = stitches[-1]
+ for i in range(len(self.fill_underlay_angle)):
+ stitches.extend(auto_fill(self.underlay_shape,
+ self.fill_underlay_angle[i],
+ self.fill_underlay_row_spacing,
+ self.fill_underlay_row_spacing,
+ self.fill_underlay_max_stitch_length,
+ self.running_stitch_length,
+ self.staggers,
+ self.fill_underlay_skip_last,
+ starting_point,
+ underpath=self.underlay_underpath))
+ starting_point = stitches[-1]
stitches.extend(auto_fill(self.fill_shape,
self.angle,