svg2gcode


Namesvg2gcode JSON
Version 3.2.5 PyPI version JSON
download
home_pageNone
Summarysvg2gcode: convert an SVG (Scalable Vector Graphic) image to gcode.
upload_time2024-02-07 15:58:04
maintainerNone
docs_urlNone
authorNone
requires_python>=3.11
licenseNone
keywords scalable vector graphics svg image laser cutter laser engraving
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # svg2gcode

A commandline steering program that enables laser cutting of svg drawings```<svg:path ..>```tags and combined engraving of svg images```<svg:image ..>```tags.
It is based on library *SvgToGcode* (*fork*: *https://github.com/johannesnoordanus/SvgToGcode*)<sup>(*)</sup>.

Drawings and images can be composed using Inkscape (or other SVG image software) and saved to a *.svg* file. This file can then be converted to gcode by *svg2gcode*.
Gcode produced in this way has the advantage that drawings and images have the same - relative - position and orientation as can be seen on the composer window.
This makes combined cutting and engraving as easy as orientating the (wood) slab once.

SVG *path* and *image* objects are supported. Note that other drawing object must be converted to a *path* to be able to translate them to a gcode sequence.
Recently (version 3.0.0 and higher) support for *stroke* color and *stroke-width* attributes of SVG *path* objects is added.
This means that it is possible to make laser engravings of text (fonts) and other drawing objects having a border with a specific color.
It is even possible to use alpha channel for these drawing objects now.

Controlling laser power, pixel size and other settings can be done via commandline parameters (see below) or within Inkscape using the XMLeditor.
Image attributes ```gcode_pixelsize```, ```gcode_maxpower```, ```gcode_speed```, ```gcode_noise```, ```gcode_speedmoves```, ```gcode_overscan``` and ```gcode_showoverscan``` can be set per object.
(Image attributes can be added within the XMLeditor (Inkscape) by using the **+**).
Note that image attributes override explicit or default commandline settings.

You have full control of placing (locating) of the result gcode via options *--origin*, <i>--rotate</i> and *--scale*.
Option *--selfcenter* can be used to set the origin at the center of the image.
Note that gcode file headers contain compile information like the boundingbox and boundingbox center coordinates.

Version 2.0.0 and higher have important speed optimizations. Engravings run significantly faster and skip from one image zone to the other at maximum speed.
See options ```--speedmoves``` and ```--noise``` for example.

Version 3.0.0 and higher have support for 'stroke' (color) and 'stroke-width' attributes, this means that cutting a path works a bit different now. 
When the *stroke* attribute of a *path* is nonexistent or set to none, the path will be laser burned with the value set by option *--cuttingpower*.

Version 3.1.0 and higher have support for 'fill' (color) and 'fill-rule' attributes. Currently only fill rule 'evenodd' is supported.

Also, *svg2gcode* option ```--pathcut``` can be used to override all stroke attributes and force cutting of all *paths* of the SVG.
Option ```--nofill``` (not set by default) is added to disable path fills.

More info can be obtained by looking at the examples below and from program *image2gcode* and its documentation (for example about callibrating laser engravers).  
 
Please consider supporting me, so I can make this application better and add new functionality to it: <http://paypal.me/johannesnoordanus/5,00>

My next update will add fill-rule 'nonzero'.


To summarize:

Optimized gcode
- draw pixels in one go until change of power
- emit X/Y coordinates only when they change
- emit linear move 'G1/G0' code minimally
- does not emit zero power (or below cutoff) pixels

General optimizations
- laser head has defered and sparse moves.
(XY locations are virtual, head does not always follow)
- moves at high speed (G0) over 10mm (default) or more zero pixels
- low burn levels (stray pixels) can be suppressed (default off)
- option *--constantburn* selects constant burn mode *M3* (for cutting and engraving) instead of default dynamic burn mode *M4*
- borders are drawn in parallel and in one go, following the *path* coordinates.
- fill has support for alpha channel and 'fill-opacity'
 
**Tip**: use commandline program *grblhud* *(https://github.com/johannesnoordanus/grblhud)* to have full control over gcode execution,
also, program *image2gcode* has similar capabilities but handles raster images files (like *png* and *jpg*) directly. 

**Tip2**: another program *LaserWeb* (not made by me) is quite capable and has an excelent 3D gcode visualizer, it is able to calculate 3D paths for CNC machines, including the bit diameter.

### Install:
```
> 
> pip install svg2gcode
```
Some linux distributions use a managed environment in which you cannot install python packages at will. Distribution Debian 12 and Manjaro have this limitation. You can setup a python *venv* and pip install *svg2gcode* in that or you can install systemwide using pipx:
```
> 
> pipx install svg2gcode
```

<sup>(*)</sup> Note that an upgraded and corrected version of this library is included. 
### Usage:
```
> svg2gcode --help
usage: svg2gcode [-h] [--showimage] [--selfcenter] [--pixelsize <default:0.1>] [--imagespeed <default:800>] [--cuttingspeed <default:1000>] [--imagepower <default:300>]
                    [--poweroffset <default:0>] [--cuttingpower <default:850>] [--passes <default:1>] [--pass_depth <default:0>] [--rapidmove <default:10>] [--noise <default:0>]
                    [--overscan <default:0>] [--showoverscan] [--constantburn] [--origin delta-x delta-y] [--scale factor-x factor-y] [--rotate <default:0>] [--splitfile] [--pathcut]
                    [--xmaxtravel <default:300>] [--ymaxtravel <default:400>] [--fan] [-V]
                    svg gcode

Convert svg to gcode for GRBL v1.1 compatible diode laser engravers.

positional arguments:
  svg                   svg file to be converted to gcode
  gcode                 gcode output file

options:
  -h, --help            show this help message and exit
  --showimage           show b&w converted image
  --selfcenter          self center the gcode (--origin cannot be used at the same time)
  --pixelsize <default:0.1>
                        pixel size in mm (XY-axis): each image pixel is drawn this size
  --imagespeed <default:800>
                        image draw speed in mm/min
  --cuttingspeed <default:1000>
                        cutting speed in mm/min
  --imagepower <default:300>
                        maximum laser power while drawing an image (as a rule of thumb set to 1/3 of the machine maximum for a 5W laser)
  --poweroffset <default:0>
                        pixel intensity to laser power: shift power range [0-imagepower]
  --cuttingpower <default:850>
                        sets laser power of line (path) cutting
  --passes <default:1>  Number of passes (iterations) for line drawings, only active when pass_depth is set
  --pass_depth <default:0>
                        cutting depth in mm for one pass, only active for passes > 1
  --rapidmove <default:10>
                        generate G0 moves between shapes, for images: G0 moves when skipping more than 10mm (default), 0 is no G0 moves
  --noise <default:0>   reduces image noise by not emitting pixels with power lower or equal than this setting
  --overscan <default:0>
                        overscan image lines to avoid incorrect power levels for pixels at left and right borders, number in pixels, default off
  --showoverscan        show overscan pixels (note that this is visible and part of the gcode emitted!)
  --constantburn        use constant burn mode M3 (a bit more dangerous!), instead of dynamic burn mode M4
  --origin delta-x delta-y
                        translate origin by vector (delta-x,delta-y) in mm (default not set, option --selfcenter cannot be used at the same time)
  --scale factor-x factor-y
                        scale svg with (factor-x,factor-y) (default not set)
  --rotate <default:0>  number of degrees to rotate
  --splitfile           split gcode output of SVG path and image objects
  --pathcut             alway cut SVG path objects! (use laser power set with option --cuttingpower)
  --nofill              ignore SVG fill attribute
  --xmaxtravel <default:300>
                        machine x-axis lengh in mm
  --ymaxtravel <default:400>
                        machine y-axis lengh in mm
  --fan                 set machine fan on
  -V, --version         show version number and exit
```

#### Configuration file:
You can also store svg2gcode settings in configuration file `~/.config/svg2gcode.toml` eg:

```
xmaxtravel= 400
ymaxtravel= 400
imagespeed = 6000
```
It can be used with any parameter which takes a value, and alows to persist your laser settings.
You can create this configuration file using an editor like vi or nano.
An alternative (quick) way to do that is to enter:
```
$ mkdir ~/.config
$ echo "xmaxtravel= 400
ymaxtravel= 400
imagespeed = 6000
" > ~/.config/svg2gcode.toml
```
(but use your own settings!)

### Examples:
#### Cutting a SVG *path* element:

The svg below draws a triangle
```
    > cat line_hoek.svg
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <!-- Created with Inkscape (http://www.inkscape.org/) -->
    <svg
        height="80"
        width="80"
        xmlns="http://www.w3.org/2000/svg"
        xmlns:svg="http://www.w3.org/2000/svg">
        <path
            id="driehoek"
            style="fill:none;stroke:#A0A0A0;stroke-width:.1"
            d="M50 0 L25 60 L75 60 Z" />
    </svg>
    
    > svg2gcode --showimage line_hoek.svg line_hoek.gc
```
This generates gcode file *line_hoek.gc* (and shows the result in a separate viewer).
The first lines of the gcode file contain comment lines *;* as shown below.
```
    > head -n 25 line_hoek.gc
    ;    svg2gcode 3.0.0 (2023-12-03 12:11:58)
    ;    arguments: 
    ;      laser_power: 850,
    ;      movement_speed: 1000,
    ;      pixel_size: 0.1,
    ;      maximum_image_laser_power: 300,
    ;      image_movement_speed: 800,
    ;      fan: False,
    ;      rapid_move: 10,
    ;      showimage: True,
    ;      x_axis_maximum_travel: 300,
    ;      y_axis_maximum_travel: 400,
    ;      image_noise: 0,
    ;      pass_depth: 0.0,
    ;      laser_mode: dynamic,
    ;      splitfile: False,
    ;      image_poweroffset: 0,
    ;      image_overscan: 0,
    ;      image_showoverscan: False
    ;    Boundingbox: (X25.0,Y20.0:X75.0,Y80.0)
    ;    boundingbox center: (X50,Y50)
    ;    GRBL 1.1, unit=mm, absolute coordinates

```
Use *gcode2image* to get an accurate representation of the gcode when run on a lasercutter.
```
    > gcode2image --showimage --flip --showorigin --grid --showG0 line_hoek.gc line_hoek.png
```
This will show gray lines (not black) because a low power (burn) level is used that represent color *#A0A0A0* from the *stroke* attribute within the *.svg* file:
```
    style="fill:none;stroke:#A0A0A0;stroke-width:.1"
```
So the conversion generates an engraving for the *.svg* and will not burn the lines with power set by *svg2gcode* option *--cuttingpower*.
The gcode after conversion will look like this:
```
    ; delta: 0
    M5
    G0 X50 Y80
    ; Cut at F1000 mm/min, power S112
    M4
    G1 X25 Y20 S112 F1000
    G1 X75
    G1 X50 Y80
    M5
    M2
```
Look at the power setting, it is S112 (which is low on a scale of 0 to 1000 which is the default)
Note: to get options and defaults:
```
    > svg2gcode --help
```
#### How do we cut these lines?
Change the *style* attribute line - within file *line_hoek.svg* - to the following:
```
    style="fill:none;stroke:none;stroke-width:.1"
```
or add 'gcode-pathcut' to the style string: 
```
    style="fill:none;stroke:red;stroke-width:.1;gcode-pathcut:true"
```
(Note that this makes it possible to selectively cut path objects within the SVG.)
  
or add *svg2gcode* option *--pathcut* to override all path stroke attributes within the SVG document

Run *svg2gcode* (with same options) again.
Now the gcode after conversion will look like this:
```
    ; delta: 0
    M5
    G0 X50 Y80
    ; Cut at F1000 mm/min, power S850
    M4
    G1 X25 Y20 S850 F1000
    G1 X75
    G1 X50 Y80
    M5
    M2
```
Note the power setting, it is S850 now. This is a burn setting!

To iterate this; make more passes, because that is often needed when cutting thicker material, run:
```
    > svg2gcode --showimage --passes 10 --pass_depth 0.05 line_hoek.svg line_hoek.gc
```
This will generate gcode that makes 10 passes and moves the Z-axis 0.05 mm down each pass.
So it will cut with a total depth of 5 mm.

Don't worry if your lasercutter has no Z-axis, because this parameter will be ignored and the burn will repeat (at the same height) as specified.

If you have a CNC machine (which does have a Z-axis) you can mill in depth (so to speak), but you can also add - or switch to - a laser head and use the gcode to be able to really laser cut deeper!

#### Create two types of gcode file
One containing the drawings of the .svg, the other containing the images:      
```
    > svg2gcode --splitfile ambachtmanlogo.svg logo.gc
    > ..
    > ls *.gc 
    > logo.gc             # all drawings
    > logo_images.gc      # all images
```   

### Notes:
 - drawing objects - within the composer - must be converted to a```path```to be translated to a gcode sequence
 - also, image objects should **not** be converted to a ```path```
 - images must be linked or embedded using base64.
 - images can be in several formats (my tests included *.png* and  *.jpg* image files)
 - SVG source documents must be in unit 'mm' (and set to 1 'user unit' is 1 mm) which is the default for Inkscape (check document settings and look at the 'scaling' parameter)

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "svg2gcode",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.11",
    "maintainer_email": null,
    "keywords": "scalable vector graphics,svg,image,laser cutter,laser engraving",
    "author": null,
    "author_email": "Johannes Noordanus <mailjohannes.mailnoordanus@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/33/a1/e2e5b057b8b4c0f10ceeb85bfef4cb7264e12aab44e3cd2b216378ac2786/svg2gcode-3.2.5.tar.gz",
    "platform": null,
    "description": "# svg2gcode\n\nA commandline steering program that enables laser cutting of svg drawings```<svg:path ..>```tags and combined engraving of svg images```<svg:image ..>```tags.\nIt is based on library *SvgToGcode* (*fork*: *https://github.com/johannesnoordanus/SvgToGcode*)<sup>(*)</sup>.\n\nDrawings and images can be composed using Inkscape (or other SVG image software) and saved to a *.svg* file. This file can then be converted to gcode by *svg2gcode*.\nGcode produced in this way has the advantage that drawings and images have the same - relative - position and orientation as can be seen on the composer window.\nThis makes combined cutting and engraving as easy as orientating the (wood) slab once.\n\nSVG *path* and *image* objects are supported. Note that other drawing object must be converted to a *path* to be able to translate them to a gcode sequence.\nRecently (version 3.0.0 and higher) support for *stroke* color and *stroke-width* attributes of SVG *path* objects is added.\nThis means that it is possible to make laser engravings of text (fonts) and other drawing objects having a border with a specific color.\nIt is even possible to use alpha channel for these drawing objects now.\n\nControlling laser power, pixel size and other settings can be done via commandline parameters (see below) or within Inkscape using the XMLeditor.\nImage attributes ```gcode_pixelsize```, ```gcode_maxpower```, ```gcode_speed```, ```gcode_noise```, ```gcode_speedmoves```, ```gcode_overscan``` and ```gcode_showoverscan``` can be set per object.\n(Image attributes can be added within the XMLeditor (Inkscape) by using the **+**).\nNote that image attributes override explicit or default commandline settings.\n\nYou have full control of placing (locating) of the result gcode via options *--origin*, <i>--rotate</i> and *--scale*.\nOption *--selfcenter* can be used to set the origin at the center of the image.\nNote that gcode file headers contain compile information like the boundingbox and boundingbox center coordinates.\n\nVersion 2.0.0 and higher have important speed optimizations. Engravings run significantly faster and skip from one image zone to the other at maximum speed.\nSee options ```--speedmoves``` and ```--noise``` for example.\n\nVersion 3.0.0 and higher have support for 'stroke' (color) and 'stroke-width' attributes, this means that cutting a path works a bit different now. \nWhen the *stroke* attribute of a *path* is nonexistent or set to none, the path will be laser burned with the value set by option *--cuttingpower*.\n\nVersion 3.1.0 and higher have support for 'fill' (color) and 'fill-rule' attributes. Currently only fill rule 'evenodd' is supported.\n\nAlso, *svg2gcode* option ```--pathcut``` can be used to override all stroke attributes and force cutting of all *paths* of the SVG.\nOption ```--nofill``` (not set by default) is added to disable path fills.\n\nMore info can be obtained by looking at the examples below and from program *image2gcode* and its documentation (for example about callibrating laser engravers).  \n \nPlease consider supporting me, so I can make this application better and add new functionality to it: <http://paypal.me/johannesnoordanus/5,00>\n\nMy next update will add fill-rule 'nonzero'.\n\n\nTo summarize:\n\nOptimized gcode\n- draw pixels in one go until change of power\n- emit X/Y coordinates only when they change\n- emit linear move 'G1/G0' code minimally\n- does not emit zero power (or below cutoff) pixels\n\nGeneral optimizations\n- laser head has defered and sparse moves.\n(XY locations are virtual, head does not always follow)\n- moves at high speed (G0) over 10mm (default) or more zero pixels\n- low burn levels (stray pixels) can be suppressed (default off)\n- option *--constantburn* selects constant burn mode *M3* (for cutting and engraving) instead of default dynamic burn mode *M4*\n- borders are drawn in parallel and in one go, following the *path* coordinates.\n- fill has support for alpha channel and 'fill-opacity'\n \n**Tip**: use commandline program *grblhud* *(https://github.com/johannesnoordanus/grblhud)* to have full control over gcode execution,\nalso, program *image2gcode* has similar capabilities but handles raster images files (like *png* and *jpg*) directly. \n\n**Tip2**: another program *LaserWeb* (not made by me) is quite capable and has an excelent 3D gcode visualizer, it is able to calculate 3D paths for CNC machines, including the bit diameter.\n\n### Install:\n```\n> \n> pip install svg2gcode\n```\nSome linux distributions use a managed environment in which you cannot install python packages at will. Distribution Debian 12 and Manjaro have this limitation. You can setup a python *venv* and pip install *svg2gcode* in that or you can install systemwide using pipx:\n```\n> \n> pipx install svg2gcode\n```\n\n<sup>(*)</sup> Note that an upgraded and corrected version of this library is included. \n### Usage:\n```\n> svg2gcode --help\nusage: svg2gcode [-h] [--showimage] [--selfcenter] [--pixelsize <default:0.1>] [--imagespeed <default:800>] [--cuttingspeed <default:1000>] [--imagepower <default:300>]\n                    [--poweroffset <default:0>] [--cuttingpower <default:850>] [--passes <default:1>] [--pass_depth <default:0>] [--rapidmove <default:10>] [--noise <default:0>]\n                    [--overscan <default:0>] [--showoverscan] [--constantburn] [--origin delta-x delta-y] [--scale factor-x factor-y] [--rotate <default:0>] [--splitfile] [--pathcut]\n                    [--xmaxtravel <default:300>] [--ymaxtravel <default:400>] [--fan] [-V]\n                    svg gcode\n\nConvert svg to gcode for GRBL v1.1 compatible diode laser engravers.\n\npositional arguments:\n  svg                   svg file to be converted to gcode\n  gcode                 gcode output file\n\noptions:\n  -h, --help            show this help message and exit\n  --showimage           show b&w converted image\n  --selfcenter          self center the gcode (--origin cannot be used at the same time)\n  --pixelsize <default:0.1>\n                        pixel size in mm (XY-axis): each image pixel is drawn this size\n  --imagespeed <default:800>\n                        image draw speed in mm/min\n  --cuttingspeed <default:1000>\n                        cutting speed in mm/min\n  --imagepower <default:300>\n                        maximum laser power while drawing an image (as a rule of thumb set to 1/3 of the machine maximum for a 5W laser)\n  --poweroffset <default:0>\n                        pixel intensity to laser power: shift power range [0-imagepower]\n  --cuttingpower <default:850>\n                        sets laser power of line (path) cutting\n  --passes <default:1>  Number of passes (iterations) for line drawings, only active when pass_depth is set\n  --pass_depth <default:0>\n                        cutting depth in mm for one pass, only active for passes > 1\n  --rapidmove <default:10>\n                        generate G0 moves between shapes, for images: G0 moves when skipping more than 10mm (default), 0 is no G0 moves\n  --noise <default:0>   reduces image noise by not emitting pixels with power lower or equal than this setting\n  --overscan <default:0>\n                        overscan image lines to avoid incorrect power levels for pixels at left and right borders, number in pixels, default off\n  --showoverscan        show overscan pixels (note that this is visible and part of the gcode emitted!)\n  --constantburn        use constant burn mode M3 (a bit more dangerous!), instead of dynamic burn mode M4\n  --origin delta-x delta-y\n                        translate origin by vector (delta-x,delta-y) in mm (default not set, option --selfcenter cannot be used at the same time)\n  --scale factor-x factor-y\n                        scale svg with (factor-x,factor-y) (default not set)\n  --rotate <default:0>  number of degrees to rotate\n  --splitfile           split gcode output of SVG path and image objects\n  --pathcut             alway cut SVG path objects! (use laser power set with option --cuttingpower)\n  --nofill              ignore SVG fill attribute\n  --xmaxtravel <default:300>\n                        machine x-axis lengh in mm\n  --ymaxtravel <default:400>\n                        machine y-axis lengh in mm\n  --fan                 set machine fan on\n  -V, --version         show version number and exit\n```\n\n#### Configuration file:\nYou can also store svg2gcode settings in configuration file `~/.config/svg2gcode.toml` eg:\n\n```\nxmaxtravel= 400\nymaxtravel= 400\nimagespeed = 6000\n```\nIt can be used with any parameter which takes a value, and alows to persist your laser settings.\nYou can create this configuration file using an editor like vi or nano.\nAn alternative (quick) way to do that is to enter:\n```\n$ mkdir ~/.config\n$ echo \"xmaxtravel= 400\nymaxtravel= 400\nimagespeed = 6000\n\" > ~/.config/svg2gcode.toml\n```\n(but use your own settings!)\n\n### Examples:\n#### Cutting a SVG *path* element:\n\nThe svg below draws a triangle\n```\n    > cat line_hoek.svg\n    <?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n    <!-- Created with Inkscape (http://www.inkscape.org/) -->\n    <svg\n        height=\"80\"\n        width=\"80\"\n        xmlns=\"http://www.w3.org/2000/svg\"\n        xmlns:svg=\"http://www.w3.org/2000/svg\">\n        <path\n            id=\"driehoek\"\n            style=\"fill:none;stroke:#A0A0A0;stroke-width:.1\"\n            d=\"M50 0 L25 60 L75 60 Z\" />\n    </svg>\n    \n    > svg2gcode --showimage line_hoek.svg line_hoek.gc\n```\nThis generates gcode file *line_hoek.gc* (and shows the result in a separate viewer).\nThe first lines of the gcode file contain comment lines *;* as shown below.\n```\n    > head -n 25 line_hoek.gc\n    ;    svg2gcode 3.0.0 (2023-12-03 12:11:58)\n    ;    arguments: \n    ;      laser_power: 850,\n    ;      movement_speed: 1000,\n    ;      pixel_size: 0.1,\n    ;      maximum_image_laser_power: 300,\n    ;      image_movement_speed: 800,\n    ;      fan: False,\n    ;      rapid_move: 10,\n    ;      showimage: True,\n    ;      x_axis_maximum_travel: 300,\n    ;      y_axis_maximum_travel: 400,\n    ;      image_noise: 0,\n    ;      pass_depth: 0.0,\n    ;      laser_mode: dynamic,\n    ;      splitfile: False,\n    ;      image_poweroffset: 0,\n    ;      image_overscan: 0,\n    ;      image_showoverscan: False\n    ;    Boundingbox: (X25.0,Y20.0:X75.0,Y80.0)\n    ;    boundingbox center: (X50,Y50)\n    ;    GRBL 1.1, unit=mm, absolute coordinates\n\n```\nUse *gcode2image* to get an accurate representation of the gcode when run on a lasercutter.\n```\n    > gcode2image --showimage --flip --showorigin --grid --showG0 line_hoek.gc line_hoek.png\n```\nThis will show gray lines (not black) because a low power (burn) level is used that represent color *#A0A0A0* from the *stroke* attribute within the *.svg* file:\n```\n    style=\"fill:none;stroke:#A0A0A0;stroke-width:.1\"\n```\nSo the conversion generates an engraving for the *.svg* and will not burn the lines with power set by *svg2gcode* option *--cuttingpower*.\nThe gcode after conversion will look like this:\n```\n    ; delta: 0\n    M5\n    G0 X50 Y80\n    ; Cut at F1000 mm/min, power S112\n    M4\n    G1 X25 Y20 S112 F1000\n    G1 X75\n    G1 X50 Y80\n    M5\n    M2\n```\nLook at the power setting, it is S112 (which is low on a scale of 0 to 1000 which is the default)\nNote: to get options and defaults:\n```\n    > svg2gcode --help\n```\n#### How do we cut these lines?\nChange the *style* attribute line - within file *line_hoek.svg* - to the following:\n```\n    style=\"fill:none;stroke:none;stroke-width:.1\"\n```\nor add 'gcode-pathcut' to the style string: \n```\n    style=\"fill:none;stroke:red;stroke-width:.1;gcode-pathcut:true\"\n```\n(Note that this makes it possible to selectively cut path objects within the SVG.)\n  \nor add *svg2gcode* option *--pathcut* to override all path stroke attributes within the SVG document\n\nRun *svg2gcode* (with same options) again.\nNow the gcode after conversion will look like this:\n```\n    ; delta: 0\n    M5\n    G0 X50 Y80\n    ; Cut at F1000 mm/min, power S850\n    M4\n    G1 X25 Y20 S850 F1000\n    G1 X75\n    G1 X50 Y80\n    M5\n    M2\n```\nNote the power setting, it is S850 now. This is a burn setting!\n\nTo iterate this; make more passes, because that is often needed when cutting thicker material, run:\n```\n    > svg2gcode --showimage --passes 10 --pass_depth 0.05 line_hoek.svg line_hoek.gc\n```\nThis will generate gcode that makes 10 passes and moves the Z-axis 0.05 mm down each pass.\nSo it will cut with a total depth of 5 mm.\n\nDon't worry if your lasercutter has no Z-axis, because this parameter will be ignored and the burn will repeat (at the same height) as specified.\n\nIf you have a CNC machine (which does have a Z-axis) you can mill in depth (so to speak), but you can also add - or switch to - a laser head and use the gcode to be able to really laser cut deeper!\n\n#### Create two types of gcode file\nOne containing the drawings of the .svg, the other containing the images:      \n```\n    > svg2gcode --splitfile ambachtmanlogo.svg logo.gc\n    > ..\n    > ls *.gc \n    > logo.gc             # all drawings\n    > logo_images.gc      # all images\n```   \n\n### Notes:\n - drawing objects - within the composer - must be converted to a```path```to be translated to a gcode sequence\n - also, image objects should **not** be converted to a ```path```\n - images must be linked or embedded using base64.\n - images can be in several formats (my tests included *.png* and  *.jpg* image files)\n - SVG source documents must be in unit 'mm' (and set to 1 'user unit' is 1 mm) which is the default for Inkscape (check document settings and look at the 'scaling' parameter)\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "svg2gcode: convert an SVG (Scalable Vector Graphic) image to gcode.",
    "version": "3.2.5",
    "project_urls": {
        "Home": "https://github.com/johannesnoordanus/svg2gcode"
    },
    "split_keywords": [
        "scalable vector graphics",
        "svg",
        "image",
        "laser cutter",
        "laser engraving"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "81e59312d6ac6626b3937a85e86121d0702ae2c089ad0dfd9f3bfe81a33e59b9",
                "md5": "d6b5a74d19684ff7addf7caa218f2c67",
                "sha256": "a48f55559fc82b99976f809c8d06db9e7ce13f3074359ebc72300f870d2d67d3"
            },
            "downloads": -1,
            "filename": "svg2gcode-3.2.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d6b5a74d19684ff7addf7caa218f2c67",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11",
            "size": 71625,
            "upload_time": "2024-02-07T15:57:58",
            "upload_time_iso_8601": "2024-02-07T15:57:58.917343Z",
            "url": "https://files.pythonhosted.org/packages/81/e5/9312d6ac6626b3937a85e86121d0702ae2c089ad0dfd9f3bfe81a33e59b9/svg2gcode-3.2.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "33a1e2e5b057b8b4c0f10ceeb85bfef4cb7264e12aab44e3cd2b216378ac2786",
                "md5": "89d32f4e302ec6fa7d4a76be89fc8b5b",
                "sha256": "4bc886cdd1210072346e6190e26b2e85e3fe6b1d212d12a9ee94971013efc0ed"
            },
            "downloads": -1,
            "filename": "svg2gcode-3.2.5.tar.gz",
            "has_sig": false,
            "md5_digest": "89d32f4e302ec6fa7d4a76be89fc8b5b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11",
            "size": 64122,
            "upload_time": "2024-02-07T15:58:04",
            "upload_time_iso_8601": "2024-02-07T15:58:04.170609Z",
            "url": "https://files.pythonhosted.org/packages/33/a1/e2e5b057b8b4c0f10ceeb85bfef4cb7264e12aab44e3cd2b216378ac2786/svg2gcode-3.2.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-07 15:58:04",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "johannesnoordanus",
    "github_project": "svg2gcode",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "svg2gcode"
}
        
Elapsed time: 0.21334s