Merge pull request #4776 from dubstar-04/fixes/DrillingOp

[Path] Fixes for drilling operation
This commit is contained in:
sliptonic
2021-05-18 15:57:11 -05:00
committed by GitHub
2 changed files with 30 additions and 14 deletions

View File

@@ -87,6 +87,7 @@ class ObjectDrilling(PathCircularHoleBase.ObjectOp):
lastAxis = None
lastAngle = 0.0
parentJob = PathUtils.findParentJob(obj)
self.commandlist.append(Path.Command("(Begin Drilling)"))
@@ -146,13 +147,17 @@ class ObjectDrilling(PathCircularHoleBase.ObjectOp):
# Prepare for drilling cycle
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': obj.StartDepth.Value, 'F': self.vertFeed}))
# Update retract height due to rotation
self.opSetDefaultRetractHeight(obj)
cmdParams['R'] = obj.RetractHeight.Value
# move to hole location
self.commandlist.append(Path.Command('G0', {'X': p['x'], 'Y': p['y'], 'F': self.horizRapid}))
startHeight = obj.StartDepth.Value + parentJob.SetupSheet.SafeHeightOffset.Value
self.commandlist.append(Path.Command('G0', {'Z': startHeight, 'F': self.vertRapid}))
self.commandlist.append(Path.Command('G1', {'Z': obj.StartDepth.Value, 'F': self.vertFeed}))
# Update changes to parameters
params.update(cmdParams)
@@ -182,7 +187,7 @@ class ObjectDrilling(PathCircularHoleBase.ObjectOp):
if hasattr(job.SetupSheet, 'RetractHeight'):
obj.RetractHeight = job.SetupSheet.RetractHeight
elif self.applyExpression(obj, 'RetractHeight', 'OpStartDepth+1mm'):
elif self.applyExpression(obj, 'RetractHeight', 'StartDepth+SetupSheet.SafeHeightOffset'):
if has_job:
obj.RetractHeight = 10
else:

View File

@@ -745,18 +745,29 @@ def guessDepths(objshape, subs=None):
def drillTipLength(tool):
"""returns the length of the drillbit tip."""
if not hasattr(tool, 'CuttingEdgeAngle') or tool.CuttingEdgeAngle == 180 or tool.CuttingEdgeAngle == 0.0 or float(tool.Diameter) == 0.0:
if isinstance(tool, Path.Tool):
PathLog.error(translate("Path", "Legacy Tools not supported"))
return 0.0
else:
if tool.CuttingEdgeAngle <= 0 or tool.CuttingEdgeAngle >= 180:
PathLog.error(translate("Path", "Invalid Cutting Edge Angle %.2f, must be >0° and <=180°") % tool.CuttingEdgeAngle)
return 0.0
theta = math.radians(tool.CuttingEdgeAngle)
length = (float(tool.Diameter) / 2) / math.tan(theta / 2)
if length < 0:
PathLog.error(translate("Path", "Cutting Edge Angle (%.2f) results in negative tool tip length") % tool.CuttingEdgeAngle)
return 0.0
return length
if not hasattr(tool, 'TipAngle'):
PathLog.error(translate("Path", "Selected tool is not a drill"))
return 0.0
angle = tool.TipAngle
if angle <= 0 or angle >= 180:
PathLog.error(translate("Path", "Invalid Cutting Edge Angle %.2f, must be >0° and <=180°") % angle)
return 0.0
theta = math.radians(angle)
length = (float(tool.Diameter) / 2) / math.tan(theta / 2)
if length < 0:
PathLog.error(translate("Path", "Cutting Edge Angle (%.2f) results in negative tool tip length") % angle)
return 0.0
return length
class depth_params(object):