stl_io

Crates.iostl_io
lib.rsstl_io
version0.8.3
sourcesrc
created_at2017-06-28 21:40:58.951192
updated_at2024-11-17 22:16:45.649917
descriptionSTL input and output.
homepage
repositoryhttps://github.com/hmeyer/stl_io
max_upload_size
id21145
size65,037
Henning Meyer (hmeyer)

documentation

README

stl_io

test workflow build workflow Cargo License: MIT Downloads

stl_io is crate for reading and writing STL (STereoLithography) files. It can read both, binary and ascii STL in a safe manner. Writing is limited to binary STL, which is more compact anyway.

Examples

Read STL file:

use std::fs::OpenOptions;
let mut file = OpenOptions::new().read(true).open("mesh.stl").unwrap();
let stl = stl_io::read_stl(&mut file).unwrap();

Write STL file:

use std::fs::OpenOptions;
let mesh = [stl_io::Triangle { normal: [1.0, 0.0, 0.0],
                               vertices: [[0.0, -1.0, 0.0],
                                          [0.0, 1.0, 0.0],
                                          [0.0, 0.0, 0.5]]}];
let mut file = OpenOptions::new().write(true).create_new(true).open("mesh.stl").unwrap();
stl_io::write_stl(&mut file, mesh.iter()).unwrap();

For more information, check out the Documentation.

License

Licensed under the MIT license.
Commit count: 306

cargo fmt