拆分仿真测试程序目录
结论:将内置 G-code 测试程序从 simulation-app.js 移入 runtime/ui/simulation/programs/,建立一程序一模块的目录化程序库,并保持页面 API 与验证 gate 兼容。
This commit is contained in:
28
wasm-port/runtime/ui/simulation/programs/index.js
Normal file
28
wasm-port/runtime/ui/simulation/programs/index.js
Normal file
@@ -0,0 +1,28 @@
|
||||
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;
|
||||
}
|
||||
Reference in New Issue
Block a user