export enum ObjectType { AXIS_LINEAR = 'AXIS_LINEAR', AXIS_ROTARY = 'AXIS_ROTARY', CYLINDER = 'CYLINDER', SWITCH = 'SWITCH', LED = 'LED', } export interface Vec3 { x: number; y: number; z: number; } export interface BaseObject { id: string; name: string; type: ObjectType; position: Vec3; rotation: Vec3; // Euler angles in radians } export interface AxisPositionTrigger { id: string; position: number; condition: '>' | '<'; targetInputPort: number; // Sets this Input bit when condition met } export interface AxisData { id: number; // 0-7 name: string; value: number; target: number; speed: number; type: 'linear' | 'rotary'; } export interface AxisObject extends BaseObject { type: ObjectType.AXIS_LINEAR | ObjectType.AXIS_ROTARY; axisIndex: number; // 0-7, Binds to Global Axis min: number; max: number; triggers: AxisPositionTrigger[]; // Triggers still belong to the physical object placement } export interface CylinderObject extends BaseObject { type: ObjectType.CYLINDER; stroke: number; extended: boolean; currentPosition: number; speed: number; outputPort: number; // Reads this Output bit to extend } export interface SwitchObject extends BaseObject { type: ObjectType.SWITCH; isOn: boolean; isMomentary: boolean; inputPort: number; // Sets this Input bit when pressed } export interface LedObject extends BaseObject { type: ObjectType.LED; isOn: boolean; color: string; outputPort: number; // Reads this Output bit to turn on } export type SimObject = AxisObject | CylinderObject | SwitchObject | LedObject; // Logic Types export enum LogicTriggerType { INPUT_BIT = 'INPUT_BIT', AXIS_COMPARE = 'AXIS_COMPARE', } export enum LogicActionType { OUTPUT_COIL = 'OUTPUT_COIL', AXIS_MOVE = 'AXIS_MOVE', } export enum LogicCondition { IS_ON = 'IS_ON', IS_OFF = 'IS_OFF', GREATER = '>', LESS = '<', EQUAL = '==', GREATER_EQUAL = '>=', LESS_EQUAL = '<=', } export enum LogicAction { SET_ON = 'ON', SET_OFF = 'OFF', TOGGLE = 'TOGGLE', MOVE_ABS = 'MOVE_ABS', MOVE_REL = 'MOVE_REL', } export interface IOLogicRule { id: string; enabled: boolean; // Trigger triggerType: LogicTriggerType; inputPort: number; // For INPUT_BIT triggerAxisIndex: number; // For AXIS_COMPARE triggerCompareOp: LogicCondition; // For AXIS_COMPARE (>, <, ==) triggerValue: number; // For AXIS_COMPARE // Action actionType: LogicActionType; outputPort: number; // For OUTPUT_COIL action: LogicAction; // For OUTPUT_COIL (ON/OFF) targetAxisIndex: number; // For AXIS_MOVE targetAxisValue: number; // For AXIS_MOVE } // Full Project Export Type export interface ProjectData { version: string; objects: SimObject[]; logicRules: IOLogicRule[]; inputNames: string[]; outputNames: string[]; axes: AxisData[]; }