An empty canvas for building plotter art in Processing.
This projects runs full screen (optional) with a proportional canvas showing your sketch in context of the target print size. Output your sketch as plot-ready SVG with optional PNG preview.
Put your sketch code in the Sketch.pde
file.
The main app will call your sketch's draw
method once per frame.
Set your paper size, pen thickness, and display scaling in the config.pde
file.
Any drawing commands in your sketch's draw
method will be output to SVG when saving.
Use the w
, h
, and ppi
variables in to your sketch to position your drawing on the canvas.
You can use these Processing functions in your sketch to access mouse and keyboard input:
mousePressed()
mouseReleased()
keyPressed()
keyReleased()
Use canvasMouseX
and canvasMouseY
to get mouse coordinates relative to the canvas.
If you need to do something in your project to respond to a change in canvas size, you can implement the setDimensions
function:
void setDimensions(int _w, int _h, float _ppi, float _strokeWeight) {
super.setDimensions(_w, _h, _ppi, _strokeWeight); // you must call super
// your code here...
}
This function will be called by app.pde
any time the canvas size changes. Be sure to call super in order to have the parent class correctly update the canvas values.
s
: Save a plot-ready SVG. This also saves a PNG preview image if you have that flag set in the config file.
g
: Toggle a visual grid that represents the maximum plot area.
This is a personal project and is mostly unsupported, but I'm happy to hear feedback or answer questions.
This project is licensed under the Unlicense - see the LICENSE file for details.
👨🏻🦲❤️🛠