ifc_material/constituent/
set.rs1use ifc_model::EntityId;
4
5use crate::view::{borrowed_entity, optional_refs, optional_text, MaterialView};
6use crate::MaterialResult;
7
8borrowed_entity!(MaterialConstituentSet, "IFCMATERIALCONSTITUENTSET");
9
10impl<'m> MaterialConstituentSet<'m> {
11 pub fn name(self) -> MaterialResult<Option<&'m str>> {
13 optional_text(
14 "IFCMATERIALCONSTITUENTSET",
15 self.id(),
16 self.entity(),
17 0,
18 "Name",
19 )
20 }
21
22 pub fn description(self) -> MaterialResult<Option<&'m str>> {
24 optional_text(
25 "IFCMATERIALCONSTITUENTSET",
26 self.id(),
27 self.entity(),
28 1,
29 "Description",
30 )
31 }
32
33 pub fn constituent_ids(self) -> MaterialResult<Option<Vec<EntityId>>> {
37 optional_refs(
38 "IFCMATERIALCONSTITUENTSET",
39 self.id(),
40 self.entity(),
41 2,
42 "MaterialConstituents",
43 1,
44 )
45 }
46}
47
48impl<'m> MaterialView<'m> {
49 pub fn constituent_sets(self) -> impl Iterator<Item = MaterialConstituentSet<'m>> + 'm {
51 self.model()
52 .of_type("IFCMATERIALCONSTITUENTSET")
53 .map(|(id, entity)| MaterialConstituentSet::from_known(id, entity))
54 }
55}