Skip to main content

Generate gcode to plot on a 3d printer with a pen

Project description

2d plotting on a 3d-printer

This python library generates GCODE from SVG paths, allowing a 3d printer to draw images with a pen. Spirals plotted on Prusa MK3S

Attach a pen to the printer

In order to draw images, we need to attach a pen to the printer. I've used this model to attach a pen to my Mk3S

Install software

pip install plotting3dprinter

obtain SVG file

to generate GCODE a vector-based SVG image file is required. Currently the library only accepts paths made out of lines and splines (cubic and quadratic). Transformed paths and groups are not (yet) supported. The examples folder on this repo contains some compatible SVG files.

Software to generate SVG images from a bitmap image which worked well for me is Potrace.

The vector images generated by potrace need some addititional cleaning up using for example Inkscape. Make sure there are no groups and that the paths use absolute positioning. In settings, under "SVG Output", set "Path string format" to "Absolute". Then select all paths, and go to "Path" and click "Reverse" (This forces inkscape to rewrite the paths) and save as plain SVG.

Attach the pen at the correct height (callibration)

In order to callibrate the height of the pen I've created a small gcode file which just puts the head in the left bottom and moves the head 2mm above the bed. This will be the drawing height (Z).

Put a paper sheet on the bed, and clamp it to the bed using magnets. Run the CALLIBRATE.gcode file and attach the pen such that it just touches the paper.

After callibration run PEN_UP.gcode afterwards to lift the pen back up.

Convert the SVG to GCODE

In order to just plot the contour lines (strokes) present in the svg use:

svgto3dprintplot example.svg example_outline.gcode --stroke

Send the generated gcode file to your printer and enjoy!

Filled shapes

By adding the --fill flag, shapes will be filled with horizontal lines.

svgto3dprintplot example.svg example_outline.gcode --fill

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

plotting3dprinter-1.11.tar.gz (9.8 kB view details)

Uploaded Source

Built Distribution

plotting3dprinter-1.11-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

Details for the file plotting3dprinter-1.11.tar.gz.

File metadata

  • Download URL: plotting3dprinter-1.11.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5

File hashes

Hashes for plotting3dprinter-1.11.tar.gz
Algorithm Hash digest
SHA256 55719cfc13fe11cc8793ef9d5fd860312e52535da883d24bb620e8232952f0a3
MD5 479e06156f1d4b729f99d536a730b275
BLAKE2b-256 2dd178e7f3ebe60b0b13063cf96303f3edbb1518f2d43c30731c3cc5c0002fbe

See more details on using hashes here.

File details

Details for the file plotting3dprinter-1.11-py3-none-any.whl.

File metadata

  • Download URL: plotting3dprinter-1.11-py3-none-any.whl
  • Upload date:
  • Size: 10.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5

File hashes

Hashes for plotting3dprinter-1.11-py3-none-any.whl
Algorithm Hash digest
SHA256 a62dff71ecac0837ab4eb1dfdecc4bafd70c784b793b4d42e946e9c12f5f55b3
MD5 b52cddfe3472751929dff783c57a585f
BLAKE2b-256 18d4f64a9b2e544eb1a82889635c8bc686ab06aa6567a26fa0224abf9f5ac7ef

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page