Skip to content

Commit

Permalink
improve p5 to gcode documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
bbaudry committed Nov 18, 2023
1 parent 245a4ce commit a549f7d
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions penplotting/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,19 @@ One can change the size of the artwork by setting the density with `-d 32` (defa

### P5->SVG->GCDODE from the browser


* [p5.js-svg](https://github.com/zenozeng/p5.js-svg) with [p5.js v1.5](https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.5.0/p5.js), as documented above
* in p5.js, a canvas of ```h = 1053; w = 744``` will print perfectly on a A4 sheet, directly out of juicy-gcode, with no need to rescale
* We have compiled the [svg2gcode](https://docs.rs/svg2gcode/latest/svg2gcode/) crate to webassembly. See Mozilla's guidelines to [compile rust to webassembly](https://developer.mozilla.org/en-US/docs/WebAssembly/Rust_to_wasm).
* The results are in [```https://github.com/bbaudry/swart-studio/blob/main/penplotting/web_svg2gcode_bg.wasm```](web_svg2gcode_bg.wasm) and [```web_svg2gcode.js```](https://github.com/bbaudry/swart-studio/blob/main/penplotting/web_svg2gcode.js) files
* In the html page, feed the svg generated by p5 into the svg2gcode in wasm. We have a first integration in [plottable001.html](https://github.com/bbaudry/swart-studio/blob/main/penplotting/plottable001.html)
* SVG to gcode, option #1
* use [juicy-gcode](https://github.com/domoszlai/juicy-gcode)
* ```juicy-gcode -f ../penplotting/flavor.txt ../penplotting/testplotsize.svg > testplotsize.gcode```
* our uunatek pen plotter plots with a resolution of 96 dpi, so:
* a canvas of ```h = 1122; w = 793``` will print perfectly on a A4 sheet, directly out of juicy-gcode, with no need to rescale
* a canvas of ```h = 1587; w = 1122``` will print perfectly on a A3 sheet, directly out of juicy-gcode, with no need to rescale
* SVG to gcode, option # 2
* use [svg2gcode](https://docs.rs/svg2gcode/latest/svg2gcode/)
* We have compiled the [svg2gcode](https://docs.rs/svg2gcode/latest/svg2gcode/) crate to webassembly. See Mozilla's guidelines to [compile rust to webassembly](https://developer.mozilla.org/en-US/docs/WebAssembly/Rust_to_wasm).
* The results are in [```https://github.com/bbaudry/swart-studio/blob/main/penplotting/web_svg2gcode_bg.wasm```](web_svg2gcode_bg.wasm) and [```web_svg2gcode.js```](https://github.com/bbaudry/swart-studio/blob/main/penplotting/web_svg2gcode.js) files
* In the html page, feed the svg generated by p5 into the svg2gcode in wasm. We have a first integration in [plottable001.html](https://github.com/bbaudry/swart-studio/blob/main/penplotting/plottable001.html)


### Fonts and letters
Expand Down

0 comments on commit a549f7d

Please sign in to comment.