diff options
| author | Kaalleen <36401965+kaalleen@users.noreply.github.com> | 2023-08-12 10:18:11 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-08-12 10:18:11 +0200 |
| commit | ee0cca2e86270ddff6936b6bcf6cc30c47d58397 (patch) | |
| tree | 4d756c1257a6c429fbf2352ed739b70d33d07dd6 /lib/extensions/zigzag_line_to_satin.py | |
| parent | bc4017514711a274258317f1b91972f8dd53815e (diff) | |
do not ignore elements in a group (#2468)
Diffstat (limited to 'lib/extensions/zigzag_line_to_satin.py')
| -rw-r--r-- | lib/extensions/zigzag_line_to_satin.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/extensions/zigzag_line_to_satin.py b/lib/extensions/zigzag_line_to_satin.py index 167f4b91..b71bf6a0 100644 --- a/lib/extensions/zigzag_line_to_satin.py +++ b/lib/extensions/zigzag_line_to_satin.py @@ -23,11 +23,12 @@ class ZigzagLineToSatin(InkstitchExtension): self.arg_parser.add_argument("-l", "--reduce-rungs", type=inkex.Boolean, default=False, dest="reduce_rungs") def effect(self): - if not self.svg.selection or not self.get_elements(): + nodes = self.get_selection(self.svg.selection) + if not nodes: inkex.errormsg(_("Please select at least one stroke to convert to a satin column.")) return - for node in self.svg.selection: + for node in nodes: d = [] point_list = list(node.get_path().end_points) # find duplicated nodes (= do not smooth) @@ -49,6 +50,17 @@ class ZigzagLineToSatin(InkstitchExtension): node.set('d', " ".join(d)) node.set('inkstitch:satin_column', True) + def get_selection(self, nodes): + selection = [] + for node in nodes: + # we only apply to path elements, no use in converting ellipses or rectangles, etc. + if node.TAG == "path": + selection.append(node) + elif node.TAG == "g": + for element in node.descendants(): + selection.extend(self.get_selection(element)) + return selection + def _get_sharp_edge_nodes(self, point_list): points = [] sharp_edges = [] |
