Skip to main content

Crate pk_stl

Crate pk_stl 

Source
Expand description

STL file parsing and writing.

This crate provides a simple interface for reading and writing STL files. It is written entirely in Rust with no dependencies, and it can read and write both ASCII and binary STL files.

§Examples

use pk_stl::parse_stl;

// Files may be loaded from bytes or from ascii.
let content = include_bytes!("../tests/test_cube.stl");
let model = parse_stl(content).unwrap();

// Models can be converted between ascii and binary.
let ascii_content = model.as_ascii();

// The header of this model is "OpenSCAD Model\n" because this file happens
// to be the output of OpenSCAD.
assert_eq!(ascii_content.lines().next(), Some("solid OpenSCAD Model"));

Modules§

error
geometry

Structs§

StlModel
The main structure of this crate. It represents a single STL model.

Functions§

parse_stl
Parse an STL file from bytes.