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§
Sourcefn on_start_model(&mut self) -> Result<()>
fn on_start_model(&mut self) -> Result<()>
Called when the model element starts.
Sourcefn on_end_model(&mut self) -> Result<()>
fn on_end_model(&mut self) -> Result<()>
Called when the model element ends.
Sourcefn on_metadata(&mut self, _name: &str, _value: &str) -> Result<()>
fn on_metadata(&mut self, _name: &str, _value: &str) -> Result<()>
Called upon encountering metadata.
Sourcefn on_start_resources(&mut self) -> Result<()>
fn on_start_resources(&mut self) -> Result<()>
Called when the resources container starts.
Sourcefn on_end_resources(&mut self) -> Result<()>
fn on_end_resources(&mut self) -> Result<()>
Called when the resources container ends.
Sourcefn on_base_materials(
&mut self,
_id: ResourceId,
_group: &BaseMaterialsGroup,
) -> Result<()>
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.
Sourcefn on_color_group(&mut self, _id: ResourceId, _group: &ColorGroup) -> Result<()>
fn on_color_group(&mut self, _id: ResourceId, _group: &ColorGroup) -> Result<()>
Called when a ColorGroup is fully parsed.
Sourcefn on_start_mesh(&mut self, _id: ResourceId) -> Result<()>
fn on_start_mesh(&mut self, _id: ResourceId) -> Result<()>
Called when a Mesh object starts.
Sourcefn on_vertex(&mut self, _x: f32, _y: f32, _z: f32) -> Result<()>
fn on_vertex(&mut self, _x: f32, _y: f32, _z: f32) -> Result<()>
Called for each vertex in the current mesh.
Sourcefn on_triangle(&mut self, _v1: u32, _v2: u32, _v3: u32) -> Result<()>
fn on_triangle(&mut self, _v1: u32, _v2: u32, _v3: u32) -> Result<()>
Called for each triangle in the current mesh.
Sourcefn on_end_mesh(&mut self) -> Result<()>
fn on_end_mesh(&mut self) -> Result<()>
Called when a Mesh object ends.
Sourcefn on_start_beam_lattice(&mut self, _object_id: ResourceId) -> Result<()>
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.
Sourcefn on_beam(&mut self, _beam: &Beam) -> Result<()>
fn on_beam(&mut self, _beam: &Beam) -> Result<()>
Called for each beam in the current beam lattice.
Sourcefn on_end_beam_lattice(&mut self) -> Result<()>
fn on_end_beam_lattice(&mut self) -> Result<()>
Called when a beam lattice ends.
Sourcefn on_start_displacement_mesh(&mut self, _id: ResourceId) -> Result<()>
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.
Sourcefn on_displacement_vertex(&mut self, _x: f32, _y: f32, _z: f32) -> Result<()>
fn on_displacement_vertex(&mut self, _x: f32, _y: f32, _z: f32) -> Result<()>
Called for each vertex in the displacement mesh.
Sourcefn on_displacement_triangle(
&mut self,
_triangle: &DisplacementTriangle,
) -> Result<()>
fn on_displacement_triangle( &mut self, _triangle: &DisplacementTriangle, ) -> Result<()>
Called for each triangle in the displacement mesh.
Sourcefn on_displacement_normal(&mut self, _nx: f32, _ny: f32, _nz: f32) -> Result<()>
fn on_displacement_normal(&mut self, _nx: f32, _ny: f32, _nz: f32) -> Result<()>
Called for each normal vector in the displacement mesh.
Sourcefn on_end_displacement_mesh(&mut self) -> Result<()>
fn on_end_displacement_mesh(&mut self) -> Result<()>
Called when a displacement mesh ends.
Sourcefn on_start_build(&mut self) -> Result<()>
fn on_start_build(&mut self) -> Result<()>
Called when the build container starts.
Sourcefn on_end_build(&mut self) -> Result<()>
fn on_end_build(&mut self) -> Result<()>
Called when the build container ends.
Sourcefn on_build_item(&mut self, _item: &BuildItem) -> Result<()>
fn on_build_item(&mut self, _item: &BuildItem) -> Result<()>
Called for each item in the build.