GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - sameer/svg2gcode: Convert vector graphics to g-code for pen plotters, laser engravers, and other CNC machines

BranchesTags
Open more actions menu

Latest commit

 

History

286 Commits
286 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
cli
cli
 
 
examples
examples
 
 
g_code
g_code
 
 
star
star
 
 
web
web
 
 
.gitignore
.gitignore
 
 
.gitmodules
.gitmodules
 
 
Cargo.lock
Cargo.lock
 
 
Cargo.toml
Cargo.toml
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
codecov.yml
codecov.yml
 
 
rustfmt.toml
rustfmt.toml
 
 

Repository files navigation

svg2gcode

Workspace crate checks Check svg2gcode-web Deploy svg2gcode-web

codecov

Convert vector graphics to g-code for pen plotters, laser engravers, and other CNC machines

Usage

Web interface

Check it out at https://sameer.github.io/svg2gcode. Select an SVG and click generate.

image

Command line interface (CLI)

Install

cargo install svg2gcode-cli

Usage

CLI Help
Arguments:
  [FILE]
          A file path to an SVG, else reads from stdin

Options:
      --tolerance <TOLERANCE>
          Curve interpolation tolerance (mm)

      --feedrate <FEEDRATE>
          Machine feed rate (mm/min)

      --dpi <DPI>
          Dots per Inch (DPI) Used for scaling visual units (pixels, points, picas, etc.)

      --on <TOOL_ON_SEQUENCE>
          G-Code for turning on the tool

      --off <TOOL_OFF_SEQUENCE>
          G-Code for turning off the tool

      --begin <BEGIN_SEQUENCE>
          G-Code for initializing the machine at the beginning of the program

      --end <END_SEQUENCE>
          G-Code for stopping/idling the machine at the end of the program

  -o, --out <OUT>
          Output file path (overwrites old files), else writes to stdout

      --settings <SETTINGS>
          Provide settings from a JSON file. Overrides command-line arguments

      --export <EXPORT>
          Export current settings to a JSON file instead of converting.
          
          Use `-` to export to standard out.

      --origin <ORIGIN>
          Coordinates for the bottom left corner of the machine

      --dimensions <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 <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 <LINE_NUMBERS>
          Include line numbers at the beginning of each line
          
          Useful for debugging/streaming g-code
          
          [possible values: true, false]

      --checksums <CHECKSUMS>
          Include checksums at the end of each line
          
          Useful for streaming g-code
          
          [possible values: true, false]

      --newline-before-comment <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

svg2gcode-cli examples/island.svg --off 'M4' --on 'M5' -o out.gcode

To convert curves to G02/G03 Gcode commands, use the flag --circular-interpolation true.

cat out.gcode

Rendered using NC Viewer: image

Library

The core functionality of this tool is available as the svg2gcode crate.

Blog Posts

These go into greater detail on the tool's origins, implementation details, and planned features.

  • https://purisa.me/blog/pen-plotter/
  • https://purisa.me/blog/svg2gcode-progress/

FAQ / Interesting details

  • Use a 3D printer for plotting: (thanks @jeevank for sharing this) https://medium.com/@urish/how-to-turn-your-3d-printer-into-a-plotter-in-one-hour-d6fe14559f1a

  • Convert a PDF to GCode: follow this guide using Inkscape to convert a PDF to an SVG, then use it with svg2gcode

  • Are shapes, fill patterns supported? No, but you can convert them to paths in Inkscape with Object to Path. See #15 for more discussion.

  • Are stroke patterns supported? No, but you can convert them into paths in Inkscape with Stroke to Path.

Reference Documents

  • W3 SVG2 Specification
  • CSS absolute lengths
  • CSS font-relative lengths
  • CSS compatible units
  • RepRap G-code
  • G-Code and M-Code Reference List for Milling

About

Convert vector graphics to g-code for pen plotters, laser engravers, and other CNC machines

sameer.github.io/svg2gcode

Topics

3d-printer3d-printingcncengraverg-codegcodegrblinkscapelaser-cuttingpen-plotterplotterprinterprusa-minirustsvgsvg2gcodewebassembly

Resources

Readme
MIT license
Activity

Stars

453 stars

Watchers

5 watching

Forks

80 forks
Report repository

Releases

Sponsor this project

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.