lib3mf_core/model/
package.rs

1use crate::model::Model;
2use std::collections::HashMap;
3
4/// Represents a 3MF Package, which can contain multiple model parts.
5#[derive(Debug, Clone, Default)]
6pub struct Package {
7    /// The main model part (usually /3D/3dmodel.model).
8    pub main_model: Model,
9
10    /// Additional model parts keyed by their package path.
11    pub parts: HashMap<String, Model>,
12}
13
14impl Package {
15    pub fn new(main_model: Model) -> Self {
16        Self {
17            main_model,
18            parts: HashMap::new(),
19        }
20    }
21
22    pub fn add_part(&mut self, path: String, model: Model) {
23        self.parts.insert(path, model);
24    }
25}