17 releases

0.7.0 Dec 4, 2022
0.6.0 Jan 4, 2021
0.5.2 Oct 19, 2020
0.4.2 Nov 29, 2018
0.3.3 Jul 5, 2017

#454 in Algorithms

Download history 2891/week @ 2023-11-03 3073/week @ 2023-11-10 2821/week @ 2023-11-17 2614/week @ 2023-11-24 2150/week @ 2023-12-01 2508/week @ 2023-12-08 2259/week @ 2023-12-15 1250/week @ 2023-12-22 1024/week @ 2023-12-29 1822/week @ 2024-01-05 2211/week @ 2024-01-12 1925/week @ 2024-01-19 2398/week @ 2024-01-26 2216/week @ 2024-02-02 1807/week @ 2024-02-09 1929/week @ 2024-02-16

8,640 downloads per month
Used in 12 crates (10 directly)

Apache-2.0 OR MIT

32KB
657 lines

stl_io

Build Status Codecov Cargo License: Apache-2.0 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 either of Apache License, Version 2.0 or MIT license at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~165KB