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.12.tar.gz (9.7 kB view details)

Uploaded Source

Built Distribution

plotting3dprinter-1.12-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: plotting3dprinter-1.12.tar.gz
  • Upload date:
  • Size: 9.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.6

File hashes

Hashes for plotting3dprinter-1.12.tar.gz
Algorithm Hash digest
SHA256 c542a07c4adeb789eddbec8329a1736556533d996f1fd1c2adc9299d19b82b94
MD5 5d51bbe03094bc9148171bc1f752d616
BLAKE2b-256 39058cfbf591aa12d558ba285644b1bd9ddcc88b5ddaae1570f05f26f6732f44

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for plotting3dprinter-1.12-py3-none-any.whl
Algorithm Hash digest
SHA256 7c56bbec1db61ce4cd17c05e72fad30a6587841d357aaf3d9c5d8c9a901afca3
MD5 3d40632f65eb2b2192c6a5428e9b27fe
BLAKE2b-256 0aab237e5fdb1024f367d4b9f60db9f0686f919cdbbe5a9ecbd5f810a23b46c4

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