diff --git a/src/Mod/Path/PathScripts/PathJob.py b/src/Mod/Path/PathScripts/PathJob.py index 77bdfa3e22..8af6f934df 100644 --- a/src/Mod/Path/PathScripts/PathJob.py +++ b/src/Mod/Path/PathScripts/PathJob.py @@ -284,7 +284,7 @@ class ObjectJob: # ops = FreeCAD.ActiveDocument.addObject( # "Path::FeatureCompoundPython", "Operations" # ) - ops = FreeCAD.ActiveDocument.addObject("App::DocumentObjectGroup","Operations") + ops = FreeCAD.ActiveDocument.addObject("App::DocumentObjectGroup", "Operations") if ops.ViewObject: # ops.ViewObject.Proxy = 0 ops.ViewObject.Visibility = True @@ -295,14 +295,15 @@ class ObjectJob: def setupSetupSheet(self, obj): if not getattr(obj, "SetupSheet", None): - obj.addProperty( - "App::PropertyLink", - "SetupSheet", - "Base", - QT_TRANSLATE_NOOP( - "App::Property", "SetupSheet holding the settings for this job" - ), - ) + if not hasattr(obj, "SetupSheet"): + obj.addProperty( + "App::PropertyLink", + "SetupSheet", + "Base", + QT_TRANSLATE_NOOP( + "App::Property", "SetupSheet holding the settings for this job" + ), + ) obj.SetupSheet = PathSetupSheet.Create() if obj.SetupSheet.ViewObject: import PathScripts.PathIconViewProvider @@ -659,7 +660,7 @@ class ObjectJob: def execute(self, obj): if getattr(obj, "Operations", None): - #obj.Path = obj.Operations.Path + # obj.Path = obj.Operations.Path self.getCycleTime() def getCycleTime(self): diff --git a/src/Mod/Path/PathScripts/PathJobGui.py b/src/Mod/Path/PathScripts/PathJobGui.py index 78359a947e..46de1cf3ed 100644 --- a/src/Mod/Path/PathScripts/PathJobGui.py +++ b/src/Mod/Path/PathScripts/PathJobGui.py @@ -694,6 +694,7 @@ class TaskPanel: def accept(self, resetEdit=True): PathLog.track() + self._jobIntegrityCheck() # Check existance of Model and Tools self.preCleanup() self.getFields() self.setupGlobal.accept() @@ -1569,6 +1570,18 @@ class TaskPanel: def open(self): FreeCADGui.Selection.addObserver(self) + def _jobIntegrityCheck(self): + """_jobIntegrityCheck() ... Check Job object for existance of Model and Tools + If either Model or Tools is empty, change GUI tab and open appropriate selection window.""" + if len(self.obj.Model.Group) == 0: + PathLog.info(translate("Path_Job", "Please select a model for this job.")) + self.form.setCurrentIndex(0) # Change tab to General tab + self.jobModelEdit() + if len(self.obj.Tools.Group) == 0: + PathLog.info(translate("Path_Job", "Please add a tool to this job.")) + self.form.setCurrentIndex(3) # Change tab to Tools tab + self.toolControllerAdd() + # SelectionObserver interface def addSelection(self, doc, obj, sub, pnt): self.updateSelection()