[B5] IFC-Export: Dach als IfcRoof-Aggregat mit IfcSlab ROOF je Dachfläche (Schichten als IfcMaterialLayerSetUsage, Pset_SlabCommon, Qto_SlabBaseQuantities; IFC4 und IFC2x3)

This commit is contained in:
Claude committed 2026-11-18 08:37:42 +00:00
1 parent f22cee4557
commit 5bd56a4fd6
11 files changed
+300 -50

No files matched your search

+82 -22
View File
@@ -619,6 +619,11 @@ fn stair_footprint(st: &Stair) -> Vec<Vec2> {
vec![Vec2 { x: min_x, y: min_y }, Vec2 { x: max_x, y: min_y }, Vec2 { x: max_x, y: max_y }, Vec2 { x: min_x, y: max_y }]
}
/// Name einer Dachfläche (Teil eines IfcRoof): Typname oder „Dachfläche“.
fn name_of_part(type_name: Option<&str>) -> &str {
type_name.filter(|n| !n.is_empty()).unwrap_or("Dachfläche")
}
fn roof_predefined(s: RoofShape) -> &'static str {
match s {
RoofShape::Flach => "FLAT_ROOF",
@@ -1789,26 +1794,10 @@ pub fn ifc_export_data(src: &Project, opt: &IfcOptions) -> Result<Flat, String>
classified.push((format!("roof/{}", roof.id), Kind::Roof, roof.category_code.clone()));
// Alle Dächer im Projekt lassen (Verschneidung [G5] braucht die Nachbarn), nur dieses ausgeben.
p.roofs = roofs.clone();
let meshes = model3d::emit_roofs(&p, Some(&roof.id))?;
let (mut positions, mut indices) = (Vec::<f64>::new(), Vec::<u32>::new());
for m in &meshes {
let at = (positions.len() / 3) as u32;
for c in m.positions.chunks_exact(3) {
positions.extend_from_slice(&[c[0], c[1], c[2] - base]);
}
indices.extend(m.indices.iter().map(|i| at + i));
}
if indices.is_empty() {
let parts = model3d::emit_roof_parts(&p, &roof.id)?;
if parts.is_empty() {
continue;
}
let mut closed = is_watertight(&positions, &indices, 1e-6);
if !closed {
let flipped: Vec<u32> = indices.chunks_exact(3).flat_map(|t| [t[0], t[2], t[1]]).collect();
if is_watertight(&positions, &flipped, 1e-6) {
indices = flipped;
closed = true;
}
}
let predefined = roof_predefined(roof.shape);
let roof_type = roof.roof_type_id.as_deref().filter(|s| !s.is_empty()).and_then(|id| p.roof_types.as_deref().unwrap_or(&[]).iter().find(|t| t.id == id));
// Ein Dach ist Gebäudehülle: IsExternal folgt aus der Bauteilart.
@@ -1817,7 +1806,8 @@ pub fn ifc_export_data(src: &Project, opt: &IfcOptions) -> Result<Flat, String>
props.push(ident("Reference", &t.name));
}
props.push(Prop::Bool("IsExternal", true));
props.extend(crate::u_value::roof_u_value(&p, roof).and_then(|u| u.u).map(|u| Prop::Thermal("ThermalTransmittance", u)));
let u_value = crate::u_value::roof_u_value(&p, roof).and_then(|u| u.u);
props.extend(u_value.map(|u| Prop::Thermal("ThermalTransmittance", u)));
let mut psets = vec![Pset { name: "Pset_RoofCommon", props }];
renovation_props(&p, &mut psets, "Pset_RoofCommon", roof.renovation.as_ref());
layer_renovation_props(&p, &mut psets, &roof.id);
@@ -1829,7 +1819,63 @@ pub fn ifc_export_data(src: &Project, opt: &IfcOptions) -> Result<Flat, String>
f.nums(&[REC_ROOF, structure, id, name, pre]);
w_type(&mut f, ty.as_ref().map(|t| type_ref(t, 2.0, predefined)).as_ref());
w_psets(&mut f, &psets);
w_mesh(&mut f, &positions, &indices, closed);
// [B5] IfcRoof als Aggregat, je Dachfläche ein IfcSlab ROOF (Pset_SlabCommon, Qto_SlabBaseQuantities).
let ri = p.roofs.as_deref().unwrap_or(&[]).iter().position(|r| r.id == roof.id);
let thickness = ty.as_ref().map_or(0.0, |t| t.2.iter().map(|l| l.2.max(0.0)).sum::<f64>());
let planes = crate::roof::roof_geometry(&roof.params(), p.roof_base_elevation(roof)).planes;
f.num(parts.len() as f64);
for (k, part) in parts.iter().enumerate() {
let (mut positions, mut indices) = (Vec::<f64>::new(), part.indices.clone());
for c in part.positions.chunks_exact(3) {
positions.extend_from_slice(&[c[0], c[1], c[2] - base]);
}
let mut closed = is_watertight(&positions, &indices, 1e-6);
if !closed {
let flipped: Vec<u32> = indices.chunks_exact(3).flat_map(|t| [t[0], t[2], t[1]]).collect();
if is_watertight(&positions, &flipped, 1e-6) {
indices = flipped;
closed = true;
}
}
let plane = part.plane.filter(|&i| i < planes.len());
let mut slab_props: Vec<Prop> = Vec::new();
if let Some(t) = roof_type {
slab_props.push(ident("Reference", &t.name));
}
slab_props.push(Prop::Bool("IsExternal", true));
slab_props.extend(u_value.map(|u| Prop::Thermal("ThermalTransmittance", u)));
let mut slab_psets = vec![Pset { name: "Pset_SlabCommon", props: slab_props }];
renovation_props(&p, &mut slab_psets, "Pset_SlabCommon", roof.renovation.as_ref());
// Mengen: Fläche der Dachfläche (geneigt, Aussenseite) abzüglich Dachfenster, Volumen aus dem Körper.
let volume = signed_volume6(&positions, &indices).abs() / 6.0;
let mut slab_q = match plane {
Some(i) => {
let gross = qty::roof_quantities(std::slice::from_ref(&planes[i])).into_iter().find(|q| q.name == "GrossArea").map_or(0.0, |q| q.value);
let pts = &planes[i];
let perimeter: f64 = (0..pts.len()).map(|j| { let (a, b) = (pts[j], pts[(j + 1) % pts.len()]); ((a[0] - b[0]).powi(2) + (a[1] - b[1]).powi(2) + (a[2] - b[2]).powi(2)).sqrt() }).sum();
let cut: f64 = ri.map_or(0.0, |ri| crate::opening_shape::roof_openings(&p, ri).iter().filter(|(_, fr)| fr.plane == Some(i)).map(|(o, _)| max(0.0, o.width) * max(0.0, o.height)).sum());
vec![
qty::Qty { name: "Width", kind: qty::QtyKind::Length, value: thickness },
qty::Qty { name: "Perimeter", kind: qty::QtyKind::Length, value: perimeter },
qty::Qty { name: "GrossArea", kind: qty::QtyKind::Area, value: gross },
qty::Qty { name: "NetArea", kind: qty::QtyKind::Area, value: max(0.0, gross - cut) },
]
}
None => Vec::new(),
};
slab_q.push(qty::Qty { name: "GrossVolume", kind: qty::QtyKind::Volume, value: volume });
slab_q.push(qty::Qty { name: "NetVolume", kind: qty::QtyKind::Volume, value: volume });
slab_psets.extend(qto("Qto_SlabBaseQuantities", slab_q));
let part_name = match (plane, parts.len()) {
(Some(_), _) => format!("{} {}", name_of_part(roof_type.map(|t| t.name.as_str())), k + 1),
(None, 1) => name_of_part(roof_type.map(|t| t.name.as_str())).to_string(),
(None, _) => "Attika".to_string(),
};
let (pname, plane_n) = (f.str(&part_name), plane.map_or(-1.0, |i| i as f64));
f.nums(&[pname, plane_n]);
w_psets(&mut f, &slab_psets);
w_mesh(&mut f, &positions, &indices, closed);
}
}
p.roofs = roofs;
@@ -1838,7 +1884,8 @@ pub fn ifc_export_data(src: &Project, opt: &IfcOptions) -> Result<Flat, String>
let Some(fr) = crate::opening_shape::host_frame(&p, o) else { continue };
let (host_key, floor_id) = if fr.plane.is_some() || fr.dormer {
let r = &p.roofs.as_deref().unwrap_or(&[])[fr.host];
(format!("roof/{}", r.id), r.floor_id.clone())
// [B5] Wirt = die Dachfläche (IfcSlab ROOF im IfcRoof-Aggregat), s. Datensatz ROOF.
(fr.plane.map_or_else(|| format!("roof/{}", r.id), |i| format!("roof/{}/p{i}", r.id)), r.floor_id.clone())
} else {
let c = &p.ceilings.as_deref().unwrap_or(&[])[fr.host];
(format!("slab/{}", c.id), c.floor_id.clone())
@@ -2310,10 +2357,23 @@ mod tests {
p.openings.as_mut().unwrap().push(Opening { id: "DF".into(), kind: ElementKind::Window, width: 0.78, height: 1.18, host_roof_id: Some("RF1".into()), host_point: Some(Vec2 { x: 2.5, y: 1.0 }), ..Default::default() });
let f = ifc_export_data(&p, &IfcOptions::default()).unwrap();
let s = strings(&f);
assert!(s.iter().any(|x| x == "wall/W1") && s.iter().any(|x| x == "roof/RF1"));
assert!(s.iter().any(|x| x == "wall/W1") && s.iter().any(|x| x.starts_with("roof/RF1")));
assert_eq!(f.nums.iter().filter(|v| **v == REC_OPENING_SOLID).count() >= 2, true);
}
/// [B5] Dach als Aggregat: je Dachfläche ein Teil mit Pset_SlabCommon und Qto_SlabBaseQuantities; Dachfenster am Teil.
#[test]
fn dach_in_dachflaechen() {
let mut p = sample();
p.openings.as_mut().unwrap().push(Opening { id: "DF".into(), kind: ElementKind::Window, width: 0.78, height: 1.18, host_roof_id: Some("RF1".into()), host_point: Some(Vec2 { x: 2.5, y: 1.0 }), ..Default::default() });
let n_planes = crate::roof::roof_geometry(&p.roofs.as_ref().unwrap()[0].params(), p.roof_base_elevation(&p.roofs.as_ref().unwrap()[0])).planes.len();
let parts = model3d::emit_roof_parts(&p, "RF1").unwrap();
assert!(parts.len() >= 2 && parts.iter().filter(|x| x.plane.is_some()).count() <= n_planes, "{}", parts.len());
let s = strings(&ifc_export_data(&p, &IfcOptions::default()).unwrap());
assert_eq!(s.iter().filter(|x| *x == "Qto_SlabBaseQuantities").count() >= 2, true);
assert!(s.iter().any(|x| x == "Pset_SlabCommon") && s.iter().any(|x| x.starts_with("roof/RF1/p")));
}
/// [148] Flachdach auf L-Umriss: IFC-Mengen aus dem echten Umriss (60 m², nicht 66 m² Bounding-Box),
/// Nettofläche ohne Dachfenster.
#[test]
+55
View File
@@ -603,6 +603,61 @@ pub fn emit_roofs(p: &Project, only_roof: Option<&str>) -> Result<Vec<RMesh>, St
Ok(out)
}
/// Ein Körper des IFC-Exports eines Dachs ([B5]): eine Dachfläche mit allen Schichten (Index in `roof_geometry().planes`)
/// oder ein Sonderteil ohne Fläche (Attika; verschnittenes Dach mit Gauben/Nachbarn als Ganzes).
pub struct RoofPart {
pub plane: Option<usize>,
pub positions: Vec<f64>,
pub indices: Vec<u32>,
}
/// Dach in Teilen für den IFC-Export: je Dachfläche ein Körper (alle Schichten, Dachfenster-Löcher wie im 3D), dazu die
/// Attika. Verschnittene Dächer und Gauben ([G5]) liefern ihre Körper nicht je Fläche: ein Teil ohne Fläche.
pub fn emit_roof_parts(p: &Project, roof_id: &str) -> Result<Vec<RoofPart>, String> {
let nb = crate::roof_assembly::neighbors_rc(p);
let Some((ri, roof)) = p.roofs.as_deref().unwrap_or(&[]).iter().enumerate().find(|(_, r)| r.id == roof_id) else { return Ok(Vec::new()) };
if crate::roof_assembly::roof_solids_with(p, ri, &nb).is_some() {
let (mut positions, mut indices) = (Vec::<f64>::new(), Vec::<u32>::new());
for m in emit_roofs(p, Some(roof_id))? {
let at = (positions.len() / 3) as u32;
positions.extend_from_slice(&m.positions);
indices.extend(m.indices.iter().map(|i| at + i));
}
return Ok(if indices.is_empty() { Vec::new() } else { vec![RoofPart { plane: None, positions, indices }] });
}
let g = crate::roof::roof_geometry(&roof.params(), p.roof_base_elevation(roof));
let mitre = Mitre::new(&g.planes);
let holes = roof_holes_by_plane(p, ri, &g.planes);
let layers: Vec<f64> = p.roof_layers(roof).iter().map(|l| l.thickness.max(0.0)).filter(|t| *t > EPS).collect();
let mut out = Vec::new();
for (i, plane) in g.planes.iter().enumerate() {
if plane.len() < 3 {
continue;
}
// Jede Fläche ein eigener, geschlossener Körper: auch entlang der Gratkanten Seitenflächen (Gehrungsebene).
let (mut positions, mut indices) = (Vec::new(), Vec::new());
let mut offset_above = 0.0;
for &t in &layers {
let top = mitre.at(i, offset_above);
let bottom = mitre.at(i, offset_above + t);
if holes[i].is_empty() {
push_roof_slab_between(&mut positions, &mut indices, &top, &bottom, &vec![false; top.len()]);
} else {
push_roof_slab_with_holes(&mut positions, &mut indices, &top, &bottom, &vec![false; top.len()], &holes[i], offset_above, offset_above + t);
}
offset_above += t;
}
if !indices.is_empty() {
out.push(RoofPart { plane: Some(i), positions, indices });
}
}
if let Some(pp) = crate::roof_parapet::parapet(roof, &g) {
let m = crate::roof_parapet::mesh(&pp);
out.push(RoofPart { plane: None, positions: m.positions, indices: m.indices });
}
Ok(out)
}
/// Dachschicht-Eingabe für den 3D-Live-Schnitt (`emitRoofCutLayers`).
pub fn emit_roof_cut_layers(p: &Project) -> Result<Vec<RRoofLayer>, String> {
let mut out = Vec::new();
@@ -68,6 +68,8 @@ pub(super) struct Builder {
pub(super) column_materials: Vec<(String, String, Vec<usize>)>,
/// Bauteil-Schlüssel (wie für die GlobalId, z. B. `wall/<id>`) → Entität; Ziel von Klassifikation/Zone/Attach.
pub(super) elements: HashMap<String, usize>,
/// Wirt für IfcRelVoidsElement, wenn der Schlüssel ein Aggregat ist (Dach → erste Dachfläche).
pub(super) void_alias: HashMap<String, usize>,
/// [201] Übernommene GlobalIds (Schlüssel wie für `gid`), Vorrang vor der abgeleiteten.
pub(super) guid_override: HashMap<String, String>,
/// IFC2x3: Türen/Fenster je (Tür?, Ausführung) → Bauteile; am Ende je ein IfcDoorStyle/IfcWindowStyle.
@@ -590,6 +592,22 @@ impl Builder {
(set != 0).then_some(set)
}
/// Aggregat ohne eigene Darstellung (IfcRoof): Typ, Eingliederung und Psets wie `finish_typed`.
#[allow(clippy::too_many_arguments)]
pub(super) fn finish_aggregate(&mut self, ifc: &str, guid_key: String, name: &str, ty: &Option<TypeRef>, psets: &[Pset], structure: i64, placement: usize, predefined: String) -> usize {
let guid = self.gid(&guid_key);
let entity = self.add(ifc, format!("{guid},#{},{},$,$,#{placement},$,$,{predefined}", self.owner_history, ifc_string(name)));
if let Some(i) = ty.as_ref().map(|t| self.type_for(t)) {
self.types[i].occurrences.push(entity);
}
self.add_to_containment(structure, entity);
for p in psets {
self.add_pset(p, entity, &guid_key);
}
self.elements.insert(guid_key, entity);
entity
}
/// Gemeinsamer Abschluss der Bauteile mit Typ und Psets: Typ (falls vorhanden) anlegen, Entität
/// schreiben, Typ-Exemplar, Eingliederung und Psets vormerken.
#[allow(clippy::too_many_arguments)]
+68 -10
View File
@@ -85,7 +85,12 @@
// ceiling_height (FinishCeilingHeight, mittlere lichte Höhe), PTS, net_area, gross_area,
// sia_category, PSETS
// END_SPACES = 8 (bündelt die Räume je Geschoss zu IfcRelAggregates)
// ROOF = 9, structure, id, name, predefined (Text), TYPEREF, PSETS, MESH
// ROOF = 9 ([B5] Aggregat), structure, id, name, predefined (Text), TYPEREF, PSETS, n_parts,
// (name, plane (Index der Dachfläche, −1 = Sonderteil), PSETS, MESH) × n_parts
// IfcRoof (PredefinedType nach Dachform; Typ, Pset_RoofCommon, Qto_RoofBaseQuantities) ohne Darstellung, per
// IfcRelAggregates je Teil ein IfcSlab ROOF mit Netz, Pset_SlabCommon, Qto_SlabBaseQuantities und den Schichten
// des Dachtyps als IfcMaterialLayerSetUsage (AXIS3, NEGATIVE). Teile: `roof/<id>/p<plane>` bzw. `roof/<id>/part<k>`;
// OPENING_SOLID mit Wirt `roof/<id>` sitzt im ersten Teil, mit `roof/<id>/p<plane>` in dieser Fläche.
// COLUMN = 10, structure, id, label, PTS, z_rel, depth, component_id (−1 = keine), component_name, PSETS
// COLUMN_PIECES = 20, structure, id, label, n, (PTS, z_rel, depth) × n, component_id (−1 = keine),
// component_name, PSETS ([141] Stütze mit Höhenabschnitten, je Abschnitt ein eigenes beschnittenes
@@ -379,6 +384,7 @@ pub fn build_ifc(flat: &[f64], strings: &str) -> Result<String, String> {
spaces: Vec::new(),
column_materials: Vec::new(),
elements: HashMap::new(),
void_alias: HashMap::new(),
fill_styles: Vec::new(),
};
let v2 = schema == Schema::Ifc2x3;
@@ -848,7 +854,13 @@ pub fn build_ifc(flat: &[f64], strings: &str) -> Result<String, String> {
}
let host_entity = match host.strip_prefix("wall/") {
Some(id) => w.walls.get(id).map(|x| x.0),
None => w.elements.get(&host).copied(),
None => w
.elements
.get(&host)
.or_else(|| w.void_alias.get(&host))
// `roof/<id>/p<n>` ohne diese Fläche (verschnittenes Dach): erster Teil des Dachs.
.or_else(|| host.rsplit_once("/p").and_then(|(roof, n)| n.parse::<u32>().ok().and_then(|_| w.void_alias.get(roof))))
.copied(),
};
let Some(host_entity) = host_entity else { continue };
let parent = w.placement_of(structure);
@@ -1169,9 +1181,46 @@ pub fn build_ifc(flat: &[f64], strings: &str) -> Result<String, String> {
let predefined = r.string()?;
let ty = r.type_ref()?;
let psets = r.psets()?;
let mesh = r.mesh()?;
let (placement, shape) = w.emit_triangulated_product(&mesh, w.placement_of(structure));
w.finish_typed("IFCROOF", format!("roof/{id}"), &name, &ty, &psets, structure, placement, shape, Some(enum_(&predefined)), false);
let n_parts = r.idx()?;
// [B5] IfcRoof als Aggregat ohne eigene Darstellung; je Dachfläche (bzw. Sonderteil) ein IfcSlab ROOF mit
// Schichten (IfcMaterialLayerSetUsage), Pset_SlabCommon und Qto_SlabBaseQuantities.
let placement = w.emit_placement(0.0, w.placement_of(structure));
let roof_key = format!("roof/{id}");
let roof_guid = w.gid(&roof_key);
let roof_entity = w.finish_aggregate("IFCROOF", roof_key.clone(), &name, &ty, &psets, structure, placement, enum_(&predefined));
let set = ty.as_ref().and_then(|t| w.layer_set_of(t));
let mut slabs = Vec::new();
for _ in 0..n_parts {
let part_name = r.string()?;
let plane = r.raw()?;
let part_psets = r.psets()?;
let mesh = r.mesh()?;
let (part_placement, shape) = w.emit_triangulated_product(&mesh, placement);
let key = if plane >= 0.0 { format!("{roof_key}/p{}", plane as i64) } else { format!("{roof_key}/part{}", slabs.len()) };
// GlobalId aus der des Dachs (stabil auch nach Import → Export, wo die Dach-id eine andere ist).
let guid = ifc_string(&ifc_guid(&format!("{roof_guid}/{}", key.rsplit('/').next().unwrap_or(""))));
let slab = w.emit_building_element("IFCSLAB", guid, &part_name, part_placement, shape, Some(enum_("ROOF")));
for p in &part_psets {
w.add_pset(p, slab, &key);
}
w.elements.insert(key, slab);
slabs.push(slab);
}
if let Some(&first) = slabs.first() {
// Dachfenster ohne Flächenangabe (verschnittenes Dach) sitzen im ersten Teil.
w.void_alias.insert(roof_key.clone(), first);
let g = w.gid(&format!("aggregates/{roof_key}"));
w.add("IFCRELAGGREGATES", format!("{g},#{},$,$,#{roof_entity},{}", w.owner_history, refs(&slabs)));
if let Some(set) = set {
// Schichten von aussen (oben) nach innen: Dickenrichtung = lokale Z-Achse, abwärts.
let u = w.add(
"IFCMATERIALLAYERSETUSAGE",
format!("#{set},{},{},0.{}", enum_("AXIS3"), enum_("NEGATIVE"), if v2 { "" } else { ",$" }),
);
let g = w.gid(&format!("{roof_key}/material"));
w.add("IFCRELASSOCIATESMATERIAL", format!("{g},#{},$,$,{},#{u}", w.owner_history, refs(&slabs)));
}
}
}
c if c == REC_COLUMN || c == REC_COLUMN_PIECES || c == REC_BEAM => {
let structure = r.structure(n_storeys)?;
@@ -1244,12 +1293,21 @@ pub fn build_ifc(flat: &[f64], strings: &str) -> Result<String, String> {
continue; // ohne Code keine Referenz
}
let Some(&entity) = w.elements.get(&key) else { continue };
if let Some((_, _, v)) = by_code.iter_mut().find(|(c, _, _)| *c == code) {
if !v.contains(&entity) {
v.push(entity);
// [B5] Dach: auch die Dachflächen (Teile des IfcRoof) tragen die Klassifikation (Leser erben nicht).
let mut targets = vec![entity];
if key.starts_with("roof/") {
let mut parts: Vec<(&String, usize)> = w.elements.iter().filter(|(k, _)| k.strip_prefix(&format!("{key}/")).is_some_and(|t| t.starts_with('p'))).map(|(k, v)| (k, *v)).collect();
parts.sort();
targets.extend(parts.into_iter().map(|x| x.1));
}
for entity in targets {
if let Some((_, _, v)) = by_code.iter_mut().find(|(c, _, _)| *c == code) {
if !v.contains(&entity) {
v.push(entity);
}
} else {
by_code.push((code.clone(), ref_name.clone(), vec![entity]));
}
} else {
by_code.push((code, ref_name, vec![entity]));
}
}
if !by_code.is_empty() {
+28 -8
View File
@@ -284,6 +284,11 @@ fn full_house_in(mut b: B, with_geo: bool) -> B {
b.str("Beton");
b.n(&[0.3]);
b.ref_pset("Pset_RoofCommon", "Satteldach");
// [B5] Teile: eine Dachfläche (Index 0) mit Pset_SlabCommon.
b.n(&[1.0]);
b.str("Satteldach 1");
b.n(&[0.0]);
b.ref_pset("Pset_SlabCommon", "Satteldach");
b.mesh_tetra();
// Stütze mit Material.
b.n(&[REC_COLUMN, 0.0]);
@@ -354,7 +359,7 @@ fn volles_haus_ist_wohlgeformt() {
assert!(ifc.is_ascii(), "Datei muss reines ASCII sein");
check_structure(&ifc);
assert_eq!(count(&ifc, "IFCWALL"), 2);
assert_eq!(count(&ifc, "IFCSLAB"), 1);
assert_eq!(count(&ifc, "IFCSLAB"), 2); // Decke + Dachfläche des Dachs
assert_eq!(count(&ifc, "IFCROOF"), 1);
assert_eq!(count(&ifc, "IFCCOLUMN"), 1);
assert_eq!(count(&ifc, "IFCSTAIR"), 1);
@@ -376,11 +381,17 @@ fn volles_haus_ist_wohlgeformt() {
assert_eq!(count(&ifc, "IFCMATERIALLAYERSET"), 2); // Wandtyp + Dachtyp
assert_eq!(count(&ifc, "IFCMATERIAL"), 2); // Beton (geteilt mit Dachtyp und Stütze) + Dämmung
assert_eq!(count(&ifc, "IFCRELDEFINESBYTYPE"), 2);
assert_eq!(count(&ifc, "IFCPROPERTYSET"), 5); // Wall, Space, Roof, Column + CH_Raum (Tür ohne Pset)
assert_eq!(count(&ifc, "IFCPROPERTYSET"), 6); // Wall, Space, Roof, SlabCommon der Dachfläche, Column + CH_Raum (Tür ohne Pset)
// Eingliederung: Geschoss (Wände, Decke, Treppe, Tür, Dach, Stütze) und Gebäude (Extrusion).
assert_eq!(count(&ifc, "IFCRELCONTAINEDINSPATIALSTRUCTURE"), 2);
// Project→Site, Site→Building, Building→Storeys, Geschoss→Räume.
assert_eq!(count(&ifc, "IFCRELAGGREGATES"), 4);
// Project→Site, Site→Building, Building→Storeys, Geschoss→Räume, Dach→Dachfläche.
assert_eq!(count(&ifc, "IFCRELAGGREGATES"), 5);
// [B5] Dach als Aggregat: IfcRoof ohne Darstellung, darunter IfcSlab ROOF mit den Schichten des Dachtyps.
let roof = first_line(&ifc, "IFCROOF");
assert!(roof.ends_with(",$,$,.GABLE_ROOF.);"), "{roof}");
assert!(first_line(&ifc, "IFCRELAGGREGATES").len() > 0);
assert!(ifc.lines().any(|l| l.contains("=IFCSLAB(") && l.ends_with(".ROOF.);")), "IfcSlab ROOF");
assert!(ifc.lines().any(|l| l.contains("=IFCMATERIALLAYERSETUSAGE(") && l.ends_with(".AXIS3.,.NEGATIVE.,0.,$);")));
}
/// Zeile der ersten Entität eines Typs.
@@ -581,7 +592,7 @@ fn wand_mit_achse_und_layer_set_usage() {
let ifc = build(&full_house(false)).unwrap();
check_structure(&ifc);
// Nur W1 hat Wandsystem: eine Usage, eine Axis-Darstellung, ein Axis-Kontext.
assert_eq!(count(&ifc, "IFCMATERIALLAYERSETUSAGE"), 1);
assert_eq!(count(&ifc, "IFCMATERIALLAYERSETUSAGE"), 2); // Wand W1 + Dachflächen
assert_eq!(count(&ifc, "IFCGEOMETRICREPRESENTATIONSUBCONTEXT"), 1);
let usage = first_line(&ifc, "IFCMATERIALLAYERSETUSAGE");
assert!(usage.contains(".AXIS2.,.POSITIVE.,-0.2,$"), "{usage}");
@@ -954,8 +965,9 @@ fn ifc2x3_kopf_und_entitaeten() {
// W1 hat Achse + Usage (StandardCase), W2 nicht (IfcWall).
assert_eq!(count(&ifc, "IFCWALLSTANDARDCASE"), 1);
assert_eq!(count(&ifc, "IFCWALL"), 1);
assert_eq!(count(&ifc, "IFCMATERIALLAYERSETUSAGE"), 1);
assert_eq!(count(&ifc, "IFCMATERIALLAYERSETUSAGE"), 2); // Wand + Dachflächen (IFC2x3: keine ReferenceExtent)
assert!(first_line(&ifc, "IFCMATERIALLAYERSETUSAGE").ends_with(".AXIS2.,.POSITIVE.,-0.2);"));
assert!(ifc.lines().any(|l| l.contains("=IFCMATERIALLAYERSETUSAGE(") && l.ends_with(".AXIS3.,.NEGATIVE.,0.);")));
// Wand ohne PredefinedType (8 Attribute), Stütze ebenso.
assert!(first_line(&ifc, "IFCWALL").ends_with(",$);") && first_line(&ifc, "IFCWALL").matches(',').count() == 7, "{}", first_line(&ifc, "IFCWALL"));
assert!(first_line(&ifc, "IFCCOLUMN").ends_with(",$);"), "{}", first_line(&ifc, "IFCCOLUMN"));
@@ -979,7 +991,7 @@ fn ifc2x3_kopf_und_entitaeten() {
assert_eq!(count(&ifc, "IFCFACE"), 4);
assert_eq!(count(&ifc, "IFCPOLYLOOP"), 4);
assert!(ifc.contains("'Body','Brep'"));
assert_eq!(count(&ifc, "IFCRELASSOCIATESMATERIAL"), 4); // Wandtyp, Usage, Dachschichten, Stütze
assert_eq!(count(&ifc, "IFCRELASSOCIATESMATERIAL"), 5); // Wandtyp, Usage, Dachschichten (am Dach), Usage der Dachflächen, Stütze
// Stile der Teilrollen über IfcPresentationStyleAssignment.
assert_eq!(count(&ifc, "IFCPRESENTATIONSTYLEASSIGNMENT"), 3);
// Mengen ohne Formula.
@@ -1037,6 +1049,10 @@ fn dachfenster_oeffnungskoerper() {
b.str("GABLE_ROOF");
b.no_type();
b.no_psets();
b.n(&[1.0]);
b.str("Dachfläche 1");
b.n(&[0.0]);
b.no_psets();
b.n(&[4.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, 0.0]);
b.n(&[2.0, 0.0, 1.0, 2.0, 0.0, 2.0, 3.0]);
b.f.push(0.0);
@@ -1081,6 +1097,10 @@ fn ifc2x3_offenes_netz_ist_shell_based_surface_model() {
b.str("FLAT_ROOF");
b.no_type();
b.no_psets();
b.n(&[1.0]);
b.str("Dachfläche 1");
b.n(&[0.0]);
b.no_psets();
// Zwei Dreiecke (offen) plus ein entartetes (doppelte Ecke).
b.n(&[4.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, 0.0]);
b.n(&[3.0, 0.0, 1.0, 2.0, 0.0, 2.0, 3.0, 0.0, 0.0, 1.0]);
@@ -1090,7 +1110,7 @@ fn ifc2x3_offenes_netz_ist_shell_based_surface_model() {
assert_eq!(count(&ifc, "IFCSHELLBASEDSURFACEMODEL"), 1);
assert_eq!(count(&ifc, "IFCOPENSHELL"), 1);
assert_eq!(count(&ifc, "IFCFACE"), 2);
assert_eq!(count(&ifc, "IFCCARTESIANPOINT"), 6); // Ursprung, 4 Ecken (je einmal), Placement
assert_eq!(count(&ifc, "IFCCARTESIANPOINT"), 7); // Ursprung, 4 Ecken (je einmal), 2 Placements (Dach, Dachfläche)
assert!(ifc.contains("'Body','SurfaceModel'"));
assert_eq!(count(&ifc, "IFCFACETEDBREP"), 0);
}