继续按 align-linuxcnc 约束:补 G7G76 源链接回归

结论:新增 LinuxCNC-backed G7 G76 fixture,依据 interp_convert.cc::convert_lathe_diameter_mode 和 convert_threading_cycle 验证直径模式下 G76 I/J/K 几何缩放、最终 threading pass 与 taper sync pitch;未扩展 smoke,test-native 与 test-linuxcnc-source-link 均通过。
This commit is contained in:
cnc
2026-06-02 15:33:17 +08:00
parent 952d3ecfd2
commit 23284e528f
6 changed files with 60 additions and 8 deletions

View File

@@ -142,9 +142,11 @@ fi
CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_threading_sync.ngc >"$output_dir/cnc_sim_linuxcnc_threading_sync.json"
CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_threading_cycle.ngc >"$output_dir/cnc_sim_linuxcnc_threading_cycle.json"
# Source basis: LinuxCNC src/emc/rs274ngc/interp_convert.cc
# convert_lathe_diameter_mode() scales G7/G8 X words; interp_namedparams.cc
# exposes #<_lathe_diameter_mode> and #<_lathe_radius_mode>.
# convert_lathe_diameter_mode() scales G7/G8 X words and G76 I/J/K words;
# interp_namedparams.cc exposes #<_lathe_diameter_mode> and
# #<_lathe_radius_mode>.
CNC_SIM_RS274_FILE_MODE=1 CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_lathe_diameter_mode.ngc >"$output_dir/cnc_sim_linuxcnc_lathe_diameter_mode.json"
CNC_SIM_RS274_FILE_MODE=1 CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_lathe_diameter_g76.ngc >"$output_dir/cnc_sim_linuxcnc_lathe_diameter_g76.json"
CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_tool_number.ngc >"$output_dir/cnc_sim_linuxcnc_tool_number.json"
CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_program_stops.ngc >"$output_dir/cnc_sim_linuxcnc_program_stops.json"
CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_coolant.ngc >"$output_dir/cnc_sim_linuxcnc_coolant.json"
@@ -396,6 +398,24 @@ expected_lathe_feeds = [
if lathe_feeds != expected_lathe_feeds:
raise SystemExit(f"unexpected G7/G8 lathe diameter-mode feeds: {lathe_feeds!r}")
lathe_g76 = load("cnc_sim_linuxcnc_lathe_diameter_g76.json")
if not any(
event["type"] == "linear-feed" and
event["line"] == 4 and
abs(event["end"]["x"] - 0.98125) < 1e-9 and
event["end"]["z"] == -1
for event in lathe_g76
):
raise SystemExit("missing G7 diameter-mode G76 final threading pass")
if not any(
event["type"] == "comment" and
event["line"] == 4 and
event["reserved"] == 3301 and
abs(event["feed"] - 0.0515388) < 1e-7
for event in lathe_g76
):
raise SystemExit("missing G7 diameter-mode G76 taper sync pitch")
tool_number = load("cnc_sim_linuxcnc_tool_number.json")
if not any(
event["type"] == "tool-change" and
@@ -1206,6 +1226,7 @@ echo "dumped $output_dir/cnc_sim_linuxcnc_modal_autorestore.json"
echo "dumped $output_dir/cnc_sim_linuxcnc_threading_sync.json"
echo "dumped $output_dir/cnc_sim_linuxcnc_threading_cycle.json"
echo "dumped $output_dir/cnc_sim_linuxcnc_lathe_diameter_mode.json"
echo "dumped $output_dir/cnc_sim_linuxcnc_lathe_diameter_g76.json"
echo "dumped $output_dir/cnc_sim_linuxcnc_tool_number.json"
echo "dumped $output_dir/cnc_sim_linuxcnc_program_stops.json"
echo "dumped $output_dir/cnc_sim_linuxcnc_coolant.json"