From f96475c161e05c882c3a068e6731688af521a58b Mon Sep 17 00:00:00 2001 From: Paul Browne Date: Tue, 6 May 2025 16:01:10 +0300 Subject: [PATCH] Add: cli instal and usage commands --- README.md | 97 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 94 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 3e6901d..f653c80 100644 --- a/README.md +++ b/README.md @@ -21,17 +21,108 @@ Check it out at https://sameer.github.io/svg2gcode. Just select an SVG and click ### Command line interface (CLI) -#### Input +#### Install ```sh -cargo run --release -- examples/Vanderbilt_Commodores_logo.svg --off 'M4' --on 'M5' -o out.gcode +cargo install svg2gcode-cli ``` +#### Usage +``` +Arguments: + [FILE] + A file path to an SVG, else reads from stdin + +Options: + --tolerance + Curve interpolation tolerance (mm) + + --feedrate + Machine feed rate (mm/min) + + --dpi + Dots per Inch (DPI) Used for scaling visual units (pixels, points, picas, etc.) + + --on + G-Code for turning on the tool + + --off + G-Code for turning off the tool + + --begin + G-Code for initializing the machine at the beginning of the program + + --end + G-Code for stopping/idling the machine at the end of the program + + -o, --out + Output file path (overwrites old files), else writes to stdout + + --settings + Provide settings from a JSON file. Overrides command-line arguments + + --export + Export current settings to a JSON file instead of converting. + + Use `-` to export to standard out. + + --origin + Coordinates for the bottom left corner of the machine + + --dimensions + Override the width and height of the SVG (i.e. 210mm,297mm) + + Useful when the SVG does not specify these (see https://github.com/sameer/svg2gcode/pull/16) + + Passing "210mm," or ",297mm" calculates the missing dimension to conform to the viewBox aspect ratio. + + --circular-interpolation + Whether to use circular arcs when generating g-code + + Please check if your machine supports G2/G3 commands before enabling this. + + [possible values: true, false] + + --line-numbers + Include line numbers at the beginning of each line + + Useful for debugging/streaming g-code + + [possible values: true, false] + + --checksums + Include checksums at the end of each line + + Useful for streaming g-code + + [possible values: true, false] + + --newline-before-comment + Add a newline character before each comment + + Workaround for parsers that don't accept comments on the same line + + [possible values: true, false] + + -h, --help + Print help (see a summary with '-h') + + -V, --version + Print version +``` + +#### Example + +```sh +svg2gcode-cli examples/Vanderbilt_Commodores_logo.svg --off 'M4' --on 'M5' -o out.gcode +``` + + To convert curves to G02/G03 Gcode commands, use flag `--circular-interpolation true`. ![Vanderbilt Commodores Logo](examples/Vanderbilt_Commodores_logo.svg) -#### Output, rendered at [https://ncviewer.com]() +#### Output, rendered at [https://ncviewer.com](https://ncviewer.com) ```sh cat out.gcode