#gcode #mex #fdm #header #serialise #deserialise

no-std bin+lib binarygcode

A Rust implementation of libbgcode to serialise and deserialise binary gcode

3 releases

Uses new Rust 2024

new 0.0.3 May 9, 2025
0.0.2 Mar 31, 2025
0.0.1 Mar 30, 2025

#295 in Compression

Download history 156/week @ 2025-03-25 87/week @ 2025-04-01 5/week @ 2025-04-08 1/week @ 2025-04-15 124/week @ 2025-05-06

125 downloads per month

MIT license

53KB
1K SLoC

binarygcode

A no_std + alloc rust library and binary (CLI) to deserialise and serialise binary gcode (.bgcode) files. The binary gcode specification can be found here.

Support

Please consider supporting the crate by:

  • Downloading and using the crate.
  • Raising issues and improvements on the GitHub repo.
  • Recommending the crate to others.
  • ⭐ the crate on GitHub.
  • Sponsoring the maintainer.

Example

Examples can be found in the examples folder. Below is an example of reading the headers

use std::{env, fs};

use binarygcode::binary_to_ascii;

fn main() {
    // Create the path to the gcode file
    let mut path = env::current_dir().unwrap();
    path.push("test_files");
    path.push("mini_cube_b.bgcode");

    let binary = fs::read(path).unwrap();
    let gcode = binary_to_ascii(&binary, true).unwrap();
    println!(
        "Binary Length: {}, ASCII Lenght: {}",
        binary.len(),
        gcode.len()
    );

    fs::write("tmp/ascii.gcode", gcode.as_ref()).unwrap();
}

References

Dependencies

~11MB
~96K SLoC