diff --git a/src/Mod/Path/CMakeLists.txt b/src/Mod/Path/CMakeLists.txt
index c5a428fa61..4190e9cd27 100644
--- a/src/Mod/Path/CMakeLists.txt
+++ b/src/Mod/Path/CMakeLists.txt
@@ -37,6 +37,7 @@ SET(PathScripts_SRCS
PathScripts/PathDrilling.py
PathScripts/PathDrillingGui.py
PathScripts/PathEngrave.py
+ PathScripts/PathEngraveGui.py
PathScripts/PathFacePocket.py
PathScripts/PathFaceProfile.py
PathScripts/PathFixture.py
diff --git a/src/Mod/Path/Gui/Resources/Path.qrc b/src/Mod/Path/Gui/Resources/Path.qrc
index 4b0b526a27..1bcfc8e2fa 100644
--- a/src/Mod/Path/Gui/Resources/Path.qrc
+++ b/src/Mod/Path/Gui/Resources/Path.qrc
@@ -66,6 +66,7 @@
panels/PageDepthsEdit.ui
panels/PageHeightsEdit.ui
panels/PageOpDrillingEdit.ui
+ panels/PageOpEngraveEdit.ui
panels/PageOpHelixEdit.ui
panels/PageOpPocketFullEdit.ui
panels/PageOpProfileFullEdit.ui
diff --git a/src/Mod/Path/InitGui.py b/src/Mod/Path/InitGui.py
index 9a6428433f..0f7529287a 100644
--- a/src/Mod/Path/InitGui.py
+++ b/src/Mod/Path/InitGui.py
@@ -53,7 +53,7 @@ class PathWorkbench (Workbench):
from PathScripts import PathDressupRampEntry
from PathScripts import PathDressupTagGui
from PathScripts import PathDrillingGui
- from PathScripts import PathEngrave
+ from PathScripts import PathEngraveGui
from PathScripts import PathFacePocket
from PathScripts import PathFaceProfile
from PathScripts import PathFixture
diff --git a/src/Mod/Path/PathScripts/PathEngrave.py b/src/Mod/Path/PathScripts/PathEngrave.py
index acf86a9ee0..eb37ec4356 100644
--- a/src/Mod/Path/PathScripts/PathEngrave.py
+++ b/src/Mod/Path/PathScripts/PathEngrave.py
@@ -22,13 +22,16 @@
# * *
# ***************************************************************************
-import FreeCAD
-import Path
-import Part
import ArchPanel
-
+import DraftGeomUtils
+import FreeCAD
+import Part
+import Path
import PathScripts.PathLog as PathLog
-from PathScripts import PathUtils
+import PathScripts.PathOp as PathOp
+import PathScripts.PathUtils as PathUtils
+
+from PySide import QtCore
"""Path Engrave object and FreeCAD command"""
@@ -38,132 +41,74 @@ if False:
else:
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
-if FreeCAD.GuiUp:
- import FreeCADGui
- from PySide import QtCore, QtGui
-
# Qt tanslation handling
def translate(context, text, disambig=None):
return QtCore.QCoreApplication.translate(context, text, disambig)
-class ObjectPathEngrave:
+class ObjectEngrave(PathOp.ObjectOp):
- def __init__(self, obj):
- obj.addProperty("App::PropertyLinkSubList", "Base", "Path", QtCore.QT_TRANSLATE_NOOP("App::Property", "The base geometry of this object"))
- obj.addProperty("App::PropertyBool", "Active", "Path", QtCore.QT_TRANSLATE_NOOP("App::Property", "Make False, to prevent operation from generating code"))
- obj.addProperty("App::PropertyString", "Comment", "Path", QtCore.QT_TRANSLATE_NOOP("App::Property", "An optional comment for this profile"))
- obj.addProperty("App::PropertyString", "UserLabel", "Path", QtCore.QT_TRANSLATE_NOOP("App::Property", "User Assigned Label"))
-
- # Tool Properties
- obj.addProperty("App::PropertyLink", "ToolController", "Path", QtCore.QT_TRANSLATE_NOOP("App::Property", "The tool controller that will be used to calculate the path"))
-
- # Depth Properties
- obj.addProperty("App::PropertyDistance", "StartDepth", "Depth", QtCore.QT_TRANSLATE_NOOP("App::Property", "Start Depth of Tool"))
- obj.addProperty("App::PropertyDistance", "FinalDepth", "Depth", QtCore.QT_TRANSLATE_NOOP("App::Property", "Final Depth of Tool- lowest value in Z"))
-
- # Heights
- obj.addProperty("App::PropertyDistance", "ClearanceHeight", "Depth", QtCore.QT_TRANSLATE_NOOP("App::Property", "The height needed to clear clamps and obstructions"))
- obj.addProperty("App::PropertyDistance", "SafeHeight", "Depth", QtCore.QT_TRANSLATE_NOOP("App::Property", "Rapid Safety Height between locations."))
+ def opFeatures(self, obj):
+ return PathOp.FeatureTool | PathOp.FeatureDepths | PathOp.FeatureHeights | PathOp.FeatureStepDown | PathOp.FeatureBaseEdges;
+ def initOperation(self, obj):
obj.addProperty("App::PropertyInteger", "StartVertex", "Path", QtCore.QT_TRANSLATE_NOOP("App::Property", "The vertex index to start the path from"))
- if FreeCAD.GuiUp:
- _ViewProviderEngrave(obj.ViewObject)
-
- obj.Proxy = self
-
- def __getstate__(self):
- return None
-
- def __setstate__(self, state):
- return None
-
- def onChanged(self, obj, prop):
- pass
-
- def execute(self, obj):
+ def opExecute(self, obj):
PathLog.track()
- if not obj.Active:
- path = Path.Path("(inactive operation)")
- obj.Path = path
- obj.ViewObject.Visibility = False
- return
+ zValues = []
+ if obj.StepDown.Value != 0:
+ z = obj.StartDepth.Value - obj.StepDown.Value
- output = ""
- if obj.Comment != "":
- output += '(' + str(obj.Comment)+')\n'
+ while z > obj.FinalDepth.Value:
+ zValues.append(z)
+ z -= obj.StepDown.Value
+ zValues.append(obj.FinalDepth.Value)
+ self.zValues = zValues
- toolLoad = obj.ToolController
-
- if toolLoad is None or toolLoad.ToolNumber == 0:
- FreeCAD.Console.PrintError("No Tool Controller is selected. We need a tool to build a Path.")
- return
- else:
- self.vertFeed = toolLoad.VertFeed.Value
- self.horizFeed = toolLoad.HorizFeed.Value
- self.vertRapid = toolLoad.VertRapid.Value
- self.horizRapid = toolLoad.HorizRapid.Value
- tool = toolLoad.Proxy.getTool(toolLoad) # PathUtils.getTool(obj, toolLoad.ToolNumber)
- if not tool or tool.Diameter == 0:
- FreeCAD.Console.PrintError("No Tool found or diameter is zero. We need a tool to build a Path.")
- return
- else:
- self.radius = tool.Diameter/2
-
- wires = []
-
- parentJob = PathUtils.findParentJob(obj)
- if parentJob is None:
- return
- baseobject = parentJob.Base
- if baseobject is None:
- return
+ output = ''
try:
- if baseobject.isDerivedFrom('Sketcher::SketchObject') or \
- baseobject.isDerivedFrom('Part::Part2DObject') or \
- hasattr(baseobject, 'ArrayType'):
+ if self.baseobject.isDerivedFrom('Sketcher::SketchObject') or \
+ self.baseobject.isDerivedFrom('Part::Part2DObject') or \
+ hasattr(self.baseobject, 'ArrayType'):
output += "G0 Z" + PathUtils.fmt(obj.ClearanceHeight.Value) + "F " + PathUtils.fmt(self.vertRapid) + "\n"
+ self.commandlist.append(Path.Command('G0', {'Z': obj.ClearanceHeight.Value, 'F': self.vertRapid}))
# we only consider the outer wire if this is a Face
- for w in baseobject.Shape.Wires:
+ wires = []
+ for w in self.baseobject.Shape.Wires:
tempedges = PathUtils.cleanedges(w.Edges, 0.5)
wires.append(Part.Wire(tempedges))
+ output += self.buildpathocc(obj, wires, zValues)
+ self.wires = wires
- output += self.buildpathocc(obj, wires)
-
- elif isinstance(baseobject.Proxy, ArchPanel.PanelSheet): # process the sheet
-
- shapes = baseobject.Proxy.getTags(baseobject, transform=True)
- for shape in shapes:
+ elif isinstance(self.baseobject.Proxy, ArchPanel.PanelSheet): # process the sheet
+ wires = []
+ for tag in self.baseobject.Proxy.getTags(self.baseobject, transform=True):
output += "G0 Z" + PathUtils.fmt(obj.ClearanceHeight.Value) + "F " + PathUtils.fmt(self.vertRapid) + "\n"
- for w in shape.Wires:
+ self.commandlist.append(Path.Command('G0', {'Z': obj.ClearanceHeight.Value, 'F': self.vertRapid}))
+ tagWires = []
+ for w in tag.Wires:
tempedges = PathUtils.cleanedges(w.Edges, 0.5)
- wires.append(Part.Wire(tempedges))
- output += self.buildpathocc(obj, wires)
+ tagWires.append(Part.Wire(tempedges))
+ output += self.buildpathocc(obj, tagWires, zValues)
+ wires.extend(tagWires)
+ self.wires = wires
else:
raise ValueError('Unknown baseobject type for engraving')
output += "G0 Z" + PathUtils.fmt(obj.ClearanceHeight.Value) + "F " + PathUtils.fmt(self.vertRapid) + "\n"
+ self.commandlist.append(Path.Command('G0', {'Z': obj.ClearanceHeight.Value, 'F': self.vertRapid}))
- except:
- FreeCAD.Console.PrintError("The Job Base Object has no engraveable element. Engraving operation will produce no output.")
+ except Exception as e:
+ #PathLog.error("Exception: %s" % e)
+ PathLog.error(translate("Path", "The Job Base Object has no engraveable element. Engraving operation will produce no output."))
- # print output
- if output == "":
- output += "(No commands processed)"
-
- path = Path.Path(output)
- obj.Path = path
- #obj.ViewObject.Visibility = True
-
- def buildpathocc(self, obj, wires):
+ def buildpathocc(self, obj, wires, zValues):
PathLog.track()
- # import Part
- import DraftGeomUtils
output = ""
for wire in wires:
@@ -172,234 +117,79 @@ class ObjectPathEngrave:
# reorder the wire
offset = DraftGeomUtils.rebaseWire(offset, obj.StartVertex)
- # we create the path from the offset shape
last = None
- for edge in offset.Edges:
- if not last:
- # we set the first move to our first point
- last = edge.Vertexes[0].Point
- output += "G0" + " X" + PathUtils.fmt(last.x) + " Y" + PathUtils.fmt(last.y) + " Z" + PathUtils.fmt(obj.ClearanceHeight.Value) + "F " + PathUtils.fmt(self.horizRapid) # Rapid to starting position
- output += "G0" + " X" + PathUtils.fmt(last.x) + " Y" + PathUtils.fmt(last.y) + " Z" + PathUtils.fmt(obj.SafeHeight.Value) + "F " + PathUtils.fmt(self.horizRapid) # Rapid to safe height
- output += "G1" + " X" + PathUtils.fmt(last.x) + " Y" + PathUtils.fmt(last.y) + " Z" + PathUtils.fmt(obj.FinalDepth.Value) + "F " + PathUtils.fmt(self.vertFeed) + "\n" # Vertical feed to depth
- if isinstance(edge.Curve, Part.Circle):
- point = edge.Vertexes[-1].Point
- if point == last: # edges can come flipped
- point = edge.Vertexes[0].Point
- center = edge.Curve.Center
- relcenter = center.sub(last)
- v1 = last.sub(center)
- v2 = point.sub(center)
- if v1.cross(v2).z < 0:
- output += "G2"
+ for z in zValues:
+ if last:
+ self.commandlist.append(Path.Command('G1', {'X': last.x, 'Y': last.y, 'Z': z, 'F': self.vertFeed}))
+
+ for edge in offset.Edges:
+ if not last:
+ # we set the first move to our first point
+ last = edge.Vertexes[0].Point
+ output += "G0" + " X" + PathUtils.fmt(last.x) + " Y" + PathUtils.fmt(last.y) + " Z" + PathUtils.fmt(obj.ClearanceHeight.Value) + "F " + PathUtils.fmt(self.horizRapid) # Rapid to starting position
+ self.commandlist.append(Path.Command('G0', {'X': last.x, 'Y': last.y, 'Z': obj.ClearanceHeight.Value, 'F': self.horizRapid}))
+ output += "G0" + " X" + PathUtils.fmt(last.x) + " Y" + PathUtils.fmt(last.y) + " Z" + PathUtils.fmt(obj.SafeHeight.Value) + "F " + PathUtils.fmt(self.horizRapid) # Rapid to safe height
+ self.commandlist.append(Path.Command('G0', {'X': last.x, 'Y': last.y, 'Z': obj.SafeHeight.Value, 'F': self.vertRapid}))
+ output += "G1" + " X" + PathUtils.fmt(last.x) + " Y" + PathUtils.fmt(last.y) + " Z" + PathUtils.fmt(z) + "F " + PathUtils.fmt(self.vertFeed) + "\n" # Vertical feed to depth
+ self.commandlist.append(Path.Command('G0', {'X': last.x, 'Y': last.y, 'Z': z, 'F': self.vertFeed}))
+
+ if isinstance(edge.Curve, Part.Circle):
+ point = edge.Vertexes[-1].Point
+ if point == last: # edges can come flipped
+ point = edge.Vertexes[0].Point
+ center = edge.Curve.Center
+ relcenter = center.sub(last)
+ v1 = last.sub(center)
+ v2 = point.sub(center)
+ if v1.cross(v2).z < 0:
+ output += "G2"
+ else:
+ output += "G3"
+ output += " X" + PathUtils.fmt(point.x) + " Y" + PathUtils.fmt(point.y) + " Z" + PathUtils.fmt(z)
+ output += " I" + PathUtils.fmt(relcenter.x) + " J" + PathUtils.fmt(relcenter.y) + " K" + PathUtils.fmt(relcenter.z)
+ output += " F " + PathUtils.fmt(self.horizFeed)
+ output += "\n"
+
+ cmd = 'G2' if v1.cross(v2).z < 0 else 'G3'
+ args = {}
+ args['X'] = point.x
+ args['Y'] = point.y
+ args['Z'] = z
+ args['I'] = relcenter.x
+ args['J'] = relcenter.y
+ args['K'] = relcenter.z
+ args['F'] = self.horizFeed
+ self.commandlist.append(Path.Command(cmd, args))
+ last = point
else:
- output += "G3"
- output += " X" + PathUtils.fmt(point.x) + " Y" + PathUtils.fmt(point.y) + " Z" + PathUtils.fmt(obj.FinalDepth.Value)
- output += " I" + PathUtils.fmt(relcenter.x) + " J" + PathUtils.fmt(relcenter.y) + " K" + PathUtils.fmt(relcenter.z)
- output += " F " + PathUtils.fmt(self.horizFeed)
- output += "\n"
- last = point
- else:
- point = edge.Vertexes[-1].Point
- if point == last: # edges can come flipped
- point = edge.Vertexes[0].Point
- output += "G1 X" + PathUtils.fmt(point.x) + " Y" + PathUtils.fmt(point.y) + " Z" + PathUtils.fmt(obj.FinalDepth.Value)
- output += " F " + PathUtils.fmt(self.horizFeed)
- output += "\n"
- last = point
+ point = edge.Vertexes[-1].Point
+ if point == last: # edges can come flipped
+ point = edge.Vertexes[0].Point
+ output += "G1 X" + PathUtils.fmt(point.x) + " Y" + PathUtils.fmt(point.y) + " Z" + PathUtils.fmt(z)
+ output += " F " + PathUtils.fmt(self.horizFeed)
+ output += "\n"
+ self.commandlist.append(Path.Command('G1', {'X': point.x, 'Y': point.y, 'Z': z, 'F': self.horizFeed}))
+ last = point
output += "G0 Z " + PathUtils.fmt(obj.ClearanceHeight.Value)
+ self.commandlist.append(Path.Command('G0', {'Z': obj.ClearanceHeight.Value, 'F': self.vertRapid}))
return output
-
-class _ViewProviderEngrave:
-
- def __init__(self, vobj):
- vobj.Proxy = self
- self.taskPanel = None
-
- def attach(self, vobj):
- self.Object = vobj.Object
-
- def deleteObjectsOnReject(self):
- return hasattr(self, 'deleteOnReject') and self.deleteOnReject
-
- def setEdit(self, vobj, mode=0):
- PathLog.track()
- FreeCADGui.Control.closeDialog()
-
- self.taskPanel = TaskPanel(vobj, self.deleteObjectsOnReject())
- FreeCADGui.Control.showDialog(self.taskPanel)
- self.taskPanel.setupUi()
- self.deleteOnReject = False
- return True
-
-# def unsetEdit(self, vobj, mode):
-# PathLog.track()
-# if hasattr(self, 'taskPanel') and self.taskPanel:
-# self.taskPanel.abort()
-
- def clearTaskPanel(self):
- self.taskpanel = None
- FreeCADGui.Selection.removeSelectionGate()
- FreeCADGui.Selection.removeObserver(self)
-
- def resetTaskPanel(self):
- PathLog.track()
- self.taskPanel = None
-
- def getIcon(self):
- return ":/icons/Path-Engrave.svg"
-
- def __getstate__(self):
- return None
-
- def __setstate__(self, state):
- return None
-
-
-class CommandPathEngrave:
-
- def GetResources(self):
- return {'Pixmap': 'Path-Engrave',
- 'MenuText': QtCore.QT_TRANSLATE_NOOP("Path_Engrave", "ShapeString Engrave"),
- 'ToolTip': QtCore.QT_TRANSLATE_NOOP("Path_Engrave", "Creates an Engraving Path around a Draft ShapeString")}
-
- def IsActive(self):
- if FreeCAD.ActiveDocument is not None:
- for o in FreeCAD.ActiveDocument.Objects:
- if o.Name[:3] == "Job":
- return True
- return False
-
- def Activated(self):
-
- # if everything is ok, execute and register the transaction in the undo/redo stack
- FreeCAD.ActiveDocument.openTransaction("Create Engrave Path")
- FreeCADGui.addModule("PathScripts.PathFaceProfile")
- FreeCADGui.addModule("PathScripts.PathUtils")
-
- FreeCADGui.doCommand('obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", "PathEngrave")')
- FreeCADGui.doCommand('PathScripts.PathEngrave.ObjectPathEngrave(obj)')
- FreeCADGui.doCommand('PathScripts.PathUtils.addToJob(obj)')
-
- FreeCADGui.doCommand('obj.ClearanceHeight = 10')
- FreeCADGui.doCommand('obj.FinalDepth= -0.1')
- FreeCADGui.doCommand('obj.SafeHeight= 5.0')
- FreeCADGui.doCommand('obj.Active = True')
- FreeCADGui.doCommand('obj.ViewObject.Proxy.deleteOnReject = True')
- FreeCADGui.doCommand('obj.ToolController = PathScripts.PathUtils.findToolController(obj)')
-
- FreeCADGui.doCommand('obj.ViewObject.startEditing()')
-
- FreeCAD.ActiveDocument.commitTransaction()
-
-
-class TaskPanel:
- def __init__(self, vobj, deleteOnReject):
- FreeCAD.ActiveDocument.openTransaction(translate("Path_Engrave", "Engraving Operation"))
- self.form = FreeCADGui.PySideUic.loadUi(":/panels/EngraveEdit.ui")
- self.vobj = vobj
- self.obj = vobj.Object
- self.deleteOnReject = deleteOnReject
- self.isDirty = True
-
- def accept(self):
- FreeCADGui.Control.closeDialog()
- FreeCADGui.ActiveDocument.resetEdit()
- FreeCAD.ActiveDocument.commitTransaction()
- FreeCADGui.Selection.removeObserver(self.s)
- if self.isDirty:
- FreeCAD.ActiveDocument.recompute()
-
- def reject(self):
- FreeCADGui.Control.closeDialog()
- FreeCADGui.ActiveDocument.resetEdit()
- FreeCAD.ActiveDocument.abortTransaction()
- FreeCADGui.Selection.removeObserver(self.s)
- if self.deleteOnReject:
- FreeCAD.ActiveDocument.openTransaction(translate("Path_Engrave", "Uncreate Engrave Operation"))
- FreeCAD.ActiveDocument.removeObject(self.obj.Name)
- FreeCAD.ActiveDocument.commitTransaction()
- FreeCAD.ActiveDocument.recompute()
-
- def clicked(self,button):
- if button == QtGui.QDialogButtonBox.Apply:
- self.getFields()
- FreeCAD.ActiveDocument.recompute()
- self.isDirty = False
-
-
- def getFields(self):
- if self.obj:
- if hasattr(self.obj, "StartDepth"):
- self.obj.StartDepth = FreeCAD.Units.Quantity(self.form.startDepth.text()).Value
- if hasattr(self.obj, "FinalDepth"):
- self.obj.FinalDepth = FreeCAD.Units.Quantity(self.form.finalDepth.text()).Value
- if hasattr(self.obj, "SafeHeight"):
- self.obj.SafeHeight = FreeCAD.Units.Quantity(self.form.safeHeight.text()).Value
- if hasattr(self.obj, "ClearanceHeight"):
- self.obj.ClearanceHeight = FreeCAD.Units.Quantity(self.form.clearanceHeight.text()).Value
- if hasattr(self.obj, "ToolController"):
- tc = PathUtils.findToolController(self.obj, self.form.uiToolController.currentText())
- self.obj.ToolController = tc
- self.isDirty = True
- # self.obj.Proxy.execute(self.obj)
-
- def setFields(self):
- self.form.finalDepth.setText(FreeCAD.Units.Quantity(self.obj.FinalDepth.Value, FreeCAD.Units.Length).UserString)
- self.form.startDepth.setText(FreeCAD.Units.Quantity(self.obj.StartDepth.Value, FreeCAD.Units.Length).UserString)
- self.form.safeHeight.setText(FreeCAD.Units.Quantity(self.obj.SafeHeight.Value, FreeCAD.Units.Length).UserString)
- self.form.clearanceHeight.setText(FreeCAD.Units.Quantity(self.obj.ClearanceHeight.Value, FreeCAD.Units.Length).UserString)
-
- controllers = PathUtils.getToolControllers(self.obj)
- labels = [c.Label for c in controllers]
- self.form.uiToolController.blockSignals(True)
- self.form.uiToolController.addItems(labels)
- self.form.uiToolController.blockSignals(False)
-
- if self.obj.ToolController is None:
- self.obj.ToolController = PathUtils.findToolController(self.obj)
-
- if self.obj.ToolController is not None:
- index = self.form.uiToolController.findText(
- self.obj.ToolController.Label, QtCore.Qt.MatchFixedString)
- if index >= 0:
- self.form.uiToolController.blockSignals(True)
- self.form.uiToolController.setCurrentIndex(index)
- self.form.uiToolController.blockSignals(False)
+ def opSetDefaultValues(self, obj):
+ job = PathUtils.findParentJob(obj)
+ if job and job.Base:
+ bb = job.Base.Shape.BoundBox
+ obj.StartDepth = bb.ZMax
+ obj.FinalDepth = bb.ZMin
+ obj.ClearanceHeight = bb.ZMax + 5.0
+ obj.SafeHeight = bb.ZMax + 3.0
else:
- self.obj.ToolController = PathUtils.findToolController(self.obj)
+ obj.FinalDepth = -0.1
+ if obj.StartDepth.Value != obj.FinalDepth.Value:
+ # maintain behaviour of a single run
+ obj.StepDown = obj.StartDepth.Value - obj.FinalDepth.Value
- def open(self):
- self.s = SelObserver()
- # install the function mode resident
- FreeCADGui.Selection.addObserver(self.s)
+def Create(name):
+ obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", name)
+ proxy = ObjectEngrave(obj)
+ return obj
- def getStandardButtons(self):
- return int(QtGui.QDialogButtonBox.Ok | QtGui.QDialogButtonBox.Apply | QtGui.QDialogButtonBox.Cancel)
-
- def setupUi(self):
- # Connect Signals and Slots
- self.form.startDepth.editingFinished.connect(self.getFields)
- self.form.finalDepth.editingFinished.connect(self.getFields)
- self.form.safeHeight.editingFinished.connect(self.getFields)
- self.form.clearanceHeight.editingFinished.connect(self.getFields)
- self.form.uiToolController.currentIndexChanged.connect(self.getFields)
-
- self.setFields()
-
-
-class SelObserver:
- def __init__(self):
- import PathScripts.PathSelection as PST
- PST.engraveselect()
-
- def __del__(self):
- import PathScripts.PathSelection as PST
- PST.clear()
-
- def addSelection(self, doc, obj, sub, pnt):
- FreeCADGui.doCommand('Gui.Selection.addSelection(FreeCAD.ActiveDocument.' + obj + ')')
- FreeCADGui.updateGui()
-
-if FreeCAD.GuiUp:
- FreeCADGui.addCommand('Path_Engrave', CommandPathEngrave())
diff --git a/src/Mod/Path/PathScripts/PathOp.py b/src/Mod/Path/PathScripts/PathOp.py
index bb17c3f0d1..3815e261a1 100644
--- a/src/Mod/Path/PathScripts/PathOp.py
+++ b/src/Mod/Path/PathScripts/PathOp.py
@@ -143,6 +143,7 @@ class ObjectOp(object):
obj.ViewObject.Visibility = False
return
+ job = PathUtils.findParentJob(obj)
if not job:
PathLog.error(translate("Path", "No parent job found for operation."))
return
diff --git a/src/Mod/Path/PathScripts/PathPocketBaseGui.py b/src/Mod/Path/PathScripts/PathPocketBaseGui.py
index 3d5937de82..7b727392d5 100644
--- a/src/Mod/Path/PathScripts/PathPocketBaseGui.py
+++ b/src/Mod/Path/PathScripts/PathPocketBaseGui.py
@@ -51,36 +51,36 @@ class TaskPanelOpPage(PathOpGui.TaskPanelPage):
return form
def getFields(self, obj):
- self.obj.CutMode = str(self.form.cutMode.currentText())
- self.obj.StepOver = self.form.stepOverPercent.value()
- self.obj.OffsetPattern = str(self.form.offsetPattern.currentText())
- self.obj.ZigZagAngle = FreeCAD.Units.Quantity(self.form.zigZagAngle.text()).Value
+ obj.CutMode = str(self.form.cutMode.currentText())
+ obj.StepOver = self.form.stepOverPercent.value()
+ obj.OffsetPattern = str(self.form.offsetPattern.currentText())
+ obj.ZigZagAngle = FreeCAD.Units.Quantity(self.form.zigZagAngle.text()).Value
- self.updateToolController(self.obj, self.form.toolController)
+ self.updateToolController(obj, self.form.toolController)
if FeaturePocket & self.pocketFeatures():
- self.obj.MaterialAllowance = FreeCAD.Units.Quantity(self.form.extraOffset.text()).Value
- self.obj.UseStartPoint = self.form.useStartPoint.isChecked()
+ obj.MaterialAllowance = FreeCAD.Units.Quantity(self.form.extraOffset.text()).Value
+ obj.UseStartPoint = self.form.useStartPoint.isChecked()
if FeatureFacing & self.pocketFeatures():
- self.obj.PassExtension = FreeCAD.Units.Quantity(self.form.passExtension.text()).Value
- self.obj.BoundaryShape = str(self.form.boundaryShape.currentText())
+ obj.PassExtension = FreeCAD.Units.Quantity(self.form.passExtension.text()).Value
+ obj.BoundaryShape = str(self.form.boundaryShape.currentText())
def setFields(self, obj):
- self.form.zigZagAngle.setText(FreeCAD.Units.Quantity(self.obj.ZigZagAngle, FreeCAD.Units.Angle).UserString)
- self.form.stepOverPercent.setValue(self.obj.StepOver)
+ self.form.zigZagAngle.setText(FreeCAD.Units.Quantity(obj.ZigZagAngle, FreeCAD.Units.Angle).UserString)
+ self.form.stepOverPercent.setValue(obj.StepOver)
- self.selectInComboBox(self.obj.OffsetPattern, self.form.offsetPattern)
- self.selectInComboBox(self.obj.CutMode, self.form.cutMode)
- self.setupToolController(self.obj, self.form.toolController)
+ self.selectInComboBox(obj.OffsetPattern, self.form.offsetPattern)
+ self.selectInComboBox(obj.CutMode, self.form.cutMode)
+ self.setupToolController(obj, self.form.toolController)
if FeaturePocket & self.pocketFeatures():
- self.form.useStartPoint.setChecked(self.obj.UseStartPoint)
- self.form.extraOffset.setText(FreeCAD.Units.Quantity(self.obj.MaterialAllowance.Value, FreeCAD.Units.Length).UserString)
+ self.form.useStartPoint.setChecked(obj.UseStartPoint)
+ self.form.extraOffset.setText(FreeCAD.Units.Quantity(obj.MaterialAllowance.Value, FreeCAD.Units.Length).UserString)
if FeatureFacing & self.pocketFeatures():
- self.form.passExtension.setText(FreeCAD.Units.Quantity(self.obj.PassExtension.Value, FreeCAD.Units.Length).UserString)
- self.selectInComboBox(self.obj.BoundaryShape, self.form.boundaryShape)
+ self.form.passExtension.setText(FreeCAD.Units.Quantity(obj.PassExtension.Value, FreeCAD.Units.Length).UserString)
+ self.selectInComboBox(obj.BoundaryShape, self.form.boundaryShape)
def getSignalsForUpdate(self, obj):
signals = []
diff --git a/src/Mod/Path/PathScripts/PathSelection.py b/src/Mod/Path/PathScripts/PathSelection.py
index f12f66605a..9670437dd5 100644
--- a/src/Mod/Path/PathScripts/PathSelection.py
+++ b/src/Mod/Path/PathScripts/PathSelection.py
@@ -164,6 +164,7 @@ def select(op):
opsel = {}
opsel['Contour'] = contourselect
opsel['Drilling'] = drillselect
+ opsel['Engrave'] = engraveselect
opsel['Helix'] = drillselect
opsel['MillFace'] = pocketselect
opsel['Pocket'] = pocketselect