132 lines
2.7 KiB
TypeScript
132 lines
2.7 KiB
TypeScript
export type CncDialect = "linuxcnc" | "fanuc" | "siemens";
|
|
|
|
export type CncPose = {
|
|
x: number;
|
|
y: number;
|
|
z: number;
|
|
a: number;
|
|
b: number;
|
|
c: number;
|
|
u: number;
|
|
v: number;
|
|
w: number;
|
|
};
|
|
|
|
export type CncEventType =
|
|
| "error"
|
|
| "comment"
|
|
| "set-units"
|
|
| "set-plane"
|
|
| "set-feed"
|
|
| "set-spindle"
|
|
| "tool-change"
|
|
| "dwell"
|
|
| "rapid"
|
|
| "linear-feed"
|
|
| "arc-feed"
|
|
| "probe"
|
|
| "program-end"
|
|
| "rtcp-pivot"
|
|
| "kinematics-switch"
|
|
| "rtcp-state"
|
|
| "set-g5x-offset"
|
|
| "set-g92-offset"
|
|
| "set-xy-rotation";
|
|
|
|
export type CncEvent = {
|
|
type: CncEventType;
|
|
line: number;
|
|
plane: number;
|
|
tool: number;
|
|
feed: number;
|
|
spindle: number;
|
|
dwellSeconds: number;
|
|
start: CncPose;
|
|
end: CncPose;
|
|
center: CncPose;
|
|
arcTurns: number;
|
|
reserved: number;
|
|
};
|
|
|
|
export type CncRtcpOptions = {
|
|
enabled: boolean;
|
|
toolLength?: number;
|
|
tool_length?: number;
|
|
toolLengths?: Record<string, number>;
|
|
tool_lengths?: Record<string, number>;
|
|
};
|
|
|
|
export type CncXyzbcTrtOptions = {
|
|
xRotPoint?: number;
|
|
yRotPoint?: number;
|
|
zRotPoint?: number;
|
|
xOffset?: number;
|
|
yOffset?: number;
|
|
zOffset?: number;
|
|
conventionalDirections?: boolean;
|
|
x_rot_point?: number;
|
|
y_rot_point?: number;
|
|
z_rot_point?: number;
|
|
x_offset?: number;
|
|
y_offset?: number;
|
|
z_offset?: number;
|
|
conventional_directions?: boolean;
|
|
};
|
|
|
|
export type CncParseOptions = {
|
|
backend?: string;
|
|
rtcp?: CncRtcpOptions;
|
|
blockDelete?: boolean;
|
|
block_delete?: boolean;
|
|
switchkins?: string;
|
|
remap?: string;
|
|
machine?: string;
|
|
config?: string;
|
|
configPath?: string;
|
|
configpath?: string;
|
|
config_path?: string;
|
|
ini?: string;
|
|
iniFile?: string;
|
|
inifile?: string;
|
|
iniFileName?: string;
|
|
inifilename?: string;
|
|
ini_file?: string;
|
|
ini_file_name?: string;
|
|
INI_FILE_NAME?: string;
|
|
halFile?: string;
|
|
halfile?: string;
|
|
hal_file?: string;
|
|
HALFILE?: string;
|
|
postguiHalFile?: string;
|
|
postguihalfile?: string;
|
|
postgui_halfile?: string;
|
|
postgui_hal_file?: string;
|
|
POSTGUI_HALFILE?: string;
|
|
subroutinePath?: string;
|
|
subroutinepath?: string;
|
|
subroutine_path?: string;
|
|
SUBROUTINE_PATH?: string;
|
|
kinematics?: string;
|
|
trt?: "xyzbc" | "xyzac" | string;
|
|
pivotLength?: number;
|
|
pivot_length?: number;
|
|
kinematicsType?: number;
|
|
kinematics_type?: number;
|
|
fiveaxisKinematicsType?: number;
|
|
fiveaxis_kinematics_type?: number;
|
|
xyzbcTrt?: CncXyzbcTrtOptions;
|
|
};
|
|
|
|
export type SimulatorCore = {
|
|
parse(
|
|
program: string,
|
|
dialect: CncDialect,
|
|
options?: CncParseOptions,
|
|
): CncEvent[];
|
|
};
|
|
|
|
export async function createSimulatorCore(): Promise<SimulatorCore> {
|
|
const { createWasmSimulator } = await import("./wasm-core.js");
|
|
return createWasmSimulator();
|
|
}
|