diff --git a/src/Mod/Path/Gui/Resources/panels/PageOpProbeEdit.ui b/src/Mod/Path/Gui/Resources/panels/PageOpProbeEdit.ui index c2c9a27309..f222080379 100644 --- a/src/Mod/Path/Gui/Resources/panels/PageOpProbeEdit.ui +++ b/src/Mod/Path/Gui/Resources/panels/PageOpProbeEdit.ui @@ -6,8 +6,8 @@ 0 0 - 400 - 140 + 424 + 376 @@ -47,27 +47,113 @@ - - - - - - Algorithm + + + Probe Grid Points + + + + + + 3 + + + 1000 - - - - - OCL Dropcutter - - - - - OCL Waterline - - + + + + 3 + + + 1000 + + + + + + + X: + + + + + + + Y: + + + + + + + + + + Probe + + + + + + Y Offset + + + + + + + + + + + + + + X Offset + + + + + + + + + + + + + + + + + Output + + + + + + File Name + + + + + + + <html><head/><body><p>Enter the filename where the probe points should be written.</p></body></html> + + + ProbePoints.txt + + + + + + + ... + @@ -88,6 +174,13 @@ + + + Gui::InputField + QLineEdit +
Gui/InputField.h
+
+
diff --git a/src/Mod/Path/PathScripts/PathProbe.py b/src/Mod/Path/PathScripts/PathProbe.py index 4bb66b1261..9e27b53411 100644 --- a/src/Mod/Path/PathScripts/PathProbe.py +++ b/src/Mod/Path/PathScripts/PathProbe.py @@ -60,9 +60,9 @@ class ObjectProbing(PathOp.ObjectOp): def initOperation(self, obj): obj.addProperty("App::PropertyLength", "Xoffset", "Probe", QtCore.QT_TRANSLATE_NOOP("App::Property", "X offset between tool and probe")) obj.addProperty("App::PropertyLength", "Yoffset", "Probe", QtCore.QT_TRANSLATE_NOOP("App::Property", "Y offset between tool and probe")) - obj.addProperty("App::PropertyInteger", "PointCountX", "Probe", QtCore.QT_TRANSLATE_NOOP("App::Property", "Number of points to probe in X direction")).PointCountX=3 - obj.addProperty("App::PropertyInteger", "PointCountY", "Probe", QtCore.QT_TRANSLATE_NOOP("App::Property", "Number of points to probe in Y direction")).PointCountY=3 - + obj.addProperty("App::PropertyInteger", "PointCountX", "Probe", QtCore.QT_TRANSLATE_NOOP("App::Property", "Number of points to probe in X direction")) + obj.addProperty("App::PropertyInteger", "PointCountY", "Probe", QtCore.QT_TRANSLATE_NOOP("App::Property", "Number of points to probe in Y direction")) + obj.addProperty("App::PropertyFile", "OutputFileName", "Path", QtCore.QT_TRANSLATE_NOOP("App::Property", "The output location for the probe data to be written")) def drange(self, start=1.0, stop=5.0, step=1.0): r = start while r <= stop: @@ -80,7 +80,8 @@ class ObjectProbing(PathOp.ObjectOp): xdist = (bb.XMax - bb.XMin)/ (obj.PointCountX - 1) ydist = (bb.YMax - bb.YMin)/ (obj.PointCountY - 1) - self.commandlist.append(Path.Command("(PROBEOPEN probe_points.txt)")) + openstring = '(PROBEOPEN {})'.format(obj.OutputFileName) + self.commandlist.append(Path.Command(openstring)) self.commandlist.append(Path.Command("G0", {"X":bb.XMin, "Y":bb.YMin, "Z":obj.SafeHeight.Value})) for x in self.drange(bb.XMin, bb.XMax, xdist): @@ -96,7 +97,7 @@ class ObjectProbing(PathOp.ObjectOp): '''opSetDefaultValues(obj, job) ... set default value for RetractHeight''' def SetupProperties(): - setup = [] + setup = ['Xoffset', 'Yoffset', 'PointCountX', 'PointCountY'] return setup def Create(name, obj = None): diff --git a/src/Mod/Path/PathScripts/PathProbeGui.py b/src/Mod/Path/PathScripts/PathProbeGui.py index eba3996517..2ae4730924 100644 --- a/src/Mod/Path/PathScripts/PathProbeGui.py +++ b/src/Mod/Path/PathScripts/PathProbeGui.py @@ -26,8 +26,9 @@ import FreeCAD import FreeCADGui import PathScripts.PathProbe as PathProbe import PathScripts.PathOpGui as PathOpGui +import PathScripts.PathGui as PathGui -from PySide import QtCore +from PySide import QtCore, QtGui __title__ = "Path Probing Operation UI" __author__ = "sliptonic (Brad Collette)" @@ -46,25 +47,47 @@ class TaskPanelOpPage(PathOpGui.TaskPanelPage): # if obj.StartVertex != self.form.startVertex.value(): # obj.StartVertex = self.form.startVertex.value() self.updateToolController(obj, self.form.toolController) + PathGui.updateInputField(obj, 'Xoffset', self.form.Xoffset) + PathGui.updateInputField(obj, 'Yoffset', self.form.Yoffset) + obj.PointCountX = self.form.PointCountX.value() + obj.PointCountY = self.form.PointCountY.value() + obj.OutputFileName = str(self.form.OutputFileName.text()) def setFields(self, obj): '''setFields(obj) ... transfers obj's property values to UI''' #self.form.startVertex.setValue(obj.StartVertex) self.setupToolController(obj, self.form.toolController) + self.form.Xoffset.setText(FreeCAD.Units.Quantity(obj.Xoffset.Value, FreeCAD.Units.Length).UserString) + self.form.Yoffset.setText(FreeCAD.Units.Quantity(obj.Yoffset.Value, FreeCAD.Units.Length).UserString) + self.form.OutputFileName.setText(obj.OutputFileName) + self.form.PointCountX.setValue(obj.PointCountX) + self.form.PointCountY.setValue(obj.PointCountY) def getSignalsForUpdate(self, obj): '''getSignalsForUpdate(obj) ... return list of signals for updating obj''' signals = [] - #signals.append(self.form.startVertex.editingFinished) signals.append(self.form.toolController.currentIndexChanged) + signals.append(self.form.PointCountX.valueChanged) + signals.append(self.form.PointCountY.valueChanged) + signals.append(self.form.OutputFileName.editingFinished) + signals.append(self.form.Xoffset.valueChanged) + signals.append(self.form.Yoffset.valueChanged) + signals.append(self.form.SetOutputFileName.clicked) return signals + # def SetOutputFileName(self): + # filename = QtGui.QFileDialog.getSaveFileName(self.form, translate("Path_Probe", "Select Output File"), None, translate("Path_Probe", "All Files (*.*)")) + # if filename and filename[0]: + # self.obj.OutputFileName = str(filename[0]) + # self.setFields() + Command = PathOpGui.SetupOperation('Probe', PathProbe.Create, TaskPanelOpPage, 'Path-Probe', QtCore.QT_TRANSLATE_NOOP("Probe", "Probe"), - QtCore.QT_TRANSLATE_NOOP("Probe", "Create a Probing Grid from a job stock"))# PathProbe.SetupProperties) + QtCore.QT_TRANSLATE_NOOP("Probe", "Create a Probing Grid from a job stock"), + PathProbe.SetupProperties) FreeCAD.Console.PrintLog("Loading PathProbeGui... done\n")