GCode Abstraction for creating 2D Plotter Art
Project description
2d-plotter-art-gcode
Introduction
A wrapper around GCode to generate GCode for 2D plotter art. Add points, lines, circles, and more.
Resource
Setup
pip install -i https://test.pypi.org/simple/ 2d-plotter-art-gcode==0.0.3
Setup plotter
The plotter
stores parameters about the plotter you'll be using.
plotter = Plotter(
units="mm", # Units of the plotter in `mm` or `inches`
x_min = 0, # Minimum plotter location along the X-Axis
x_max = 100, # Maximum plotter location along the X-Axis
y_min = 100, # Minimum plotter location along the Y-Axis
y_max = 0, # Maximum plotter location along the Y-Axis
feed_rate=10000 # Feed rate of the plotter
output_dir="output" # Output directory for GCode files, defaults to `output`
)
Universal Gcode Sender (UGS) is a useful tool for finding these values. Use Jog Controller
functionality to move the plotter head around to find the minimum and maximum values. Similarly, Feed rate can be set with the jog controller.
Add Layer
(s)
A layer is a collection of plotter instructions that will be executed together. Each layer will generate a separate G-code file. It can be useful to separate layers by color. Each GCode file can be fed into UGS separately, allowing time to change the tool head.
from gcode2dplotterart.Plotter import Plotter
def four_squares():
RED_LAYER = 'red'
GREEN_LAYER = 'green'
BLUE_LAYER = 'blue'
plotter = Plotter(units="mm", x_min = 0, x_max = 280, y_min = -200, y_max = 0, feed_rate=10000)
plotter.add_layer(RED_LAYER)
plotter.add_layer(GREEN_LAYER)
plotter.add_layer(BLUE_LAYER)
plotter.layers[RED_LAYER].add_line(0,-100,100,-100)
plotter.layers[GREEN_LAYER].add_line(100,0,100,-100)
plotter.layers[BLUE_LAYER].add_line(0,0,0,-100)
plotter.save()
if __name__ == "__main__":
four_squares()
Preview GCode
Browse the output directory to find the collection of files.
To understand the GCode, you can read more about the instructions here: https://marlinfw.org/meta/gcode/
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for gcode2dplotterart-0.0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bc89af78649e0254dfa33954fc3bf65b19a1319c684ac3cede5dc63f580e08f7 |
|
MD5 | 55ad574931e59269bb9d2811d0bc00e9 |
|
BLAKE2b-256 | 7f192b41fc15663524d8947201df383bad24644a046790c8de2db0defabb69de |