Path: Allow parent job assignment
Modifications focus on allowing the creation of operations to include direct provision of parent job. Path: Remove `useGui` implementation
This commit is contained in:
@@ -737,9 +737,9 @@ def SetupProperties():
|
||||
return setup
|
||||
|
||||
|
||||
def Create(name, obj=None):
|
||||
def Create(name, obj=None, parentJob=None):
|
||||
'''Create(name) ... Creates and returns a Adaptive operation.'''
|
||||
if obj is None:
|
||||
obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", name)
|
||||
obj.Proxy = PathAdaptive(obj, name)
|
||||
obj.Proxy = PathAdaptive(obj, name, parentJob)
|
||||
return obj
|
||||
|
||||
@@ -70,9 +70,9 @@ def SetupProperties():
|
||||
return setup
|
||||
|
||||
|
||||
def Create(name, obj=None):
|
||||
def Create(name, obj=None, parentJob=None):
|
||||
'''Create(name) ... Creates and returns a Custom operation.'''
|
||||
if obj is None:
|
||||
obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", name)
|
||||
proxy = ObjectCustom(obj, name)
|
||||
obj.Proxy = ObjectCustom(obj, name, parentJob)
|
||||
return obj
|
||||
|
||||
@@ -291,10 +291,9 @@ def SetupProperties():
|
||||
return setup
|
||||
|
||||
|
||||
def Create(name, obj=None):
|
||||
def Create(name, obj=None, parentJob=None):
|
||||
'''Create(name) ... Creates and returns a Deburr operation.'''
|
||||
if obj is None:
|
||||
obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", name)
|
||||
|
||||
obj.Proxy = ObjectDeburr(obj, name)
|
||||
obj.Proxy = ObjectDeburr(obj, name, parentJob)
|
||||
return obj
|
||||
|
||||
@@ -159,12 +159,13 @@ def SetupProperties():
|
||||
setup.append("RetractHeight")
|
||||
return setup
|
||||
|
||||
def Create(name, obj = None):
|
||||
|
||||
def Create(name, obj=None, parentJob=None):
|
||||
'''Create(name) ... Creates and returns a Drilling operation.'''
|
||||
if obj is None:
|
||||
obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", name)
|
||||
|
||||
obj.Proxy = ObjectDrilling(obj, name)
|
||||
obj.Proxy = ObjectDrilling(obj, name, parentJob)
|
||||
if obj.Proxy:
|
||||
obj.Proxy.findAllHoles(obj)
|
||||
|
||||
|
||||
@@ -48,8 +48,8 @@ def translate(context, text, disambig=None):
|
||||
class ObjectEngrave(PathEngraveBase.ObjectOp):
|
||||
'''Proxy class for Engrave operation.'''
|
||||
|
||||
def __init__(self, obj, name):
|
||||
super(ObjectEngrave, self).__init__(obj, name)
|
||||
def __init__(self, obj, name, parentJob):
|
||||
super(ObjectEngrave, self).__init__(obj, name, parentJob)
|
||||
self.wires = []
|
||||
|
||||
def opFeatures(self, obj):
|
||||
@@ -144,9 +144,9 @@ def SetupProperties():
|
||||
return ["StartVertex"]
|
||||
|
||||
|
||||
def Create(name, obj=None):
|
||||
def Create(name, obj=None, parentJob=None):
|
||||
'''Create(name) ... Creates and returns an Engrave operation.'''
|
||||
if obj is None:
|
||||
obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", name)
|
||||
obj.Proxy = ObjectEngrave(obj, name)
|
||||
obj.Proxy = ObjectEngrave(obj, name, parentJob)
|
||||
return obj
|
||||
|
||||
@@ -214,11 +214,11 @@ def SetupProperties():
|
||||
return setup
|
||||
|
||||
|
||||
def Create(name, obj=None):
|
||||
def Create(name, obj=None, parentJob=None):
|
||||
'''Create(name) ... Creates and returns a Helix operation.'''
|
||||
if obj is None:
|
||||
obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", name)
|
||||
obj.Proxy = ObjectHelix(obj, name)
|
||||
obj.Proxy = ObjectHelix(obj, name, parentJob)
|
||||
if obj.Proxy:
|
||||
obj.Proxy.findAllHoles(obj)
|
||||
return obj
|
||||
|
||||
@@ -175,8 +175,8 @@ class ViewProvider:
|
||||
FreeCADGui.Control.closeDialog()
|
||||
FreeCADGui.Control.showDialog(self.taskPanel)
|
||||
self.taskPanel.setupUi(activate)
|
||||
self.deleteOnReject = False
|
||||
self.showOriginAxis(True)
|
||||
self.deleteOnReject = False
|
||||
|
||||
def resetTaskPanel(self):
|
||||
self.showOriginAxis(False)
|
||||
|
||||
@@ -304,9 +304,9 @@ def SetupProperties():
|
||||
return setup
|
||||
|
||||
|
||||
def Create(name, obj=None):
|
||||
def Create(name, obj=None, parentJob=None):
|
||||
'''Create(name) ... Creates and returns a Mill Facing operation.'''
|
||||
if obj is None:
|
||||
obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", name)
|
||||
obj.Proxy = ObjectFace(obj, name)
|
||||
obj.Proxy = ObjectFace(obj, name, parentJob)
|
||||
return obj
|
||||
|
||||
@@ -119,7 +119,7 @@ class ObjectOp(object):
|
||||
obj.addProperty("App::PropertyDistance", "OpStockZMin", "Op Values", QtCore.QT_TRANSLATE_NOOP("PathOp", "Holds the min Z value of Stock"))
|
||||
obj.setEditorMode('OpStockZMin', 1) # read-only
|
||||
|
||||
def __init__(self, obj, name):
|
||||
def __init__(self, obj, name, parentJob=None):
|
||||
PathLog.track()
|
||||
|
||||
obj.addProperty("App::PropertyBool", "Active", "Path", QtCore.QT_TRANSLATE_NOOP("PathOp", "Make False, to prevent operation from generating code"))
|
||||
@@ -190,6 +190,8 @@ class ObjectOp(object):
|
||||
self.initOperation(obj)
|
||||
|
||||
if not hasattr(obj, 'DoNotSetDefaultValues') or not obj.DoNotSetDefaultValues:
|
||||
if parentJob:
|
||||
self.job = PathUtils.addToJob(obj, jobname=parentJob.Name)
|
||||
job = self.setDefaultValues(obj)
|
||||
if job:
|
||||
job.SetupSheet.Proxy.setOperationProperties(obj, name)
|
||||
@@ -322,7 +324,10 @@ class ObjectOp(object):
|
||||
def setDefaultValues(self, obj):
|
||||
'''setDefaultValues(obj) ... base implementation.
|
||||
Do not overwrite, overwrite opSetDefaultValues() instead.'''
|
||||
job = PathUtils.addToJob(obj)
|
||||
if self.job:
|
||||
job = self.job
|
||||
else:
|
||||
job = PathUtils.addToJob(obj)
|
||||
|
||||
obj.Active = True
|
||||
|
||||
@@ -622,5 +627,3 @@ class ObjectOp(object):
|
||||
This function can safely be overwritten by subclasses.'''
|
||||
|
||||
return True
|
||||
|
||||
|
||||
|
||||
@@ -1280,12 +1280,12 @@ def Create(res):
|
||||
this function directly, but calls the Activated() function of the Command object
|
||||
that is created in each operations Gui implementation.'''
|
||||
FreeCAD.ActiveDocument.openTransaction("Create %s" % res.name)
|
||||
obj = res.objFactory(res.name)
|
||||
obj = res.objFactory(res.name, obj=None, parentJob=res.job)
|
||||
if obj.Proxy:
|
||||
obj.ViewObject.Proxy = ViewProvider(obj.ViewObject, res)
|
||||
obj.ViewObject.Visibility = False
|
||||
|
||||
FreeCAD.ActiveDocument.commitTransaction()
|
||||
|
||||
obj.ViewObject.Document.setEdit(obj.ViewObject, 0)
|
||||
return obj
|
||||
FreeCAD.ActiveDocument.abortTransaction()
|
||||
@@ -1329,6 +1329,7 @@ class CommandResources:
|
||||
self.menuText = menuText
|
||||
self.accelKey = accelKey
|
||||
self.toolTip = toolTip
|
||||
self.job = None
|
||||
|
||||
|
||||
def SetupOperation(name,
|
||||
|
||||
@@ -717,9 +717,9 @@ def SetupProperties():
|
||||
return PathPocketBase.SetupProperties() + ["HandleMultipleFeatures"]
|
||||
|
||||
|
||||
def Create(name, obj=None):
|
||||
def Create(name, obj=None, parentJob=None):
|
||||
'''Create(name) ... Creates and returns a Pocket operation.'''
|
||||
if obj is None:
|
||||
obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", name)
|
||||
obj.Proxy = ObjectPocket(obj, name)
|
||||
obj.Proxy = ObjectPocket(obj, name, parentJob)
|
||||
return obj
|
||||
|
||||
@@ -242,11 +242,11 @@ def SetupProperties():
|
||||
return setup
|
||||
|
||||
|
||||
def Create(name, obj=None):
|
||||
def Create(name, obj=None, parentJob=None):
|
||||
'''Create(name) ... Creates and returns a Pocket operation.'''
|
||||
if obj is None:
|
||||
obj = FreeCAD.ActiveDocument.addObject('Path::FeaturePython', name)
|
||||
|
||||
obj.Proxy = ObjectPocket(obj, name)
|
||||
obj.Proxy = ObjectPocket(obj, name, parentJob)
|
||||
return obj
|
||||
|
||||
return obj
|
||||
@@ -97,9 +97,9 @@ def SetupProperties():
|
||||
return setup
|
||||
|
||||
|
||||
def Create(name, obj=None):
|
||||
def Create(name, obj=None, parentJob=None):
|
||||
'''Create(name) ... Creates and returns a Probing operation.'''
|
||||
if obj is None:
|
||||
obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", name)
|
||||
proxy = ObjectProbing(obj, name)
|
||||
proxy = ObjectProbing(obj, name, parentJob)
|
||||
return obj
|
||||
|
||||
@@ -1301,9 +1301,9 @@ def SetupProperties():
|
||||
return setup
|
||||
|
||||
|
||||
def Create(name, obj=None):
|
||||
def Create(name, obj=None, parentJob=None):
|
||||
'''Create(name) ... Creates and returns a Profile based on faces operation.'''
|
||||
if obj is None:
|
||||
obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", name)
|
||||
obj.Proxy = ObjectProfile(obj, name)
|
||||
obj.Proxy = ObjectProfile(obj, name, parentJob)
|
||||
return obj
|
||||
|
||||
@@ -42,9 +42,9 @@ def SetupProperties():
|
||||
return PathProfile.SetupProperties()
|
||||
|
||||
|
||||
def Create(name, obj=None):
|
||||
def Create(name, obj=None, parentJob=None):
|
||||
'''Create(name) ... Creates and returns a Profile operation.'''
|
||||
if obj is None:
|
||||
obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", name)
|
||||
obj.Proxy = ObjectContour(obj, name)
|
||||
obj.Proxy = ObjectContour(obj, name, parentJob)
|
||||
return obj
|
||||
|
||||
@@ -43,9 +43,9 @@ def SetupProperties():
|
||||
return PathProfile.SetupProperties()
|
||||
|
||||
|
||||
def Create(name, obj=None):
|
||||
def Create(name, obj=None, parentJob=None):
|
||||
'''Create(name) ... Creates and returns a Profile operation.'''
|
||||
if obj is None:
|
||||
obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", name)
|
||||
obj.Proxy = ObjectProfile(obj, name)
|
||||
obj.Proxy = ObjectProfile(obj, name, parentJob)
|
||||
return obj
|
||||
|
||||
@@ -44,9 +44,9 @@ def SetupProperties():
|
||||
return PathProfile.SetupProperties()
|
||||
|
||||
|
||||
def Create(name, obj=None):
|
||||
def Create(name, obj=None, parentJob=None):
|
||||
'''Create(name) ... Creates and returns a Profile operation.'''
|
||||
if obj is None:
|
||||
obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", name)
|
||||
obj.Proxy = ObjectProfile(obj, name)
|
||||
obj.Proxy = ObjectProfile(obj, name, parentJob)
|
||||
return obj
|
||||
|
||||
@@ -1767,9 +1767,9 @@ def SetupProperties():
|
||||
return [tup[1] for tup in ObjectSlot.opPropertyDefinitions(False)]
|
||||
|
||||
|
||||
def Create(name, obj=None):
|
||||
def Create(name, obj=None, parentJob=None):
|
||||
'''Create(name) ... Creates and returns a Slot operation.'''
|
||||
if obj is None:
|
||||
obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", name)
|
||||
obj.Proxy = ObjectSlot(obj, name)
|
||||
obj.Proxy = ObjectSlot(obj, name, parentJob)
|
||||
return obj
|
||||
|
||||
@@ -2124,9 +2124,9 @@ def SetupProperties():
|
||||
return [tup[1] for tup in ObjectSurface.opPropertyDefinitions(False)]
|
||||
|
||||
|
||||
def Create(name, obj=None):
|
||||
def Create(name, obj=None, parentJob=None):
|
||||
'''Create(name) ... Creates and returns a Surface operation.'''
|
||||
if obj is None:
|
||||
obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", name)
|
||||
obj.Proxy = ObjectSurface(obj, name)
|
||||
obj.Proxy = ObjectSurface(obj, name, parentJob)
|
||||
return obj
|
||||
|
||||
@@ -327,11 +327,11 @@ def SetupProperties():
|
||||
return setup
|
||||
|
||||
|
||||
def Create(name, obj=None):
|
||||
def Create(name, obj=None, parentJob=None):
|
||||
'''Create(name) ... Creates and returns a thread milling operation.'''
|
||||
if obj is None:
|
||||
obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", name)
|
||||
obj.Proxy = ObjectThreadMilling(obj, name)
|
||||
obj.Proxy = ObjectThreadMilling(obj, name, parentJob)
|
||||
if obj.Proxy:
|
||||
obj.Proxy.findAllHoles(obj)
|
||||
return obj
|
||||
|
||||
@@ -363,9 +363,9 @@ def SetupProperties():
|
||||
return ["Discretize"]
|
||||
|
||||
|
||||
def Create(name, obj=None):
|
||||
def Create(name, obj=None, parentJob=None):
|
||||
'''Create(name) ... Creates and returns a Vcarve operation.'''
|
||||
if obj is None:
|
||||
obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", name)
|
||||
ObjectVcarve(obj, name)
|
||||
obj.Proxy = ObjectVcarve(obj, name, parentJob)
|
||||
return obj
|
||||
|
||||
@@ -1814,9 +1814,9 @@ def SetupProperties():
|
||||
return [tup[1] for tup in ObjectWaterline.opPropertyDefinitions(False)]
|
||||
|
||||
|
||||
def Create(name, obj=None):
|
||||
def Create(name, obj=None, parentJob=None):
|
||||
'''Create(name) ... Creates and returns a Waterline operation.'''
|
||||
if obj is None:
|
||||
obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", name)
|
||||
obj.Proxy = ObjectWaterline(obj, name)
|
||||
obj.Proxy = ObjectWaterline(obj, name, parentJob)
|
||||
return obj
|
||||
|
||||
Reference in New Issue
Block a user