diff --git a/src/Mod/Path/Gui/Resources/Path.qrc b/src/Mod/Path/Gui/Resources/Path.qrc
index 2e0873a2be..6111dcf762 100644
--- a/src/Mod/Path/Gui/Resources/Path.qrc
+++ b/src/Mod/Path/Gui/Resources/Path.qrc
@@ -94,6 +94,7 @@
panels/DlgToolEdit.ui
panels/DogboneEdit.ui
panels/DressupPathBoundary.ui
+ panels/DragKnifeEdit.ui
panels/HoldingTagsEdit.ui
panels/PageBaseGeometryEdit.ui
panels/PageBaseHoleGeometryEdit.ui
diff --git a/src/Mod/Path/Gui/Resources/panels/DragKnifeEdit.ui b/src/Mod/Path/Gui/Resources/panels/DragKnifeEdit.ui
new file mode 100644
index 0000000000..b9ed04d37e
--- /dev/null
+++ b/src/Mod/Path/Gui/Resources/panels/DragKnifeEdit.ui
@@ -0,0 +1,110 @@
+
+
+ TaskPanel
+
+
+
+ 0
+ 0
+ 376
+ 387
+
+
+
+ Dragknife Dressup
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 275
+
+
+
+
+ -
+
+
+ Filter Angle
+
+
+
+ -
+
+
+ Pivot Height
+
+
+
+ -
+
+
+ <html><head/><body><p>Distance the point trails behind the spindle</p></body></html>
+
+
+ mm
+
+
+ 0.000000000000000
+
+
+ 100.000000000000000
+
+
+ 2.000000000000000
+
+
+
+ -
+
+
+ Offset Distance
+
+
+
+ -
+
+
+ <html><head/><body><p>Height to raise during corner action</p></body></html>
+
+
+ mm
+
+
+ 0.000000000000000
+
+
+ 100.000000000000000
+
+
+ 4.000000000000000
+
+
+
+ -
+
+
+ <html><head/><body><p>Angles less than filter angle will not receive corner actions</p></body></html>
+
+
+ deg
+
+
+
+
+
+
+
+ Gui::QuantitySpinBox
+ QWidget
+
+
+
+
+
+
diff --git a/src/Mod/Path/PathScripts/PathDressupDragknife.py b/src/Mod/Path/PathScripts/PathDressupDragknife.py
index 38badc176d..cdea6c3265 100644
--- a/src/Mod/Path/PathScripts/PathDressupDragknife.py
+++ b/src/Mod/Path/PathScripts/PathDressupDragknife.py
@@ -28,6 +28,7 @@ import Path
from PySide import QtCore
import math
import PathScripts.PathUtils as PathUtils
+import PathScripts.PathGui as PathGui
# lazily loaded modules
from lazy_loader.lazy_loader import LazyLoader
@@ -38,10 +39,12 @@ __doc__ = """Dragknife Dressup object and FreeCAD command"""
if FreeCAD.GuiUp:
import FreeCADGui
+
# Qt translation handling
def translate(context, text, disambig=None):
return QtCore.QCoreApplication.translate(context, text, disambig)
+
movecommands = ['G1', 'G01', 'G2', 'G02', 'G3', 'G03']
rapidcommands = ['G0', 'G00']
arccommands = ['G2', 'G3', 'G02', 'G03']
@@ -52,8 +55,8 @@ currLocation = {}
class ObjectDressup:
def __init__(self, obj):
- obj.addProperty("App::PropertyLink", "Base", "Path", QtCore.QT_TRANSLATE_NOOP("App::Property", "The base path to modify"))
- obj.addProperty("App::PropertyAngle", "filterangle", "Path", QtCore.QT_TRANSLATE_NOOP("App::Property", "Angles less than filter angle will not receive corner actions"))
+ obj.addProperty("App::PropertyLink", "Base", "Path", QtCore.QT_TRANSLATE_NOOP("App::Property", "The base path to modify"))
+ obj.addProperty("App::PropertyAngle", "filterAngle", "Path", QtCore.QT_TRANSLATE_NOOP("App::Property", "Angles less than filter angle will not receive corner actions"))
obj.addProperty("App::PropertyFloat", "offset", "Path", QtCore.QT_TRANSLATE_NOOP("App::Property", "Distance the point trails behind the spindle"))
obj.addProperty("App::PropertyFloat", "pivotheight", "Path", QtCore.QT_TRANSLATE_NOOP("App::Property", "Height to raise during corner action"))
@@ -66,7 +69,8 @@ class ObjectDressup:
return None
def shortcut(self, queue):
- '''Determines whether its shorter to twist CW or CCW to align with the next move'''
+ '''Determines whether its shorter to twist CW or CCW to align with
+ the next move'''
# get the vector of the last move
if queue[1].Name in arccommands:
@@ -127,7 +131,7 @@ class ObjectDressup:
def arcExtension(self, obj, queue):
'''returns gcode for arc extension'''
- global currLocation # pylint: disable=global-statement
+ global currLocation # pylint: disable=global-statement
results = []
offset = obj.offset
@@ -166,7 +170,7 @@ class ObjectDressup:
'''returns gcode to do an arc move toward an arc to perform
a corner action twist. Includes lifting and plungeing the knife'''
- global currLocation # pylint: disable=global-statement
+ global currLocation # pylint: disable=global-statement
pivotheight = obj.pivotheight
offset = obj.offset
results = []
@@ -233,7 +237,7 @@ class ObjectDressup:
def lineExtension(self, obj, queue):
'''returns gcode for line extension'''
- global currLocation # pylint: disable=global-statement
+ global currLocation # pylint: disable=global-statement
offset = float(obj.offset)
results = []
@@ -259,7 +263,7 @@ class ObjectDressup:
def lineTwist(self, obj, queue, lastXY, twistCW=False):
'''returns gcode to do an arc move toward a line to perform
a corner action twist. Includes lifting and plungeing the knife'''
- global currLocation # pylint: disable=global-statement
+ global currLocation # pylint: disable=global-statement
pivotheight = obj.pivotheight
offset = obj.offset
@@ -310,7 +314,7 @@ class ObjectDressup:
def execute(self, obj):
newpath = []
- global currLocation # pylint: disable=global-statement
+ global currLocation # pylint: disable=global-statement
if not obj.Base:
return
@@ -384,7 +388,7 @@ class ObjectDressup:
# check if the inciden angle incident exceeds the filter
incident_angle = self.getIncidentAngle(queue)
- if abs(incident_angle) >= obj.filterangle:
+ if abs(incident_angle) >= obj.filterAngle:
if self.shortcut(queue) == "CW":
# if incident_angle >= 0:
twistCW = True
@@ -430,6 +434,56 @@ class ObjectDressup:
obj.Path = path
+class TaskPanel:
+
+ def __init__(self, obj):
+ self.obj = obj
+ self.form = FreeCADGui.PySideUic.loadUi(":/panels/DragKnifeEdit.ui")
+ self.filterAngle = PathGui.QuantitySpinBox(self.form.filterAngle, obj, 'filterAngle')
+ self.offsetDistance = PathGui.QuantitySpinBox(self.form.offsetDistance, obj, 'offset')
+ self.pivotHeight = PathGui.QuantitySpinBox(self.form.pivotHeight, obj, 'pivotheight')
+
+ FreeCAD.ActiveDocument.openTransaction(translate("Path_DressupDragKnife", "Edit Dragknife Dress-up"))
+
+ def reject(self):
+ FreeCAD.ActiveDocument.abortTransaction()
+ FreeCADGui.Control.closeDialog()
+ FreeCAD.ActiveDocument.recompute()
+
+ def accept(self):
+ self.getFields()
+ FreeCAD.ActiveDocument.commitTransaction()
+ FreeCADGui.ActiveDocument.resetEdit()
+ FreeCADGui.Control.closeDialog()
+ FreeCAD.ActiveDocument.recompute()
+
+ def getFields(self):
+ self.filterAngle.updateProperty()
+ self.offsetDistance.updateProperty()
+ self.pivotHeight.updateProperty()
+ self.updateUI()
+
+ self.obj.Proxy.execute(self.obj)
+
+ def updateUI(self):
+ self.filterAngle.updateSpinBox()
+ self.offsetDistance.updateSpinBox()
+ self.pivotHeight.updateSpinBox()
+
+ def updateModel(self):
+ self.getFields()
+ FreeCAD.ActiveDocument.recompute()
+
+ def setFields(self):
+ self.updateUI()
+
+ def open(self):
+ pass
+
+ def setupUi(self):
+ self.setFields()
+
+
class ViewProviderDressup:
def __init__(self, vobj):
@@ -454,6 +508,10 @@ class ViewProviderDressup:
def setEdit(self, vobj, mode=0):
# pylint: disable=unused-argument
+ FreeCADGui.Control.closeDialog()
+ panel = TaskPanel(vobj.Object)
+ FreeCADGui.Control.showDialog(panel)
+ panel.setupUi()
return True
def claimChildren(self):
@@ -521,9 +579,10 @@ class CommandDressupDragknife:
FreeCADGui.doCommand('job.Proxy.addOperation(obj, base)')
FreeCADGui.doCommand('obj.ViewObject.Proxy = PathScripts.PathDressupDragknife.ViewProviderDressup(obj.ViewObject)')
FreeCADGui.doCommand('Gui.ActiveDocument.getObject(base.Name).Visibility = False')
- FreeCADGui.doCommand('obj.filterangle = 20')
+ FreeCADGui.doCommand('obj.filterAngle = 20')
FreeCADGui.doCommand('obj.offset = 2')
FreeCADGui.doCommand('obj.pivotheight = 4')
+ FreeCADGui.doCommand('obj.ViewObject.Document.setEdit(obj.ViewObject, 0)')
FreeCAD.ActiveDocument.commitTransaction()
FreeCAD.ActiveDocument.recompute()