lib3mf-converters
Convert between 3MF, STL, and OBJ formats for 3D printing workflows.
When to Use This Crate
Use lib3mf-converters when you need:
- Convert legacy STL files to modern 3MF format
- Export 3MF models to OBJ for visualization
- Batch format conversion in manufacturing pipelines
- Integration with CAD tools that use different formats
Quick Start
[]
= "0.4"
STL to 3MF (auto-detects binary or ASCII)
use StlImporter;
use File;
let file = open?;
let model = read?;
model.write?;
# Ok::
3MF to Binary STL
use BinaryStlExporter;
use ;
use parse_model;
use File;
let file = open?;
let mut archiver = new?;
let model_path = find_model_path?;
let data = archiver.read_entry?;
let model = parse_model?;
write?;
# Ok::
3MF to ASCII STL
use AsciiStlExporter;
use ;
use parse_model;
use File;
let file = open?;
let mut archiver = new?;
let model_path = find_model_path?;
let data = archiver.read_entry?;
let model = parse_model?;
write?;
# Ok::
Supported Formats
| Format | Import | Export | Notes |
|---|---|---|---|
| STL (Binary) | ✅ | ✅ | Standard binary STL |
| STL (ASCII) | ✅ | ✅ | Text-based STL |
| OBJ | ✅ | ✅ | Wavefront OBJ with vertices and faces |
Features
- Binary and ASCII STL import with automatic format detection
- Binary STL export (
BinaryStlExporter) and ASCII STL export (AsciiStlExporter) - OBJ import (vertices and faces) and export
- Preserves mesh topology
- Error recovery for malformed files
CLI Usage
Format conversion is also available via the CLI tool:
Related
- lib3mf-core - Core parsing library (required dependency)
- lib3mf-cli - Command-line converter
- Full Documentation
License
BSD-2-Clause