diff --git a/src/Mod/Path/PathScripts/PathDressupAxisMap.py b/src/Mod/Path/PathScripts/PathDressupAxisMap.py index 62d6ee34a8..ac9f15c3c4 100644 --- a/src/Mod/Path/PathScripts/PathDressupAxisMap.py +++ b/src/Mod/Path/PathScripts/PathDressupAxisMap.py @@ -206,11 +206,13 @@ class CommandPathDressup: FreeCADGui.addModule("PathScripts.PathUtils") FreeCADGui.doCommand('obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", "AxisMapDressup")') FreeCADGui.doCommand('PathScripts.PathDressupAxisMap.ObjectDressup(obj)') - FreeCADGui.doCommand('obj.Base = FreeCAD.ActiveDocument.' + selection[0].Name) + FreeCADGui.doCommand('base = FreeCAD.ActiveDocument.' + selection[0].Name) + FreeCADGui.doCommand('job = PathScripts.PathUtils.findParentJob(base)') + FreeCADGui.doCommand('obj.Base = base') FreeCADGui.doCommand('obj.Radius = 45') + FreeCADGui.doCommand('job.Proxy.addOperation(obj, base)') FreeCADGui.doCommand('PathScripts.PathDressupAxisMap.ViewProviderDressup(obj.ViewObject)') - FreeCADGui.doCommand('PathScripts.PathUtils.addToJob(obj)') - FreeCADGui.doCommand('Gui.ActiveDocument.getObject(obj.Base.Name).Visibility = False') + FreeCADGui.doCommand('Gui.ActiveDocument.getObject(base.Name).Visibility = False') FreeCAD.ActiveDocument.commitTransaction() FreeCAD.ActiveDocument.recompute() diff --git a/src/Mod/Path/PathScripts/PathDressupDogbone.py b/src/Mod/Path/PathScripts/PathDressupDogbone.py index 2d1a480c28..805f587255 100644 --- a/src/Mod/Path/PathScripts/PathDressupDogbone.py +++ b/src/Mod/Path/PathScripts/PathDressupDogbone.py @@ -1032,7 +1032,7 @@ def Create(base, name='DogboneDressup'): obj = FreeCAD.ActiveDocument.addObject('Path::FeaturePython', 'DogboneDressup') dbo = ObjectDressup(obj, base) job = PathUtils.findParentJob(base) - job.Proxy.addOperation(obj) + job.Proxy.addOperation(obj, base) if FreeCAD.GuiUp: ViewProviderDressup(obj.ViewObject) diff --git a/src/Mod/Path/PathScripts/PathDressupDragknife.py b/src/Mod/Path/PathScripts/PathDressupDragknife.py index 8228340748..0acd50c509 100644 --- a/src/Mod/Path/PathScripts/PathDressupDragknife.py +++ b/src/Mod/Path/PathScripts/PathDressupDragknife.py @@ -499,10 +499,12 @@ class CommandDressupDragknife: FreeCADGui.addModule("PathScripts.PathUtils") FreeCADGui.doCommand('obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython","DragknifeDressup")') FreeCADGui.doCommand('PathScripts.PathDressupDragknife.ObjectDressup(obj)') - FreeCADGui.doCommand('obj.Base = FreeCAD.ActiveDocument.' + selection[0].Name) + FreeCADGui.doCommand('base = FreeCAD.ActiveDocument.' + selection[0].Name) + FreeCADGui.doCommand('job = PathScripts.PathUtils.findParentJob(base)') + FreeCADGui.doCommand('obj.Base = base') + FreeCADGui.doCommand('job.Proxy.addOperation(obj, base)') FreeCADGui.doCommand('PathScripts.PathDressupDragknife.ViewProviderDressup(obj.ViewObject)') - FreeCADGui.doCommand('PathScripts.PathUtils.addToJob(obj)') - FreeCADGui.doCommand('Gui.ActiveDocument.getObject(obj.Base.Name).Visibility = False') + FreeCADGui.doCommand('Gui.ActiveDocument.getObject(base.Name).Visibility = False') FreeCADGui.doCommand('obj.filterangle = 20') FreeCADGui.doCommand('obj.offset = 2') FreeCADGui.doCommand('obj.pivotheight = 4') diff --git a/src/Mod/Path/PathScripts/PathDressupHoldingTags.py b/src/Mod/Path/PathScripts/PathDressupHoldingTags.py index b11a1267ef..5e716128ed 100644 --- a/src/Mod/Path/PathScripts/PathDressupHoldingTags.py +++ b/src/Mod/Path/PathScripts/PathDressupHoldingTags.py @@ -1019,7 +1019,7 @@ def Create(baseObject, name='DressupTag'): obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", "TagDressup") dbo = ObjectTagDressup(obj, baseObject) job = PathUtils.findParentJob(baseObject) - job.Proxy.addOperation(obj) + job.Proxy.addOperation(obj, baseObject) dbo.setup(obj, True) return obj diff --git a/src/Mod/Path/PathScripts/PathDressupLeadInOut.py b/src/Mod/Path/PathScripts/PathDressupLeadInOut.py index 6f23fc0b5e..ee19eb735b 100644 --- a/src/Mod/Path/PathScripts/PathDressupLeadInOut.py +++ b/src/Mod/Path/PathScripts/PathDressupLeadInOut.py @@ -365,10 +365,12 @@ class CommandPathDressupLeadInOut: FreeCADGui.addModule("PathScripts.PathUtils") FreeCADGui.doCommand('obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", "LeadInOutDressup")') FreeCADGui.doCommand('dbo = PathScripts.PathDressupLeadInOut.ObjectDressup(obj)') - FreeCADGui.doCommand('obj.Base = FreeCAD.ActiveDocument.' + selection[0].Name) + FreeCADGui.doCommand('base = FreeCAD.ActiveDocument.' + selection[0].Name) + FreeCADGui.doCommand('job = PathScripts.PathUtils.findParentJob(base)') + FreeCADGui.doCommand('obj.Base = base') + FreeCADGui.doCommand('job.Proxy.addOperation(obj, base)') FreeCADGui.doCommand('PathScripts.PathDressupLeadInOut.ViewProviderDressup(obj.ViewObject)') - FreeCADGui.doCommand('PathScripts.PathUtils.addToJob(obj)') - FreeCADGui.doCommand('Gui.ActiveDocument.getObject(obj.Base.Name).Visibility = False') + FreeCADGui.doCommand('Gui.ActiveDocument.getObject(base.Name).Visibility = False') FreeCADGui.doCommand('dbo.setup(obj)') FreeCAD.ActiveDocument.commitTransaction() FreeCAD.ActiveDocument.recompute() diff --git a/src/Mod/Path/PathScripts/PathDressupRampEntry.py b/src/Mod/Path/PathScripts/PathDressupRampEntry.py index d4adc7f2c0..5a36986808 100644 --- a/src/Mod/Path/PathScripts/PathDressupRampEntry.py +++ b/src/Mod/Path/PathScripts/PathDressupRampEntry.py @@ -687,10 +687,12 @@ class CommandPathDressupRampEntry: FreeCADGui.addModule("PathScripts.PathUtils") FreeCADGui.doCommand('obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", "RampEntryDressup")') FreeCADGui.doCommand('dbo = PathScripts.PathDressupRampEntry.ObjectDressup(obj)') - FreeCADGui.doCommand('obj.Base = FreeCAD.ActiveDocument.' + selection[0].Name) + FreeCADGui.doCommand('base = FreeCAD.ActiveDocument.' + selection[0].Name) + FreeCADGui.doCommand('job = PathScripts.PathUtils.findParentJob(base)') + FreeCADGui.doCommand('obj.Base = base') + FreeCADGui.doCommand('job.Proxy.addOperation(obj, base)') FreeCADGui.doCommand('PathScripts.PathDressupRampEntry.ViewProviderDressup(obj.ViewObject)') - FreeCADGui.doCommand('PathScripts.PathUtils.addToJob(obj)') - FreeCADGui.doCommand('Gui.ActiveDocument.getObject(obj.Base.Name).Visibility = False') + FreeCADGui.doCommand('Gui.ActiveDocument.getObject(base.Name).Visibility = False') FreeCADGui.doCommand('dbo.setup(obj)') FreeCAD.ActiveDocument.commitTransaction() FreeCAD.ActiveDocument.recompute() diff --git a/src/Mod/Path/PathScripts/PathJob.py b/src/Mod/Path/PathScripts/PathJob.py index cd75c5e27f..b73e8a44ae 100644 --- a/src/Mod/Path/PathScripts/PathJob.py +++ b/src/Mod/Path/PathScripts/PathJob.py @@ -331,10 +331,17 @@ class ObjectJob: def execute(self, obj): obj.Path = obj.Operations.Path - def addOperation(self, op): + def addOperation(self, op, before = None): group = self.obj.Operations.Group if op not in group: - group.append(op) + if before: + try: + group.insert(group.index(before), op) + except Exception as e: + PathLog.error(e) + group.append(op) + else: + group.append(op) self.obj.Operations.Group = group op.Path.Center = self.obj.Operations.Path.Center