summaryrefslogtreecommitdiff
path: root/lib/elements
diff options
context:
space:
mode:
authorKaalleen <36401965+kaalleen@users.noreply.github.com>2025-04-06 12:28:58 +0200
committerGitHub <noreply@github.com>2025-04-06 12:28:58 +0200
commitd6faff13ea8e28b244749901f1dafcf594526387 (patch)
tree175864c2d1e6934fbd0fa879f8a01bf21c375469 /lib/elements
parentc0bf948a6974b3b697fe8187fcfcb6d626b9ee29 (diff)
generate split line at specified end point rather than next point (#3634)
Diffstat (limited to 'lib/elements')
-rw-r--r--lib/elements/satin_column.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/elements/satin_column.py b/lib/elements/satin_column.py
index de04579c..05ba43ce 100644
--- a/lib/elements/satin_column.py
+++ b/lib/elements/satin_column.py
@@ -1267,19 +1267,25 @@ class SatinColumn(EmbroideryElement):
return pairs
- def _connect_stitch_group_with_point(self, first_stitch_group, start_point, connect_to_satin_end=False):
+ def _connect_stitch_group_with_point(self, first_stitch_group, start_point, end_point=None):
start_stitch_group = StitchGroup(
color=self.color,
stitches=[Stitch(*start_point)]
)
connector = self.offset_center_line
- split_line = shgeo.LineString(self.find_cut_points(start_point))
+
+ if end_point:
+ split_line = shgeo.LineString(self.find_cut_points(end_point))
+ else:
+ split_line = shgeo.LineString(self.find_cut_points(start_point))
start = connector.project(nearest_points(split_line, connector)[1])
- if connect_to_satin_end and not self._center_walk_is_odd():
+
+ if end_point and not self._center_walk_is_odd():
end = connector.length
else:
split_line = shgeo.LineString(self.find_cut_points(first_stitch_group.stitches[0]))
end = connector.project(nearest_points(split_line, connector)[1])
+
start_path = substring(connector, start, end)
stitches = [Stitch(*coord) for coord in start_path.coords]
@@ -1850,7 +1856,7 @@ class SatinColumn(EmbroideryElement):
if end_point:
ordered_stitch_groups = []
ordered_stitch_groups.extend(stitch_groups[::2])
- ordered_stitch_groups.append(self._connect_stitch_group_with_point(stitch_groups[1], ordered_stitch_groups[-1].stitches[-1], True))
+ ordered_stitch_groups.append(self._connect_stitch_group_with_point(stitch_groups[1], ordered_stitch_groups[-1].stitches[-1], end_point))
ordered_stitch_groups.extend(stitch_groups[1::2])
return ordered_stitch_groups
return stitch_groups