按源验证单位切换UVW线性轴

This commit is contained in:
cnc
2026-06-06 08:31:42 +08:00
parent 25cb6885bf
commit 1d96aa8a55
3 changed files with 11 additions and 3 deletions

View File

@@ -1227,6 +1227,10 @@ if units_rapid[2]["start"] != units_rapid[2]["end"]:
) )
if (units_rapid[1]["end"]["a"], units_rapid[1]["end"]["b"], units_rapid[1]["end"]["c"]) != (4, 5, 6): if (units_rapid[1]["end"]["a"], units_rapid[1]["end"]["b"], units_rapid[1]["end"]["c"]) != (4, 5, 6):
raise SystemExit("LinuxCNC G21 unit change unexpectedly scaled rotary axes") raise SystemExit("LinuxCNC G21 unit change unexpectedly scaled rotary axes")
if (units_rapid[1]["end"]["u"], units_rapid[1]["end"]["v"], units_rapid[1]["end"]["w"]) != (177.8, 203.2, 228.6):
raise SystemExit("LinuxCNC G21 unit change did not scale U/V/W linear axes")
if (units_rapid[2]["end"]["u"], units_rapid[2]["end"]["v"], units_rapid[2]["end"]["w"]) != (7, 8, 9):
raise SystemExit("LinuxCNC G20 unit change did not restore U/V/W linear axes")
units_g92_restore = load("cnc_sim_linuxcnc_units_g92_restore.json") units_g92_restore = load("cnc_sim_linuxcnc_units_g92_restore.json")
units_g92_states = [ units_g92_states = [

View File

@@ -1927,6 +1927,10 @@ if units_rapid[2]["start"] != units_rapid[2]["end"]:
) )
if (units_rapid[1]["end"]["a"], units_rapid[1]["end"]["b"], units_rapid[1]["end"]["c"]) != (4, 5, 6): if (units_rapid[1]["end"]["a"], units_rapid[1]["end"]["b"], units_rapid[1]["end"]["c"]) != (4, 5, 6):
raise SystemExit("source-linked LinuxCNC G21 unit change unexpectedly scaled rotary axes") raise SystemExit("source-linked LinuxCNC G21 unit change unexpectedly scaled rotary axes")
if (units_rapid[1]["end"]["u"], units_rapid[1]["end"]["v"], units_rapid[1]["end"]["w"]) != (177.8, 203.2, 228.6):
raise SystemExit("source-linked LinuxCNC G21 unit change did not scale U/V/W linear axes")
if (units_rapid[2]["end"]["u"], units_rapid[2]["end"]["v"], units_rapid[2]["end"]["w"]) != (7, 8, 9):
raise SystemExit("source-linked LinuxCNC G20 unit change did not restore U/V/W linear axes")
units_g92_restore = load("cnc_sim_linuxcnc_source_units_g92_restore.json") units_g92_restore = load("cnc_sim_linuxcnc_source_units_g92_restore.json")
units_g92_states = [ units_g92_states = [

View File

@@ -1,8 +1,8 @@
G20 G90 G17 G20 G90 G17
(Source basis: LinuxCNC unit_tests/interp/test_interp_basics.cc Convert G20 / G21 verifies that current linear axes rescale on unit changes while rotary axes keep angular values.) (Source basis: LinuxCNC unit_tests/interp/test_interp_basics.cc Convert G20 / G21 verifies that current linear axes rescale on unit changes while rotary axes keep angular values.)
G0 X1 Y2 Z3 A4 B5 C6 G0 X1 Y2 Z3 A4 B5 C6 U7 V8 W9
G21 G21
G0 X25.4 Y50.8 Z76.2 A4 B5 C6 G0 X25.4 Y50.8 Z76.2 A4 B5 C6 U177.8 V203.2 W228.6
G20 G20
G0 X1 Y2 Z3 A4 B5 C6 G0 X1 Y2 Z3 A4 B5 C6 U7 V8 W9
M30 M30