From f92c4e393d3c9a1030218f7d869118c0f2751faf Mon Sep 17 00:00:00 2001 From: PaddleStroke Date: Tue, 2 Jul 2024 15:06:51 +0200 Subject: [PATCH] Assembly: Create joint: prevent errors on undo/ctrl-Z --- src/Mod/Assembly/CommandCreateJoint.py | 5 ++++- src/Mod/Assembly/JointObject.py | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Mod/Assembly/CommandCreateJoint.py b/src/Mod/Assembly/CommandCreateJoint.py index 0bd7b142f6..410d8bb224 100644 --- a/src/Mod/Assembly/CommandCreateJoint.py +++ b/src/Mod/Assembly/CommandCreateJoint.py @@ -59,7 +59,10 @@ def activateJoint(index): JointObject.activeTask.reject() panel = TaskAssemblyCreateJoint(index) - Gui.Control.showDialog(panel) + dialog = Gui.Control.showDialog(panel) + if dialog is not None: + dialog.setAutoCloseOnTransactionChange(True) + dialog.setDocumentName(App.ActiveDocument.Name) class CommandCreateJointFixed: diff --git a/src/Mod/Assembly/JointObject.py b/src/Mod/Assembly/JointObject.py index 099bcad1d3..cf9033fbed 100644 --- a/src/Mod/Assembly/JointObject.py +++ b/src/Mod/Assembly/JointObject.py @@ -1383,6 +1383,9 @@ class TaskAssemblyCreateJoint(QtCore.QObject): self.joint.Visibility = self.visibilityBackup return True + def autoClosedOnTransactionChange(self): + self.reject() + def deactivate(self): global activeTask activeTask = None