From ac13b55666b21b15390525a72e29498de177c145 Mon Sep 17 00:00:00 2001 From: Daniel Wood Date: Tue, 4 May 2021 13:41:50 +0100 Subject: [PATCH 1/5] fixes for drilling operation start depth --- src/Mod/Path/PathScripts/PathDrilling.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Mod/Path/PathScripts/PathDrilling.py b/src/Mod/Path/PathScripts/PathDrilling.py index 3be3a859cb..56c4d12ef6 100644 --- a/src/Mod/Path/PathScripts/PathDrilling.py +++ b/src/Mod/Path/PathScripts/PathDrilling.py @@ -146,13 +146,14 @@ 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 + 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 changes to parameters params.update(cmdParams) From 5ff5b11e3cb630be90954fea3877ee8aa5afbe89 Mon Sep 17 00:00:00 2001 From: Daniel Wood Date: Tue, 4 May 2021 14:06:30 +0100 Subject: [PATCH 2/5] Rapid to safe height above the hole --- src/Mod/Path/PathScripts/PathDrilling.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Mod/Path/PathScripts/PathDrilling.py b/src/Mod/Path/PathScripts/PathDrilling.py index 56c4d12ef6..d8c5c3e05a 100644 --- a/src/Mod/Path/PathScripts/PathDrilling.py +++ b/src/Mod/Path/PathScripts/PathDrilling.py @@ -87,6 +87,7 @@ class ObjectDrilling(PathCircularHoleBase.ObjectOp): lastAxis = None lastAngle = 0.0 + parentJob = PathUtils.findParentJob(obj) self.commandlist.append(Path.Command("(Begin Drilling)")) @@ -151,7 +152,10 @@ class ObjectDrilling(PathCircularHoleBase.ObjectOp): 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.vertFeed})) self.commandlist.append(Path.Command('G1', {'Z': obj.StartDepth.Value, 'F': self.vertFeed})) # Update changes to parameters From aaa5a81e45886ae07da1449ab57d0913682320d3 Mon Sep 17 00:00:00 2001 From: Daniel Wood Date: Tue, 4 May 2021 15:56:45 +0100 Subject: [PATCH 3/5] use toolbits with tooltip calculation --- src/Mod/Path/PathScripts/PathUtils.py | 33 ++++++++++++++++++--------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/src/Mod/Path/PathScripts/PathUtils.py b/src/Mod/Path/PathScripts/PathUtils.py index d2e18e7184..5152ae044a 100644 --- a/src/Mod/Path/PathScripts/PathUtils.py +++ b/src/Mod/Path/PathScripts/PathUtils.py @@ -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): From 1e8e81b986047613b3f6e84c1956123b8ca2eb75 Mon Sep 17 00:00:00 2001 From: Daniel Wood Date: Wed, 5 May 2021 20:33:26 +0100 Subject: [PATCH 4/5] use correct feedrate for rapid moves --- src/Mod/Path/PathScripts/PathDrilling.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Mod/Path/PathScripts/PathDrilling.py b/src/Mod/Path/PathScripts/PathDrilling.py index d8c5c3e05a..8d16b3761f 100644 --- a/src/Mod/Path/PathScripts/PathDrilling.py +++ b/src/Mod/Path/PathScripts/PathDrilling.py @@ -155,7 +155,7 @@ class ObjectDrilling(PathCircularHoleBase.ObjectOp): # 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.vertFeed})) + 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 From f497d0da046c44163e8401cb44afe9d8c20a3940 Mon Sep 17 00:00:00 2001 From: Daniel Wood Date: Thu, 6 May 2021 08:09:43 +0100 Subject: [PATCH 5/5] Use defaults for retract height Use the StartDepth + SafeHeightOffset to calculate the retract height in relation to the hole start height. --- src/Mod/Path/PathScripts/PathDrilling.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Mod/Path/PathScripts/PathDrilling.py b/src/Mod/Path/PathScripts/PathDrilling.py index 8d16b3761f..ff5a4abac6 100644 --- a/src/Mod/Path/PathScripts/PathDrilling.py +++ b/src/Mod/Path/PathScripts/PathDrilling.py @@ -187,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: