picocadrs

A library to deserialize and serialize picoCAD files. As of now there aren't many features that help with manipulating the file, however these features are planned.

Example

This is a simple example of how to read a file, modify it and write the results to the same file. Note that an environment variable picocad_path containing the absolute path to your picoCAD folder and a picoCAD file called plane.txt is required, to run this example the way it is. plane.txt might get changed in a way you dont want it to, so please be sure that it does not contain any project you wouldn't want to be changed.

```rust use std::{fs, env}; use picocadrs::assets::{PicoColor, Vector}; use picocadrs::save::PicoSave;

// generate path let mut path = env::var("picocadpath").expect("Invalid environment variable."); path.pushstr("plane.txt");

// read file and create save let mut save = PicoSave::from(fs::readtostring(path.clone()).expect("Couldn't read file."));

// set bg color save.header.bg_color = PicoColor::DarkGreen;

// edit mesh let mesh = save.meshes.getmut(0).unwrap(); // rename the mesh to "firstmesh" mesh.name = "firstmesh".tostring(); // set mesh origin to 0|3|0 mesh.pos = Vector::new(0.0, 3.0, 0.0);

// write save to file fs::write(path, save.to_string()).expect("Couldn't write to file."); ```