@linuxcnc-node/core - v2.0.0
    Preparing search index...

    @linuxcnc-node/core - v2.0.0

    @linuxcnc-node/core

    Node.js bindings for the LinuxCNC NML interface. Control and monitor CNC machines running LinuxCNC directly from JavaScript/TypeScript.

    • StatChannel - Real-time machine status monitoring with typed property change events
    • CommandChannel - Send commands to LinuxCNC (MDI, program control, jogging, tool changes, etc.)
    • ErrorChannel - Receive error and operator messages from LinuxCNC
    • PositionLogger - High-frequency position logging for toolpath visualization
    npm install @linuxcnc-node/core
    
    import {
    StatChannel,
    CommandChannel,
    TaskMode,
    TaskState,
    PositionIndex,
    } from "@linuxcnc-node/core";

    const stat = new StatChannel();
    const cmd = new CommandChannel();

    // Watch for position changes
    stat.on("motion.traj.actualPosition", (pos) => {
    // pos is now a Float64Array(9) - destructure index for readable access
    const { X, Y, Z } = PositionIndex;
    console.log(`X=${pos[X]} Y=${pos[Y]} Z=${pos[Z]}`);
    });

    // Send commands
    await cmd.setState(TaskState.ON);
    await cmd.setTaskMode(TaskMode.MDI);
    await cmd.executeMdi("G0 X10 Y10");

    // Cleanup
    stat.destroy();

    Full API documentation: https://b0czek.github.io/linuxcnc-node/

    • Linux
    • LinuxCNC installed and running
    • Node.js 18+

    GPL-2.0-only