Copy all path operations in selection

Changes "Copy operation in the job" from only being able to copy one
operation. To copy all operations in a selection.
The copy command will only be enabled if all selected objects are
copyable.
This commit is contained in:
Mikael Ågren
2020-04-20 20:44:58 +02:00
parent 6b48dfa3e8
commit df177ee4ee

View File

@@ -170,15 +170,17 @@ class _CopyOperation:
if bool(FreeCADGui.Selection.getSelection()) is False:
return False
try:
obj = FreeCADGui.Selection.getSelectionEx()[0].Object
return isinstance(obj.Proxy, PathScripts.PathOp.ObjectOp)
for sel in FreeCADGui.Selection.getSelectionEx():
if not isinstance(sel.Object.Proxy, PathScripts.PathOp.ObjectOp):
return False
return True
except(IndexError, AttributeError):
return False
def Activated(self):
obj = FreeCADGui.Selection.getSelectionEx()[0].Object
jobname = findParentJob(obj).Name
addToJob(FreeCAD.ActiveDocument.copyObject(obj, False), jobname)
for sel in FreeCADGui.Selection.getSelectionEx():
jobname = findParentJob(sel.Object).Name
addToJob(FreeCAD.ActiveDocument.copyObject(sel.Object, False), jobname)
if FreeCAD.GuiUp: