Files
cnc_wams/wasm-port/runtime/ui/simulation/programs/index.js
wangdequan 163a68ff42 拆分仿真测试程序目录
结论:将内置 G-code 测试程序从 simulation-app.js 移入 runtime/ui/simulation/programs/,建立一程序一模块的目录化程序库,并保持页面 API 与验证 gate 兼容。
2026-06-16 22:03:06 +08:00

29 lines
970 B
JavaScript

import { arcG2G3Program } from "./arc-g2-g3.js";
import { drillG81Program } from "./drill-g81.js";
import { incrementalLoopProgram } from "./incremental-loop.js";
import { pocketZProgram } from "./pocket-z.js";
import { squareLinearProgram } from "./square-linear.js";
export const SIMULATION_TEST_PROGRAMS = [
squareLinearProgram,
pocketZProgram,
incrementalLoopProgram,
arcG2G3Program,
drillG81Program,
];
export const DEFAULT_SIMULATION_PROGRAM_ID = SIMULATION_TEST_PROGRAMS[0].id;
export const DEFAULT_SIMULATION_PROGRAM = SIMULATION_TEST_PROGRAMS[0].text;
export function getSimulationTestPrograms() {
return SIMULATION_TEST_PROGRAMS.map((program) => ({ ...program }));
}
export function getSimulationTestProgram(programId = DEFAULT_SIMULATION_PROGRAM_ID) {
const program = SIMULATION_TEST_PROGRAMS.find(({ id }) => id === programId);
if (!program) {
throw new Error(`unknown simulation test program: ${programId}`);
}
return program;
}