juicy-gcode: SVG to G-Code converter

[ bsd3, graphics, program ] [ Propose Tags ]

SVG to G-code converter that aims to support most SVG features. The flavor of the generated G-Code can be influenced providing a configuration file.


[Skip to Readme]

Downloads

Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 0.1.0.0, 0.1.0.1, 0.1.0.2, 0.1.0.3, 0.1.0.4, 0.1.0.5, 0.1.0.5.1, 0.1.0.5.2, 0.1.0.6, 0.1.0.7, 0.1.0.8, 0.1.0.9, 0.1.0.10, 0.2.0.1, 0.2.0.2, 0.2.1.0, 0.3.0.0, 1.0.0.0
Change log ChangeLog.md
Dependencies base (>=4.8 && <5), configurator (>=0.3 && <0.4), gitrev (>=1.3.0 && <1.4), lens (>=4.15.4 && <5.3), linear (>=1.20 && <1.23), matrix (>=0.3.5 && <0.4), optparse-applicative (>=0.13 && <0.20), svg-tree (>=0.6 && <0.7), text (>=1.2.2 && <1.3 || >=2.0 && <2.1) [details]
License BSD-3-Clause
Author dlacko
Maintainer dlacko@gmail.com
Revised Revision 1 made by Bodigrim at 2023-05-08T15:39:23Z
Category Graphics
Home page https://github.com/domoszlai/juicy-gcode
Bug tracker https://github.com/domoszlai/juicy-gcode/issues
Source repo head: git clone https://github.com/domoszlai/juicy-gcode
Uploaded by dlacko at 2022-12-14T07:09:55Z
Distributions NixOS:1.0.0.0
Reverse Dependencies 1 direct, 0 indirect [details]
Executables juicy-gcode
Downloads 6881 total (64 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs not available [build log]
All reported builds failed as of 2022-12-14 [all 2 reports]

Readme for juicy-gcode-0.3.0.0

[back to package description]

Juicy-gcode: A lightweight SVG to GCode converter for maximal curve fitting

Hackage Appveyor

Overview

Juicy-gcode is a configurable SVG to G-code converter that approximates bezier curves based on your needs:

  • with biarcs for maximal curve fitting: bezier curves are approximated with arcs (G2, G3 commands), the resulting path is G1 continues
  • with linear approximation when arcs are not supported by your firmware: bezier curves are approximated with line segments (G0, G1 commands), the resulting path is not smooth, and the generated gcode is usually significantly larger
  • with cubic bezier curves if your firmware supports it: some firmwares (e.g. Marlin) can handle bezier curves directly (G5 command), the result is G2 continues

Installation

The easiest way is to download one of the pre-built binaries from the releases page. Alternatively, you can build from source code as follows:

  • Install Stack if you do not have it yet
  • $ git clone https://github.com/domoszlai/juicy-gcode.git
  • $ stack build
  • $ stack install
  • $ juicy-gcode --help

Usage

⚠️ Breaking change: Since version 0.3.0.0, --generate-bezier has been removed in favor of the more generic --curve-fitting parameter and --resolution has been renamed to --tolerance

⚠️ Breaking change: Since version 0.2.0.1, default DPI is changed to 96 and the option to mirror the Y axis is removed (it is always mirrored now for correct result)

The easier way to use juicy-gcode is to simply provide an SVG file name. The generated GCode will be written to standard output. The default approximation method is the biarcs based.

$ juicy-gcode SVGFILE

Alternativly, you can provide an output file name as well.

$ juicy-gcode SVGFILE -o OUTPUT

Sometimes you want to overwrite some default settings. These are the

  • --dpi (default 96 DPI) the resolution of the SVG file that is used to determine the size of the SVG when it does not contain explicit units
  • --tolerance (default is 0.1 mm) maximum allowed derivation of the approximation curve
$ juicy-gcode SVGFILE --dpi 72 --tolerance 0.01 

Curve fitting options (default is biarc):

$ juicy-gcode SVGFILE --curve-fitting=biarc
$ juicy-gcode SVGFILE --curve-fitting=linear
$ juicy-gcode SVGFILE --curve-fitting=cubic-bezier

Configuration

The generated GCode is highly dependent on the actual device it will be executed by. In juicy-gcode these settings are called GCode flavor and consists of the following:

  • Begin GCode routine (commands that are executed before the actual print job)
  • End GCode routine (commands that are executed after the actual print job)
  • Tool on (commands to switch the tool on, e.g. lower pen)
  • Tool off (commands to switch the tool off e.g. lift pen)

These settings can be provided by a configuration file. The default settings are made for being able to test the generated GCode in an emulator e.g. with LaserWeb or my hanging plotter simulator.

gcode
{
   begin = "G17;G90;G0 Z1;G0 X0 Y0"
   end = "G0 Z1"
   toolon =  "G00 Z1"
   tooloff = "G01 Z0 F10.00"
}

In the case you want to overwrite it, copy this favor to a text file and modify it according to your need. Then use juicy-gcode as follows:

$ juicy-gcode SVGFILE -f FLAVORFILE

Future development

Juicy-gcode was originally developed as a testbed for my hanging plotter project, but over the years it reached maturity and became a really usuable tool. My main idea for further development is to turn it into a tool that can drive CNCs in 2.5 dimensions (e.g. carving, engraving) with just one colored SVG file.

To be able to test and enjoy that software, I need a proper CNC. Please consider donating a small amount for that purpose, or donate an actual CNC if you have a spare one for whatever reason.

Donate for a CNC

Collected so far: 229.47€ Target: >= 209€

Thank you so much for all people supporting the development!

Limitations

SVG features that are not supported:

  • texts
  • filling
  • clipping
  • images