The subplot art environment
Subplot is a Rust framework that implements An environment for computer art, targeting pen plotter artwork using SVGs. The subplot tool works on a directory with a TOML file that describes the parameters of the piece, like the paper size and orientation:
name = "january-postcard"
module = "voronoi-rays"
paper = "A6"
orientation = "landscape"
The module names a Rust library (dylib on macOS) that's used to generate the image.
Each module needs a plot function with the following signature:
#[no_mangle]
pub fn plot(sheet: &mut Sheet, params_map: &HashMap<String, ParamValue>)
The artwork is regenerated by calling this function whenever the library is rebuilt or the TOML file changes. Below the common fields is a dictionary of module-specific parameters:
[params]
seed = 12345
points = 5
Each artwork file generated is saved and numbered with a preview file that's hard-linked to the latest iteration. An SVG viewer that redraws when the underlying file changes (like Gapplin) can open the stable preview file for feedback on changes to the program.
Roadmap
I want to extend subplot with a web interface, similar to saxi. Instead of viewing SVG in a native app, each iteration of the artwork would automatically be sent to a web page where it could be fine-tuned for plotting. It's a lot easier to lay out a plot using form controls with immediate feedback in the same screen, than juggling a text file and viewer app at the same time.
This is a big project, and I don't want to cut any corners by using non-Rust code, so I'll have to build it up in smaller pieces:
Write a tokio-serial adapter for the EiBotBoard serial protocol to communicate with AxiDraw hardware directly.
Add a hardware abstraction layer for motion control of a 2D plotter, given its physical characteristics.
Convert most SVG tags into commands for this hardware abstraction layer, starting with the path tag.
Create a web interface using Sycamore with a sidebar for settings and a main viewing area for the SVG.
Integrate the web interface with the existing subplot SVG regeneration code and the SVG plotting system.
Once the basics are plumbed through, I can add more features, like:
Add a way to inspect the motion control system to ensure the plot is optimized for time.
Estimate the time duration for plotting.
Characterize pens and their line widths to offer warnings or line de-duplication.
Support plots with multiple pens.