Skip to content

Commit

Permalink
Add missing G53 for absolute zchange in milldrill.
Browse files Browse the repository at this point in the history
At best, if your absolute zchange position was 0mm, you would have been
presented with an impossible tool change. At worse, for a negative
zchange position, your CNC would have attempted murder on your
workpiece.

The final retraction at the end of the program already has the G53
prefix.
  • Loading branch information
bombela authored and eyal0 committed Feb 7, 2022
1 parent 764007c commit 0da1d07
Show file tree
Hide file tree
Showing 27 changed files with 31 additions and 28 deletions.
7 changes: 5 additions & 2 deletions drill.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -607,8 +607,11 @@ void ExcellonProcessor::export_ngc(const string of_dir, const boost::optional<st
//preamble
of << preamble_ext << preamble
<< "S" << left << target->speed << " (RPM spindle speed.)\n\n"
<< "G01 F" << target->feed * cfactor << " (Feedrate)\n"
<< "G00 Z" << target->zchange * cfactor << " (Retract)\n"
<< "G01 F" << target->feed * cfactor << " (Feedrate)\n";
if (zchange_absolute) {
of << "G53 ";
}
of << "G00 Z" << target->zchange * cfactor << " (Retract to tool change height)\n"
<< "T" << (*holes.begin()).first << "\n"
<< "M5 (Spindle stop.)\n"
<< "G04 P" << target->spindown_time << "\n"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ G90 (Absolute coordinates.)
S10000 (RPM spindle speed.)

G01 F100.00000 (Feedrate)
G00 Z1.00000 (Retract)
G00 Z1.00000 (Retract to tool change height)
T1
M5 (Spindle stop.)
G04 P1.00000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ G90 (Absolute coordinates.)
S2000 (RPM spindle speed.)

G01 F600.00000 (Feedrate)
G00 Z10.00000 (Retract)
G00 Z10.00000 (Retract to tool change height)
T6
M5 (Spindle stop.)
G04 P1.00000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ G90 (Absolute coordinates.)
S2000 (RPM spindle speed.)

G01 F600.00000 (Feedrate)
G00 Z10.00000 (Retract)
G00 Z10.00000 (Retract to tool change height)
T6
M5 (Spindle stop.)
G04 P1.00000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ G90 (Absolute coordinates.)
S10000 (RPM spindle speed.)

G01 F100.00000 (Feedrate)
G00 Z1.00000 (Retract)
G00 Z1.00000 (Retract to tool change height)
T1
M5 (Spindle stop.)
G04 P1.00000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ G90 (Absolute coordinates.)
S10000 (RPM spindle speed.)

G01 F100.00000 (Feedrate)
G00 Z1.00000 (Retract)
G00 Z1.00000 (Retract to tool change height)
T1
M5 (Spindle stop.)
G04 P1.00000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ G90 (Absolute coordinates.)
S10000 (RPM spindle speed.)

G01 F100.00000 (Feedrate)
G00 Z1.00000 (Retract)
G00 Z1.00000 (Retract to tool change height)
T1
M5 (Spindle stop.)
G04 P1.00000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ G90 (Absolute coordinates.)
S10000 (RPM spindle speed.)

G01 F100.00000 (Feedrate)
G00 Z1.00000 (Retract)
G00 Z1.00000 (Retract to tool change height)
T1
M5 (Spindle stop.)
G04 P1.00000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ G90 (Absolute coordinates.)
S10000 (RPM spindle speed.)

G01 F100.00000 (Feedrate)
G00 Z1.00000 (Retract)
G00 Z1.00000 (Retract to tool change height)
T1
M5 (Spindle stop.)
G04 P1.00000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ G90 (Absolute coordinates.)
S10000 (RPM spindle speed.)

G01 F100.00000 (Feedrate)
G00 Z1.00000 (Retract)
G00 Z1.00000 (Retract to tool change height)
T1
M5 (Spindle stop.)
G04 P1.00000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ G90 (Absolute coordinates.)
S10000 (RPM spindle speed.)

G01 F100.00000 (Feedrate)
G00 Z1.00000 (Retract)
G53 G00 Z1.00000 (Retract to tool change height)
T1
M5 (Spindle stop.)
G04 P1.00000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ G90 (Absolute coordinates.)
S10000 (RPM spindle speed.)

G01 F100.00000 (Feedrate)
G00 Z1.00000 (Retract)
G00 Z1.00000 (Retract to tool change height)
T1
M5 (Spindle stop.)
G04 P1.00000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ G90 (Absolute coordinates.)
S10000 (RPM spindle speed.)

G01 F100.00000 (Feedrate)
G00 Z1.00000 (Retract)
G00 Z1.00000 (Retract to tool change height)
T1
M5 (Spindle stop.)
G04 P1.00000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ G90 (Absolute coordinates.)
S10000 (RPM spindle speed.)

G01 F100.00000 (Feedrate)
G00 Z1.00000 (Retract)
G00 Z1.00000 (Retract to tool change height)
T1
M5 (Spindle stop.)
G04 P1.00000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ G90 (Absolute coordinates.)
S10000 (RPM spindle speed.)

G01 F100.00000 (Feedrate)
G00 Z1.00000 (Retract)
G00 Z1.00000 (Retract to tool change height)
T1
M5 (Spindle stop.)
G04 P1.00000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ G90 (Absolute coordinates.)
S10000 (RPM spindle speed.)

G01 F100.00000 (Feedrate)
G00 Z1.00000 (Retract)
G00 Z1.00000 (Retract to tool change height)
T1
M5 (Spindle stop.)
G04 P1.00000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ G90 (Absolute coordinates.)
S10000 (RPM spindle speed.)

G01 F100.00000 (Feedrate)
G00 Z1.00000 (Retract)
G00 Z1.00000 (Retract to tool change height)
T1
M5 (Spindle stop.)
G04 P1.00000
Expand Down
2 changes: 1 addition & 1 deletion testing/gerbv_example/multivibrator/expected/milldrill.ngc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ G90 (Absolute coordinates.)
S10000 (RPM spindle speed.)

G01 F100.00000 (Feedrate)
G00 Z1.00000 (Retract)
G00 Z1.00000 (Retract to tool change height)
T1
M5 (Spindle stop.)
G04 P1.00000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ G90 (Absolute coordinates.)
S10000 (RPM spindle speed.)

G01 F100.00000 (Feedrate)
G00 Z1.00000 (Retract)
G00 Z1.00000 (Retract to tool change height)
T1
M5 (Spindle stop.)
G04 P1.00000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ G90 (Absolute coordinates.)
S10000 (RPM spindle speed.)

G01 F100.00000 (Feedrate)
G00 Z1.00000 (Retract)
G00 Z1.00000 (Retract to tool change height)
T1
M5 (Spindle stop.)
G04 P1.00000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ G90 (Absolute coordinates.)
S10000 (RPM spindle speed.)

G01 F100.00000 (Feedrate)
G00 Z1.00000 (Retract)
G00 Z1.00000 (Retract to tool change height)
T1
M5 (Spindle stop.)
G04 P1.00000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ G90 (Absolute coordinates.)
S10000 (RPM spindle speed.)

G01 F100.00000 (Feedrate)
G00 Z1.00000 (Retract)
G00 Z1.00000 (Retract to tool change height)
T1
M5 (Spindle stop.)
G04 P1.00000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ G90 (Absolute coordinates.)
S10000 (RPM spindle speed.)

G01 F100.00000 (Feedrate)
G00 Z1.00000 (Retract)
G00 Z1.00000 (Retract to tool change height)
T1
M5 (Spindle stop.)
G04 P1.00000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ G90 (Absolute coordinates.)
S10000 (RPM spindle speed.)

G01 F100.00000 (Feedrate)
G00 Z1.00000 (Retract)
G00 Z1.00000 (Retract to tool change height)
T1
M5 (Spindle stop.)
G04 P1.00000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ G90 (Absolute coordinates.)
S10000 (RPM spindle speed.)

G01 F2540.00000 (Feedrate)
G00 Z25.40000 (Retract)
G00 Z25.40000 (Retract to tool change height)
T1
M5 (Spindle stop.)
G04 P1.00000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ G90 (Absolute coordinates.)
S10000 (RPM spindle speed.)

G01 F100.00000 (Feedrate)
G00 Z1.00000 (Retract)
G00 Z1.00000 (Retract to tool change height)
T1
M5 (Spindle stop.)
G04 P1.00000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ G90 (Absolute coordinates.)
S10000 (RPM spindle speed.)

G01 F100.00000 (Feedrate)
G00 Z1.00000 (Retract)
G00 Z1.00000 (Retract to tool change height)
T2
M5 (Spindle stop.)
G04 P1.00000
Expand Down

0 comments on commit 0da1d07

Please sign in to comment.