From a21e1113c96261a1493c1e0d1739ad2118d5485d Mon Sep 17 00:00:00 2001 From: Kaalleen <36401965+kaalleen@users.noreply.github.com> Date: Tue, 22 Dec 2020 17:37:11 +0100 Subject: [PATCH] break apart with evenodd rule (#931) --- lib/extensions/break_apart.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/lib/extensions/break_apart.py b/lib/extensions/break_apart.py index 30b2a4b0f..0b17d3d7c 100644 --- a/lib/extensions/break_apart.py +++ b/lib/extensions/break_apart.py @@ -134,12 +134,22 @@ class BreakApart(InkstitchExtension): if polygons[0].area < 5: continue el = copy(element.node) + + # Set fill-rule to evenodd + style = el.get('style', '').split(';') + style = [s for s in style if not s.startswith('fill-rule')] + style.append('fill-rule:evenodd;') + style = ';'.join(style) + el.set('style', style) + + # update element id + if len(polygon_list) > 1: + node_id = self.uniqueId(el.get('id') + '_') + el.set('id', node_id) + + # Set path d = "" for polygon in polygons: - # update element id - if len(polygon_list) > 1: - node_id = self.uniqueId(el.get('id') + '_') - el.set('id', node_id) d += "M" for x, y in polygon.exterior.coords: d += "%s,%s " % (x, y)