P5.js to GCODE: canvas drawing calls

Hello all,

i would like to write a library that translates p5’s drawing calls of shape primitives and text to GCODE for plotters. Is there maybe a simpler way to hook p5’s drawing calls than extending p5.Renderer2D.js?

I already had a look at p5.js-svg in order to get an idea. There’s also a code snipped how to hook calls to the canvas in Javascript. Unfortunately i don’t get it to work in the p5 editor (https://editor.p5js.org/emnullfuenf/sketches/QBCIlYsdq).

The goal of the library would be printing to the Line-us ploter like in my Processing/Geomerative version:

Any help or ideas would be appreciated.

I got the canvas logger script working. It maybe could to do the job when used like Processing’s PDF Export library. Otherwise it slows down the sketch.

I’ll keep this post updated.