xyz-tools / gcode-preview

A simple GCode parser & previewer lib with 3D printing in mind. Written in Typescript.
https://gcode-preview.web.app/
MIT License
160 stars 31 forks source link

Parser metadata library #159

Open sophiedeziel opened 5 months ago

sophiedeziel commented 5 months ago

GCode comments metadata from the slicer can provide valuable information to the library. However, slicers format the comments differently.

I'm suggesting a first implementation that would only take care of the layers split. Right now, the parser uses a tolerance algorithm based on z changes. I'm suggesting a library for prusa and/or cura that would parse the ;LAYER_CHANGE (prusa slicer) and ;LAYER:2 (Cura) comments when available and fallback to the tolerance algorithm only when the metadata is not available.

Eventually, we'll want the line types (outer wall, infill, etc) for features around those!