lib3mf_cli/lib.rs
1//! # lib3mf-cli
2//!
3//! Command-line tool for analyzing, validating, converting, and repairing 3MF files.
4//!
5//! ## Overview
6//!
7//! This crate provides the `3mf` command-line tool for working with 3D Manufacturing Format files.
8//! While primarily a binary crate, it exposes its command implementations as a library to enable
9//! programmatic usage and testing.
10//!
11//! ## CLI Commands
12//!
13//! The `3mf` binary supports the following commands:
14//!
15//! - **`stats`**: Report statistics and metadata (unit, geometry counts, materials)
16//! - **`list`**: List all entries in the 3MF archive (flat or tree view)
17//! - **`rels`**: Inspect OPC relationships and content types
18//! - **`dump`**: Dump the raw parsed model structure for debugging
19//! - **`extract`**: Extract a file from the archive by path or resource ID
20//! - **`copy`**: Copy and re-package a 3MF file (verifies read/write cycle)
21//! - **`convert`**: Convert between 3MF, STL, and OBJ formats
22//! - **`validate`**: Validate a 3MF file at various strictness levels
23//! - **`repair`**: Repair mesh geometry (stitch vertices, remove degenerates, harmonize orientations)
24//! - **`sign`**: Sign a 3MF file using an RSA key (not yet implemented)
25//! - **`verify`**: Verify digital signatures in a 3MF file (requires `crypto` feature)
26//! - **`encrypt`**: Encrypt a 3MF file (not yet implemented)
27//! - **`decrypt`**: Decrypt a 3MF file (not yet implemented)
28//! - **`benchmark`**: Benchmark loading and parsing speed
29//! - **`diff`**: Compare two 3MF files structurally
30//! - **`thumbnails`**: Manage thumbnails (extract, inject, list)
31//!
32//! ## Installation
33//!
34//! ```bash
35//! cargo install lib3mf-cli
36//! ```
37//!
38//! ## CLI Usage Examples
39//!
40//! ```bash
41//! # Report model statistics
42//! 3mf stats model.3mf
43//!
44//! # Validate at strict level
45//! 3mf validate model.3mf --level strict
46//!
47//! # Convert STL to 3MF
48//! 3mf convert mesh.stl model.3mf
49//!
50//! # Repair a mesh with vertex stitching
51//! 3mf repair broken.3mf fixed.3mf --epsilon 0.001
52//! ```
53//!
54//! ## Programmatic Usage
55//!
56//! The command implementations are exposed as public functions in the [`commands`] module:
57//!
58//! ```no_run
59//! use lib3mf_cli::commands::{OutputFormat, stats, validate};
60//! use std::path::PathBuf;
61//!
62//! # fn main() -> anyhow::Result<()> {
63//! // Generate statistics programmatically
64//! stats(PathBuf::from("model.3mf"), OutputFormat::Json)?;
65//!
66//! // Validate a model
67//! validate(PathBuf::from("model.3mf"), "standard".to_string())?;
68//! # Ok(())
69//! # }
70//! ```
71//!
72//! ## Feature Flags
73//!
74//! - `crypto` (default): Enables signature verification via `lib3mf-core/crypto`
75//! - `parallel` (default): Enables parallel mesh processing via `lib3mf-core/parallel`
76//!
77//! ## Cross-Reference
78//!
79//! This CLI tool is built on top of [`lib3mf_core`], which provides the underlying
80//! 3MF parsing, validation, and serialization functionality. For detailed information
81//! about the 3MF format and library architecture, see the `lib3mf-core` documentation.
82
83pub mod commands;