pub struct ThreeMfReadResult {
pub model_part: String,
pub unit: ThreeMfUnit,
pub meshes: Vec<ThreeMfMesh>,
pub instances: Vec<ThreeMfInstance>,
pub positions: Vec<f64>,
pub indices: Vec<u32>,
pub triangle_colors: Vec<Option<[u8; 3]>>,
}Expand description
Everything read_3mf recovered from a package.
Fields§
§model_part: StringThe part the model was read from (from the start-part relationship).
unit: ThreeMfUnitThe unit the file declared, before conversion.
meshes: Vec<ThreeMfMesh>One entry per mesh-bearing <object> in <resources>, in document
order — including any the build never places.
instances: Vec<ThreeMfInstance>The <build>, flattened through <components>: one entry per placed
mesh. Objects of a type other than model are not placed.
positions: Vec<f64>Every instance’s triangles in world coordinates, millimetres — the soup the mesh-to-solid chain reads.
indices: Vec<u32>Triangle corners into positions/3, winding preserved (reversed for a
mirrored instance so the result stays outward-facing).
triangle_colors: Vec<Option<[u8; 3]>>Parallel to the flattened triangles (indices.len() / 3 entries, each
following its triangle through the instance order and a mirrored
placement’s winding reversal) when any placed triangle resolves to a
colour; EMPTY otherwise.
Implementations§
Source§impl ThreeMfReadResult
impl ThreeMfReadResult
pub fn vertex_count(&self) -> usize
pub fn triangle_count(&self) -> usize
Sourcepub fn instance_mesh(&self, instance: usize) -> Option<(Vec<f64>, Vec<u32>)>
pub fn instance_mesh(&self, instance: usize) -> Option<(Vec<f64>, Vec<u32>)>
ONE instance’s triangle soup: its world-space vertices and its triangles
rebased onto them. A multi-instance build is several bodies in one
buffer — this is how a consumer takes them apart by PLACEMENT without
knowing how read_3mf laid them out. The importer does not need it: the
mesh-to-solid chain splits the whole soup into its vertex-connected
components and reconstructs each as its own body. It is the answer when
the question is which instance a body came from, which the geometry
alone cannot say (two instances that touch are one component).