gcode-nom

Crates.iogcode-nom
lib.rsgcode-nom
version
sourcesrc
created_at2024-12-26 11:53:56.741491
updated_at2024-12-27 10:36:29.306518
descriptionVisualization tool for inspecting a g-code file.
homepagehttps://github.com/martinfrances107/gcode-nom
repositoryhttps://github.com/martinfrances107/gcode-nom
max_upload_size
id1495589
Cargo.toml error:TOML parse error at line 19, column 1 | 19 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include`
size0
martin frances (martinfrances107)

documentation

README

gcode-nom

Rust 2021 Edition.

crates.io Documentation

A library containing a full set of nom parsers for decoding gcode files.

Based on this library the workspace contains a series of visualization tools

  • gcode2obj - Generates "WaveFront Obj" files.
  • gcode2svg - Generates SVG files.
  • gcodeExtractThumbs - Extracts the images embedded in a binary-gcode file.
  • bgcodeViewer - Generates a report by turning on all the logging and them attempts to parse the file.

I intend the parsers to be as strictly compliant as possible. This is under-going rapid development. Please create issues here, or send me gcode files which expose unimplemented sections.

Sections gcode and bgcode files are compressed using a variety of algorithms. The HeatShrink and MeatPacking algorithms are not yet implemented.

For "binary gcode files" ['.bgcode' extension] the parser are streaming parsers.

See nom - "A byte-oriented, zero-copy, parser combinator library"

Tools

gcode2obj

Generates obj files.

Pass the gcode file into StdIn - the obj file is sent to StdOut :-

cd gcode2obj
cargo run --release -- < ./assets/bency.gcode > bench.obj

Which for example can be imported into blender for visualization.

Benchy in Blender Lego bricks Within blender :-

  1. This obj has been "Imported".
  2. Converted into a "Curve".
  3. Finally a circular bevel object has been applied to make the object solid [ A circle to represent a 0.1mm fibre].

gcode2svg

Generate svg files

Benchy in Blender

How to use

Pass the gcode file into StdIn - the SVG file is sent to StdOut :-

cd gcode2svg
cargo run --release -- < ./assets/benchy.gcode > benchy.svg

gcodeExtractThumbs

Extracts

bgcodeViewer

Strict checking of binaries. validates blocks checksums, ensures 'block' parameters values are within valid ranges.

Pass the gcode file into StdIn - A summary file is written to StdOut

cd bgcodeViewer
cargo run --release  < ../assets/both\ parts.bgcode > summary.txt

Future work

see TODO

A Bevy app?

Commit count: 119

cargo fmt