lib3mf-core
Parse and validate 3MF files for manufacturing workflows - production-ready with streaming parser and comprehensive validation.
Quick Start
Add to your Cargo.toml:
[]
= "0.1"
Parse a 3MF file:
use Model;
Examples
Parse and Validate
use ;
let model = from_file?;
let report = model.validate?;
if report.has_errors
Streaming Parser (Large Files)
use parse_model_streaming;
use StatsVisitor;
let mut visitor = new;
parse_model_streaming?;
println!;
Write 3MF
use ;
let model = create_model?;
write_model?;
Geometry Repair
use ;
let repaired = model.repair_geometry?;
println!;
Why lib3mf-rs?
- Production-ready: Comprehensive validation system with 4 levels (Minimal/Standard/Strict/Paranoid)
- Zero unsafe code: Memory-safe by design
- Comprehensive testing: 90%+ test coverage, fuzzing infrastructure, property-based tests
- Feature flags: Minimal dependencies by default, add crypto/parallel/png-validation as needed
- Complete spec support: All 9 official 3MF extensions (Materials, Slicing, Security, Boolean Ops, Displacement, etc.)
- Conformance tested: 86% pass rate on 3MF Consortium official test suite
Feature Flags
| Feature | Description |
|---|---|
crypto |
Digital signatures and encryption (Secure Content Extension) |
parallel |
Multi-threaded mesh processing for large files |
png-validation |
Validate PNG texture files |
full |
All features enabled |
# Minimal (default)
= "0.1"
# With parallel processing
= { = "0.1", = ["parallel"] }
# All features
= { = "0.1", = ["full"] }
Ecosystem
lib3mf-rs is a multi-crate workspace:
| Crate | When to Use |
|---|---|
| lib3mf-core (this crate) | Core parsing, validation, and writing |
| lib3mf-async | Non-blocking async I/O with tokio |
| lib3mf-cli | Command-line analysis and processing |
| lib3mf-converters | STL/OBJ format conversion |
| lib3mf-wasm | Browser and edge deployment |
Specification Compliance
Implements 3MF specifications:
- Core Specification v1.4.0
- Beam Lattice Extension v1.2.0
- Boolean Operations Extension v1.1.1
- Displacement Extension v1.0.0
- Materials and Properties Extension v1.2.1
- Production Extension v1.1.2
- Secure Content Extension v1.0.2
- Slice Extension v1.0.2
- Volumetric Extension v0.8.0
Documentation
Performance
Benchmarks on M1 Mac with 3MB test file:
- Parse: 15ms (200 MiB/s)
- Validate (Standard): 18ms
- Validate (Paranoid): 45ms
- Write: 12ms
See benchmarks for detailed metrics.
License
MIT OR Apache-2.0