diff --git a/src/Mod/Path/Gui/Resources/Path.qrc b/src/Mod/Path/Gui/Resources/Path.qrc index 2e0873a2be..701836b893 100644 --- a/src/Mod/Path/Gui/Resources/Path.qrc +++ b/src/Mod/Path/Gui/Resources/Path.qrc @@ -99,6 +99,7 @@ panels/PageBaseHoleGeometryEdit.ui panels/PageBaseLocationEdit.ui panels/PageDepthsEdit.ui + panels/PageDiametersEdit.ui panels/PageHeightsEdit.ui panels/PageOpCustomEdit.ui panels/PageOpDeburrEdit.ui diff --git a/src/Mod/Path/Gui/Resources/panels/PageDiametersEdit.ui b/src/Mod/Path/Gui/Resources/panels/PageDiametersEdit.ui new file mode 100644 index 0000000000..3a7182ba97 --- /dev/null +++ b/src/Mod/Path/Gui/Resources/panels/PageDiametersEdit.ui @@ -0,0 +1,136 @@ + + + Form + + + + 0 + 0 + 345 + 235 + + + + Form + + + + + + <html><head/><body><p>Start Depth of the operation. The highest point in Z-axis the operation needs to process.</p></body></html> + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + -999999999.000000000000000 + + + 999999999.000000000000000 + + + + + + + <html><head/><body><p>The depth of the operation which corresponds to the lowest value in Z-axis the operation needs to process.</p></body></html> + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + -999999999.000000000000000 + + + 999999999.000000000000000 + + + + + + + <html><head/><body><p>Transfer the Z value of the selected feature as the Final Depth for the operation.</p></body></html> + + + ... + + + + :/icons/button_left.svg:/icons/button_left.svg + + + + + + + <html><head/><body><p>Transfer the Z value of the selected feature as the Start Depth for the operation.</p></body></html> + + + ... + + + + :/icons/button_left.svg:/icons/button_left.svg + + + + + + + Min Diameter + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Max Diameter + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + Gui::QuantitySpinBox + QDoubleSpinBox +
Gui/QuantitySpinBox.h
+
+
+ + minDiameter + maxDiameter + startDepthSet + finalDepthSet + + + + + +
diff --git a/src/Mod/Path/PathScripts/PathOp.py b/src/Mod/Path/PathScripts/PathOp.py index 376ab63667..ea5b8e31c8 100644 --- a/src/Mod/Path/PathScripts/PathOp.py +++ b/src/Mod/Path/PathScripts/PathOp.py @@ -64,6 +64,7 @@ FeatureBaseFaces = 0x0400 # Base FeatureBasePanels = 0x0800 # Base FeatureLocations = 0x1000 # Locations FeatureCoolant = 0x2000 # Coolant +FeatureDiameters = 0x4000 # Turning Diameters FeatureBaseGeometry = FeatureBaseVertexes | FeatureBaseFaces | FeatureBaseEdges | FeatureBasePanels @@ -91,6 +92,7 @@ class ObjectOp(object): FeatureBasePanels ... Base geometry support for Arch.Panels FeatureLocations ... Base location support FeatureCoolant ... Support for operation coolant + FeatureDiameters ... Support for turning operation diameters The base class handles all base API and forwards calls to subclasses with an op prefix. For instance, an op is not expected to overwrite onChanged(), @@ -169,6 +171,10 @@ class ObjectOp(object): obj.addProperty("App::PropertyVectorDistance", "StartPoint", "Start Point", QtCore.QT_TRANSLATE_NOOP("PathOp", "The start point of this path")) obj.addProperty("App::PropertyBool", "UseStartPoint", "Start Point", QtCore.QT_TRANSLATE_NOOP("PathOp", "Make True, if specifying a Start Point")) + if FeatureDiameters & features: + obj.addProperty("App::PropertyDistance", "MinDiameter", "Diameter", QtCore.QT_TRANSLATE_NOOP("PathOp", "Lower limit of the turning diameter")) + obj.addProperty("App::PropertyDistance", "MaxDiameter", "Diameter", QtCore.QT_TRANSLATE_NOOP("PathOp", "Upper limit of the turning diameter.")) + # members being set later self.commandlist = None self.horizFeed = None @@ -352,6 +358,10 @@ class ObjectOp(object): if not self.applyExpression(obj, 'ClearanceHeight', job.SetupSheet.ClearanceHeightExpression): obj.ClearanceHeight = '5 mm' + if FeatureDiameters & features: + obj.MinDiameter = '0 mm' + obj.MaxDiameter = '0 mm' + if FeatureStartPoint & features: obj.UseStartPoint = False diff --git a/src/Mod/Path/PathScripts/PathOpGui.py b/src/Mod/Path/PathScripts/PathOpGui.py index 4a175e34f6..cff53be051 100644 --- a/src/Mod/Path/PathScripts/PathOpGui.py +++ b/src/Mod/Path/PathScripts/PathOpGui.py @@ -928,6 +928,43 @@ class TaskPanelDepthsPage(TaskPanelPage): self.form.startDepthSet.setEnabled(False) self.form.finalDepthSet.setEnabled(False) +class TaskPanelDiametersPage(TaskPanelPage): + '''Page controller for diameters.''' + + def __init__(self, obj, features): + super(TaskPanelDiametersPage, self).__init__(obj, features) + + # members initialized later + self.clearanceHeight = None + self.safeHeight = None + + def getForm(self): + return FreeCADGui.PySideUic.loadUi(":/panels/PageDiametersEdit.ui") + + def initPage(self, obj): + self.minDiameter = PathGui.QuantitySpinBox(self.form.minDiameter, obj, 'MinDiameter') + self.maxDiameter = PathGui.QuantitySpinBox(self.form.maxDiameter, obj, 'MaxDiameter') + + def getTitle(self, obj): + return translate("Path", "Diameters") + + def getFields(self, obj): + self.minDiameter.updateProperty() + self.maxDiameter.updateProperty() + + def setFields(self, obj): + self.minDiameter.updateSpinBox() + self.maxDiameter.updateSpinBox() + + def getSignalsForUpdate(self, obj): + signals = [] + signals.append(self.form.minDiameter.editingFinished) + signals.append(self.form.maxDiameter.editingFinished) + return signals + + def pageUpdateData(self, obj, prop): + if prop in ['MinDiameter', 'MaxDiameter']: + self.setFields(obj) class TaskPanel(object): ''' @@ -953,6 +990,8 @@ class TaskPanel(object): self.finalDepth = None self.stepDown = None self.buttonBox = None + self.minDiameter = None + self.maxDiameter = None features = obj.Proxy.opFeatures(obj) opPage.features = features @@ -980,7 +1019,13 @@ class TaskPanel(object): self.featurePages.append(opPage.taskPanelHeightsPage(obj, features)) else: self.featurePages.append(TaskPanelHeightsPage(obj, features)) - + + if PathOp.FeatureDiameters & features: + if hasattr(opPage, 'taskPanelDiametersPage'): + self.featurePages.append(opPage.taskPanelDiametersPage(obj, features)) + else: + self.featurePages.append(TaskPanelDiametersPage(obj, features)) + self.featurePages.append(opPage) for page in self.featurePages: