Complete 3axis tutorial native and Web/WASM parity tools

This commit is contained in:
2026-08-24 14:01:30 +08:00
parent 938654b19d
commit 7e90142b63
147 changed files with 17639 additions and 557 deletions

View File

@@ -20,6 +20,7 @@ ROOT = Path(__file__).resolve().parents[1]
LINUXCNC_ROOT = ROOT / "linuxcnc"
SOURCE = ROOT / "linuxcnc/configs/sim/axis/vismach/3axis-tutorial"
CASE = "linuxcnc/configs/sim/axis/vismach/3axis-tutorial"
PROGRAM = Path("linuxcnc/configs/nc_files/3dtest.ngc")
FILES = ("3axis-tutorial.ini", "3axis-tutorial.hal", "3axis-tutorial", "tool.tbl")
SCHEMA = "axis3-tutorial-native-run.v1"
@@ -117,6 +118,7 @@ def run(screenshot_path: Path | None = None) -> dict[str, object]:
for name in FILES:
shutil.copy2(SOURCE / name, case_dir / name)
(case_dir / "3axis-tutorial").chmod(0o755)
environment["AXIS_OPEN_FILE"] = str(LINUXCNC_ROOT / "configs/nc_files/3dtest.ngc")
update = subprocess.run(["update_ini", "-f", str(case_dir / "3axis-tutorial.ini")], cwd=LINUXCNC_ROOT, env=environment, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True, check=False)
log_path = case_dir / "native.log"
with log_path.open("w", encoding="utf-8") as log:
@@ -127,6 +129,9 @@ def run(screenshot_path: Path | None = None) -> dict[str, object]:
while time.monotonic() < deadline and process.poll() is None:
window = axis_window(environment)
if window:
if "(no file)" in str(window.get("title", "")).lower() and time.monotonic() + 0.25 < deadline:
time.sleep(0.25)
continue
if screenshot_path is not None:
screenshot_path.parent.mkdir(parents=True, exist_ok=True)
capture = subprocess.run(["import", "-window", str(window["window_id"]), str(screenshot_path)], env=environment, stdout=subprocess.PIPE, stderr=subprocess.PIPE, check=False)
@@ -153,7 +158,7 @@ def run(screenshot_path: Path | None = None) -> dict[str, object]:
"cwd": "linuxcnc_source_root",
"display": environment["DISPLAY"],
"ini_update": {"command": ["update_ini", "-f", "<case_dir>/3axis-tutorial.ini"], "returncode": update.returncode, "output_sha256": hashlib.sha256(update.stdout.encode()).hexdigest()},
"exact_source_files": [{"path": f"{CASE}/{name}", "sha256": sha256(SOURCE / name)} for name in FILES],
"exact_source_files": [{"path": f"{CASE}/{name}", "sha256": sha256(SOURCE / name)} for name in FILES] + [{"path": PROGRAM.as_posix(), "sha256": sha256(ROOT / PROGRAM)}],
"axis_panel": window,
"process_returncode": process.returncode,
"generated_files": generated,