Merge branch 'master' into feature/tooltable
This commit is contained in:
@@ -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'):
|
||||
@@ -115,14 +114,7 @@ class ObjectDrilling(PathCircularHoleBase.ObjectOp):
|
||||
holes = PathUtils.sort_jobs(holes, ['x', 'y'])
|
||||
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 = {}
|
||||
@@ -172,10 +164,12 @@ 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'))
|
||||
self.commandlist.append(Path.Command('G0', {'Z': obj.SafeHeight.Value}))
|
||||
|
||||
|
||||
|
||||
# shift axis and angle values
|
||||
if obj.EnableRotation != 'Off':
|
||||
@@ -186,9 +180,27 @@ class ObjectDrilling(PathCircularHoleBase.ObjectOp):
|
||||
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 +208,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,47 @@ 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.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)
|
||||
|
||||
self.form.peckRetractHeight.setEnabled(True)
|
||||
self.form.retractLabel.setEnabled(True)
|
||||
|
||||
if self.form.peckEnabled.isChecked():
|
||||
self.form.dwellEnabled.setEnabled(False)
|
||||
self.form.peckDepth.setEnabled(True)
|
||||
self.form.peckDepthLabel.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 +103,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 +126,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 +135,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