Skip to main content

ModelVisitor

Trait ModelVisitor 

Source
pub trait ModelVisitor {
Show 22 methods // Provided methods fn on_start_model(&mut self) -> Result<()> { ... } fn on_end_model(&mut self) -> Result<()> { ... } fn on_metadata(&mut self, _name: &str, _value: &str) -> Result<()> { ... } fn on_start_resources(&mut self) -> Result<()> { ... } fn on_end_resources(&mut self) -> Result<()> { ... } fn on_base_materials( &mut self, _id: ResourceId, _group: &BaseMaterialsGroup, ) -> Result<()> { ... } fn on_color_group( &mut self, _id: ResourceId, _group: &ColorGroup, ) -> Result<()> { ... } fn on_start_mesh(&mut self, _id: ResourceId) -> Result<()> { ... } fn on_vertex(&mut self, _x: f32, _y: f32, _z: f32) -> Result<()> { ... } fn on_triangle(&mut self, _v1: u32, _v2: u32, _v3: u32) -> Result<()> { ... } fn on_end_mesh(&mut self) -> Result<()> { ... } fn on_start_beam_lattice(&mut self, _object_id: ResourceId) -> Result<()> { ... } fn on_beam(&mut self, _beam: &Beam) -> Result<()> { ... } fn on_end_beam_lattice(&mut self) -> Result<()> { ... } fn on_start_displacement_mesh(&mut self, _id: ResourceId) -> Result<()> { ... } fn on_displacement_vertex( &mut self, _x: f32, _y: f32, _z: f32, ) -> Result<()> { ... } fn on_displacement_triangle( &mut self, _triangle: &DisplacementTriangle, ) -> Result<()> { ... } fn on_displacement_normal( &mut self, _nx: f32, _ny: f32, _nz: f32, ) -> Result<()> { ... } fn on_end_displacement_mesh(&mut self) -> Result<()> { ... } fn on_start_build(&mut self) -> Result<()> { ... } fn on_end_build(&mut self) -> Result<()> { ... } fn on_build_item(&mut self, _item: &BuildItem) -> Result<()> { ... }
}
Expand description

Trait for receiving callback events during streaming parsing of a 3MF model. This allows for processing massive files with constant memory usage.

Provided Methods§

Source

fn on_start_model(&mut self) -> Result<()>

Called when the model element starts.

Source

fn on_end_model(&mut self) -> Result<()>

Called when the model element ends.

Source

fn on_metadata(&mut self, _name: &str, _value: &str) -> Result<()>

Called upon encountering metadata.

Source

fn on_start_resources(&mut self) -> Result<()>

Called when the resources container starts.

Source

fn on_end_resources(&mut self) -> Result<()>

Called when the resources container ends.

Source

fn on_base_materials( &mut self, _id: ResourceId, _group: &BaseMaterialsGroup, ) -> Result<()>

Called when a BaseMaterials group is fully parsed. Since these are typically small, we pass the full object.

Source

fn on_color_group(&mut self, _id: ResourceId, _group: &ColorGroup) -> Result<()>

Called when a ColorGroup is fully parsed.

Source

fn on_start_mesh(&mut self, _id: ResourceId) -> Result<()>

Called when a Mesh object starts.

Source

fn on_vertex(&mut self, _x: f32, _y: f32, _z: f32) -> Result<()>

Called for each vertex in the current mesh.

Source

fn on_triangle(&mut self, _v1: u32, _v2: u32, _v3: u32) -> Result<()>

Called for each triangle in the current mesh.

Source

fn on_end_mesh(&mut self) -> Result<()>

Called when a Mesh object ends.

Source

fn on_start_beam_lattice(&mut self, _object_id: ResourceId) -> Result<()>

Called when a beam lattice starts (inside a mesh object).

The object_id identifies which mesh object contains this beam lattice. Note: BeamSets are silently skipped in streaming mode since they reference beams by index and require all beams to be known (violating streaming semantics). Use DOM mode if BeamSet data is required.

Source

fn on_beam(&mut self, _beam: &Beam) -> Result<()>

Called for each beam in the current beam lattice.

Source

fn on_end_beam_lattice(&mut self) -> Result<()>

Called when a beam lattice ends.

Source

fn on_start_displacement_mesh(&mut self, _id: ResourceId) -> Result<()>

Called when a displacement mesh object starts.

The id identifies this displacement mesh resource. Note: disp2dgroups (gradient vectors) are silently skipped in streaming mode. Use DOM mode if gradient vector data is required.

Source

fn on_displacement_vertex(&mut self, _x: f32, _y: f32, _z: f32) -> Result<()>

Called for each vertex in the displacement mesh.

Source

fn on_displacement_triangle( &mut self, _triangle: &DisplacementTriangle, ) -> Result<()>

Called for each triangle in the displacement mesh.

Source

fn on_displacement_normal(&mut self, _nx: f32, _ny: f32, _nz: f32) -> Result<()>

Called for each normal vector in the displacement mesh.

Source

fn on_end_displacement_mesh(&mut self) -> Result<()>

Called when a displacement mesh ends.

Source

fn on_start_build(&mut self) -> Result<()>

Called when the build container starts.

Source

fn on_end_build(&mut self) -> Result<()>

Called when the build container ends.

Source

fn on_build_item(&mut self, _item: &BuildItem) -> Result<()>

Called for each item in the build.

Implementors§