[B4] IFC-Import: eigene Dächer als Dach (Pset Dossier_Roof, Rundreise :komplex 4/4)

This commit is contained in:
Claude committed 2026-11-18 11:55:12 +00:00
1 parent b672290d26
commit c315377810
7 files changed
+198 -11

No files matched your search

+1 -1
View File
@@ -226,7 +226,7 @@ Punktwolken/BCF-Ausbau, Windows-Paket, [C5]/[C7]/[15] Kern-Umbauten — ausser s
## Import und Export
- ◐ **[211]** Rendering mit Blender/Cycles (12.11.; Export-Paket `model.glb` + `scene.json` + `textures/` `export/blenderRender.ts`, Skript `scripts/blender/render_dossier.py`, Dialog, CLI `render`; Mac-Gegenprobe 12.11. lief, Befunde in [227] behoben). Offen: nicht in der Tauri-App/auf dem Mac geprüft (Berechtigungen, Metal-GPU, Ereignisse), nicht mit installiertem Blender 3.6/4.x (Mix-Knoten per Platz, `light_settings.ao_factor` nur in 5.x geprüft); Dialog nicht im Browser geklickt; ambientCG-Web-Texturen lädt die CLI nicht; Dachtyp-Schichten ohne Bildkarte (z. B. Faserzement) nur nach Namen. · M
- ◐ **[B4]** (= [25], zweite Stufe) IFC-Import zu echten Bauteilen (`io/ifcImport*`, `fileio`). Stand 18.11.: Rundreise eigener Export → Import für Träger (rechteckig → `Project.beams`, Oberkante über `topOffset`), Geländer (Pset `Dossier_Railing` mit Achse/Höhe/Art, nur eigener Export und nur wenn der Körper passt; fremde Geländer bleiben Mesh), Rampen (`IfcRamp`/`IfcRampFlight` als ebene schräge Platte → Decke mit `slope.ramp`; mehrere Läufe/Stufen bleiben Mesh), Dachplatten nicht doppelt (Test `src/io/ifcImport.roundtrip.test.ts`, `:wettbewerb`, `:komplex`); nicht auf dem Mac geprüft, Träger-Bezug ignoriert Decken, die schon vor dem Import im Projekt lagen. Offen: Dächer (Rundreise `:komplex`: nur 1 von 4 Dächern als Dach), Treppen mit 3+ Podesten, Träger mit Profil I/U und schräge Träger, geneigte `IfcSlab` (ausser Rampen), schräge/gekrümmte Wände, Wände mit Profiländerung, Decken aus Netzen mit T-Stössen, Tür-Anschlag, Typen aus IfcDoorType/IfcWindowType, Farbe der Bauteile; LEFT/RIGHT nur gegen den eigenen Export geprüft. · L
- ◐ **[B4]** (= [25], zweite Stufe) IFC-Import zu echten Bauteilen (`io/ifcImport*`, `fileio`). Stand 18.11. (Dächer ergänzt): Rundreise eigener Export → Import für Träger (rechteckig → `Project.beams`, Oberkante über `topOffset`), Geländer (Pset `Dossier_Railing` mit Achse/Höhe/Art, nur eigener Export und nur wenn der Körper passt; fremde Geländer bleiben Mesh), Rampen (`IfcRamp`/`IfcRampFlight` als ebene schräge Platte → Decke mit `slope.ramp`; mehrere Läufe/Stufen bleiben Mesh), Dächer (Pset `Dossier_Roof` mit Umriss/Form/Neigung/Traufhöhe/Dicke und `RoofParams`-JSON für Höfe, Bögen, Kantenneigungen, Überstände, Gauben, Attika; Rundreise `:komplex` 4 von 4, `:wettbewerb` 1 von 1; fremde Dächer weiter über `fit_roof`, gedrehte Karte verliert die Parameter), Dachplatten nicht doppelt (Test `src/io/ifcImport.roundtrip.test.ts`, `:wettbewerb`, `:komplex`); nicht auf dem Mac geprüft, Träger-Bezug ignoriert Decken, die schon vor dem Import im Projekt lagen. Offen: Dachtyp-Bezug und Dachfenster der Rundreise (Fenster im Dach bleiben Mesh), Treppen mit 3+ Podesten, Träger mit Profil I/U und schräge Träger, geneigte `IfcSlab` (ausser Rampen), schräge/gekrümmte Wände, Wände mit Profiländerung, Decken aus Netzen mit T-Stössen, Tür-Anschlag, Typen aus IfcDoorType/IfcWindowType, Farbe der Bauteile; LEFT/RIGHT nur gegen den eigenen Export geprüft. · L
- ◐ **[B3]-Rest** IFC-Geometrie-Import. Offen: IfcAdvancedBrep (NURBS), IFC4.3-Ausrichtung, IfcGridPlacement, B-Spline-Kurven, Profil-Kantenradien; CSG bei > 200 000 Dreiecken übersprungen; Farbe von Kontext-Meshes im 3D (`plan/toWalls3d.ts::emitMeshes` setzt fest `IMPORTED_RGB`). · M
- ◐ **[B5]** IFC-Export (Kern `ifc_data.rs`, `ifc_export/`). 18.11.: Dach als `IfcRoof`-Aggregat (PredefinedType nach Dachform, Typ/`Pset_RoofCommon`/`Qto_RoofBaseQuantities` am Dach) mit je Dachfläche einem `IfcSlab` ROOF (Netz, `Pset_SlabCommon` inkl. Status Umbau, `Qto_SlabBaseQuantities`, Schichten des Dachtyps als `IfcMaterialLayerSetUsage` AXIS3/NEGATIVE, Dachfenster-Öffnung in der Wirtsfläche, Klassifikation auch an den Flächen), IFC4 und IFC2x3 (ifcopenshell-Schema gültig; Datensatz 9 ROOF neu geordnet, keine neue Nummer). Verschnittene Dächer/Gauben ([G5]) und Attika gehen als EIN Teil bzw. eigenes Teil statt je Fläche; Dachfläche bleibt Netz (kein Profil-Sweep); `IfcRoofType` nur IFC4. Offen: Wand/Decke-Felder ohne UI; Reference-Rückimport fehlt; IFC2x3 nicht gesondert geprüft; nicht in Revit/ArchiCAD geöffnet. · M
- ◐ **[BCF]** BCF (`fileio/src/bcf.rs`). Offen: Kamera im nativen Metal-Fenster; Schnittebene aus dem Live-Schnitt übernehmen; Kamera-Roll; schräge Schnittebenen nur angezeigt; `extensions.xml`, Farbgruppen/Linien, BimSnippet, Dokument-Referenzen und verwandte Themen gehen beim Speichern verloren. · M
+28
View File
@@ -624,6 +624,32 @@ 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 }]
}
/// [B4] Pset `Dossier_Roof`: lesbares Gerüst (Form, Neigung, Firstrichtung, Traufhöhe absolut, Dicke, Umriss) und
/// `RoofParams` (JSON der übrigen Dach-Felder: Höfe, Bögen, Kantenneigungen, Überstände, Gauben, Attika …).
fn dossier_roof_pset(p: &Project, roof: &Roof) -> Pset {
let mut v = serde_json::to_value(roof).unwrap_or_default();
let shape = v["shape"].as_str().unwrap_or("flach").to_string();
let ridge = v["ridgeAxis"].as_str().unwrap_or("x").to_string();
if let Some(o) = v.as_object_mut() {
for k in ["id", "type", "floorId", "categoryCode", "ifcGlobalId", "locked", "outline", "shape", "pitchDeg", "ridgeAxis", "baseElevation", "thickness", "roofTypeId", "renovation", "designOption"] {
o.remove(k);
}
}
let outline = roof.outline.iter().map(|q| format!("{},{}", fmt_coord(q.x), fmt_coord(q.y))).collect::<Vec<_>>().join(";");
Pset {
name: "Dossier_Roof",
props: vec![
ident("RoofShape", &shape),
ident("RoofPitch", &fmt_coord(roof.pitch_deg)),
ident("RoofRidge", &ridge),
ident("RoofBase", &fmt_coord(p.roof_base_elevation(roof))),
ident("RoofThickness", &fmt_coord(roof.thickness)),
ident("RoofOutline", &outline),
ident("RoofParams", &v.to_string()),
],
}
}
/// 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")
@@ -1815,6 +1841,8 @@ pub fn ifc_export_data(src: &Project, opt: &IfcOptions) -> Result<Flat, String>
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());
// [B4] Dach-Parameter fürs Zurücklesen als Dach (Umriss, Form, Neigungen, Höfe, Gauben …); fremde IFC haben das nicht.
psets.push(dossier_roof_pset(&p, roof));
layer_renovation_props(&p, &mut psets, &roof.id);
let (roof_q, dormer_q) = roof_base_quantities(&p, roof);
psets.extend(qto("Qto_RoofBaseQuantities", roof_q));
+61 -2
View File
@@ -147,6 +147,8 @@ struct RoofData {
/// Neigung je Umrisskante (`None` = Giebel); gilt, wenn `custom` (Form dann Sattel bzw. Walm).
edge_pitch: Vec<Option<f64>>,
custom: bool,
/// [B4] Eigener Export (Pset `Dossier_Roof`): übrige Dach-Felder (Höfe, Bögen, Überstände, Gauben …) als JSON-Objekt.
params: Option<Map<String, Value>>,
}
struct StairData {
@@ -340,7 +342,8 @@ fn decode_elements(meta: &Value, data: &[f64]) -> Elements {
}
"roof" => {
if let Some(mut r) = rings(v, 3, 1.0) {
let shape = s_of(e.get("shape")).filter(|x| ["flach", "pult", "sattel", "walm"].contains(&x.as_str()));
let params = e.get("params").and_then(Value::as_str).and_then(|t| serde_json::from_str::<Value>(t).ok()).and_then(|v| if let Value::Object(m) = v { Some(m) } else { None });
let shape = s_of(e.get("shape")).filter(|x| ["flach", "pult", "sattel", "walm", "mansarde", "zelt"].contains(&x.as_str()));
let axis = s_of(e.get("ridgeAxis")).filter(|x| x == "x" || x == "y");
let outline = r.remove(0);
// Neigung je Kante: Zahl ≥ 0 (Traufe) oder null (Giebel), eine je Umrisskante.
@@ -348,7 +351,7 @@ fn decode_elements(meta: &Value, data: &[f64]) -> Elements {
let edge_pitch = edge_pitch.filter(|a| a.len() == outline.len()).unwrap_or_default();
let custom = e.get("custom").and_then(Value::as_bool).unwrap_or(false) && !edge_pitch.is_empty();
if let (Some(shape), Some(ridge_axis)) = (shape, axis) {
out.roofs.push(RoofData { info, outline, shape, ridge_axis, eave_z: v[0], pitch_deg: v[1], thickness: v[2], edge_pitch, custom });
out.roofs.push(RoofData { info, outline, shape, ridge_axis, eave_z: v[0], pitch_deg: v[1], thickness: v[2], edge_pitch, custom, params });
}
}
}
@@ -1016,6 +1019,42 @@ fn elements_ops(root: &Map<String, Value>, meta: &Value, products: &[IfcProduct]
v["shape"] = (if r.edge_pitch.iter().all(Option::is_some) { "walm" } else { "sattel" }).into();
v["edgePitchDeg"] = r.edge_pitch.iter().map(|p| p.map_or(Value::Null, |x| js_num(round(x, 1e-6)))).collect();
}
// [B4] Eigener Export: die übrigen Felder aus `Dossier_Roof` (Koordinaten wie der Umriss verschoben).
if let Some(m) = &r.params {
let sh = |q: &Value| -> Value {
match (q.get("x").and_then(Value::as_f64), q.get("y").and_then(Value::as_f64)) {
(Some(x), Some(y)) => mv([x, y]),
_ => q.clone(),
}
};
for (k, val) in m {
let mut val = val.clone();
match k.as_str() {
"holes" => {
if let Some(a) = val.as_array_mut() {
a.iter_mut().for_each(|ring| ring.as_array_mut().into_iter().flatten().for_each(|q| *q = sh(q)));
}
}
"dormers" => {
if let Some(a) = val.as_array_mut() {
for d in a {
if let Some(o) = d.as_object_mut() {
if let Some(pos) = o.get("position").map(sh) {
o.insert("position".into(), pos);
}
// Typen der Quelldatei gibt es hier nicht.
o.remove("wallTypeId");
o.remove("roofTypeId");
}
}
}
}
_ => {}
}
v[k] = val;
}
v["shape"] = r.shape.clone().into();
}
// Dachtyp nur mit Material aus der Datei; sonst einschichtig über `thickness`.
if r.info.layers.iter().any(|l| !l.material.trim().is_empty()) {
v["roofTypeId"] = type_for(&mut ctx, &mut roof_types, &r.info, r.thickness, "rooftype", "roofTypes").into();
@@ -1231,6 +1270,8 @@ fn rotate_elements(el: &mut Elements, cs: [f64; 2]) {
ring(&mut sp.boundary);
}
for r in &mut el.roofs {
// Ein gedrehtes Dach verträgt die Parameter des eigenen Exports (Kanten, Gauben …) nicht.
r.params = None;
ring(&mut r.outline);
if r.shape != "flach" && r.edge_pitch.len() == r.outline.len() {
r.custom = true;
@@ -1413,6 +1454,24 @@ mod tests {
assert_eq!(gid(added(&r.ops, "stairs")[0]), Some(ids[5].into()));
}
#[test]
fn own_roof_params_overlay_with_map_shift() {
let (mut m, data) = meta("Tür");
let params = json!({"overhang": 0.4, "overhangGable": 0.2, "holes": [[{"x": 1.0, "y": 1.0}, {"x": 2.0, "y": 1.0}, {"x": 2.0, "y": 2.0}]],
"dormers": [{"id": "g", "kind": "sattel", "position": {"x": 3.0, "y": 1.5}, "width": 2.0, "wallTypeId": "weg"}]});
let roof = m["elements"]["elements"].as_array_mut().unwrap().iter_mut().find(|e| e["kind"] == "roof").unwrap();
roof["shape"] = "mansarde".into();
roof["params"] = params.to_string().into();
let opts = IfcOptions { file_name: "a.ifc".into(), group: None, elements: true };
let r = ifc_import(&root(), &m.to_string(), &[], &[], &data, &opts, 0.0).unwrap();
let roofs = added(&r.ops, "roofs");
assert_eq!((roofs[0]["shape"].as_str(), roofs[0]["overhang"].as_f64(), roofs[0]["overhangGable"].as_f64()), (Some("mansarde"), Some(0.4), Some(0.2)));
// Verschiebung (100, 50) auch auf Höfe und Gaubenpositionen; Typ-Bezüge der Quelldatei entfallen.
assert!(at(&roofs[0]["holes"][0][0], 101.0, 51.0), "{}", roofs[0]["holes"]);
assert!(at(&roofs[0]["dormers"][0]["position"], 103.0, 51.5));
assert!(roofs[0]["dormers"][0].get("wallTypeId").is_none());
}
#[test]
fn roof_stair_arc_wall_round_opening_type_by_name_and_map_shift() {
let (m, data) = meta("Haustür Eiche");
+71 -3
View File
@@ -97,7 +97,7 @@ pub struct Info {
/// Eigenschaften der gemeinsamen Psets, die ins Modell übernommen werden; [158] dazu die Raum-Oberflächen
/// (`Pset_SpaceCoveringRequirements`, IFC2x3 `Pset_SpaceCommon`) und Nutzung/Bodenaufbau (`Dossier_RoomBook`).
const COMMON_PROPS: [&str; 17] = [
const COMMON_PROPS: [&str; 24] = [
"IsExternal",
"LoadBearing",
"FireRating",
@@ -116,11 +116,19 @@ const COMMON_PROPS: [&str; 17] = [
"Kind",
"Handrail",
"Height",
// `Dossier_Roof` ([B4]): Gerüst des Dachs und die übrigen Felder als JSON.
"RoofShape",
"RoofPitch",
"RoofRidge",
"RoofBase",
"RoofThickness",
"RoofOutline",
"RoofParams",
];
/// Psets, deren Eigenschaften aus [`COMMON_PROPS`] gelesen werden: `Pset_*Common` und die Raumbuch-Psets.
fn reads_common(name: &str) -> bool {
(name.starts_with("Pset_") && name.ends_with("Common")) || name == "Pset_SpaceCoveringRequirements" || name == "Dossier_RoomBook" || name == "Dossier_Railing"
(name.starts_with("Pset_") && name.ends_with("Common")) || name == "Pset_SpaceCoveringRequirements" || name == "Dossier_RoomBook" || name == "Dossier_Railing" || name == "Dossier_Roof"
}
#[derive(Clone, Debug, Default)]
@@ -255,6 +263,9 @@ pub struct Roof {
pub thickness: f64,
/// Bauteile, aus denen das Dach besteht (IfcRoof + Platten).
pub parts: Vec<u64>,
/// Eigener Export (Pset `Dossier_Roof`): JSON der übrigen Dach-Felder (Höfe, Bögen, Überstände, Gauben …);
/// Form, Neigung, Umriss, Traufhöhe und Dicke stehen dann schon in den Feldern oben.
pub params: Option<String>,
}
/// Treppe ([B4]) aus IfcStair/IfcStairFlight: gerade, L (Podest an der Ecke), Wendel, U (Halbpodest
@@ -1444,6 +1455,53 @@ fn is_spatial(f: &crate::ifc_step::StepFile, id: u64) -> bool {
f.get(id).is_some_and(|e| matches!(e.ty.as_str(), "IFCBUILDINGSTOREY" | "IFCBUILDING" | "IFCSITE" | "IFCSPACE"))
}
/// [B4] Dach des eigenen Exports aus dem Pset `Dossier_Roof` (Umriss, Form, Neigung, Firstrichtung, Traufhöhe, Dicke).
/// Nur wenn die Körper der Dachflächen den Umriss im Grundriss enthalten, sonst bleibt es ein Fall für `fit_roof`.
fn own_roof(cx: &mut Ctx, main: u64, parts: &[u64]) -> Option<Roof> {
let common = cx.common.get(&main)?.clone();
let num = |k: &str| common.get(k)?.trim().parse::<f64>().ok().filter(|v| v.is_finite());
let shape: &'static str = ["flach", "pult", "sattel", "walm", "mansarde", "zelt"].into_iter().find(|s| common.get("RoofShape").is_some_and(|c| c == s))?;
let ridge_axis: &'static str = ["x", "y"].into_iter().find(|s| common.get("RoofRidge").is_some_and(|c| c == s))?;
let outline: Vec<V2> = common
.get("RoofOutline")?
.split(';')
.map(|p| {
let (x, y) = p.split_once(',')?;
let q = [x.trim().parse::<f64>().ok()?, y.trim().parse::<f64>().ok()?];
(q[0].is_finite() && q[1].is_finite()).then_some(q)
})
.collect::<Option<_>>()?;
let (pitch_deg, eave_z, thickness) = (num("RoofPitch")?, num("RoofBase")?, num("RoofThickness")?);
if outline.len() < 3 || !(0.0..90.0).contains(&pitch_deg) || thickness <= 0.0 {
return None;
}
let b = bodies(cx, parts);
if b.len() != parts.len() {
return None;
}
let mut bb = [f64::INFINITY, f64::INFINITY, f64::NEG_INFINITY, f64::NEG_INFINITY];
for (_, m, _) in &b {
for c in m.positions.chunks_exact(3) {
bb = [bb[0].min(c[0]), bb[1].min(c[1]), bb[2].max(c[0]), bb[3].max(c[1])];
}
}
let tol = 0.05;
if !outline.iter().all(|p| p[0] >= bb[0] - tol && p[0] <= bb[2] + tol && p[1] >= bb[1] - tol && p[1] <= bb[3] + tol) {
return None;
}
let color = b.iter().find_map(|x| x.2);
let mut info = cx.info(main, color);
if info.storey.is_none() {
info.storey = parts.iter().find_map(|p| cx.info(*p, None).storey);
}
if info.layers.is_empty() {
let l = cx.info(parts[0], None);
info.layers = l.layers;
info.type_name = info.type_name.or(l.type_name);
}
Some(Roof { info, outline, edge_pitch: Vec::new(), custom: false, shape, pitch_deg, ridge_axis, eave_z, thickness, parts: parts.to_vec(), params: common.get("RoofParams").cloned() })
}
/// Dächer ([B4]): IfcRoof (eigener Körper, sonst seine Platten) und frei stehende IfcSlab ROOF (je
/// Geschoss die sich berührenden zusammen). Liefert für Platten, die kein Dach wurden, den Grund.
fn roofs(cx: &mut Ctx, out: &mut Semantic, ids: &[u64], children: &HashMap<u64, Vec<u64>>) -> HashMap<u64, &'static str> {
@@ -1507,6 +1565,15 @@ fn roofs(cx: &mut Ctx, out: &mut Semantic, ids: &[u64], children: &HashMap<u64,
let mut fail = HashMap::new();
for (main, parts, is_roof) in groups {
// [B4] Eigener Export: Dach aus `Dossier_Roof`, wenn die Dachkörper zum Umriss passen (sonst wie fremde IFC).
if is_roof {
if let Some(r) = own_roof(cx, main, &parts) {
out.converted.insert(main);
out.converted.extend(parts.iter().copied());
out.roofs.push(r);
continue;
}
}
let try_fit = |cx: &mut Ctx, group: &[u64]| -> Result<(crate::ifc_shapes::RoofFit, Option<[f64; 4]>), &'static str> {
let main = if is_roof { main } else { group[0] };
if group.iter().chain([&main]).any(|p| rels.voids.get(p).is_some_and(|v| !v.is_empty())) {
@@ -1582,6 +1649,7 @@ fn roofs(cx: &mut Ctx, out: &mut Semantic, ids: &[u64], children: &HashMap<u64,
eave_z: fit.eave_z,
thickness: fit.thickness,
parts: group.clone(),
params: None,
});
cx.roofs.push(fit);
}
@@ -2172,7 +2240,7 @@ pub(crate) fn encode(s: &Semantic) -> (serde_json::Value, Vec<f64>) {
for r in &s.roofs {
let mut nums = vec![r.eave_z, r.pitch_deg, r.thickness];
ring(&r.outline, &mut nums);
push("roof", &r.info, json!({ "shape": r.shape, "ridgeAxis": r.ridge_axis, "edgePitch": r.edge_pitch, "custom": r.custom }), nums, &mut data);
push("roof", &r.info, json!({ "shape": r.shape, "ridgeAxis": r.ridge_axis, "edgePitch": r.edge_pitch, "custom": r.custom, "params": r.params }), nums, &mut data);
}
for b in &s.beams {
let mut nums = vec![b.z0, b.z1];
+2 -2
View File
@@ -171,8 +171,8 @@ describe("anonyme Wettbewerbs-Abgabe in allen Ausgaben", () => {
expect(o[key], key).toContain("D:20000101000000");
}
for (const key of ["IFC4", "IFC2x3"]) {
// „Dossier_Qto_…" ist der Name eines Eigenschaftssatzes (Programm-Konvention), keine Angabe zur Herkunft.
expect(o[key].replace(/Dossier_Qto_/g, ""), key).not.toMatch(/dossier/i);
// „Dossier_Qto_…" und „Dossier_Roof" ([B4]) sind Namen von Eigenschaftssätzen (Programm-Konvention), keine Angabe zur Herkunft.
expect(o[key].replace(/Dossier_(Qto_|Roof)/g, ""), key).not.toMatch(/dossier/i);
expect(o[key], key).not.toContain(`${year}-`);
expect(o[key], key).toContain(`'${NEUTRAL_ISO}'`);
}
+3 -3
View File
@@ -40,13 +40,13 @@ describe("IFC-Import als Bauteile: Rundreise Demo-Haus", () => {
expect(summary).toMatchObject({ roofs: 1, stairs: 1, roofTypes: 0, doorTypes: 0, windowTypes: 0 });
expect(p.context ?? []).toEqual([]);
expect(validateProject(p)).toEqual([]);
// Satteldach: Umriss = Traufe samt Überstand (0.4), Überstand 0, Traufhöhe = OK OG (5.2), 30°, First x.
// Satteldach ([B4], Pset `Dossier_Roof`): Umriss und Überstand (0.4) wie im Modell, Traufhöhe = OK OG (5.2), 30°, First x.
const roof = p.roofs![0];
expect([roof.shape, roof.ridgeAxis, roof.overhang]).toEqual(["sattel", "x", 0]);
expect([roof.shape, roof.ridgeAxis, roof.overhang]).toEqual(["sattel", "x", 0.4]);
expect(roof.pitchDeg).toBeCloseTo(30, 4);
expect(roof.baseElevation!).toBeCloseTo(5.2, 6);
expect(roof.thickness).toBeCloseTo(0.2, 6);
for (const q of [{ x: -0.4, y: -0.4 }, { x: 5.4, y: 4.4 }]) expect(roof.outline.some((g) => near(g, q, 1e-6)), JSON.stringify(roof.outline)).toBe(true);
for (const q of [{ x: 0, y: 0 }, { x: 5, y: 4 }]) expect(roof.outline.some((g) => near(g, q, 1e-6)), JSON.stringify(roof.outline)).toBe(true);
// Gerade Treppe: gleicher Antritt, Richtung, Breite, Stufen, Steighöhe und Lauflänge.
const st0 = sampleProject.stairs![0];
const st = p.stairs![0];
+32
View File
@@ -45,6 +45,38 @@ describe("[B4] IFC-Rundreise: Träger, Geländer, Rampen, Dächer", () => {
expect(new Set(gids).size, "kein Bauteil doppelt als Netz").toBe(gids.length);
});
it(":komplex: alle Dächer kommen als Dach zurück (Form, Neigung, Umriss, Gauben)", async () => {
const src = buildComplexSampleProject();
const { spf, p, summary } = await roundtrip(src);
expect(src.roofs!.length).toBe(4);
expect((spf.match(/IFCPROPERTYSET\([^;]*Dossier_Roof/g) ?? []).length).toBe(src.roofs!.length);
expect(p.roofs?.length).toBe(src.roofs!.length);
expect(summary.roofs).toBe(src.roofs!.length);
for (const r of src.roofs!) {
const got = p.roofs!.find((g) => g.shape === r.shape && g.ridgeAxis === r.ridgeAxis && g.outline.length === r.outline.length && g.outline.every((q, i) => near(q.x, r.outline[i].x) && near(q.y, r.outline[i].y)))!;
expect(got, r.id).toBeDefined();
expect(near(got.pitchDeg, r.pitchDeg) && near(got.overhang, r.overhang) && near(got.thickness, r.thickness, 1e-4), JSON.stringify(got)).toBe(true);
expect(got.overhangGable ?? null).toEqual(r.overhangGable ?? null);
expect(got.outlineBulge ?? null).toEqual(r.outlineBulge ?? null);
expect(got.parapetHeight ?? null).toEqual(r.parapetHeight ?? null);
expect((got.dormers ?? []).map((d) => [d.kind, d.width])).toEqual((r.dormers ?? []).map((d) => [d.kind, d.width]));
expect((got.dormers ?? []).every((d, i) => near(d.position.x, r.dormers![i].position.x) && near(d.position.y, r.dormers![i].position.y))).toBe(true);
expect(near(got.baseElevation ?? 0, r.baseElevation ?? got.baseElevation ?? 0, 1e-4), `${r.id} ${got.baseElevation} ${r.baseElevation}`).toBe(true);
}
});
it(":wettbewerb: Dach kommt als Dach zurück", async () => {
const src = buildWettbewerbSampleProject();
const { p } = await roundtrip(src);
expect(src.roofs!.length).toBeGreaterThan(0);
expect(p.roofs?.length).toBe(src.roofs!.length);
for (const r of src.roofs!) {
const got = p.roofs!.find((g) => g.shape === r.shape && g.outline.length === r.outline.length && near(g.pitchDeg, r.pitchDeg))!;
expect(got, r.id).toBeDefined();
expect(near(got.thickness, r.thickness, 1e-4)).toBe(true);
}
});
it(":wettbewerb: Geländer und Rampe kommen als Bauteile zurück", async () => {
const src = buildWettbewerbSampleProject();
const { spf, p, summary } = await roundtrip(src);