CAM: fix G0 regression in drilling (#22602)
* CAM: fix G0 regression in drilling At some point the initial rapid to Safe Height got dropped from drilling cycles. This leads to excessive air drilling. It also alters "OLD_Z" which sets the Retraction plane under G98. The defect is causing much confusion and time wasting in the roadmap discussions This PR fixes the G0 regression. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
@@ -205,14 +205,13 @@ class ObjectDrilling(PathCircularHoleBase.ObjectOp):
|
||||
machine = PathMachineState.MachineState()
|
||||
|
||||
self.commandlist.append(Path.Command("(Begin Drilling)"))
|
||||
self.commandlist.append(Path.Command("G90")) # Set absolute distance mode before any moves
|
||||
|
||||
# rapid to clearance height
|
||||
command = Path.Command("G0", {"Z": obj.ClearanceHeight.Value})
|
||||
machine.addCommand(command)
|
||||
self.commandlist.append(command)
|
||||
|
||||
self.commandlist.append(Path.Command("G90")) # Absolute distance mode
|
||||
|
||||
# Calculate offsets to add to target edge
|
||||
endoffset = 0.0
|
||||
if obj.ExtraOffset == "Drill Tip":
|
||||
@@ -265,6 +264,7 @@ class ObjectDrilling(PathCircularHoleBase.ObjectOp):
|
||||
edgelist.append(Part.makeLine(v1, v2))
|
||||
|
||||
# iterate the edgelist and generate gcode
|
||||
safeHeight = True
|
||||
for edge in edgelist:
|
||||
|
||||
Path.Log.debug(edge)
|
||||
@@ -279,6 +279,13 @@ class ObjectDrilling(PathCircularHoleBase.ObjectOp):
|
||||
self.commandlist.append(command)
|
||||
machine.addCommand(command)
|
||||
|
||||
# rapid to safe height for first edge only //Dimitrios
|
||||
if safeHeight is True:
|
||||
command = Path.Command("G0", {"Z": obj.SafeHeight.Value})
|
||||
self.commandlist.append(command)
|
||||
machine.addCommand(command)
|
||||
safeHeight = False
|
||||
|
||||
# Technical Debt: We are assuming the edges are aligned.
|
||||
# This assumption should be corrected and the necessary rotations
|
||||
# performed to align the edge with the Z axis for drilling
|
||||
|
||||
Reference in New Issue
Block a user