diff options
| author | Kaalleen <36401965+kaalleen@users.noreply.github.com> | 2023-05-23 22:54:46 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-05-23 22:54:46 +0200 |
| commit | 8b20e518b5e993b1ad4d657530171467a403af95 (patch) | |
| tree | 6cc0bd9219f6b0e4cffe0528dbb2bc8ec448fb77 /lib/extensions/fill_to_stroke.py | |
| parent | ef6f6580df6e8fbce913eecc1fe7e0f8caf1315b (diff) | |
Fix some transforms ... (#2314)
* fix fill to stroke transform
* remove empty leftover groups
* gradient blocks transforms
* gradient: do not ignore holes
Diffstat (limited to 'lib/extensions/fill_to_stroke.py')
| -rw-r--r-- | lib/extensions/fill_to_stroke.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/extensions/fill_to_stroke.py b/lib/extensions/fill_to_stroke.py index eca17c95..5672fb69 100644 --- a/lib/extensions/fill_to_stroke.py +++ b/lib/extensions/fill_to_stroke.py @@ -53,8 +53,8 @@ class FillToStroke(InkstitchExtension): parent.insert(index, centerline_group) for element in fill_shapes: - transform = element.node.transform @ Transform(get_correction_transform(element.node, child=True)) - stroke_width = convert_unit(self.options.line_width_mm, self.svg.unit, 'mm') + transform = Transform(get_correction_transform(parent, child=True)) + stroke_width = convert_unit(self.options.line_width_mm, 'px', 'mm') color = element.node.style('fill') style = f"fill:none;stroke:{ color };stroke-width:{ stroke_width }" @@ -93,13 +93,19 @@ class FillToStroke(InkstitchExtension): return fill_shapes, cut_lines def _remove_elements(self): + parents = [] for element in self.elements: # it is possible, that we get one element twice (if it has both, a fill and a stroke) # just ignore the second time try: + parents.append(element.node.getparent()) element.node.getparent().remove(element.node) except AttributeError: pass + # remove empty groups + for parent in set(parents): + if not parent.getchildren(): + parent.getparent().remove(parent) def _get_high_res_polygon(self, polygon): # use running stitch method |
