From 1b63ac5bfa12dc4fc4162a4e7c8e06130e5e906c Mon Sep 17 00:00:00 2001 From: Lex Neva Date: Wed, 4 Jul 2018 23:00:03 -0400 Subject: [PATCH] only process each node once --- lib/extensions/commands.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/extensions/commands.py b/lib/extensions/commands.py index 9c080b4e5..4c9fd1729 100644 --- a/lib/extensions/commands.py +++ b/lib/extensions/commands.py @@ -142,5 +142,11 @@ class Commands(InkstitchExtension): for command in commands: self.ensure_symbol(command) + # Each object (node) in the SVG may correspond to multiple Elements of different + # types (e.g. stroke + fill). We only want to process each one once. + seen_nodes = set() + for element in self.elements: - self.add_command(element, commands) + if element.node not in seen_nodes: + self.add_command(element, commands) + seen_nodes.add(element.node)