From 767ead90813b296de991de497bfe0e2d33c7452e Mon Sep 17 00:00:00 2001 From: Kaalleen <36401965+kaalleen@users.noreply.github.com> Date: Mon, 5 Apr 2021 11:45:57 +0200 Subject: [PATCH] Delete Command Group on Auto-Route and Cut Satin (#1125) --- lib/extensions/cut_satin.py | 8 ++++++-- lib/stitches/auto_satin.py | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/lib/extensions/cut_satin.py b/lib/extensions/cut_satin.py index b471239ec..fcd1ca065 100644 --- a/lib/extensions/cut_satin.py +++ b/lib/extensions/cut_satin.py @@ -31,8 +31,12 @@ class CutSatin(InkstitchExtension): 'Please use the "Attach commands" extension and attach the "Satin Column cut point" command first.')) split_point = command.target_point - command.use.getparent().remove(command.use) - command.connector.getparent().remove(command.connector) + command_group = command.use.getparent() + if command_group is not None and command_group.get('id').startswith('command_group'): + command_group.getparent().remove(command_group) + else: + command.use.getparent().remove(command.use) + command.connector.getparent().remove(command.connector) new_satins = satin.split(split_point) transform = get_correction_transform(satin.node) diff --git a/lib/stitches/auto_satin.py b/lib/stitches/auto_satin.py index 795df036c..a047ea748 100644 --- a/lib/stitches/auto_satin.py +++ b/lib/stitches/auto_satin.py @@ -628,8 +628,12 @@ def operations_to_elements_and_trims(operations, preserve_order): def remove_original_elements(elements): for element in elements: for command in element.commands: - remove_from_parent(command.connector) - remove_from_parent(command.use) + command_group = command.use.getparent() + if command_group is not None and command_group.get('id').startswith('command_group'): + remove_from_parent(command_group) + else: + remove_from_parent(command.connector) + remove_from_parent(command.use) remove_from_parent(element.node)