lib3mf_core/model/
mod.rs

1//! Core data model for 3MF files.
2//!
3//! This module contains the in-memory representation of a 3MF document, including all geometry,
4//! materials, build instructions, and extension data.
5//!
6//! ## Key Types
7//!
8//! - [`Model`]: The root structure representing an entire 3MF document. Contains resources,
9//!   build instructions, metadata, and attachments.
10//! - [`ResourceCollection`]: Central registry for all resources (objects, materials, textures)
11//!   using a global ID namespace within the model.
12//! - [`Object`]: A 3MF resource representing geometry or components. Can be a mesh, support,
13//!   surface, solid support, boolean shape, or other type.
14//! - [`Mesh`]: Triangle mesh geometry with vertices, triangles, and optional beam lattice data.
15//! - [`Build`]: Collection of [`BuildItem`]s that define which objects to print and where to
16//!   position them.
17//! - [`BuildItem`]: An instance of an object in the build volume, with optional transformation.
18//!
19//! ## Material System
20//!
21//! Materials are applied to geometry via property IDs (`pid`):
22//!
23//! - [`BaseMaterial`]: Simple named materials with optional display color
24//! - [`ColorGroup`]: Per-vertex or per-triangle color assignments
25//! - [`Texture2DGroup`]: Image-based materials with UV coordinates
26//! - [`CompositeMaterials`]: Blended combinations of base materials
27//! - [`MultiProperties`]: Multi-channel property assignments
28//!
29//! Materials can be assigned at the object level (default for all triangles) or overridden
30//! per-triangle or per-vertex.
31//!
32//! ## Extension Support
33//!
34//! The model includes first-class support for 3MF extensions:
35//!
36//! - **Beam Lattice**: [`BeamLattice`] and [`BeamSet`] for structural lattices
37//! - **Slice**: [`SliceStack`] for layer-based geometry
38//! - **Volumetric**: [`VolumetricStack`] for voxel data
39//! - **Boolean Operations**: [`BooleanShape`] for CSG operations
40//! - **Displacement**: [`DisplacementMesh`] for texture-driven surface modification
41//! - **Secure Content**: Cryptographic features (see [`secure_content`] module)
42//!
43//! ## Design Philosophy
44//!
45//! The model follows an **immutable-by-default** design:
46//!
47//! - All structures derive `Clone` for easy copying
48//! - Modification happens via explicit operations (e.g., [`MeshRepair`] trait)
49//! - Thread-safe by default (no interior mutability)
50//! - Predictable behavior: functions don't have hidden side effects
51//!
52//! ## Re-exports
53//!
54//! For convenience, all public types are re-exported at the crate root via `pub use model::*`.
55//! You can use `lib3mf_core::Model` instead of `lib3mf_core::model::Model`.
56
57pub mod build;
58pub mod core;
59pub mod crypto;
60pub mod materials;
61pub mod mesh;
62pub mod package;
63pub mod repair;
64pub mod resolver;
65pub mod resources;
66pub mod secure_content;
67pub mod slice;
68pub mod stats;
69pub mod stats_impl;
70
71pub mod units;
72pub mod volumetric;
73
74pub use build::*;
75pub use core::*;
76pub use crypto::*;
77pub use materials::*;
78pub use mesh::*;
79pub use package::*;
80pub use repair::*;
81pub use resources::*;
82pub use secure_content::*;
83pub use slice::*;
84pub use stats::*;
85
86pub use units::*;
87pub use volumetric::*;