Skip to content

quarklark/svg2gcode

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

65 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

svg2gcode

svg2gcode codecov

Convert any SVG 1.1 path to gcode for a pen plotter, laser engraver, etc.

TODO

  • Support all path variants
  • Support group and path transforms
  • Biarc interpolation (G2/G3 instead of many G1)
  • Px, pc, in to mm
  • Configurable DPI for px/pc to mm
  • Sort paths by distance to reduce G0 distances
  • Configurable start/end sequence
  • Comments in GCode input
  • Rustdocs
  • End-to-end tests

Known bugs & whether fixed

  • Smooth curves should not use the control point when the previous curve is not of the same type (quadratic -> smooth cubic, cubic -> smooth quadratic)
    • This is just a nit, it shouldn't matter if the SVG is correct
  • Image coordinates mirrored in the y-axis because SVGs uses upper left corner as (0,0) while GCode uses lower left as (0,0)
  • Close path command connects back to (0.0, 0.0) instead of the last move
  • Ellipse paths are dubious -- large_arc, sweep may need to be inverted

Demonstration

Input

cargo run --release -- examples/Vanderbilt_Commodores_logo.svg --off 'M4' --on 'M5' -o out.gcode

Vanderbilt Commodores Logo

Output, rendered at https://ncviewer.com

cat out.gcode

Vanderbilt Commodores Logo Gcode

FAQ / Interesting details

Reference Documents

About

Minimal SVG to GCode converter written in Rust

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 99.4%
  • G-code 0.6%