UNPKG

@thi.ng/axidraw

Version:

Minimal AxiDraw plotter/drawing machine controller for Node.js

77 lines 2.54 kB
import type { ReadonlyVec } from "@thi.ng/vectors"; import type { CommentCommand, DrawCommand, HomeCommand, MotorCommand, MoveRelCommand, MoveXYCommand, PenConfigCommand, PenUpDownCommand, ResetCommand, RestoreCommand, SaveCommand, StartCommand, StopCommand, WaitCommand } from "./api.js"; export declare const START: StartCommand; export declare const STOP: StopCommand; export declare const HOME: HomeCommand; export declare const RESET: ResetCommand; export declare const ON: MotorCommand; export declare const OFF: MotorCommand; export declare const SAVE: SaveCommand; export declare const RESTORE: RestoreCommand; /** * Creates a {@link PenConfigCommand} using provided down/up positions. * * @param posDown * @param posUp */ export declare const PEN: (posDown?: number, posUp?: number) => PenConfigCommand; /** * Creates a {@link PenUpDownCommand} to move the pen up. Both args are optional * and if omitted globally configured values are used. * * @param delay * @param level */ export declare const UP: (delay?: number, level?: number) => PenUpDownCommand; /** * Creates a {@link PenUpDownCommand} to move the pen down. Both args are * optional and if omitted globally configured values are used. * * @param delay * @param level */ export declare const DOWN: (delay?: number, level?: number) => PenUpDownCommand; /** * Creates a {@link MoveXYCommand} command (absolute coordinates). * * @param pos * @param speed */ export declare const MOVE: (pos: ReadonlyVec, speed?: number) => MoveXYCommand; /** * Creates a {@link MoveRelCommand} command (relative coordinates). * * @param delta * @param speed */ export declare const MOVE_REL: (delta: ReadonlyVec, speed?: number) => MoveRelCommand; /** * Creates a {@link WaitCommand}. Default delay is 1000 ms. * * @param delay */ export declare const WAIT: (delay?: number) => WaitCommand; /** * Creates a {@link CommentCommand}. * * @param msg */ export declare const COMMENT: (msg: string) => CommentCommand; /** * Syntax sugar. Takes an iterable of draw commands, adds {@link START} as * prefix and {@link STOP} as suffix. I.e. it creates a "complete" drawing... * * @example * ```ts tangle:../export/complete.ts * import { complete, MOVE } from "@thi.ng/axidraw"; * * console.log( * [...complete([ MOVE([0, 0]) ])] * ); * // [ ["start"], ["M", [0, 0]], ["stop"] ] * ``` * * @param commands */ export declare function complete(commands: Iterable<DrawCommand>): Generator<DrawCommand, void, any>; //# sourceMappingURL=commands.d.ts.map