diff --git a/src/Mod/Path/Gui/Resources/Path.qrc b/src/Mod/Path/Gui/Resources/Path.qrc
index ca3603f12d..aa19370edb 100644
--- a/src/Mod/Path/Gui/Resources/Path.qrc
+++ b/src/Mod/Path/Gui/Resources/Path.qrc
@@ -54,6 +54,7 @@
panels/DlgJobChooser.ui
panels/DlgSelectPostProcessor.ui
panels/DlgToolCopy.ui
+ panels/DlgTCChooser.ui
panels/DogboneEdit.ui
panels/DrillingEdit.ui
panels/EngraveEdit.ui
diff --git a/src/Mod/Path/Gui/Resources/panels/DlgTCChooser.ui b/src/Mod/Path/Gui/Resources/panels/DlgTCChooser.ui
new file mode 100644
index 0000000000..a9ab7d0ed8
--- /dev/null
+++ b/src/Mod/Path/Gui/Resources/panels/DlgTCChooser.ui
@@ -0,0 +1,83 @@
+
+
+ DlgJobChooser
+
+
+ Qt::WindowModal
+
+
+
+ 0
+ 0
+ 367
+ 99
+
+
+
+
+ 0
+ 0
+
+
+
+ Choose a Tool Controller
+
+
+ -
+
+
+ Tool Controller
+
+
+
+ -
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QDialogButtonBox::Cancel|QDialogButtonBox::Ok
+
+
+
+
+
+
+
+
+ buttonBox
+ accepted()
+ DlgJobChooser
+ accept()
+
+
+ 248
+ 254
+
+
+ 157
+ 274
+
+
+
+
+ buttonBox
+ rejected()
+ DlgJobChooser
+ reject()
+
+
+ 316
+ 260
+
+
+ 286
+ 274
+
+
+
+
+
diff --git a/src/Mod/Path/PathScripts/PathContour.py b/src/Mod/Path/PathScripts/PathContour.py
index 8cb14e0522..8724ccd88c 100644
--- a/src/Mod/Path/PathScripts/PathContour.py
+++ b/src/Mod/Path/PathScripts/PathContour.py
@@ -438,7 +438,9 @@ class TaskPanel:
index = self.form.direction.findText(
self.obj.Direction, QtCore.Qt.MatchFixedString)
if index >= 0:
+ self.form.direction.blockSignals(True)
self.form.direction.setCurrentIndex(index)
+ self.form.direction.blockSignals(False)
controllers = PathUtils.getToolControllers(self.obj)
labels = [c.Label for c in controllers]
@@ -447,7 +449,9 @@ class TaskPanel:
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 open(self):
self.s = SelObserver()
diff --git a/src/Mod/Path/PathScripts/PathDrilling.py b/src/Mod/Path/PathScripts/PathDrilling.py
index ce15d395e3..dfd2cc0766 100644
--- a/src/Mod/Path/PathScripts/PathDrilling.py
+++ b/src/Mod/Path/PathScripts/PathDrilling.py
@@ -35,8 +35,8 @@ from PathScripts.PathUtils import fmt
LOG_MODULE = 'PathDrilling'
-PathLog.setLevel(PathLog.Level.DEBUG, LOG_MODULE)
-PathLog.trackModule('PathDrilling')
+PathLog.setLevel(PathLog.Level.INFO, LOG_MODULE)
+#PathLog.trackModule('PathDrilling')
FreeCADGui = None
if FreeCAD.GuiUp:
@@ -83,6 +83,10 @@ class ObjectDrilling:
obj.addProperty("App::PropertyLink", "ToolController", "Path", QtCore.QT_TRANSLATE_NOOP("App::Property", "The tool controller that will be used to calculate the path"))
obj.Proxy = self
+ self.vertFeed = 0.0
+ self.horizFeed = 0.0
+ self.vertRapid = 0.0
+ self.horizRapid = 0.0
def __getstate__(self):
return None
@@ -91,8 +95,9 @@ class ObjectDrilling:
return None
def onChanged(self, obj, prop):
- if prop == "UserLabel":
- obj.Label = obj.UserLabel + " :" + obj.ToolDescription
+ pass
+ # if prop == "UserLabel":
+ # obj.Label = obj.UserLabel + " :" + obj.ToolDescription
def execute(self, obj):
PathLog.track()
@@ -244,7 +249,7 @@ class ObjectDrilling:
baselist.append(item)
obj.Base = baselist
- self.execute(obj)
+ #self.execute(obj)
class _ViewProviderDrill:
@@ -312,7 +317,6 @@ class CommandPathDrilling:
FreeCADGui.doCommand('obj.RetractHeight= ' + str(ztop))
FreeCADGui.doCommand('obj.FinalDepth=' + str(zbottom))
FreeCADGui.doCommand('PathScripts.PathUtils.addToJob(obj)')
- FreeCADGui.doCommand('obj.ToolController = PathScripts.PathUtils.findToolController(obj)')
FreeCAD.ActiveDocument.commitTransaction()
FreeCAD.ActiveDocument.recompute()
@@ -324,7 +328,7 @@ class TaskPanel:
self.form = FreeCADGui.PySideUic.loadUi(":/panels/DrillingEdit.ui")
def accept(self):
- self.getFields()
+ #self.getFields()
FreeCADGui.ActiveDocument.resetEdit()
FreeCADGui.Control.closeDialog()
@@ -337,6 +341,7 @@ class TaskPanel:
FreeCADGui.Selection.removeObserver(self.s)
def getFields(self):
+ PathLog.track()
if self.obj:
if hasattr(self.obj, "StartDepth"):
self.obj.StartDepth = FreeCAD.Units.Quantity(self.form.startDepth.text()).Value
@@ -351,11 +356,13 @@ class TaskPanel:
if hasattr(self.obj, "RetractHeight"):
self.obj.RetractHeight = FreeCAD.Units.Quantity(self.form.retractHeight.text()).Value
if hasattr(self.obj, "ToolController"):
+ PathLog.debug("name: {}".format(self.form.uiToolController.currentText()))
tc = PathUtils.findToolController(self.obj, self.form.uiToolController.currentText())
self.obj.ToolController = tc
self.obj.Proxy.execute(self.obj)
def setFields(self):
+ PathLog.track()
self.form.startDepth.setText(FreeCAD.Units.Quantity(self.obj.StartDepth.Value, FreeCAD.Units.Length).UserString)
self.form.finalDepth.setText(FreeCAD.Units.Quantity(self.obj.FinalDepth.Value, FreeCAD.Units.Length).UserString)
self.form.peckDepth.setText(FreeCAD.Units.Quantity(self.obj.PeckDepth.Value, FreeCAD.Units.Length).UserString)
@@ -370,12 +377,20 @@ class TaskPanel:
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 not None:
index = self.form.uiToolController.findText(
self.obj.ToolController.Label, QtCore.Qt.MatchFixedString)
+ PathLog.debug("searching for TC label {}. Found Index: {}".format(self.obj.ToolController.Label, index))
if index >= 0:
+ self.form.uiToolController.blockSignals(True)
self.form.uiToolController.setCurrentIndex(index)
+ self.form.uiToolController.blockSignals(False)
+ else:
+ self.obj.ToolController = PathUtils.findToolController(self.obj)
+
def open(self):
self.s = SelObserver()
@@ -446,6 +461,7 @@ class TaskPanel:
return int(QtGui.QDialogButtonBox.Ok)
def setupUi(self):
+ PathLog.track()
# Connect Signals and Slots
self.form.startDepth.editingFinished.connect(self.getFields)
diff --git a/src/Mod/Path/PathScripts/PathLoadTool.py b/src/Mod/Path/PathScripts/PathLoadTool.py
index 56bdd55e3d..beee9c2ec9 100644
--- a/src/Mod/Path/PathScripts/PathLoadTool.py
+++ b/src/Mod/Path/PathScripts/PathLoadTool.py
@@ -72,12 +72,12 @@ class LoadTool():
toolnum = obj.Tooltable.Tools.keys()[0]
commands = ""
commands += "(" + obj.Label + ")"+'\n'
- commands += 'M6T'+str(toolnum)+'\n'
+ commands += 'M6 T'+str(toolnum)+'\n'
if obj.SpindleDir == 'Forward':
- commands += 'M3S' + str(obj.SpindleSpeed) + '\n'
+ commands += 'M3 S' + str(obj.SpindleSpeed) + '\n'
else:
- commands += 'M4S' + str(obj.SpindleSpeed) + '\n'
+ commands += 'M4 S' + str(obj.SpindleSpeed) + '\n'
if commands == "":
commands += "(No commands processed)"
@@ -245,7 +245,6 @@ class TaskPanel:
def getFields(self):
if self.obj:
-
if hasattr(self.obj, "Label"):
self.obj.Label = self.form.tcoName.text()
if hasattr(self.obj, "VertFeed"):
diff --git a/src/Mod/Path/PathScripts/PathUtils.py b/src/Mod/Path/PathScripts/PathUtils.py
index a145c908b4..3bf150a116 100644
--- a/src/Mod/Path/PathScripts/PathUtils.py
+++ b/src/Mod/Path/PathScripts/PathUtils.py
@@ -36,10 +36,9 @@ from FreeCAD import Vector
LOG_MODULE = 'PathUtils'
PathLog.setLevel(PathLog.Level.INFO, LOG_MODULE)
-PathLog.trackModule('PathUtils')
+#PathLog.trackModule('PathUtils')
def cleanedges(splines, precision):
- PathLog.track()
'''cleanedges([splines],precision). Convert BSpline curves, Beziers, to arcs that can be used for cnc paths.
Returns Lines as is. Filters Circle and Arcs for over 180 degrees. Discretizes Ellipses. Ignores other geometry. '''
edges = []
@@ -76,7 +75,6 @@ def cleanedges(splines, precision):
def curvetowire(obj, steps):
'''adapted from DraftGeomUtils, because the discretize function changed a bit '''
- PathLog.track()
points = obj.copy().discretize(Distance=eval('steps'))
p0 = points[0]
edgelist = []
@@ -87,7 +85,6 @@ def curvetowire(obj, steps):
return edgelist
def isDrillable(obj, candidate):
- PathLog.track()
PathLog.debug('obj: {} candidate {}')
drillable = False
if candidate.ShapeType == 'Face':
@@ -100,11 +97,9 @@ def isDrillable(obj, candidate):
v1 = edge.Vertexes[1].Point
if (v1.sub(v0).x == 0) and (v1.sub(v0).y == 0):
# vector of top center
- lsp = Vector(face.BoundBox.Center.x,
- face.BoundBox.Center.y, face.BoundBox.ZMax)
+ lsp = Vector(face.BoundBox.Center.x,face.BoundBox.Center.y, face.BoundBox.ZMax)
# vector of bottom center
- lep = Vector(face.BoundBox.Center.x,
- face.BoundBox.Center.y, face.BoundBox.ZMin)
+ lep = Vector(face.BoundBox.Center.x,face.BoundBox.Center.y, face.BoundBox.ZMin)
if obj.isInside(lsp, 0, False) or obj.isInside(lep, 0, False):
drillable = False
# eliminate elliptical holes
@@ -112,11 +107,7 @@ def isDrillable(obj, candidate):
drillable = False
else:
drillable = True
- else:
- print('here')
- drillable = False
else:
- print ('looking at edges')
for edge in candidate.Edges:
if (isinstance(edge.Curve, Part.Circle)):
if abs(edge.BoundBox.XLength - edge.BoundBox.YLength) > 0.05:
@@ -223,8 +214,6 @@ def changeTool(obj, job):
def getToolControllers(obj):
'''returns all the tool controllers'''
-
- PathLog.track()
controllers = []
try:
parent = obj.InList[0]
@@ -238,20 +227,40 @@ def getToolControllers(obj):
controllers.append(g)
return controllers
-def findToolController(obj, name=""):
+def findToolController(obj, name=None):
'''returns a tool controller with a given name.
If no name is specified, returns the first controller.
if no controller is found, returns None'''
- PathLog.track()
+ PathLog.track('name: {}'.format(name))
controllers = getToolControllers(obj)
- for c in controllers:
- if c.Label == name:
- return c
- if len(controllers) > 0:
- return controllers[0]
+
+ if len(controllers) == 1:
+ if name is None or name == controllers[0].Label:
+ tc = controllers[0]
+ else:
+ tc = None
+ elif name is not None:
+ tc = [i for i in controllers if i.Label == name][0]
else:
- return None
+ #form = FreeCADGui.PySideUic.loadUi(FreeCAD.getHomePath() + "Mod/Path/DlgTCChooser.ui")
+ form = FreeCADGui.PySideUic.loadUi(":/panels/DlgTCChooser.ui")
+ mylist = [i.Label for i in controllers]
+ form.uiToolController.addItems(mylist)
+ r = form.exec_()
+ if r is False:
+ tc = None
+ else:
+ tc = [i for i in controllers if i.Label == form.uiToolController.currentText()][0]
+ return tc
+
+ # for c in controllers:
+ # if c.Label == name:
+ # return c
+ # if len(controllers) > 0:
+ # return controllers[0]
+ # else:
+ # return None
def findParentJob(obj):
'''retrieves a parent job object for an operation or other Path object'''