CLI Interface

You can also use the CLI interface to control the CNC machine.

Installation

npm install -g gcnc

Send G-code from file

# Grbl over serial port
gcnc --port /dev/tty.usbserial-0001 --file my-gcode.gcode

# Bambu over WebSocket
gcnc --bambu-host 192.168.1.100 --bambu-access-code abcd1234 --bambu-serial-number XXXXXXXXXXXXXXX --file my-gcode.gcode

One-liner execution

gcnc --run "G0 X0 Y0 Z0&G1 X100 Y100 Z100"

Interactive Mode

If you don't specify --file, the CLI will enter the interactive mode.

gcnc --port /dev/tty.usbserial-0001
>G0 X0 Y0 Z0

All options

Options:
      --version              Show version number                       [boolean]
  -f, --file                 Path to the G-code file                    [string]
  -n, --linenumber           Line number to start from                  [number]
  -r, --run                  Run a one-liner command. Multiple commands can be s
                             eparated by `&`                            [string]
  -p, --port                 Serial port to use                         [string]
      --ws                   WebSocket url to send to                   [string]
      --bambu-host           Bambu Lab host to send to                  [string]
      --bambu-access-code    Bambu Lab access code to send to           [string]
      --bambu-serial-number  Bambu Lab serial number to send to         [string]
      --osc-port             OSC port to send to                        [number]
      --osc-host             OSC host to send to [string] [default: "localhost"]
      --help                 Show help                                 [boolean]