From 2da26fe715f7bd7512dcf79c245d48724914952e Mon Sep 17 00:00:00 2001 From: Russell Johnson <47639332+Russ4262@users.noreply.github.com> Date: Sat, 10 Jul 2021 21:09:01 -0500 Subject: [PATCH] Path: Add `Active` property to PathArray object; Fixes #4704 This property is required for the Path Simulator. It might also be required for some post-processing procedures. --- src/Mod/Path/PathScripts/PathArray.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/Mod/Path/PathScripts/PathArray.py b/src/Mod/Path/PathScripts/PathArray.py index edecb74654..999d4e2528 100644 --- a/src/Mod/Path/PathScripts/PathArray.py +++ b/src/Mod/Path/PathScripts/PathArray.py @@ -62,7 +62,10 @@ class ObjectArray: "Path", QtCore.QT_TRANSLATE_NOOP("App::Property","Maximum random offset of copies")) obj.addProperty("App::PropertyLink", "ToolController", "Path", QtCore.QT_TRANSLATE_NOOP("App::Property", "The tool controller that will be used to calculate the path")) + obj.addProperty("App::PropertyBool", "Active", + "Path", QtCore.QT_TRANSLATE_NOOP("PathOp", "Make False, to prevent operation from generating code")) + obj.Active = True obj.Type = ['Linear1D', 'Linear2D', 'Polar'] self.setEditorModes(obj) @@ -102,6 +105,12 @@ class ObjectArray: def onDocumentRestored(self, obj): """onDocumentRestored(obj) ... Called automatically when document is restored.""" + + if not hasattr(obj, "Active"): + obj.addProperty("App::PropertyBool", "Active", + "Path", QtCore.QT_TRANSLATE_NOOP("PathOp", "Make False, to prevent operation from generating code")) + obj.Active = True + self.setEditorModes(obj) def rotatePath(self, path, angle, centre): @@ -175,6 +184,12 @@ class ObjectArray: obj.ToolController = base[0].ToolController + # Do not generate paths and clear current Path data if operation not + if not obj.Active: + if obj.Path: + obj.Path = Path.Path() + return + pa = PathArray(obj.Base, obj.Type, obj.Copies, obj.Offset, obj.CopiesX, obj.CopiesY, obj.Angle, obj.Centre, obj.SwapDirection, obj.JitterMagnitude, obj.JitterPercent, obj.Name)