Peck retract height default changed from 10mm to opStartDepth+1
Peck depth default changed to tool dia*0.75 Fields changed to QuanitiySpinBoxes Insure travel between regions is always performed at safe height Make Peck and Dwell exclusive in GUI Restore name of RetractHeight Use SetupSheet for all numerical properties
This commit is contained in:
@@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>255</height>
|
||||
<width>572</width>
|
||||
<height>299</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -49,55 +49,75 @@
|
||||
<item>
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="3" column="0" rowspan="2" colspan="2">
|
||||
<widget class="QCheckBox" name="dwellEnabled">
|
||||
<item row="7" column="1">
|
||||
<widget class="QCheckBox" name="useTipLength">
|
||||
<property name="text">
|
||||
<string>Dwell</string>
|
||||
<string>Use Tip Length</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2" rowspan="2">
|
||||
<widget class="Gui::InputField" name="dwellTime">
|
||||
<item row="6" column="4">
|
||||
<widget class="QLabel" name="dwellTimelabel">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0 sec</string>
|
||||
</property>
|
||||
<property name="unit" stdset="0">
|
||||
<string notr="true">sec</string>
|
||||
<string>Time</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="Gui::InputField" name="retractHeight">
|
||||
<property name="unit" stdset="0">
|
||||
<string notr="true">mm</string>
|
||||
<item row="1" column="4">
|
||||
<widget class="QLabel" name="peckDepthLabel">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="text">
|
||||
<string>Retract Height</string>
|
||||
<string>Depth</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<item row="3" column="4">
|
||||
<widget class="QLabel" name="retractLabel">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Retract</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="6">
|
||||
<widget class="Gui::QuantitySpinBox" name="peckDepth">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="2">
|
||||
<widget class="QCheckBox" name="peckEnabled">
|
||||
<property name="text">
|
||||
<string>Peck</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="Gui::InputField" name="peckDepth">
|
||||
<property name="unit" stdset="0">
|
||||
<string notr="true">mm</string>
|
||||
<item row="5" column="1" rowspan="2" colspan="2">
|
||||
<widget class="QCheckBox" name="dwellEnabled">
|
||||
<property name="text">
|
||||
<string>Dwell</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QCheckBox" name="useTipLength">
|
||||
<property name="text">
|
||||
<string>Use Tip Length</string>
|
||||
<item row="3" column="6">
|
||||
<widget class="Gui::QuantitySpinBox" name="peckRetractHeight">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="6">
|
||||
<widget class="Gui::QuantitySpinBox" name="dwellTime">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -121,18 +141,15 @@
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>Gui::InputField</class>
|
||||
<extends>QLineEdit</extends>
|
||||
<header>Gui/InputField.h</header>
|
||||
<class>Gui::QuantitySpinBox</class>
|
||||
<extends>QDoubleSpinBox</extends>
|
||||
<header>Gui/QuantitySpinBox.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>toolController</tabstop>
|
||||
<tabstop>retractHeight</tabstop>
|
||||
<tabstop>peckEnabled</tabstop>
|
||||
<tabstop>peckDepth</tabstop>
|
||||
<tabstop>dwellEnabled</tabstop>
|
||||
<tabstop>dwellTime</tabstop>
|
||||
<tabstop>useTipLength</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
|
||||
@@ -43,7 +43,7 @@ __title__ = "Path Drilling Operation"
|
||||
__author__ = "sliptonic (Brad Collette)"
|
||||
__url__ = "http://www.freecadweb.org"
|
||||
__doc__ = "Path Drilling operation."
|
||||
__contributors__ = "russ4262 (Russell Johnson)"
|
||||
__contributors__ = "russ4262 (Russell Johnson), IMBack!"
|
||||
__created__ = "2014"
|
||||
__scriptVersion__ = "1c testing"
|
||||
__lastModified__ = "2019-06-25 14:49 CST"
|
||||
@@ -77,10 +77,9 @@ class ObjectDrilling(PathCircularHoleBase.ObjectOp):
|
||||
obj.addProperty("App::PropertyFloat", "DwellTime", "Drill", QtCore.QT_TRANSLATE_NOOP("App::Property", "The time to dwell between peck cycles"))
|
||||
obj.addProperty("App::PropertyBool", "DwellEnabled", "Drill", QtCore.QT_TRANSLATE_NOOP("App::Property", "Enable dwell"))
|
||||
obj.addProperty("App::PropertyBool", "AddTipLength", "Drill", QtCore.QT_TRANSLATE_NOOP("App::Property", "Calculate the tip length and subtract from final depth"))
|
||||
obj.addProperty("App::PropertyEnumeration", "ReturnLevel", "Drill", QtCore.QT_TRANSLATE_NOOP("App::Property", "Controls how tool retracts Default=G98"))
|
||||
obj.ReturnLevel = ['G98', 'G99'] # this is the direction that the Contour runs
|
||||
|
||||
obj.addProperty("App::PropertyDistance", "RetractHeight", "Drill", QtCore.QT_TRANSLATE_NOOP("App::Property", "The height where feed starts and height during retract tool when path is finished"))
|
||||
obj.addProperty("App::PropertyEnumeration", "ReturnLevel", "Drill", QtCore.QT_TRANSLATE_NOOP("App::Property", "Controls how tool retracts Default=G99"))
|
||||
obj.ReturnLevel = ['G99', 'G98'] # Canned Cycle Return Level
|
||||
obj.addProperty("App::PropertyDistance", "RetractHeight", "Drill", QtCore.QT_TRANSLATE_NOOP("App::Property", "The height where feed starts and height during retract tool when path is finished while in a peck operation"))
|
||||
|
||||
# Rotation related properties
|
||||
if not hasattr(obj, 'EnableRotation'):
|
||||
@@ -116,20 +115,14 @@ class ObjectDrilling(PathCircularHoleBase.ObjectOp):
|
||||
self.commandlist.append(Path.Command('G90'))
|
||||
self.commandlist.append(Path.Command(obj.ReturnLevel))
|
||||
|
||||
# ml: I'm not sure whey these were here, they seem redundant
|
||||
# # rapid to first hole location, with spindle still retracted:
|
||||
# p0 = holes[0]
|
||||
# self.commandlist.append(Path.Command('G0', {'X': p0['x'], 'Y': p0['y'], 'F': self.horizRapid}))
|
||||
# # move tool to clearance plane
|
||||
# self.commandlist.append(Path.Command('G0', {'Z': obj.ClearanceHeight.Value, 'F': self.vertRapid}))
|
||||
|
||||
for p in holes:
|
||||
cmd = "G81"
|
||||
cmdParams = {}
|
||||
cmdParams['Z'] = p['trgtDep'] - tiplength
|
||||
cmdParams['F'] = self.vertFeed
|
||||
cmdParams['R'] = obj.RetractHeight.Value
|
||||
cmdParams['R'] = obj.SafeHeight.Value
|
||||
if obj.PeckEnabled and obj.PeckDepth.Value > 0:
|
||||
cmdParams['R'] = obj.RetractHeight.Value
|
||||
cmd = "G83"
|
||||
cmdParams['Q'] = obj.PeckDepth.Value
|
||||
elif obj.DwellEnabled and obj.DwellTime > 0:
|
||||
@@ -172,23 +165,45 @@ class ObjectDrilling(PathCircularHoleBase.ObjectOp):
|
||||
self.commandlist.append(Path.Command('G0', {axisOfRot: angle, 'F': self.axialRapid}))
|
||||
self.commandlist.append(Path.Command('G0', {'X': p['x'], 'Y': p['y'], 'F': self.horizRapid}))
|
||||
self.commandlist.append(Path.Command('G1', {'Z': p['stkTop'], 'F': self.vertFeed}))
|
||||
|
||||
|
||||
# Perform and cancel canned drilling cycle
|
||||
self.commandlist.append(Path.Command(cmd, params))
|
||||
self.commandlist.append(Path.Command('G80'))
|
||||
|
||||
|
||||
|
||||
# shift axis and angle values
|
||||
if obj.EnableRotation != 'Off':
|
||||
lastAxis = axisOfRot
|
||||
lastAngle = angle
|
||||
elif obj.PeckEnabled and obj.PeckDepth.Value > 0 and obj.RetractHeight.Value != obj.SafeHeight.Value:
|
||||
self.commandlist.append(Path.Command('G0', {'Z': obj.SafeHeight.Value}))
|
||||
|
||||
if obj.EnableRotation != 'Off':
|
||||
self.commandlist.append(Path.Command('G0', {'Z': obj.SafeHeight.Value, 'F': self.vertRapid}))
|
||||
self.commandlist.append(Path.Command('G0', {lastAxis: 0.0, 'F': self.axialRapid}))
|
||||
|
||||
|
||||
def opSetDefaultValues(self, obj, job):
|
||||
'''opSetDefaultValues(obj, job) ... set default value for RetractHeight'''
|
||||
obj.RetractHeight = 10.0
|
||||
|
||||
parentJob = PathUtils.findParentJob(obj)
|
||||
|
||||
if hasattr(parentJob.SetupSheet, 'RetractHeight'):
|
||||
obj.RetractHeight = parentJob.SetupSheet.RetractHeight
|
||||
elif self.applyExpression(obj, 'RetractHeight', 'OpStartDepth+1mm'):
|
||||
obj.RetractHeight = 10
|
||||
|
||||
if hasattr(parentJob.SetupSheet, 'PeckDepth'):
|
||||
obj.PeckDepth = parentJob.SetupSheet.PeckDepth
|
||||
elif self.applyExpression(obj, 'PeckDepth', 'OpToolDiameter*0.75'):
|
||||
obj.PeckDepth = 1
|
||||
|
||||
if hasattr(parentJob.SetupSheet, 'DwellTime'):
|
||||
obj.DwellTime = parentJob.SetupSheet.DwellTime
|
||||
else:
|
||||
obj.DwellTime = 1
|
||||
|
||||
obj.ReverseDirection = False
|
||||
obj.InverseAngle = False
|
||||
obj.B_AxisErrorOverride = False
|
||||
@@ -196,7 +211,6 @@ class ObjectDrilling(PathCircularHoleBase.ObjectOp):
|
||||
|
||||
# Initial setting for EnableRotation is taken from Job SetupSheet
|
||||
# User may override on per-operation basis as needed.
|
||||
parentJob = PathUtils.findParentJob(obj)
|
||||
if hasattr(parentJob.SetupSheet, 'SetupEnableRotation'):
|
||||
obj.EnableRotation = parentJob.SetupSheet.SetupEnableRotation
|
||||
else:
|
||||
|
||||
@@ -36,6 +36,7 @@ __title__ = "Path Drilling Operation UI."
|
||||
__author__ = "sliptonic (Brad Collette)"
|
||||
__url__ = "http://www.freecadweb.org"
|
||||
__doc__ = "UI and Command for Path Drilling Operation."
|
||||
__contributors__ = "IMBack!"
|
||||
|
||||
LOGLEVEL = False
|
||||
|
||||
@@ -48,17 +49,49 @@ else:
|
||||
|
||||
class TaskPanelOpPage(PathCircularHoleBaseGui.TaskPanelOpPage):
|
||||
'''Controller for the drilling operation's page'''
|
||||
|
||||
def initPage(self, obj):
|
||||
self.peckDepthSpinBox = PathGui.QuantitySpinBox(self.form.peckDepth, obj, 'PeckDepth')
|
||||
self.peckRetractSpinBox = PathGui.QuantitySpinBox(self.form.peckRetractHeight, obj, 'RetractHeight')
|
||||
self.dwellTimeSpinBox = PathGui.QuantitySpinBox(self.form.dwellTime, obj, 'DwellTime')
|
||||
|
||||
def registerSignalHandlers(self, obj):
|
||||
self.form.peckEnabled.toggled.connect(self.form.peckDepth.setEnabled)
|
||||
self.form.peckEnabled.toggled.connect(self.form.peckRetractHeight.setEnabled)
|
||||
self.form.peckEnabled.toggled.connect(self.form.peckDepthLabel.setEnabled)
|
||||
self.form.peckEnabled.toggled.connect(self.form.retractLabel.setEnabled)
|
||||
self.form.peckEnabled.toggled.connect(self.form.dwellEnabled.setDisabled)
|
||||
|
||||
self.form.dwellEnabled.toggled.connect(self.form.dwellTime.setEnabled)
|
||||
self.form.dwellEnabled.toggled.connect(self.form.dwellTimelabel.setEnabled)
|
||||
self.form.dwellEnabled.toggled.connect(self.form.peckEnabled.setDisabled)
|
||||
|
||||
if self.form.peckEnabled.isChecked():
|
||||
self.form.dwellEnabled.setEnabled(False)
|
||||
self.form.peckDepth.setEnabled(True)
|
||||
self.form.peckRetractHeight.setEnabled(True)
|
||||
self.form.peckDepthLabel.setEnabled(True)
|
||||
self.form.retractLabel.setEnabled(True)
|
||||
elif self.form.dwellEnabled.isChecked():
|
||||
self.form.peckEnabled.setEnabled(False)
|
||||
self.form.dwellTime.setEnabled(True)
|
||||
self.form.dwellTimelabel.setEnabled(True)
|
||||
|
||||
def getForm(self):
|
||||
'''getForm() ... return UI'''
|
||||
return FreeCADGui.PySideUic.loadUi(":/panels/PageOpDrillingEdit.ui")
|
||||
|
||||
def updateQuantitySpinBoxes(self, index = None):
|
||||
self.peckDepthSpinBox.updateSpinBox()
|
||||
self.peckRetractSpinBox.updateSpinBox()
|
||||
self.dwellTimeSpinBox.updateSpinBox()
|
||||
|
||||
def getFields(self, obj):
|
||||
'''setFields(obj) ... update obj's properties with values from the UI'''
|
||||
PathLog.track()
|
||||
PathGui.updateInputField(obj, 'PeckDepth', self.form.peckDepth)
|
||||
PathGui.updateInputField(obj, 'RetractHeight', self.form.retractHeight)
|
||||
PathGui.updateInputField(obj, 'DwellTime', self.form.dwellTime)
|
||||
self.peckDepthSpinBox.updateProperty()
|
||||
self.peckRetractSpinBox.updateProperty()
|
||||
self.dwellTimeSpinBox.updateProperty()
|
||||
|
||||
if obj.DwellEnabled != self.form.dwellEnabled.isChecked():
|
||||
obj.DwellEnabled = self.form.dwellEnabled.isChecked()
|
||||
@@ -72,10 +105,7 @@ class TaskPanelOpPage(PathCircularHoleBaseGui.TaskPanelOpPage):
|
||||
def setFields(self, obj):
|
||||
'''setFields(obj) ... update UI with obj properties' values'''
|
||||
PathLog.track()
|
||||
|
||||
self.form.peckDepth.setText(FreeCAD.Units.Quantity(obj.PeckDepth.Value, FreeCAD.Units.Length).UserString)
|
||||
self.form.retractHeight.setText(FreeCAD.Units.Quantity(obj.RetractHeight.Value, FreeCAD.Units.Length).UserString)
|
||||
self.form.dwellTime.setText(str(obj.DwellTime))
|
||||
self.updateQuantitySpinBoxes()
|
||||
|
||||
if obj.DwellEnabled:
|
||||
self.form.dwellEnabled.setCheckState(QtCore.Qt.Checked)
|
||||
@@ -98,7 +128,7 @@ class TaskPanelOpPage(PathCircularHoleBaseGui.TaskPanelOpPage):
|
||||
'''getSignalsForUpdate(obj) ... return list of signals which cause the receiver to update the model'''
|
||||
signals = []
|
||||
|
||||
signals.append(self.form.retractHeight.editingFinished)
|
||||
signals.append(self.form.peckRetractHeight.editingFinished)
|
||||
signals.append(self.form.peckDepth.editingFinished)
|
||||
signals.append(self.form.dwellTime.editingFinished)
|
||||
signals.append(self.form.dwellEnabled.stateChanged)
|
||||
@@ -107,6 +137,10 @@ class TaskPanelOpPage(PathCircularHoleBaseGui.TaskPanelOpPage):
|
||||
signals.append(self.form.toolController.currentIndexChanged)
|
||||
|
||||
return signals
|
||||
|
||||
def updateData(self, obj, prop):
|
||||
if prop in ['PeckDepth', 'RetractHeight'] and not prop in ['Base', 'Disabled']:
|
||||
self.updateQuantitySpinBoxes()
|
||||
|
||||
Command = PathOpGui.SetupOperation('Drilling',
|
||||
PathDrilling.Create,
|
||||
|
||||
@@ -122,6 +122,11 @@ The spin box gets bound to a given property and supports update in both directio
|
||||
if self.valid:
|
||||
return self.widget.property('expression')
|
||||
return ''
|
||||
|
||||
def setMinimum(self, quantity):
|
||||
if self.valid:
|
||||
value = quantity.Value if hasattr(quantity, 'Value') else quantity
|
||||
self.widget.setProperty('setMinimum', value)
|
||||
|
||||
def updateSpinBox(self, quantity=None):
|
||||
'''updateSpinBox(quantity=None) ... update the display value of the spin box.
|
||||
|
||||
@@ -354,6 +354,7 @@ class TaskPanelPage(object):
|
||||
controllers = PathUtils.getToolControllers(self.obj)
|
||||
labels = [c.Label for c in controllers]
|
||||
combo.blockSignals(True)
|
||||
combo.clear()
|
||||
combo.addItems(labels)
|
||||
combo.blockSignals(False)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user