参考所有分组:补 G73 G85 G86 G89 source 覆盖,测试通过

This commit is contained in:
cnc
2026-06-03 06:30:24 +08:00
parent dbf27a4e6b
commit d0a7a9fcec
4 changed files with 129 additions and 1 deletions

View File

@@ -589,6 +589,9 @@ if CNC_SIM_RS274_FILE_MODE=1 CNC_SIM_RS274_VAR="$var_file" \
fi
grep -Fq "Cannot put an a in canned cycle" \
"$output_dir/cnc_sim_linuxcnc_canned_cycle_reject_rotary_followup.err"
# Source basis: LinuxCNC src/emc/rs274ngc/interp_cycles.cc
# convert_cycle_g73()/g85()/g86()/g89() expand peck, feed-out,
# stop/restart, dwell, and retract sequences through Canon motion.
CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_canned_cycles_extended.ngc >"$output_dir/cnc_sim_linuxcnc_canned_cycles_extended.json"
CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_canned_cycle_planes.ngc >"$output_dir/cnc_sim_linuxcnc_canned_cycle_planes.json"
CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_extended_plane_cycle.ngc >"$output_dir/cnc_sim_linuxcnc_extended_plane_cycle.json"
@@ -1668,6 +1671,65 @@ expected_g87_sequence = [
if g87_sequence != expected_g87_sequence:
raise SystemExit(f"unexpected G87 back-boring sequence: {g87_sequence!r}")
g73_feed_depths = [
event["end"]["z"]
for event in extended_cycle
if event["type"] == "linear-feed" and event["line"] == 15
]
if g73_feed_depths != [1, 0, -1, -2, -3]:
raise SystemExit(f"unexpected G73 peck depths: {g73_feed_depths!r}")
g73_rapid_depths = [
event["end"]["z"]
for event in extended_cycle
if event["type"] == "rapid" and event["line"] == 15 and event["end"]["x"] == 70
]
if g73_rapid_depths != [2, 2, 1, 0, -1, 2]:
raise SystemExit(f"unexpected G73 short-retract depths: {g73_rapid_depths!r}")
g85_sequence = [
g84_signature(event)
for event in extended_cycle
if event["line"] == 16 and event["type"] == "linear-feed"
]
expected_g85_sequence = [
("linear-feed", 80, -2),
("linear-feed", 80, 2),
]
if g85_sequence != expected_g85_sequence:
raise SystemExit(f"unexpected G85 feed-out sequence: {g85_sequence!r}")
g86_sequence = [
g84_signature(event)
for event in extended_cycle
if event["line"] == 17 and event["type"] in {"linear-feed", "set-spindle", "dwell"}
]
expected_g86_sequence = [
("linear-feed", 90, -2),
("dwell", 0.06),
("set-spindle", 0, 0),
("set-spindle", 800, 1),
]
if g86_sequence != expected_g86_sequence:
raise SystemExit(f"unexpected G86 stop/restart sequence: {g86_sequence!r}")
if not any(
event["type"] == "rapid" and event["line"] == 17 and event["end"]["x"] == 90 and event["end"]["z"] == 2
for event in extended_cycle
):
raise SystemExit("missing G86 rapid retract")
g89_sequence = [
g84_signature(event)
for event in extended_cycle
if event["line"] == 18 and event["type"] in {"linear-feed", "dwell"}
]
expected_g89_sequence = [
("linear-feed", 100, -2),
("dwell", 0.08),
("linear-feed", 100, 2),
]
if g89_sequence != expected_g89_sequence:
raise SystemExit(f"unexpected G89 dwell/feed-out sequence: {g89_sequence!r}")
arc_planes = load("cnc_sim_linuxcnc_arc_planes.json")
if not any(
event["type"] == "arc-feed" and