From 0adf582b1c2777ee3be294f509adfe63fcef4e34 Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Wed, 16 Aug 2017 18:31:17 -0300 Subject: [PATCH] Arch: Fixed cutplane bug - fixes #3082 --- src/Mod/Arch/ArchCutPlane.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/Mod/Arch/ArchCutPlane.py b/src/Mod/Arch/ArchCutPlane.py index 8d74596e38..4d897c2e5f 100644 --- a/src/Mod/Arch/ArchCutPlane.py +++ b/src/Mod/Arch/ArchCutPlane.py @@ -102,14 +102,22 @@ class _CutPlaneTaskPanel: self.retranslateUi(self.form) self.previewCutVolume(self.combobox.currentIndex()) + def isAllowedAlterSelection(self): + return False + def accept(self): FreeCAD.ActiveDocument.removeObject(self.previewObj.Name) val = self.combobox.currentIndex() - FreeCAD.ActiveDocument.openTransaction(str(translate("Arch","Cutting"))) - FreeCADGui.addModule("Arch") - FreeCADGui.doCommand("Arch.cutComponentwithPlane(FreeCADGui.Selection.getSelectionEx()[0],FreeCADGui.Selection.getSelectionEx()[1].SubObjects[0],"+ str(val) +")") - FreeCAD.ActiveDocument.commitTransaction() - FreeCAD.ActiveDocument.recompute() + s = FreeCADGui.Selection.getSelectionEx() + if len(s) > 1: + if s[1].SubObjects: + FreeCAD.ActiveDocument.openTransaction(str(translate("Arch","Cutting"))) + FreeCADGui.addModule("Arch") + FreeCADGui.doCommand("Arch.cutComponentwithPlane(FreeCADGui.Selection.getSelectionEx()[0],FreeCADGui.Selection.getSelectionEx()[1].SubObjects[0],"+ str(val) +")") + FreeCAD.ActiveDocument.commitTransaction() + FreeCAD.ActiveDocument.recompute() + return True + FreeCAD.Console.PrintError("Wrong selection\n") return True def reject(self):