Expand description
§lib3mf-cli
Command-line tool for analyzing, validating, converting, and repairing 3MF files.
§Overview
This crate provides the 3mf command-line tool for working with 3D Manufacturing Format files.
While primarily a binary crate, it exposes its command implementations as a library to enable
programmatic usage and testing.
§CLI Commands
The 3mf binary supports the following commands:
stats: Report statistics and metadata (unit, geometry counts, materials)list: List all entries in the 3MF archive (flat or tree view)rels: Inspect OPC relationships and content typesdump: Dump the raw parsed model structure for debuggingextract: Extract a file from the archive by path or resource IDcopy: Copy and re-package a 3MF file (verifies read/write cycle)convert: Convert between 3MF, STL, and OBJ formatsvalidate: Validate a 3MF file at various strictness levelsrepair: Repair mesh geometry (stitch vertices, remove degenerates, harmonize orientations)sign: Sign a 3MF file using an RSA key (not yet implemented)verify: Verify digital signatures in a 3MF file (requirescryptofeature)encrypt: Encrypt a 3MF file (not yet implemented)decrypt: Decrypt a 3MF file (not yet implemented)benchmark: Benchmark loading and parsing speeddiff: Compare two 3MF files structurallythumbnails: Manage thumbnails (extract, inject, list)
§Installation
cargo install lib3mf-cli§CLI Usage Examples
# Report model statistics
3mf stats model.3mf
# Validate at strict level
3mf validate model.3mf --level strict
# Convert STL to 3MF
3mf convert mesh.stl model.3mf
# Repair a mesh with vertex stitching
3mf repair broken.3mf fixed.3mf --epsilon 0.001§Programmatic Usage
The command implementations are exposed as public functions in the commands module:
use lib3mf_cli::commands::{OutputFormat, stats, validate};
use std::path::PathBuf;
// Generate statistics programmatically
stats(PathBuf::from("model.3mf"), OutputFormat::Json)?;
// Validate a model
validate(PathBuf::from("model.3mf"), "standard".to_string())?;§Feature Flags
crypto(default): Enables signature verification vialib3mf-core/cryptoparallel(default): Enables parallel mesh processing vialib3mf-core/parallel
§Cross-Reference
This CLI tool is built on top of lib3mf_core, which provides the underlying
3MF parsing, validation, and serialization functionality. For detailed information
about the 3MF format and library architecture, see the lib3mf-core documentation.
Modules§
- commands
- Command implementations for the 3mf CLI tool.