Path: add feature for drill tip calculation
This commit is contained in:
committed by
Yorik van Havre
parent
6c52548750
commit
9874444dba
@@ -74,6 +74,7 @@ class ObjectDrilling:
|
||||
obj.addProperty("App::PropertyLength", "StartDepth", "Depth", QtCore.QT_TRANSLATE_NOOP("App::Property", "Starting Depth of Tool- first cut depth in Z"))
|
||||
obj.addProperty("App::PropertyFloat", "DwellTime", "Depth", QtCore.QT_TRANSLATE_NOOP("App::Property", "The time to dwell between peck cycles"))
|
||||
obj.addProperty("App::PropertyBool", "DwellEnabled", "Depth", QtCore.QT_TRANSLATE_NOOP("App::Property", "Enable dwell"))
|
||||
obj.addProperty("App::PropertyBool", "AddTipLength", "Depth", QtCore.QT_TRANSLATE_NOOP("App::Property", "Calculate the tip length and subtract from final depth"))
|
||||
|
||||
# Heights & Depths
|
||||
obj.addProperty("App::PropertyDistance", "ClearanceHeight", "Depth", QtCore.QT_TRANSLATE_NOOP("App::Property", "The height needed to clear clamps and obstructions"))
|
||||
@@ -132,6 +133,10 @@ class ObjectDrilling:
|
||||
else:
|
||||
self.radius = tool.Diameter/2
|
||||
|
||||
tiplength = 0.0
|
||||
if obj.AddTipLength:
|
||||
tiplength = PathUtils.drillTipLength(tool)
|
||||
|
||||
if len(obj.Names) == 0:
|
||||
parentJob = PathUtils.findParentJob(obj)
|
||||
if parentJob is None:
|
||||
@@ -170,7 +175,7 @@ class ObjectDrilling:
|
||||
diameters = []
|
||||
for h in holes:
|
||||
if len(names) == 0:
|
||||
self.findHeights(obj, baseobject, h)
|
||||
self.setDepths(obj, baseobject, h)
|
||||
names.append(h['featureName'])
|
||||
positions.append(FreeCAD.Vector(h['x'], h['y'], 0))
|
||||
enabled.append(1)
|
||||
@@ -211,7 +216,7 @@ class ObjectDrilling:
|
||||
output += cmd + \
|
||||
" X" + fmt(p['x']) + \
|
||||
" Y" + fmt(p['y']) + \
|
||||
" Z" + fmt(obj.FinalDepth.Value) + qword + pword + \
|
||||
" Z" + fmt(obj.FinalDepth.Value - tiplength) + qword + pword + \
|
||||
" R" + str(obj.RetractHeight.Value) + \
|
||||
" F" + str(self.vertFeed) + "\n" \
|
||||
|
||||
@@ -219,10 +224,8 @@ class ObjectDrilling:
|
||||
|
||||
path = Path.Path(output)
|
||||
obj.Path = path
|
||||
# obj.ViewObject.Visibility = True
|
||||
|
||||
|
||||
def findHeights(self, obj, bobj, hole):
|
||||
def setDepths(self, obj, bobj, hole):
|
||||
try:
|
||||
bb = bobj.Shape.BoundBox
|
||||
subobj = hole['feature']
|
||||
@@ -346,6 +349,7 @@ class CommandPathDrilling:
|
||||
FreeCADGui.doCommand('obj.FinalDepth=' + str(zbottom))
|
||||
FreeCADGui.doCommand('PathScripts.PathUtils.addToJob(obj)')
|
||||
FreeCADGui.doCommand('obj.ToolController = PathScripts.PathUtils.findToolController(obj)')
|
||||
# FreeCADGui.doCommand('PathScripts.PathDrilling.ObjectDrilling.setDepths(obj.Proxy, obj)')
|
||||
|
||||
FreeCAD.ActiveDocument.commitTransaction()
|
||||
FreeCADGui.doCommand('obj.ViewObject.startEditing()')
|
||||
@@ -414,6 +418,8 @@ class TaskPanel:
|
||||
PathLog.debug("name: {}".format(self.form.uiToolController.currentText()))
|
||||
tc = PathUtils.findToolController(self.obj, self.form.uiToolController.currentText())
|
||||
self.obj.ToolController = tc
|
||||
if hasattr(self.obj, "AddTipLength"):
|
||||
self.obj.AddTipLength = self.form.chkTipDepth.isChecked()
|
||||
except ValueError:
|
||||
self.setFields()
|
||||
self.isDirty = True
|
||||
@@ -465,6 +471,11 @@ class TaskPanel:
|
||||
else:
|
||||
self.form.peckEnabled.setCheckState(QtCore.Qt.Unchecked)
|
||||
|
||||
if self.obj.AddTipLength:
|
||||
self.form.chkTipDepth.setCheckState(QtCore.Qt.Checked)
|
||||
else:
|
||||
self.form.chkTipDepth.setCheckState(QtCore.Qt.Unchecked)
|
||||
|
||||
self.updateFeatureList()
|
||||
|
||||
controllers = PathUtils.getToolControllers(self.obj)
|
||||
@@ -610,6 +621,7 @@ class TaskPanel:
|
||||
self.form.dwellTime.editingFinished.connect(self.getFields)
|
||||
self.form.dwellEnabled.stateChanged.connect(self.getFields)
|
||||
self.form.peckEnabled.stateChanged.connect(self.getFields)
|
||||
self.form.chkTipDepth.stateChanged.connect(self.getFields)
|
||||
|
||||
# buttons
|
||||
self.form.uiEnableSelected.clicked.connect(self.enableSelected)
|
||||
|
||||
Reference in New Issue
Block a user