Skip to main content

gcodepy

gcodepy is a g-code generator for 3D printers that use Marlin Firmware. This project was heavily inspired by Full Control GCODE. It is essentially my own take on the concept of writing g-code through an abstraction layer, using Python instead of Excel/VBA.

Why would I want to write g-code with Python?

To be honest, there aren't usually many occasions where using an interface layer like gcodepy or Full Control GCODE are better than the CAD/slicer workflow. However, there are occasions where being able to programmatically define your printer's movements can be useful. One possible use of interface layers is in defining motions using mathematical functions. For example, gcodepy supports essentially any other Python code, so you can create any function with the correct output as input for movement even using other libraries such as numpy.

Thomas Sanladerer created a blog post and associated video about the potential uses of Full Control GCODE, which also applies to gcodepy. Notably, he created some very interesting geometric lampshade-esque objects.

Installation

gcodepy is available on PyPI and so can be installed with pip.

$ pip3 install gcodepy

Note that gcodepy has only been tested with Python 3.X and no guarantees are made about compatibility with the deprecated Python 2.X.

Examples

One of the most interesting things to do with gcodepy is to do toolhead movements using mathematical functions. For example, you can make your printer go in a spiral: zspiral image This example is defined in examples/zspiral.py. For more examples, check the examples folder.

Planned features

  • cleaner gcode output (particularly feedrates)
  • better interfacing for absolute movements
  • better detection + handling of invalid inputs/movements

Metadata

Release files for gcodepy 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gcodepy 0.1.1
File Size Uploaded
gcodepy-0.1.1.tar.gz 5.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gcodepy 0.1.1
File Interpreter ABI Platform
gcodepy-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 10.5 kB

Release files / gcodepy-0.1.1.tar.gz

Download URL gcodepy-0.1.1.tar.gz
Size 5.0 kB
Tags Source
SHA-256 checksum
How to use checksums
1a541ff810e5965ef90eab36b2a5956e8780ece0e25b37249692c05388bd3705
BLAKE2b-256 checksum
How to use checksums
f33fde4c663d2b78f4b88dd6b8c9c8a71175b9757c3e81d41fd8711e4de186db
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

Release files / gcodepy-0.1.1-py3-none-any.whl

Download URL gcodepy-0.1.1-py3-none-any.whl
Size 5.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
872cdf15c946751f25d5f44d4980756327a620e520f1584dd510ff65c10e4ac4
BLAKE2b-256 checksum
How to use checksums
bb333a6e1b2a6b2a8da46268c058fce9b52519749a79ea9bdc9d95075164415d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page