支持真实G代码程序执行
结论:AXIS 风格浏览器仿真页面新增 Open Program、runProgramText 和 loadProgramFile,支持用户提供的 G-code 文本/文件通过 LinuxCNC WASM 执行并参与回放。
This commit is contained in:
@@ -306,9 +306,11 @@ export function renderSimulationPlaybackFrame(documentRef, state, index = state.
|
||||
export function renderSimulationState(documentRef, state) {
|
||||
documentRef.body.dataset.simulationReady = state.summary.ready ? "true" : "false";
|
||||
documentRef.body.dataset.simulationProgramId = state.program?.id ?? "custom";
|
||||
documentRef.body.dataset.simulationProgramSource = state.program?.source ?? "custom";
|
||||
setText(documentRef, "[data-simulation-status]", state.summary.ready ? "ready" : "blocked");
|
||||
setText(documentRef, "[data-runtime-status]", state.summary.rows[0].value);
|
||||
setText(documentRef, "[data-selected-program]", state.program?.label ?? "Custom program");
|
||||
setText(documentRef, "[data-program-source]", state.program?.sourceLabel ?? "Custom G-code text");
|
||||
setText(documentRef, "[data-canonical-output]", state.resultText);
|
||||
renderProgramSelector(documentRef, state.program?.id ?? "custom");
|
||||
renderRows(documentRef, state.summary.rows);
|
||||
@@ -330,7 +332,15 @@ export async function runRealBrowserSimulation({
|
||||
const state = {
|
||||
apiName: "real-browser-simulation-state",
|
||||
stateVersion: 1,
|
||||
program: program ? { ...program, text: undefined } : null,
|
||||
program: program
|
||||
? { ...program, source: "builtin", sourceLabel: "Built-in test program", text: undefined }
|
||||
: {
|
||||
id: "custom",
|
||||
label: "Custom G-code program",
|
||||
category: "Custom",
|
||||
source: "custom",
|
||||
sourceLabel: "Custom G-code text",
|
||||
},
|
||||
programText: resolvedProgramText,
|
||||
resultText,
|
||||
motion,
|
||||
|
||||
Reference in New Issue
Block a user