对齐 LinuxCNC 解析器覆盖
This commit is contained in:
@@ -9,6 +9,7 @@ build_dir=${TMPDIR:-/tmp}/cnc_sim_native
|
||||
mkdir -p "$build_dir"
|
||||
var_file="$build_dir/rs274ngc.var"
|
||||
base_var_file="$build_dir/rs274ngc-base.var"
|
||||
ini_named_parameter_file="$(pwd)/tests/gcode/linuxcnc_ini_named_parameter.ini"
|
||||
cp "$linuxcnc_root/tests/halui/jogging/sim.var" "$base_var_file"
|
||||
cp "$base_var_file" "$var_file"
|
||||
|
||||
@@ -39,22 +40,54 @@ CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linux
|
||||
CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/basic_mill.ngc >/tmp/cnc_sim_linuxcnc_basic_mill.json
|
||||
CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_rtcp_controls.ngc >/tmp/cnc_sim_linuxcnc_rtcp_controls.json
|
||||
CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_spindle_direction.ngc >/tmp/cnc_sim_linuxcnc_spindle_direction.json
|
||||
CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_spindle_modes.ngc >/tmp/cnc_sim_linuxcnc_spindle_modes.json
|
||||
CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_spindle_orient.ngc >/tmp/cnc_sim_linuxcnc_spindle_orient.json
|
||||
CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_io_controls.ngc >/tmp/cnc_sim_linuxcnc_io_controls.json
|
||||
CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_override_controls.ngc >/tmp/cnc_sim_linuxcnc_override_controls.json
|
||||
CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_modal_state.ngc >/tmp/cnc_sim_linuxcnc_modal_state.json
|
||||
CNC_SIM_RS274_FILE_MODE=1 CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_modal_autorestore.ngc >/tmp/cnc_sim_linuxcnc_modal_autorestore.json
|
||||
if CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_modal_invalidate.ngc >/tmp/cnc_sim_linuxcnc_modal_invalidate.json 2>/tmp/cnc_sim_linuxcnc_modal_invalidate.err; then
|
||||
echo "expected linuxcnc_modal_invalidate.ngc to fail" >&2
|
||||
exit 1
|
||||
fi
|
||||
CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_threading_sync.ngc >/tmp/cnc_sim_linuxcnc_threading_sync.json
|
||||
CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_threading_cycle.ngc >/tmp/cnc_sim_linuxcnc_threading_cycle.json
|
||||
CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_tool_number.ngc >/tmp/cnc_sim_linuxcnc_tool_number.json
|
||||
CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_program_stops.ngc >/tmp/cnc_sim_linuxcnc_program_stops.json
|
||||
CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_coolant.ngc >/tmp/cnc_sim_linuxcnc_coolant.json
|
||||
CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_feed_modes.ngc >/tmp/cnc_sim_linuxcnc_feed_modes.json
|
||||
CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_motion_modes.ngc >/tmp/cnc_sim_linuxcnc_motion_modes.json
|
||||
CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_tool_length.ngc >/tmp/cnc_sim_linuxcnc_tool_length.json
|
||||
CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_dynamic_tool_length.ngc >/tmp/cnc_sim_linuxcnc_dynamic_tool_length.json
|
||||
CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_canned_cycle.ngc >/tmp/cnc_sim_linuxcnc_canned_cycle.json
|
||||
CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_canned_cycles_extended.ngc >/tmp/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 >/tmp/cnc_sim_linuxcnc_canned_cycle_planes.json
|
||||
CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_arc_planes.ngc >/tmp/cnc_sim_linuxcnc_arc_planes.json
|
||||
CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_arc_distance_modes.ngc >/tmp/cnc_sim_linuxcnc_arc_distance_modes.json
|
||||
CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_predefined_positions.ngc >/tmp/cnc_sim_linuxcnc_predefined_positions.json
|
||||
CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_machine_coordinates.ngc >/tmp/cnc_sim_linuxcnc_machine_coordinates.json
|
||||
CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_cutter_comp.ngc >/tmp/cnc_sim_linuxcnc_cutter_comp.json
|
||||
CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_comments.ngc >/tmp/cnc_sim_linuxcnc_comments.json
|
||||
CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_probe_no_error.ngc >/tmp/cnc_sim_linuxcnc_probe_no_error.json
|
||||
CNC_SIM_RS274_FILE_MODE=1 CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/smoke_oword_subprogram.ngc >/tmp/cnc_sim_linuxcnc_oword_subprogram.json
|
||||
CNC_SIM_RS274_FILE_MODE=1 CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_named_oword_subprogram.ngc >/tmp/cnc_sim_linuxcnc_named_oword_subprogram.json
|
||||
CNC_SIM_RS274_FILE_MODE=1 CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_oword_control_flow.ngc >/tmp/cnc_sim_linuxcnc_oword_control_flow.json
|
||||
CNC_SIM_RS274_FILE_MODE=1 CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_named_parameter_exists.ngc >/tmp/cnc_sim_linuxcnc_named_parameter_exists.json
|
||||
CNC_SIM_RS274_FILE_MODE=1 CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_indexed_parameters.ngc >/tmp/cnc_sim_linuxcnc_indexed_parameters.json
|
||||
CNC_SIM_RS274_FILE_MODE=1 CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_named_parameter_normalization.ngc >/tmp/cnc_sim_linuxcnc_named_parameter_normalization.json
|
||||
INI_FILE_NAME="$ini_named_parameter_file" CNC_SIM_RS274_FILE_MODE=1 CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_ini_named_parameter.ngc >/tmp/cnc_sim_linuxcnc_ini_named_parameter.json
|
||||
cp "$base_var_file" "$var_file"
|
||||
CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_coordinate_offsets.ngc >/tmp/cnc_sim_linuxcnc_coordinate_offsets.json
|
||||
cp "$base_var_file" "$var_file"
|
||||
CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_coordinate_l20.ngc >/tmp/cnc_sim_linuxcnc_coordinate_l20.json
|
||||
cp "$base_var_file" "$var_file"
|
||||
CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_coordinate_p0.ngc >/tmp/cnc_sim_linuxcnc_coordinate_p0.json
|
||||
cp "$base_var_file" "$var_file"
|
||||
CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_coordinate_select_all.ngc >/tmp/cnc_sim_linuxcnc_coordinate_select_all.json
|
||||
cp "$base_var_file" "$var_file"
|
||||
CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_g92_restore.ngc >/tmp/cnc_sim_linuxcnc_g92_restore.json
|
||||
cp "$base_var_file" "$var_file"
|
||||
CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_g52_offset.ngc >/tmp/cnc_sim_linuxcnc_g52_offset.json
|
||||
python3 - <<'PY'
|
||||
import json
|
||||
from pathlib import Path
|
||||
@@ -95,6 +128,160 @@ if (3, 1200, 2) not in spindle_states:
|
||||
if (4, 0, 0) not in spindle_states:
|
||||
raise SystemExit("missing M5 stopped spindle state")
|
||||
|
||||
spindle_modes = json.loads(Path("/tmp/cnc_sim_linuxcnc_spindle_modes.json").read_text())
|
||||
spindle_mode_states = [
|
||||
(event["line"], event["reserved"], event["feed"], event["tool"])
|
||||
for event in spindle_modes
|
||||
if event["type"] == "comment" and event["line"] in {2, 3, 4} and event["reserved"] in {960, 970}
|
||||
]
|
||||
expected_spindle_mode_states = [
|
||||
(2, 970, 0, 0),
|
||||
(3, 960, 2500, 0),
|
||||
(4, 970, 0, 0),
|
||||
]
|
||||
if spindle_mode_states != expected_spindle_mode_states:
|
||||
raise SystemExit(f"unexpected G96/G97 spindle mode states: {spindle_mode_states!r}")
|
||||
|
||||
spindle_orient = json.loads(Path("/tmp/cnc_sim_linuxcnc_spindle_orient.json").read_text())
|
||||
if not any(
|
||||
event["type"] == "comment" and
|
||||
event["line"] == 2 and
|
||||
event["reserved"] == 1901 and
|
||||
event["tool"] == 0 and
|
||||
event["feed"] == 45 and
|
||||
event["arcTurns"] == 1
|
||||
for event in spindle_orient
|
||||
):
|
||||
raise SystemExit("missing M19 spindle orient state")
|
||||
if not any(
|
||||
event["type"] == "comment" and
|
||||
event["line"] == 2 and
|
||||
event["reserved"] == 1902 and
|
||||
event["tool"] == 0 and
|
||||
event["dwellSeconds"] == 2
|
||||
for event in spindle_orient
|
||||
):
|
||||
raise SystemExit("missing M19 spindle orient wait state")
|
||||
|
||||
io_controls = json.loads(Path("/tmp/cnc_sim_linuxcnc_io_controls.json").read_text())
|
||||
io_states = [
|
||||
(event["line"], event["reserved"], event["tool"], event["feed"], event["arcTurns"], event["dwellSeconds"])
|
||||
for event in io_controls
|
||||
if event["type"] == "comment" and event["reserved"] in {62, 63, 64, 65, 66, 67, 68}
|
||||
]
|
||||
expected_io_states = [
|
||||
(2, 62, 1, 1, 0, 0),
|
||||
(3, 63, 1, 0, 0, 0),
|
||||
(4, 64, 2, 1, 0, 0),
|
||||
(5, 65, 2, 0, 0, 0),
|
||||
(6, 66, 0, 3, 1, 5),
|
||||
(7, 66, 1, 0, 0, 0),
|
||||
(8, 67, 0, 1.25, 0, 0),
|
||||
(9, 68, 1, 2.5, 0, 0),
|
||||
]
|
||||
if io_states != expected_io_states:
|
||||
raise SystemExit(f"unexpected M62-M68 I/O states: {io_states!r}")
|
||||
|
||||
override_controls = json.loads(Path("/tmp/cnc_sim_linuxcnc_override_controls.json").read_text())
|
||||
override_states = [
|
||||
(event["line"], event["reserved"], event["tool"], event["feed"])
|
||||
for event in override_controls
|
||||
if event["type"] == "comment" and event["reserved"] in {50, 51, 52, 53}
|
||||
]
|
||||
expected_override_states = [
|
||||
(2, 50, 0, 1),
|
||||
(2, 51, 0, 1),
|
||||
(3, 50, 0, 0),
|
||||
(3, 51, 0, 0),
|
||||
(4, 50, 0, 1),
|
||||
(5, 50, 0, 0),
|
||||
(6, 51, 0, 1),
|
||||
(7, 51, 0, 0),
|
||||
(8, 52, 0, 1),
|
||||
(9, 52, 0, 0),
|
||||
(10, 53, 0, 1),
|
||||
(11, 53, 0, 0),
|
||||
(12, 50, 0, 1),
|
||||
]
|
||||
if override_states != expected_override_states:
|
||||
raise SystemExit(f"unexpected M48-M53 override states: {override_states!r}")
|
||||
|
||||
modal_state = json.loads(Path("/tmp/cnc_sim_linuxcnc_modal_state.json").read_text())
|
||||
if not any(
|
||||
event["type"] == "rapid" and
|
||||
event["line"] == 7 and
|
||||
event["end"]["x"] == 2 and
|
||||
event["end"]["y"] == 0 and
|
||||
event["end"]["z"] == 2
|
||||
for event in modal_state
|
||||
):
|
||||
raise SystemExit("missing M72 restored absolute millimeter move")
|
||||
if not any(
|
||||
event["type"] == "arc-feed" and
|
||||
event["line"] == 8 and
|
||||
event["plane"] == 17 and
|
||||
event["end"]["x"] == 4 and
|
||||
event["end"]["y"] == 0
|
||||
for event in modal_state
|
||||
):
|
||||
raise SystemExit("missing M72 restored XY plane arc")
|
||||
|
||||
modal_autorestore = json.loads(Path("/tmp/cnc_sim_linuxcnc_modal_autorestore.json").read_text())
|
||||
if not any(
|
||||
event["type"] == "rapid" and
|
||||
event["line"] == 9 and
|
||||
event["end"]["x"] == 10
|
||||
for event in modal_autorestore
|
||||
):
|
||||
raise SystemExit("missing M73 subroutine changed modal state move")
|
||||
if not any(
|
||||
event["type"] == "rapid" and
|
||||
event["line"] == 4 and
|
||||
event["start"]["x"] == 10 and
|
||||
event["end"]["x"] == 12
|
||||
for event in modal_autorestore
|
||||
):
|
||||
raise SystemExit("missing M73 autorestored incremental caller move")
|
||||
|
||||
threading_sync = json.loads(Path("/tmp/cnc_sim_linuxcnc_threading_sync.json").read_text())
|
||||
sync_states = [
|
||||
(event["line"], event["reserved"], event["feed"], event["tool"])
|
||||
for event in threading_sync
|
||||
if event["type"] == "comment" and event["reserved"] in {3300, 3301, 3302}
|
||||
]
|
||||
expected_sync_states = [
|
||||
(4, 3301, 1, 0),
|
||||
(4, 3300, 0, 0),
|
||||
(6, 3301, 1, 0),
|
||||
(6, 3300, 0, 0),
|
||||
]
|
||||
if sync_states != expected_sync_states:
|
||||
raise SystemExit(f"unexpected G33/G33.1 sync states: {sync_states!r}")
|
||||
if not any(
|
||||
event["type"] == "linear-feed" and event["line"] == 6 and event["end"]["z"] == 0
|
||||
for event in threading_sync
|
||||
):
|
||||
raise SystemExit("missing G33.1 rigid tap motion line")
|
||||
|
||||
threading_cycle = json.loads(Path("/tmp/cnc_sim_linuxcnc_threading_cycle.json").read_text())
|
||||
if not any(
|
||||
event["type"] == "comment" and
|
||||
event["line"] == 4 and
|
||||
event["reserved"] == 3301 and
|
||||
event["feed"] == 0.05
|
||||
for event in threading_cycle
|
||||
):
|
||||
raise SystemExit("missing G76 threading sync start")
|
||||
if not any(event["type"] == "comment" and event["line"] == 4 and event["reserved"] == 3300 for event in threading_cycle):
|
||||
raise SystemExit("missing G76 threading sync stop")
|
||||
if not any(
|
||||
event["type"] == "linear-feed" and event["line"] == 4 and event["end"]["z"] == -1
|
||||
for event in threading_cycle
|
||||
):
|
||||
raise SystemExit("missing G76 final threading pass")
|
||||
if not any(event["type"] == "program-end" and event["line"] == 5 for event in threading_cycle):
|
||||
raise SystemExit("missing G76 program end line number")
|
||||
|
||||
tool_number = json.loads(Path("/tmp/cnc_sim_linuxcnc_tool_number.json").read_text())
|
||||
if not any(
|
||||
event["type"] == "tool-change" and
|
||||
@@ -170,6 +357,16 @@ if not any(
|
||||
):
|
||||
raise SystemExit("missing G49 tool length clear event")
|
||||
|
||||
dynamic_tool_length = json.loads(Path("/tmp/cnc_sim_linuxcnc_dynamic_tool_length.json").read_text())
|
||||
dynamic_offsets = [
|
||||
(event["line"], event["start"]["x"], event["start"]["z"])
|
||||
for event in dynamic_tool_length
|
||||
if event["type"] == "comment" and event["reserved"] == 430
|
||||
]
|
||||
expected_dynamic_offsets = [(2, 1, 2), (3, 1.25, 2.5), (4, 1.25, 15), (5, 0, 0)]
|
||||
if dynamic_offsets != expected_dynamic_offsets:
|
||||
raise SystemExit(f"unexpected G43.1/G43.2 tool length offsets: {dynamic_offsets!r}")
|
||||
|
||||
cycle = json.loads(Path("/tmp/cnc_sim_linuxcnc_canned_cycle.json").read_text())
|
||||
motions = [event for event in cycle if event["type"] in {"rapid", "linear-feed"}]
|
||||
expected_cycle = [
|
||||
@@ -183,6 +380,152 @@ actual_cycle = [(event["type"], event["end"]["x"], event["end"]["y"], event["end
|
||||
if actual_cycle != expected_cycle:
|
||||
raise SystemExit(f"unexpected G81/G80 expansion: {actual_cycle!r}")
|
||||
|
||||
cycle_planes = json.loads(Path("/tmp/cnc_sim_linuxcnc_canned_cycle_planes.json").read_text())
|
||||
if not any(
|
||||
event["type"] == "linear-feed" and
|
||||
event["line"] == 4 and
|
||||
event["end"]["x"] == 1 and
|
||||
event["end"]["y"] == -2 and
|
||||
event["end"]["z"] == 4
|
||||
for event in cycle_planes
|
||||
):
|
||||
raise SystemExit("missing G18 G81 feed along Y depth axis")
|
||||
if not any(
|
||||
event["type"] == "rapid" and
|
||||
event["line"] == 4 and
|
||||
event["end"]["x"] == 1 and
|
||||
event["end"]["y"] == 3 and
|
||||
event["end"]["z"] == 4
|
||||
for event in cycle_planes
|
||||
):
|
||||
raise SystemExit("missing G18 G81 retract to Y R plane")
|
||||
if not any(
|
||||
event["type"] == "linear-feed" and
|
||||
event["line"] == 7 and
|
||||
event["end"]["x"] == -2 and
|
||||
event["end"]["y"] == 3 and
|
||||
event["end"]["z"] == 4
|
||||
for event in cycle_planes
|
||||
):
|
||||
raise SystemExit("missing G19 G82 feed along X depth axis")
|
||||
if not any(
|
||||
event["type"] == "dwell" and
|
||||
event["line"] == 7 and
|
||||
event["dwellSeconds"] == 0.2
|
||||
for event in cycle_planes
|
||||
):
|
||||
raise SystemExit("missing G19 G82 dwell at bottom")
|
||||
if not any(
|
||||
event["type"] == "rapid" and
|
||||
event["line"] == 7 and
|
||||
event["end"]["x"] == 2 and
|
||||
event["end"]["y"] == 3 and
|
||||
event["end"]["z"] == 4
|
||||
for event in cycle_planes
|
||||
):
|
||||
raise SystemExit("missing G19 G82 retract to X R plane")
|
||||
def plane_cycle_signature(event):
|
||||
if event["type"] in {"rapid", "linear-feed"}:
|
||||
return (event["type"], event["end"]["x"], event["end"]["y"], event["end"]["z"])
|
||||
if event["type"] == "set-spindle":
|
||||
return ("set-spindle", event["spindle"], event["reserved"])
|
||||
if event["type"] == "dwell":
|
||||
return ("dwell", event["dwellSeconds"])
|
||||
if event["type"] == "program-end":
|
||||
return ("program-end", event["reserved"])
|
||||
return None
|
||||
plane_g84_sequence = [
|
||||
plane_cycle_signature(event)
|
||||
for event in cycle_planes
|
||||
if event["line"] == 11 and event["type"] in {"rapid", "linear-feed", "set-spindle", "dwell"}
|
||||
]
|
||||
expected_plane_g84_sequence = [
|
||||
("rapid", 1, 5, 4),
|
||||
("rapid", 1, 3, 4),
|
||||
("linear-feed", -2, 4, 1),
|
||||
("set-spindle", 0, 0),
|
||||
("set-spindle", 600, 2),
|
||||
("dwell", 0.05),
|
||||
("linear-feed", 3, 4, 1),
|
||||
("set-spindle", 0, 0),
|
||||
("set-spindle", 600, 1),
|
||||
]
|
||||
if plane_g84_sequence != expected_plane_g84_sequence:
|
||||
raise SystemExit(f"unexpected G18 G84 plane sequence: {plane_g84_sequence!r}")
|
||||
plane_g74_sequence = [
|
||||
plane_cycle_signature(event)
|
||||
for event in cycle_planes
|
||||
if event["line"] == 15 and event["type"] in {"rapid", "linear-feed", "set-spindle", "dwell"}
|
||||
]
|
||||
expected_plane_g74_sequence = [
|
||||
("rapid", 5, 3, 4),
|
||||
("rapid", 2, 3, 4),
|
||||
("linear-feed", 4, -2, 3),
|
||||
("set-spindle", 0, 0),
|
||||
("set-spindle", 500, 1),
|
||||
("dwell", 0.04),
|
||||
("linear-feed", 4, 2, 3),
|
||||
("set-spindle", 0, 0),
|
||||
("set-spindle", 500, 2),
|
||||
]
|
||||
if plane_g74_sequence != expected_plane_g74_sequence:
|
||||
raise SystemExit(f"unexpected G19 G74 plane sequence: {plane_g74_sequence!r}")
|
||||
plane_g86_sequence = [
|
||||
plane_cycle_signature(event)
|
||||
for event in cycle_planes
|
||||
if event["line"] == 19 and event["type"] in {"rapid", "linear-feed", "set-spindle", "dwell"}
|
||||
]
|
||||
expected_plane_g86_sequence = [
|
||||
("rapid", 1, 5, 4),
|
||||
("rapid", 1, 3, 4),
|
||||
("linear-feed", 1, -2, 4),
|
||||
("dwell", 0.1),
|
||||
("set-spindle", 0, 0),
|
||||
("rapid", 1, 3, 4),
|
||||
("set-spindle", 900, 1),
|
||||
]
|
||||
if plane_g86_sequence != expected_plane_g86_sequence:
|
||||
raise SystemExit(f"unexpected G18 G86 plane sequence: {plane_g86_sequence!r}")
|
||||
plane_g88_sequence = [
|
||||
plane_cycle_signature(event)
|
||||
for event in cycle_planes
|
||||
if event["line"] == 23 and event["type"] in {"rapid", "linear-feed", "set-spindle", "dwell", "program-end"}
|
||||
]
|
||||
expected_plane_g88_sequence = [
|
||||
("rapid", 5, 3, 4),
|
||||
("rapid", 2, 3, 4),
|
||||
("linear-feed", -2, 3, 4),
|
||||
("dwell", 0.07),
|
||||
("set-spindle", 0, 0),
|
||||
("program-end", 1),
|
||||
("set-spindle", 700, 1),
|
||||
]
|
||||
if plane_g88_sequence != expected_plane_g88_sequence:
|
||||
raise SystemExit(f"unexpected G19 G88 plane sequence: {plane_g88_sequence!r}")
|
||||
plane_g87_sequence = [
|
||||
plane_cycle_signature(event)
|
||||
for event in cycle_planes
|
||||
if event["line"] == 27 and event["type"] in {"rapid", "linear-feed", "set-spindle"}
|
||||
]
|
||||
expected_plane_g87_sequence = [
|
||||
("rapid", 5, 1, 2),
|
||||
("rapid", 2, 1, 2),
|
||||
("rapid", 2, 1.2, 2.3),
|
||||
("set-spindle", 0, 0),
|
||||
("rapid", -4, 1.2, 2.3),
|
||||
("rapid", -4, 1, 2),
|
||||
("set-spindle", 800, 1),
|
||||
("linear-feed", -2, 1, 2),
|
||||
("linear-feed", -4, 1, 2),
|
||||
("set-spindle", 0, 0),
|
||||
("rapid", -4, 1.2, 2.3),
|
||||
("rapid", 2, 1.2, 2.3),
|
||||
("rapid", 2, 1, 2),
|
||||
("set-spindle", 800, 1),
|
||||
]
|
||||
if plane_g87_sequence != expected_plane_g87_sequence:
|
||||
raise SystemExit(f"unexpected G19 G87 plane sequence: {plane_g87_sequence!r}")
|
||||
|
||||
extended_cycle = json.loads(Path("/tmp/cnc_sim_linuxcnc_canned_cycles_extended.json").read_text())
|
||||
if not any(
|
||||
event["type"] == "linear-feed" and
|
||||
@@ -214,6 +557,178 @@ if not any(
|
||||
for event in extended_cycle
|
||||
):
|
||||
raise SystemExit("missing G83 final retract to R plane")
|
||||
def g84_signature(event):
|
||||
if event["type"] == "linear-feed":
|
||||
return ("linear-feed", event["end"]["x"], event["end"]["z"])
|
||||
if event["type"] == "set-spindle":
|
||||
return ("set-spindle", event["spindle"], event["reserved"])
|
||||
if event["type"] == "dwell":
|
||||
return ("dwell", event["dwellSeconds"])
|
||||
if event["type"] == "program-end":
|
||||
return ("program-end", event["reserved"])
|
||||
return None
|
||||
g84_sequence = [
|
||||
g84_signature(event)
|
||||
for event in extended_cycle
|
||||
if event["line"] == 7 and event["type"] in {"linear-feed", "set-spindle", "dwell"}
|
||||
]
|
||||
expected_g84_sequence = [
|
||||
("linear-feed", 30, -2),
|
||||
("set-spindle", 0, 0),
|
||||
("set-spindle", 600, 2),
|
||||
("dwell", 0.05),
|
||||
("linear-feed", 30, 2),
|
||||
("set-spindle", 0, 0),
|
||||
("set-spindle", 600, 1),
|
||||
]
|
||||
if g84_sequence != expected_g84_sequence:
|
||||
raise SystemExit(f"unexpected G84 tapping sequence: {g84_sequence!r}")
|
||||
g74_sequence = [
|
||||
g84_signature(event)
|
||||
for event in extended_cycle
|
||||
if event["line"] == 9 and event["type"] in {"linear-feed", "set-spindle", "dwell"}
|
||||
]
|
||||
expected_g74_sequence = [
|
||||
("linear-feed", 40, -2),
|
||||
("set-spindle", 0, 0),
|
||||
("set-spindle", 500, 1),
|
||||
("dwell", 0.04),
|
||||
("linear-feed", 40, 2),
|
||||
("set-spindle", 0, 0),
|
||||
("set-spindle", 500, 2),
|
||||
]
|
||||
if g74_sequence != expected_g74_sequence:
|
||||
raise SystemExit(f"unexpected G74 tapping sequence: {g74_sequence!r}")
|
||||
g88_sequence = [
|
||||
g84_signature(event)
|
||||
for event in extended_cycle
|
||||
if event["line"] == 11 and event["type"] in {"linear-feed", "set-spindle", "dwell", "program-end"}
|
||||
]
|
||||
expected_g88_sequence = [
|
||||
("linear-feed", 50, -2),
|
||||
("dwell", 0.07),
|
||||
("set-spindle", 0, 0),
|
||||
("program-end", 1),
|
||||
("set-spindle", 700, 1),
|
||||
]
|
||||
if g88_sequence != expected_g88_sequence:
|
||||
raise SystemExit(f"unexpected G88 manual-out sequence: {g88_sequence!r}")
|
||||
if any(
|
||||
event["type"] == "rapid" and
|
||||
event["line"] == 11 and
|
||||
event["start"]["x"] == 50 and
|
||||
event["start"]["z"] == -2 and
|
||||
event["end"]["x"] == 50 and
|
||||
event["end"]["z"] == 2
|
||||
for event in extended_cycle
|
||||
):
|
||||
raise SystemExit("unexpected G88 automatic retract")
|
||||
def g87_signature(event):
|
||||
if event["type"] in {"rapid", "linear-feed"}:
|
||||
return (event["type"], event["end"]["x"], event["end"]["y"], event["end"]["z"])
|
||||
if event["type"] == "set-spindle":
|
||||
return ("set-spindle", event["spindle"], event["reserved"])
|
||||
return None
|
||||
g87_sequence = [
|
||||
g87_signature(event)
|
||||
for event in extended_cycle
|
||||
if event["line"] == 14 and event["type"] in {"rapid", "linear-feed", "set-spindle"}
|
||||
]
|
||||
expected_g87_sequence = [
|
||||
("rapid", 60, 0, 5),
|
||||
("rapid", 60, 0, 2),
|
||||
("rapid", 60.2, 0.3, 2),
|
||||
("set-spindle", 0, 0),
|
||||
("rapid", 60.2, 0.3, -4),
|
||||
("rapid", 60, 0, -4),
|
||||
("set-spindle", 800, 1),
|
||||
("linear-feed", 60, 0, -2),
|
||||
("linear-feed", 60, 0, -4),
|
||||
("set-spindle", 0, 0),
|
||||
("rapid", 60.2, 0.3, -4),
|
||||
("rapid", 60.2, 0.3, 2),
|
||||
("rapid", 60, 0, 2),
|
||||
("set-spindle", 800, 1),
|
||||
]
|
||||
if g87_sequence != expected_g87_sequence:
|
||||
raise SystemExit(f"unexpected G87 back-boring sequence: {g87_sequence!r}")
|
||||
|
||||
arc_planes = json.loads(Path("/tmp/cnc_sim_linuxcnc_arc_planes.json").read_text())
|
||||
if not any(
|
||||
event["type"] == "arc-feed" and
|
||||
event["line"] == 5 and
|
||||
event["plane"] == 18 and
|
||||
event["start"]["x"] == 0 and
|
||||
event["start"]["z"] == 0 and
|
||||
event["end"]["x"] == 10 and
|
||||
event["end"]["z"] == 0 and
|
||||
event["center"]["x"] == 5 and
|
||||
event["center"]["z"] == 0 and
|
||||
event["arcTurns"] == -1
|
||||
for event in arc_planes
|
||||
):
|
||||
raise SystemExit("missing G18 XZ plane arc-feed mapping")
|
||||
if not any(
|
||||
event["type"] == "arc-feed" and
|
||||
event["line"] == 8 and
|
||||
event["plane"] == 19 and
|
||||
event["start"]["y"] == 0 and
|
||||
event["start"]["z"] == 0 and
|
||||
event["end"]["y"] == 10 and
|
||||
event["end"]["z"] == 0 and
|
||||
event["center"]["y"] == 5 and
|
||||
event["center"]["z"] == 0 and
|
||||
event["arcTurns"] == 1
|
||||
for event in arc_planes
|
||||
):
|
||||
raise SystemExit("missing G19 YZ plane arc-feed mapping")
|
||||
|
||||
arc_distance = json.loads(Path("/tmp/cnc_sim_linuxcnc_arc_distance_modes.json").read_text())
|
||||
arc_centers = [
|
||||
(event["line"], event["center"]["x"], event["center"]["y"])
|
||||
for event in arc_distance
|
||||
if event["type"] == "arc-feed"
|
||||
]
|
||||
expected_arc_centers = [(5, 5, 0), (7, 15, 0), (9, 25, 0)]
|
||||
if arc_centers != expected_arc_centers:
|
||||
raise SystemExit(f"unexpected G90.1/G91.1 arc centers: {arc_centers!r}")
|
||||
|
||||
predefined = json.loads(Path("/tmp/cnc_sim_linuxcnc_predefined_positions.json").read_text())
|
||||
predefined_rapids = [
|
||||
(
|
||||
event["line"],
|
||||
event["start"]["x"], event["start"]["y"], event["start"]["z"],
|
||||
event["end"]["x"], event["end"]["y"], event["end"]["z"],
|
||||
)
|
||||
for event in predefined
|
||||
if event["type"] == "rapid" and event["line"] in {5, 9}
|
||||
]
|
||||
expected_predefined_rapids = [
|
||||
(5, 10, 20, 30, 10, 20, 5),
|
||||
(5, 10, 20, 5, 10, 20, 3),
|
||||
(9, 40, 50, 60, 40, 50, 60),
|
||||
(9, 40, 50, 60, 4, 5, 6),
|
||||
]
|
||||
if predefined_rapids != expected_predefined_rapids:
|
||||
raise SystemExit(f"unexpected G28/G30 rapid sequence: {predefined_rapids!r}")
|
||||
|
||||
machine_coords = json.loads(Path("/tmp/cnc_sim_linuxcnc_machine_coordinates.json").read_text())
|
||||
machine_moves = [
|
||||
(
|
||||
event["type"], event["line"],
|
||||
event["start"]["x"], event["start"]["y"], event["start"]["z"],
|
||||
event["end"]["x"], event["end"]["y"], event["end"]["z"],
|
||||
)
|
||||
for event in machine_coords
|
||||
if event["type"] in {"rapid", "linear-feed"} and event["line"] in {3, 4, 6}
|
||||
]
|
||||
expected_machine_moves = [
|
||||
("rapid", 3, 5, 6, 7, 0, 6, 1),
|
||||
("rapid", 4, 0, 6, 1, 2, 6, 1),
|
||||
("linear-feed", 6, 2, 6, 1, 2, 3, 1),
|
||||
]
|
||||
if machine_moves != expected_machine_moves:
|
||||
raise SystemExit(f"unexpected G53 machine-coordinate moves: {machine_moves!r}")
|
||||
|
||||
cutter_comp = json.loads(Path("/tmp/cnc_sim_linuxcnc_cutter_comp.json").read_text())
|
||||
cutter_comp_motions = [
|
||||
@@ -248,17 +763,29 @@ if not any(event["type"] == "comment" and event["line"] == 2 for event in commen
|
||||
raise SystemExit("missing LinuxCNC comment line event")
|
||||
|
||||
probe = json.loads(Path("/tmp/cnc_sim_linuxcnc_probe_no_error.json").read_text())
|
||||
probe_events = [
|
||||
(event["line"], event["reserved"], event["start"]["z"], event["end"]["z"])
|
||||
for event in probe
|
||||
if event["type"] == "probe"
|
||||
]
|
||||
expected_probe_events = [
|
||||
(4, 0, 5, 4),
|
||||
(6, 1, 5, 3),
|
||||
(8, 2, 5, 2),
|
||||
(10, 3, 5, 1),
|
||||
(12, 1, 5, 0),
|
||||
]
|
||||
if probe_events != expected_probe_events:
|
||||
raise SystemExit(f"unexpected G38 probe variants: {probe_events!r}")
|
||||
if any(event["type"] == "linear-feed" and event["line"] in {4, 6, 8, 10, 12} for event in probe):
|
||||
raise SystemExit("G38 probe moves should not be emitted as linear-feed")
|
||||
if not any(
|
||||
event["type"] == "probe" and
|
||||
event["line"] == 4 and
|
||||
event["feed"] == 100 and
|
||||
event["start"]["z"] == 5 and
|
||||
event["end"]["z"] == 0
|
||||
event["type"] == "linear-feed" and
|
||||
event["line"] == 14 and
|
||||
event["end"]["x"] == 1
|
||||
for event in probe
|
||||
):
|
||||
raise SystemExit("missing G38.3 probe event")
|
||||
if any(event["type"] == "linear-feed" and event["line"] == 4 for event in probe):
|
||||
raise SystemExit("G38.3 probe should not be emitted as linear-feed")
|
||||
raise SystemExit("missing #5070 probe-tripped conditional motion")
|
||||
|
||||
oword = json.loads(Path("/tmp/cnc_sim_linuxcnc_oword_subprogram.json").read_text())
|
||||
if not any(
|
||||
@@ -285,6 +812,161 @@ if any(
|
||||
):
|
||||
raise SystemExit("LinuxCNC O-word return should skip remaining subprogram body")
|
||||
|
||||
named_oword = json.loads(Path("/tmp/cnc_sim_linuxcnc_named_oword_subprogram.json").read_text())
|
||||
if not any(
|
||||
event["type"] == "linear-feed" and
|
||||
event["line"] == 9 and
|
||||
event["start"]["x"] == 0 and
|
||||
event["end"]["x"] == 10
|
||||
for event in named_oword
|
||||
):
|
||||
raise SystemExit("missing LinuxCNC named O-word expression motion")
|
||||
if not any(
|
||||
event["type"] == "linear-feed" and
|
||||
event["line"] == 10 and
|
||||
event["start"]["y"] == 0 and
|
||||
event["end"]["y"] == 6
|
||||
for event in named_oword
|
||||
):
|
||||
raise SystemExit("missing LinuxCNC named O-word #2 argument motion")
|
||||
if not any(
|
||||
event["type"] == "linear-feed" and
|
||||
event["line"] == 5 and
|
||||
event["start"]["x"] == 10 and
|
||||
event["end"]["x"] == 20
|
||||
for event in named_oword
|
||||
):
|
||||
raise SystemExit("missing LinuxCNC named O-word return-to-caller motion")
|
||||
if any(
|
||||
event["type"] == "linear-feed" and
|
||||
event["line"] == 12 and
|
||||
event["end"]["x"] == 99
|
||||
for event in named_oword
|
||||
):
|
||||
raise SystemExit("LinuxCNC named O-word return should skip remaining subprogram body")
|
||||
|
||||
oword_flow = json.loads(Path("/tmp/cnc_sim_linuxcnc_oword_control_flow.json").read_text())
|
||||
if not any(event["type"] == "linear-feed" and event["line"] == 7 and event["end"]["x"] == 2 for event in oword_flow):
|
||||
raise SystemExit("missing LinuxCNC O-word elseif branch motion")
|
||||
if any(
|
||||
event["type"] == "linear-feed" and event["line"] in {5, 9} and event["end"]["x"] in {98, 99}
|
||||
for event in oword_flow
|
||||
):
|
||||
raise SystemExit("LinuxCNC O-word conditional should skip inactive branches")
|
||||
while_values = [
|
||||
event["end"]["y"]
|
||||
for event in oword_flow
|
||||
if event["type"] == "linear-feed" and event["line"] == 13
|
||||
]
|
||||
if while_values != [0, 1, 2]:
|
||||
raise SystemExit(f"unexpected LinuxCNC O-word while values: {while_values!r}")
|
||||
repeat_values = [
|
||||
event["end"]["z"]
|
||||
for event in oword_flow
|
||||
if event["type"] == "linear-feed" and event["line"] == 19
|
||||
]
|
||||
if repeat_values != [1, 2, 3]:
|
||||
raise SystemExit(f"unexpected LinuxCNC O-word repeat values: {repeat_values!r}")
|
||||
do_values = [
|
||||
event["end"]["a"]
|
||||
for event in oword_flow
|
||||
if event["type"] == "linear-feed" and event["line"] == 24
|
||||
]
|
||||
if do_values != [1, 2, 3]:
|
||||
raise SystemExit(f"unexpected LinuxCNC O-word do/while values: {do_values!r}")
|
||||
break_values = [
|
||||
event["end"]["b"]
|
||||
for event in oword_flow
|
||||
if event["type"] == "linear-feed" and event["line"] == 32
|
||||
]
|
||||
if break_values != [1]:
|
||||
raise SystemExit(f"unexpected LinuxCNC O-word do/break body values: {break_values!r}")
|
||||
if not any(
|
||||
event["type"] == "linear-feed" and
|
||||
event["line"] == 34 and
|
||||
event["end"]["c"] == 2
|
||||
for event in oword_flow
|
||||
):
|
||||
raise SystemExit("missing LinuxCNC O-word do/break final loop counter motion")
|
||||
continue_values = [
|
||||
event["end"]["u"]
|
||||
for event in oword_flow
|
||||
if event["type"] == "linear-feed" and event["line"] == 43
|
||||
]
|
||||
if continue_values != [2, 3]:
|
||||
raise SystemExit(f"unexpected LinuxCNC O-word do/continue body values: {continue_values!r}")
|
||||
if not any(
|
||||
event["type"] == "linear-feed" and
|
||||
event["line"] == 45 and
|
||||
event["end"]["v"] == 3
|
||||
for event in oword_flow
|
||||
):
|
||||
raise SystemExit("missing LinuxCNC O-word do/continue final loop counter motion")
|
||||
if not any(
|
||||
event["type"] == "linear-feed" and
|
||||
event["line"] == 46 and
|
||||
event["end"]["w"] == 2
|
||||
for event in oword_flow
|
||||
):
|
||||
raise SystemExit("missing LinuxCNC O-word do/continue skipped-body counter motion")
|
||||
|
||||
exists = json.loads(Path("/tmp/cnc_sim_linuxcnc_named_parameter_exists.json").read_text())
|
||||
exists_moves = [
|
||||
(event["line"], event["end"]["x"], event["end"]["y"])
|
||||
for event in exists
|
||||
if event["type"] == "linear-feed"
|
||||
]
|
||||
expected_exists_moves = [(5, 1, 0), (8, 1, 1)]
|
||||
if exists_moves != expected_exists_moves:
|
||||
raise SystemExit(f"unexpected LinuxCNC EXISTS named parameter branch motions: {exists_moves!r}")
|
||||
|
||||
indexed = json.loads(Path("/tmp/cnc_sim_linuxcnc_indexed_parameters.json").read_text())
|
||||
indexed_moves = [
|
||||
(
|
||||
event["line"],
|
||||
event["end"]["x"], event["end"]["y"], event["end"]["z"],
|
||||
event["end"]["a"], event["end"]["b"], event["end"]["c"],
|
||||
event["end"]["u"], event["end"]["v"], event["end"]["w"],
|
||||
)
|
||||
for event in indexed
|
||||
if event["type"] == "linear-feed"
|
||||
]
|
||||
expected_indexed_moves = [
|
||||
(7, 17, 0, 0, 0, 0, 0, 0, 0, 0),
|
||||
(8, 17, 22, 0, 0, 0, 0, 0, 0, 0),
|
||||
(10, 17, 22, 1, 0, 0, 0, 0, 0, 0),
|
||||
(13, 17, 22, 1, 21, 0, 0, 0, 0, 0),
|
||||
(14, 17, 22, 1, 21, 9, 0, 0, 0, 0),
|
||||
(16, 17, 22, 1, 21, 9, 9, 2, 0, 0),
|
||||
(17, 17, 22, 1, 21, 9, 9, 2, 4, 9),
|
||||
(18, 4, 22, 1, 21, 9, 9, 2, 4, 9),
|
||||
(19, 4, 12, 4, 21, 9, 9, 2, 4, 9),
|
||||
(20, 4, 12, 4, 12, 9, 9, 2, 4, 9),
|
||||
(21, 4, 12, 4, 12, 14, 9, 2, 4, 9),
|
||||
]
|
||||
if indexed_moves != expected_indexed_moves:
|
||||
raise SystemExit(f"unexpected LinuxCNC indexed/indirect parameter motions: {indexed_moves!r}")
|
||||
|
||||
normalized = json.loads(Path("/tmp/cnc_sim_linuxcnc_named_parameter_normalization.json").read_text())
|
||||
normalized_moves = [
|
||||
(event["line"], event["end"]["x"], event["end"]["y"])
|
||||
for event in normalized
|
||||
if event["type"] == "linear-feed"
|
||||
]
|
||||
expected_normalized_moves = [(4, 12, 0), (6, 12, 1)]
|
||||
if normalized_moves != expected_normalized_moves:
|
||||
raise SystemExit(f"unexpected LinuxCNC normalized named parameter motions: {normalized_moves!r}")
|
||||
|
||||
ini_named = json.loads(Path("/tmp/cnc_sim_linuxcnc_ini_named_parameter.json").read_text())
|
||||
ini_named_moves = [
|
||||
(event["line"], event["end"]["x"], event["end"]["y"])
|
||||
for event in ini_named
|
||||
if event["type"] == "linear-feed"
|
||||
]
|
||||
expected_ini_named_moves = [(3, 3.25, 0), (5, 3.25, 1)]
|
||||
if ini_named_moves != expected_ini_named_moves:
|
||||
raise SystemExit(f"unexpected LinuxCNC INI named parameter motions: {ini_named_moves!r}")
|
||||
|
||||
coords = json.loads(Path("/tmp/cnc_sim_linuxcnc_coordinate_offsets.json").read_text())
|
||||
g5x = [event for event in coords if event["type"] == "set-g5x-offset"]
|
||||
g92 = [event for event in coords if event["type"] == "set-g92-offset"]
|
||||
@@ -324,6 +1006,76 @@ if not any(
|
||||
raise SystemExit("missing G10 L20 P2 offset event after G55 selection")
|
||||
if not any(event["type"] == "program-end" and event["line"] == 5 for event in l20):
|
||||
raise SystemExit("missing G10 L20 program end line number")
|
||||
|
||||
p0 = json.loads(Path("/tmp/cnc_sim_linuxcnc_coordinate_p0.json").read_text())
|
||||
if not any(
|
||||
event["type"] == "set-g5x-offset" and
|
||||
event["line"] == 3 and
|
||||
event["tool"] == 2 and
|
||||
event["start"]["x"] == 7 and
|
||||
event["start"]["y"] == 8 and
|
||||
event["start"]["z"] == 9
|
||||
for event in p0
|
||||
):
|
||||
raise SystemExit("missing G10 L2 P0 active G55 offset event")
|
||||
if not any(event["type"] == "program-end" and event["line"] == 4 for event in p0):
|
||||
raise SystemExit("missing G10 P0 program end line number")
|
||||
|
||||
select_all = json.loads(Path("/tmp/cnc_sim_linuxcnc_coordinate_select_all.json").read_text())
|
||||
select_events = [
|
||||
(event["line"], event["tool"], event["start"]["x"])
|
||||
for event in select_all
|
||||
if event["type"] == "set-g5x-offset" and event["line"] in set(range(11, 20))
|
||||
]
|
||||
expected_select_events = [
|
||||
(11, 2, 2),
|
||||
(12, 1, 1),
|
||||
(13, 3, 3),
|
||||
(14, 4, 4),
|
||||
(15, 5, 5),
|
||||
(16, 6, 6),
|
||||
(17, 7, 7),
|
||||
(18, 8, 8),
|
||||
(19, 9, 9),
|
||||
]
|
||||
if select_events != expected_select_events:
|
||||
raise SystemExit(f"unexpected G54-G59.3 selection events: {select_events!r}")
|
||||
|
||||
g92_restore = json.loads(Path("/tmp/cnc_sim_linuxcnc_g92_restore.json").read_text())
|
||||
g92_states = [
|
||||
(event["line"], event["start"]["x"], event["start"]["y"], event["start"]["z"])
|
||||
for event in g92_restore
|
||||
if event["type"] == "set-g92-offset" and event["line"] > 0
|
||||
]
|
||||
expected_g92_states = [
|
||||
(2, -1, -2, -3),
|
||||
(3, 0, 0, 0),
|
||||
(4, -1, -2, -3),
|
||||
(5, 0, 0, 0),
|
||||
(6, 0, 0, 0),
|
||||
]
|
||||
if g92_states != expected_g92_states:
|
||||
raise SystemExit(f"unexpected G92.2/G92.3 restore sequence: {g92_states!r}")
|
||||
if not any(event["type"] == "program-end" and event["line"] == 7 for event in g92_restore):
|
||||
raise SystemExit("missing G92 restore program end line number")
|
||||
|
||||
g52_offset = json.loads(Path("/tmp/cnc_sim_linuxcnc_g52_offset.json").read_text())
|
||||
g52_states = [
|
||||
(event["line"], event["start"]["x"], event["start"]["y"], event["start"]["z"])
|
||||
for event in g52_offset
|
||||
if event["type"] == "set-g92-offset" and event["line"] > 0
|
||||
]
|
||||
expected_g52_states = [
|
||||
(2, 1, 2, 0),
|
||||
(3, 1, 3, 0),
|
||||
(4, 0, 0, 0),
|
||||
(5, 1, 3, 0),
|
||||
(6, 0, 0, 0),
|
||||
]
|
||||
if g52_states != expected_g52_states:
|
||||
raise SystemExit(f"unexpected G52 shared offset sequence: {g52_states!r}")
|
||||
if not any(event["type"] == "program-end" and event["line"] == 7 for event in g52_offset):
|
||||
raise SystemExit("missing G52 offset program end line number")
|
||||
PY
|
||||
|
||||
echo "linuxcnc rs274 native smoke passed"
|
||||
@@ -331,17 +1083,41 @@ echo "dumped /tmp/cnc_sim_linuxcnc_basic_motion.json"
|
||||
echo "dumped /tmp/cnc_sim_linuxcnc_basic_mill.json"
|
||||
echo "dumped /tmp/cnc_sim_linuxcnc_rtcp_controls.json"
|
||||
echo "dumped /tmp/cnc_sim_linuxcnc_spindle_direction.json"
|
||||
echo "dumped /tmp/cnc_sim_linuxcnc_spindle_modes.json"
|
||||
echo "dumped /tmp/cnc_sim_linuxcnc_spindle_orient.json"
|
||||
echo "dumped /tmp/cnc_sim_linuxcnc_io_controls.json"
|
||||
echo "dumped /tmp/cnc_sim_linuxcnc_override_controls.json"
|
||||
echo "dumped /tmp/cnc_sim_linuxcnc_modal_state.json"
|
||||
echo "dumped /tmp/cnc_sim_linuxcnc_modal_autorestore.json"
|
||||
echo "dumped /tmp/cnc_sim_linuxcnc_threading_sync.json"
|
||||
echo "dumped /tmp/cnc_sim_linuxcnc_threading_cycle.json"
|
||||
echo "dumped /tmp/cnc_sim_linuxcnc_tool_number.json"
|
||||
echo "dumped /tmp/cnc_sim_linuxcnc_program_stops.json"
|
||||
echo "dumped /tmp/cnc_sim_linuxcnc_coolant.json"
|
||||
echo "dumped /tmp/cnc_sim_linuxcnc_feed_modes.json"
|
||||
echo "dumped /tmp/cnc_sim_linuxcnc_motion_modes.json"
|
||||
echo "dumped /tmp/cnc_sim_linuxcnc_tool_length.json"
|
||||
echo "dumped /tmp/cnc_sim_linuxcnc_dynamic_tool_length.json"
|
||||
echo "dumped /tmp/cnc_sim_linuxcnc_canned_cycle.json"
|
||||
echo "dumped /tmp/cnc_sim_linuxcnc_canned_cycles_extended.json"
|
||||
echo "dumped /tmp/cnc_sim_linuxcnc_canned_cycle_planes.json"
|
||||
echo "dumped /tmp/cnc_sim_linuxcnc_arc_planes.json"
|
||||
echo "dumped /tmp/cnc_sim_linuxcnc_arc_distance_modes.json"
|
||||
echo "dumped /tmp/cnc_sim_linuxcnc_predefined_positions.json"
|
||||
echo "dumped /tmp/cnc_sim_linuxcnc_machine_coordinates.json"
|
||||
echo "dumped /tmp/cnc_sim_linuxcnc_cutter_comp.json"
|
||||
echo "dumped /tmp/cnc_sim_linuxcnc_comments.json"
|
||||
echo "dumped /tmp/cnc_sim_linuxcnc_probe_no_error.json"
|
||||
echo "dumped /tmp/cnc_sim_linuxcnc_oword_subprogram.json"
|
||||
echo "dumped /tmp/cnc_sim_linuxcnc_named_oword_subprogram.json"
|
||||
echo "dumped /tmp/cnc_sim_linuxcnc_oword_control_flow.json"
|
||||
echo "dumped /tmp/cnc_sim_linuxcnc_named_parameter_exists.json"
|
||||
echo "dumped /tmp/cnc_sim_linuxcnc_indexed_parameters.json"
|
||||
echo "dumped /tmp/cnc_sim_linuxcnc_named_parameter_normalization.json"
|
||||
echo "dumped /tmp/cnc_sim_linuxcnc_ini_named_parameter.json"
|
||||
echo "dumped /tmp/cnc_sim_linuxcnc_coordinate_offsets.json"
|
||||
echo "dumped /tmp/cnc_sim_linuxcnc_coordinate_l20.json"
|
||||
echo "dumped /tmp/cnc_sim_linuxcnc_coordinate_p0.json"
|
||||
echo "dumped /tmp/cnc_sim_linuxcnc_coordinate_select_all.json"
|
||||
echo "dumped /tmp/cnc_sim_linuxcnc_g92_restore.json"
|
||||
echo "dumped /tmp/cnc_sim_linuxcnc_g52_offset.json"
|
||||
|
||||
Reference in New Issue
Block a user