Expand description
Core data model for 3MF files.
This module contains the in-memory representation of a 3MF document, including all geometry, materials, build instructions, and extension data.
§Key Types
Model: The root structure representing an entire 3MF document. Contains resources, build instructions, metadata, and attachments.ResourceCollection: Central registry for all resources (objects, materials, textures) using a global ID namespace within the model.Object: A 3MF resource representing geometry or components. Can be a mesh, support, surface, solid support, boolean shape, or other type.Mesh: Triangle mesh geometry with vertices, triangles, and optional beam lattice data.Build: Collection ofBuildItems that define which objects to print and where to position them.BuildItem: An instance of an object in the build volume, with optional transformation.
§Material System
Materials are applied to geometry via property IDs (pid):
BaseMaterial: Simple named materials with optional display colorColorGroup: Per-vertex or per-triangle color assignmentsTexture2DGroup: Image-based materials with UV coordinatesCompositeMaterials: Blended combinations of base materialsMultiProperties: Multi-channel property assignments
Materials can be assigned at the object level (default for all triangles) or overridden per-triangle or per-vertex.
§Extension Support
The model includes first-class support for 3MF extensions:
- Beam Lattice:
BeamLatticeandBeamSetfor structural lattices - Slice:
SliceStackfor layer-based geometry - Volumetric:
VolumetricStackfor voxel data - Boolean Operations:
BooleanShapefor CSG operations - Displacement:
DisplacementMeshfor texture-driven surface modification - Secure Content: Cryptographic features (see
secure_contentmodule)
§Design Philosophy
The model follows an immutable-by-default design:
- All structures derive
Clonefor easy copying - Modification happens via explicit operations (e.g.,
MeshRepairtrait) - Thread-safe by default (no interior mutability)
- Predictable behavior: functions don’t have hidden side effects
§Re-exports
For convenience, all public types are re-exported at the crate root via pub use model::*.
You can use lib3mf_core::Model instead of lib3mf_core::model::Model.
Re-exports§
pub use resolver::ResolveOptions;pub use resolver::ResolvedMesh;pub use build::*;pub use core::*;pub use crypto::*;pub use materials::*;pub use mesh::*;pub use package::*;pub use repair::*;pub use resources::*;pub use secure_content::*;pub use slice::*;pub use stats::*;pub use units::*;pub use volumetric::*;
Modules§
- build
- Build instructions —
BuildandBuildItemtypes. - core
- Root
Modelstruct and itsvalidate/compute_statsmethods. - crypto
- XML-DSIG crypto data structures used by the Secure Content Extension.
- materials
- Material and texture types (colors, base materials, composites, etc.).
- mesh
- Mesh geometry types (
Mesh,Triangle,Vertex,BeamLattice, etc.). - package
- Multi-part
Packagetype for Production Extension multi-model files. - repair
- Mesh repair operations (
MeshRepairtrait andRepairStats). - resolver
- Cross-file component resolver (
PartResolver,ResolvedMesh,ResolveOptions). - resources
ResourceCollection— central registry for all model resources.- secure_
content - Secure Content Extension key store types (
KeyStore,Consumer, etc.). - slice
- Slice Extension types (
SliceStack,Slice,Polygon, etc.). - stats
- Model statistics types returned by
Model::compute_stats(). - stats_
impl - Internal implementation of
compute_stats()— not part of the public API surface. - units
- Unit of measurement enum and conversion utilities.
- volumetric
- Volumetric Extension types (
VolumetricStack,VolumetricLayer, etc.).