支持真实G代码程序执行
结论:AXIS 风格浏览器仿真页面新增 Open Program、runProgramText 和 loadProgramFile,支持用户提供的 G-code 文本/文件通过 LinuxCNC WASM 执行并参与回放。
This commit is contained in:
50
text15.txt
50
text15.txt
@@ -1887,3 +1887,53 @@ real_simulation_programs_node_smoke=ok
|
||||
- 程序目录只保存 G-code fixture text 和 expected LinuxCNC canonical motion type 断言;
|
||||
- 执行仍通过 LinuxCNC-backed WASM SDK;
|
||||
- JS 没有新增 G-code 解释、planner 或 machine semantics。
|
||||
|
||||
八十四、2026-06-16 继续执行记录:真实 G-code 文本/文件执行
|
||||
|
||||
用户要求程序实现跑真实的 G-code 程序。本批在保留内置测试程序库的基础上,新增 operator-provided
|
||||
G-code text 和 browser File 的执行入口。
|
||||
|
||||
本批新增实质能力:
|
||||
|
||||
- 页面工具栏新增 Open Program 文件入口:
|
||||
- `data-open-program`;
|
||||
- `data-open-program-file`;
|
||||
- `window.linuxCncRealSimulationApi` 新增:
|
||||
- `runProgramText(programText, metadata)`;
|
||||
- `loadProgramFile(file)`;
|
||||
- `runProgramText()` 会直接调用 `runRealBrowserSimulation({ programText })`,因此仍通过
|
||||
LinuxCNC-backed WASM interpreter 执行;
|
||||
- `loadProgramFile(file)` 读取浏览器 File 文本,再走同一个 LinuxCNC WASM 执行路径;
|
||||
- simulation state 新增 program source metadata:
|
||||
- `program.source`;
|
||||
- `program.sourceLabel`;
|
||||
- `program.filename`;
|
||||
- `document.body.dataset.simulationProgramSource`;
|
||||
- UI 显示程序来源:
|
||||
- G-code pane header;
|
||||
- bottom status bar;
|
||||
- browser smoke 新增真实 G-code 验证:
|
||||
- `runProgramText()` 执行非内置 G-code,验证 canonical output 中出现对应坐标;
|
||||
- `loadProgramFile()` 使用 browser `File` 对象加载 `.ngc` 文本,验证修改后的 G-code 坐标
|
||||
通过 LinuxCNC WASM 输出;
|
||||
- Node smoke 新增 custom `programText` 直接执行验证。
|
||||
|
||||
本批新增/更新可执行验证:
|
||||
|
||||
```bash
|
||||
wasm-port/tests/ui/node/verify_real_simulation_programs.sh
|
||||
SKIP_INTERP_BUILD=1 wasm-port/tests/browser/verify_real_simulation_browser.sh
|
||||
```
|
||||
|
||||
关键通过输出:
|
||||
|
||||
```text
|
||||
real_simulation_programs_node_smoke=ok
|
||||
browser_real_simulation_page_smoke=ok
|
||||
```
|
||||
|
||||
本批仍保持 LinuxCNC 语义边界:
|
||||
|
||||
- JS 只读取用户提供的 G-code 文本/文件;
|
||||
- G-code 执行仍交给 LinuxCNC-backed WASM;
|
||||
- JS 不解释 G-code、不规划刀路、不推导 CNC 语义。
|
||||
|
||||
Reference in New Issue
Block a user