From 4c70a243a53257a6dfe4edbb53921a970a75ec6b Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 29 Oct 2026 21:40:44 +0000 Subject: [PATCH] =?UTF-8?q?[98]=20IFC:=20IsExternal/LoadBearing=20f=C3=BCr?= =?UTF-8?q?=20Wand=20und=20Decke,=20Brand-/Schallschutz,=20U-Wert,=20Einbr?= =?UTF-8?q?uchhemmung=20f=C3=BCr=20T=C3=BCr=20und=20Fenster=20im=20Pset=5F?= =?UTF-8?q?*Common;=20Import=20liest=20sie=20zur=C3=BCck?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TODO.md | 11 +++++- src-tauri/core/src/ifc_data.rs | 56 +++++++++++++++++++++++++-- src-tauri/core/src/import_ifc.rs | 41 ++++++++++++++++++++ src-tauri/fileio/src/ifc_export.rs | 9 ++++- src-tauri/fileio/src/ifc_semantic.rs | 43 +++++++++++++++++++- src/export/exportIfc.test.ts | 37 +++++++++++++++++- src/export/exportIfc.validate.test.ts | 13 +++++++ src/io/ifcImport.elements.test.ts | 23 +++++++++++ 8 files changed, 224 insertions(+), 9 deletions(-) diff --git a/TODO.md b/TODO.md index 9d81f7fe..d4352f5d 100644 --- a/TODO.md +++ b/TODO.md @@ -1562,8 +1562,15 @@ Ganzes nicht WASM-tauglich (rayon, tempfile, SystemTime) — nur einzelne Module unabhängig von anderen Bauteilen, projektübergreifend verschieden. GUIDs ändern sich einmalig gegenüber Exporten vor dem 28.10. - ✅ Georeferenz [69]. - - ○ Offen: IsExternal/LoadBearing/ThermalTransmittance für Wand/Decke/Tür/Fenster brauchen - Modellfelder (z. B. am Wandtyp tragend/aussen, λ je Bauteil → U-Wert). · S–M + - ✅ **[98] IsExternal/LoadBearing/Brand-/Schallschutz/U-Wert im Pset.** (29.10.) Wand/Decke: + `Pset_WallCommon`/`Pset_SlabCommon` mit IsExternal und LoadBearing, nur wenn im Modell gesetzt + (`Wall`/`Ceiling` `isExternal`/`loadBearing`). Tür/Fenster: `Pset_DoorCommon`/`Pset_WindowCommon` mit + Reference (Nummer, sonst Typname), IsExternal (eigene Angabe > Wand > Raumlage wie die Liste [97]), + FireRating, AcousticRating, ThermalTransmittance (`IfcThermalTransmittanceMeasure`), SecurityRating. + Import liest dieselben Werte aus `Pset_*Common` zurück (Rundreise-Test; nur bekannte Eigenschaften). + Mit ifcopenshell geprüft (`exportIfc.validate.test.ts`: gültig). Offen: U-Wert der Wand aus den + Schichten (λ je Bauteil, [71]); Wand/Decke-Felder ohne UI; Reference-Rückimport (Nummer) fehlt; + IFC2x3 nicht gesondert geprüft. · S - ✅ IfcMaterialLayerSetUsage + Achs-Darstellung an Extrusions-Wänden. (28.10.) Wand-Placement am Wandanfang, X = Achse, Y = linke Normale (Rust rechnet die Welt-Profile und die Öffnungen ins Wandsystem); „Axis“-Darstellung (IfcPolyline, Unterkontext GRAPH_VIEW) + Usage (AXIS2, POSITIVE, diff --git a/src-tauri/core/src/ifc_data.rs b/src-tauri/core/src/ifc_data.rs index f82e2ad3..32a18771 100644 --- a/src-tauri/core/src/ifc_data.rs +++ b/src-tauri/core/src/ifc_data.rs @@ -68,11 +68,16 @@ pub struct IfcOptions { // ── Puffer-Bausteine (Reihenfolge der Aufrufe = Reihenfolge der Zeichenketten) ───────────────── -/// Pset-Eigenschaft (0 IfcIdentifier, 1 IfcBoolean, 2 IfcPositiveRatioMeasure, 3–5 Mengen). +/// Pset-Eigenschaft (0 IfcIdentifier, 1 IfcBoolean, 2 IfcPositiveRatioMeasure, 3–5 Mengen, 6 IfcLabel, +/// 7 IfcThermalTransmittanceMeasure). enum Prop { Ident(&'static str, String), Bool(&'static str, bool), Ratio(&'static str, f64), + /// IfcLabel (Freitext wie Feuerwiderstand). + Label(&'static str, String), + /// IfcThermalTransmittanceMeasure, W/(m²K). + Thermal(&'static str, f64), Qty(&'static str, QtyKind, f64), } @@ -96,6 +101,14 @@ fn type_ref<'a>(t: &'a TypeData, kind: f64, predefined: &'a str) -> TypeRef<'a> TypeRef { kind, id: &t.0, name: &t.1, predefined, layers: t.2.iter().map(|(a, b, c)| (a.as_str(), b.as_str(), *c)).collect() } } +/// `IsExternal`/`LoadBearing` für Wand und Decke, nur mit Angabe im Modell. +fn structure_props(external: Option, load_bearing: Option) -> Vec { + let mut v = Vec::new(); + v.extend(external.map(|e| Prop::Bool("IsExternal", e))); + v.extend(load_bearing.map(|b| Prop::Bool("LoadBearing", b))); + v +} + fn ident(name: &'static str, v: &str) -> Prop { Prop::Ident(name, v.to_string()) } @@ -156,6 +169,14 @@ fn w_psets(f: &mut Flat, list: &[Pset]) { let a = f.str(name); f.nums(&[a, 2.0, *v]); } + Prop::Label(name, v) => { + let (a, b) = (f.str(name), f.str(v)); + f.nums(&[a, 6.0, b]); + } + Prop::Thermal(name, v) => { + let a = f.str(name); + f.nums(&[a, 7.0, *v]); + } Prop::Qty(name, kind, v) => { let a = f.str(name); let code = match kind { @@ -544,14 +565,23 @@ pub fn ifc_export_data(src: &Project, opt: &IfcOptions) -> Result let openings: Vec = p.openings.clone().unwrap_or_default(); let wall_ident = |p: &Project, wall: &Wall, quantities: Vec| -> (String, Option, Vec) { let q = qto("Qto_WallBaseQuantities", quantities); + // Aussen/tragend nur mit Angabe im Modell (nichts erfunden). + let mut props: Vec = Vec::new(); match p.wall_type(wall) { Some(wt) => { let layers = wt.layers.iter().map(|l| (l.component_id.clone(), component_name(p, &l.component_id), l.thickness)).collect(); - let mut ps = vec![Pset { name: "Pset_WallCommon", props: vec![ident("Reference", &wt.name)] }]; + props.push(ident("Reference", &wt.name)); + props.extend(structure_props(wall.is_external, wall.load_bearing)); + let mut ps = vec![Pset { name: "Pset_WallCommon", props }]; ps.extend(q); (wt.name.clone(), Some((wt.id.clone(), wt.name.clone(), layers)), ps) } - None => (wall.id.clone(), None, q), + None => { + props.extend(structure_props(wall.is_external, wall.load_bearing)); + let mut ps = if props.is_empty() { Vec::new() } else { vec![Pset { name: "Pset_WallCommon", props }] }; + ps.extend(q); + (wall.id.clone(), None, ps) + } } }; let cutouts_of = |p: &Project, wall: &Wall| -> Vec<(usize, Cutout)> { @@ -669,10 +699,15 @@ pub fn ifc_export_data(src: &Project, opt: &IfcOptions) -> Result let mut name = c.id.clone(); let mut ty: Option = None; let mut psets: Vec = Vec::new(); + let mut slab_props: Vec = Vec::new(); if let Some((id, tname, layers)) = model3d::ceiling_type_ref(&p, c) { name = tname.to_string(); ty = Some((id.to_string(), tname.to_string(), layers.iter().map(|l| (l.component_id.clone(), component_name(&p, &l.component_id), l.thickness)).collect())); - psets.push(Pset { name: "Pset_SlabCommon", props: vec![ident("Reference", tname)] }); + slab_props.push(ident("Reference", tname)); + } + slab_props.extend(structure_props(c.is_external, c.load_bearing)); + if !slab_props.is_empty() { + psets.push(Pset { name: "Pset_SlabCommon", props: slab_props }); } // Aussparungen (wie im 3D) als innere Ringe des Profils; Netto zieht sie ab. let inner: Vec<&[Vec2]> = c.openings.as_deref().unwrap_or(&[]).iter().filter(|r| r.len() >= 3).map(|r| r.as_slice()).collect(); @@ -718,6 +753,19 @@ pub fn ifc_export_data(src: &Project, opt: &IfcOptions) -> Result } "Pset_WindowCommon" }; + // Nummer ersetzt den Typnamen als Reference; Kennwerte nur mit Angabe im Modell. + if let Some(mark) = o.mark.as_deref().map(str::trim).filter(|m| !m.is_empty()) { + props.retain(|x| !matches!(x, Prop::Ident("Reference", _))); + props.insert(0, ident("Reference", mark)); + } + if let Some(e) = crate::opening_schedule::opening_external(&p, o) { + props.push(Prop::Bool("IsExternal", e)); + } + let label = |name: &'static str, v: &Option| v.as_deref().map(str::trim).filter(|x| !x.is_empty()).map(|x| Prop::Label(name, x.to_string())); + props.extend(label("FireRating", &o.fire_rating)); + props.extend(label("AcousticRating", &o.sound_class)); + props.extend(o.u_value.filter(|u| *u > 0.0).map(|u| Prop::Thermal("ThermalTransmittance", u))); + props.extend(label("SecurityRating", &o.burglary_class)); let mut psets = vec![Pset { name: pset_name, props }]; psets.extend(qto(if is_door { "Qto_DoorBaseQuantities" } else { "Qto_WindowBaseQuantities" }, qty::opening_quantities(c.to - c.from, depth))); let label = crate::plan::walls::opening_label(o); diff --git a/src-tauri/core/src/import_ifc.rs b/src-tauri/core/src/import_ifc.rs index 48332052..d66f3925 100644 --- a/src-tauri/core/src/import_ifc.rs +++ b/src-tauri/core/src/import_ifc.rs @@ -45,6 +45,21 @@ struct Info { type_name: Option, layers: Vec, classified: bool, + /// Eigenschaften aus `Pset_*Common` (Text). + common: Map, +} + +impl Info { + fn flag(&self, key: &str) -> Option { + match self.common.get(key).and_then(Value::as_str) { + Some("true") => Some(true), + Some("false") => Some(false), + _ => None, + } + } + fn text(&self, key: &str) -> Option { + self.common.get(key).and_then(Value::as_str).map(str::trim).filter(|s| !s.is_empty()).map(str::to_string) + } } struct WallData { @@ -137,6 +152,7 @@ fn info_of(e: &Value) -> Info { type_name: s_of(e.get("typeName")), layers, classified: e.get("classifications").and_then(Value::as_array).is_some_and(|a| !a.is_empty()), + common: e.get("common").and_then(Value::as_object).cloned().unwrap_or_default(), } } @@ -515,6 +531,12 @@ fn elements_ops(root: &Map, products: &[IfcProduct], el: &Element if bottom.abs() > LEVEL_TOL { o["bottom"] = json!({"mode": "floor", "floorId": fid, "offset": js_num(bottom)}); } + if let Some(b) = w.info.flag("IsExternal") { + o["isExternal"] = b.into(); + } + if let Some(b) = w.info.flag("LoadBearing") { + o["loadBearing"] = b.into(); + } walls.push(o); } let door_types = root.get("doorTypes").and_then(Value::as_array).cloned().unwrap_or_default(); @@ -575,6 +597,19 @@ fn elements_ops(root: &Map, products: &[IfcProduct], el: &Element v.insert("wingCount".into(), js_num(w)); } } + if o.kind != "hole" { + if let Some(b) = o.info.flag("IsExternal") { + v.insert("isExternal".into(), b.into()); + } + for (key, field) in [("FireRating", "fireRating"), ("AcousticRating", "soundClass"), ("SecurityRating", "burglaryClass")] { + if let Some(t) = o.info.text(key) { + v.insert(field.into(), t.into()); + } + } + if let Some(u) = o.info.common.get("ThermalTransmittance").and_then(Value::as_str).and_then(|t| t.parse::().ok()).filter(|u| *u > 0.0) { + v.insert("uValue".into(), js_num(u)); + } + } openings.push(Value::Object(v)); } @@ -598,6 +633,12 @@ fn elements_ops(root: &Map, products: &[IfcProduct], el: &Element v.insert("wallTypeId".into(), wt.into()); let ct = type_for(&mut ctx, &mut ceiling_types, &s.info, t, "ceilingtype", "ceilingTypes"); v.insert("ceilingTypeId".into(), ct.into()); + if let Some(b) = s.info.flag("IsExternal") { + v.insert("isExternal".into(), b.into()); + } + if let Some(b) = s.info.flag("LoadBearing") { + v.insert("loadBearing".into(), b.into()); + } if (s.z1 - floor_top).abs() > LEVEL_TOL { v.insert("top".into(), json!({"mode": "floor", "floorId": fid, "offset": js_num(anchor_offset(s.z1, base))})); } diff --git a/src-tauri/fileio/src/ifc_export.rs b/src-tauri/fileio/src/ifc_export.rs index cb653c4f..be1dea36 100644 --- a/src-tauri/fileio/src/ifc_export.rs +++ b/src-tauri/fileio/src/ifc_export.rs @@ -18,7 +18,8 @@ // n_layers, (component_id, component_name, thickness) × n_layers // PSETS = n, (name, n_props, (prop_name, kind, value) × n_props) × n // kind 0 = IfcIdentifier (value = Zeichenketten-Index), 1 = IfcBoolean (0/1), -// 2 = IfcPositiveRatioMeasure (value = Zahl), +// 2 = IfcPositiveRatioMeasure (value = Zahl), 6 = IfcLabel (Zeichenketten-Index), +// 7 = IfcThermalTransmittanceMeasure (Zahl), // 3 = IfcQuantityLength, 4 = IfcQuantityArea, 5 = IfcQuantityVolume (value = Zahl, ≥ 0). // Heisst der Satz `Qto_…`, entsteht je Bauteil ein eigener IfcElementQuantity (Basismengen, // nie geteilt); sonst ein IfcPropertySet (gleicher Inhalt = ein Pset für alle Bauteile). @@ -592,6 +593,8 @@ impl<'a> Reader<'a> { 0 => PropVal::Ident(self.string()?), 1 => PropVal::Bool(self.flag()?), 2 => PropVal::Ratio(self.f()?), + 6 => PropVal::Label(self.string()?), + 7 => PropVal::Thermal(self.f()?), 3 => PropVal::Length(self.f()?), 4 => PropVal::Area(self.f()?), 5 => PropVal::Volume(self.f()?), @@ -722,6 +725,8 @@ enum PropVal { Ident(String), Bool(bool), Ratio(f64), + Label(String), + Thermal(f64), /// Basismengen (`Qto_…`): Länge, Fläche, Volumen. Length(f64), Area(f64), @@ -735,6 +740,8 @@ impl PropVal { PropVal::Ident(s) => format!("IFCIDENTIFIER({})", ifc_string(s)), PropVal::Bool(b) => format!("IFCBOOLEAN({})", if *b { ".T." } else { ".F." }), PropVal::Ratio(r) => format!("IFCPOSITIVERATIOMEASURE({})", fmt_real(*r)), + PropVal::Label(s) => format!("IFCLABEL({})", ifc_string(s)), + PropVal::Thermal(u) => format!("IFCTHERMALTRANSMITTANCEMEASURE({})", fmt_real(*u)), PropVal::Length(_) | PropVal::Area(_) | PropVal::Volume(_) => String::new(), } } diff --git a/src-tauri/fileio/src/ifc_semantic.rs b/src-tauri/fileio/src/ifc_semantic.rs index 55988b23..cd8cb427 100644 --- a/src-tauri/fileio/src/ifc_semantic.rs +++ b/src-tauri/fileio/src/ifc_semantic.rs @@ -77,8 +77,14 @@ pub struct Info { pub layers: Vec, /// Klassifikationen (eBKP-H, BKP ...) des Bauteils, sonst seines Typs. pub classifications: Vec, + /// Eigenschaften aus `Pset_*Common` (IsExternal, LoadBearing, FireRating, AcousticRating, + /// ThermalTransmittance, SecurityRating, Reference) als Text; Wahrheitswerte "true"/"false". + pub common: BTreeMap, } +/// Eigenschaften der gemeinsamen Psets, die ins Modell übernommen werden. +const COMMON_PROPS: [&str; 7] = ["IsExternal", "LoadBearing", "FireRating", "AcousticRating", "ThermalTransmittance", "SecurityRating", "Reference"]; + #[derive(Clone, Debug, Default)] pub struct Wall { pub info: Info, @@ -498,6 +504,7 @@ struct Ctx<'r, 'a> { type_of: HashMap, fills: HashMap>, sia: HashMap, + common: HashMap>, storey_index: HashMap, } @@ -570,6 +577,7 @@ impl Ctx<'_, '_> { own } }, + common: self.common.get(&id).cloned().unwrap_or_default(), } } @@ -903,6 +911,7 @@ pub(crate) fn analyze(r: &mut Reader, rels: &Rels, ids: &[u64]) -> Semantic { let mut type_of = HashMap::new(); let mut fills: HashMap> = HashMap::new(); let mut sia = HashMap::new(); + let mut common: HashMap> = HashMap::new(); let mut storeys = Vec::new(); for &id in ids { let Some(e) = f.get(id) else { continue }; @@ -924,8 +933,28 @@ pub(crate) fn analyze(r: &mut Reader, rels: &Rels, ids: &[u64]) -> Semantic { if ps.ty != "IFCPROPERTYSET" { continue; } + let is_common = ps.arg(2).and_then(|v| v.as_str()).is_some_and(|n| n.starts_with("Pset_") && n.ends_with("Common")); for p in refs(ps.arg(4)) { let Some(pe) = f.get(p) else { continue }; + if is_common && pe.ty == "IFCPROPERTYSINGLEVALUE" { + let name = pe.arg(0).and_then(|v| v.as_str()).unwrap_or(""); + let inner = match pe.arg(2) { + Some(Value::Typed(_, a)) if a.len() == 1 => Some(&a[0]), + other => other, + }; + let text = match inner { + Some(Value::Enum(e)) if e == "T" => Some("true".to_string()), + Some(Value::Enum(e)) if e == "F" => Some("false".to_string()), + Some(v) => v.as_str().map(str::to_string).or_else(|| v.as_f64().map(|x| x.to_string())), + None => None, + }; + if let (true, Some(text)) = (COMMON_PROPS.contains(&name), text) { + for o in refs(e.arg(4)) { + common.entry(o).or_default().entry(name.to_string()).or_insert_with(|| text.clone()); + } + } + continue; + } if pe.ty != "IFCPROPERTYSINGLEVALUE" || pe.arg(0).and_then(|v| v.as_str()) != Some("SIA416") { continue; } @@ -960,7 +989,7 @@ pub(crate) fn analyze(r: &mut Reader, rels: &Rels, ids: &[u64]) -> Semantic { } storeys.sort_by(|a, b| a.elevation.total_cmp(&b.elevation)); let storey_index = storeys.iter().enumerate().map(|(i, s)| (s.id, i)).collect(); - let mut cx = Ctx { r, rels, type_of, fills, sia, storey_index }; + let mut cx = Ctx { r, rels, type_of, fills, sia, common, storey_index }; let mut out = Semantic { storeys, ..Default::default() }; let spatial = |id: u64| f.get(id).is_some_and(|e| matches!(e.ty.as_str(), "IFCBUILDINGSTOREY" | "IFCBUILDING" | "IFCSITE" | "IFCSPACE")); @@ -1085,6 +1114,7 @@ pub(crate) fn encode(s: &Semantic) -> (serde_json::Value, Vec) { "typeName": i.type_name, "layers": i.layers.iter().map(|l| json!({ "material": l.material, "thickness": l.thickness, "color": l.color })).collect::>(), "classifications": crate::ifc_import::classifications_json(&i.classifications), + "common": i.common, }) }; let mut push = |kind: &str, i: &Info, extra: serde_json::Value, nums: Vec, data: &mut Vec| { @@ -1473,6 +1503,17 @@ ENDSEC;\nEND-ISO-10303-21;\n" assert_eq!(s.spaces[0].sia.as_deref(), Some("FF")); } + #[test] + fn common_pset_properties_are_read() { + let psets = "#620=IFCPROPERTYSINGLEVALUE('IsExternal',$,IFCBOOLEAN(.T.),$);#621=IFCPROPERTYSINGLEVALUE('FireRating',$,IFCLABEL('EI30'),$);\ +#622=IFCPROPERTYSINGLEVALUE('ThermalTransmittance',$,IFCTHERMALTRANSMITTANCEMEASURE(1.3),$);#623=IFCPROPERTYSINGLEVALUE('Fremd',$,IFCLABEL('x'),$);\ +#624=IFCPROPERTYSET('cp',$,'Pset_DoorCommon',$,(#620,#621,#622,#623));#625=IFCRELDEFINESBYPROPERTIES('cr',$,$,$,(#500),#624);"; + let (_, s) = sem(&space_file(psets)); + let c = &s.spaces[0].info.common; + assert_eq!((c.get("IsExternal").map(String::as_str), c.get("FireRating").map(String::as_str), c.get("ThermalTransmittance").map(String::as_str)), (Some("true"), Some("EI30"), Some("1.3"))); + assert!(!c.contains_key("Fremd"), "nur bekannte Eigenschaften"); + } + #[test] fn classification_references_of_element_type_and_mesh() { // Stütze (Bauteil) mit eBKP-H, Raum mit Klassifikation über verschachtelte Referenz, BKP am Typ, diff --git a/src/export/exportIfc.test.ts b/src/export/exportIfc.test.ts index 5a1ae6c4..fdae565f 100644 --- a/src/export/exportIfc.test.ts +++ b/src/export/exportIfc.test.ts @@ -685,12 +685,47 @@ describe("[B5] Pset_*Common mit den Werten aus dem Modell", () => { expect(psetOf(spf, line(spf, "IFCDOOR"), "Pset_DoorCommon")).toEqual({ Reference: "IFCIDENTIFIER('Glast\\X2\\00FC\\X0\\r')", GlazingAreaFraction: "IFCPOSITIVERATIOMEASURE(0.6)", + IsExternal: "IFCBOOLEAN(.T.)", }); - expect(psetOf(spf, line(spf, "IFCWINDOW"), "Pset_WindowCommon")).toEqual({ Reference: "IFCIDENTIFIER('Holz-Metall IV')" }); + expect(psetOf(spf, line(spf, "IFCWINDOW"), "Pset_WindowCommon")).toMatchObject({ Reference: "IFCIDENTIFIER('Holz-Metall IV')" }); // Ohne Typ kein leeres Pset. const plain = exportIfcSpf(fixtureProject()); expect(psetOf(plain, line(plain, "IFCDOOR"), "Pset_DoorCommon")).toBeNull(); }); + it("[98] Tür/Fenster: Brand-, Schallschutz, U-Wert, Einbruchhemmung, Nummer und aussen/innen aus dem Modell", () => { + const base = project(); + const spf = exportIfcSpf({ + ...base, + openings: [ + { ...base.openings![0], mark: "T1.01", fireRating: "EI30", soundClass: "Rw 32 dB", uValue: 1.3, burglaryClass: "RC2", isExternal: false }, + { ...base.openings![1], uValue: 0.9, isExternal: true }, + ], + }); + expect(psetOf(spf, line(spf, "IFCDOOR"), "Pset_DoorCommon")).toEqual({ + Reference: "IFCIDENTIFIER('T1.01')", + GlazingAreaFraction: "IFCPOSITIVERATIOMEASURE(0.6)", + IsExternal: "IFCBOOLEAN(.F.)", + FireRating: "IFCLABEL('EI30')", + AcousticRating: "IFCLABEL('Rw 32 dB')", + ThermalTransmittance: "IFCTHERMALTRANSMITTANCEMEASURE(1.3)", + SecurityRating: "IFCLABEL('RC2')", + }); + expect(psetOf(spf, line(spf, "IFCWINDOW"), "Pset_WindowCommon")).toEqual({ + Reference: "IFCIDENTIFIER('Holz-Metall IV')", + IsExternal: "IFCBOOLEAN(.T.)", + ThermalTransmittance: "IFCTHERMALTRANSMITTANCEMEASURE(0.9)", + }); + }); + it("[98] Wand/Decke: IsExternal und LoadBearing nur mit Angabe im Modell", () => { + const base = project(); + const spf = exportIfcSpf({ + ...base, + walls: base.walls.map((w, i) => (i === 0 ? { ...w, isExternal: true, loadBearing: true } : w)), + ceilings: base.ceilings!.map((c) => ({ ...c, isExternal: false, loadBearing: true })), + }); + expect(psetOf(spf, line(spf, "IFCWALL"), "Pset_WallCommon")).toEqual({ Reference: "IFCIDENTIFIER('Aussenwand')", IsExternal: "IFCBOOLEAN(.T.)", LoadBearing: "IFCBOOLEAN(.T.)" }); + expect(psetOf(spf, line(spf, "IFCSLAB"), "Pset_SlabCommon")).toEqual({ Reference: "IFCIDENTIFIER('Betondecke')", IsExternal: "IFCBOOLEAN(.F.)", LoadBearing: "IFCBOOLEAN(.T.)" }); + }); it("Raum: Reference = Raumnummer, IsExternal aus SIA 416 (AGF = Aussengeschossfläche)", () => { const spf = exportIfcSpf(project()); const kueche = line(spf, "IFCSPACE", "'K\\X2\\00FC\\X0\\che'"); diff --git a/src/export/exportIfc.validate.test.ts b/src/export/exportIfc.validate.test.ts index f5331604..137f8f38 100644 --- a/src/export/exportIfc.validate.test.ts +++ b/src/export/exportIfc.validate.test.ts @@ -163,6 +163,19 @@ describe.skipIf(!hasIfcOpenShell)("IFC-Export gegen ifcopenshell", { timeout: 60 expect(r.out).toContain("0 Befunde"); expect(r.status).toBe(0); }); + it("[98] Pset_Door/Window/Wall/SlabCommon mit Kennwerten: gültig", () => { + const p: Project = { + ...sampleProject, + walls: sampleProject.walls.map((w, i) => (i === 0 ? { ...w, isExternal: true, loadBearing: true } : w)), + ceilings: (sampleProject.ceilings ?? []).map((c) => ({ ...c, isExternal: false, loadBearing: true })), + openings: (sampleProject.openings ?? []).map((o) => ({ ...o, mark: "X1", fireRating: "EI30", soundClass: "Rw 32 dB", burglaryClass: "RC2", uValue: 1.3, isExternal: true })), + }; + const ifc = exportIfcSpf(p); + expect(ifc).toContain("IFCTHERMALTRANSMITTANCEMEASURE(1.3)"); + const r = validate("psets-kennwerte", ifc); + expect(r.out).toContain("0 Befunde"); + expect(r.status).toBe(0); + }); it("Umlaute in Namen", () => { const p = { ...sampleProject, name: "Wohnüberbauung «Süd»", rooms: (sampleProject.rooms ?? []).map((r) => ({ ...r, name: "Küche/Essen" })) }; const r = validate("umlaute", exportIfcSpf(p)); diff --git a/src/io/ifcImport.elements.test.ts b/src/io/ifcImport.elements.test.ts index 4167ef15..3136a9e9 100644 --- a/src/io/ifcImport.elements.test.ts +++ b/src/io/ifcImport.elements.test.ts @@ -79,6 +79,29 @@ describe("IFC-Import als Bauteile: Rundreise Demo-Haus", () => { expect(text).toContain('"walls":9'); }); + it("[98] Pset_*Common: Brand-/Schallschutz, U-Wert, Einbruchhemmung, aussen, tragend (Rundreise)", async () => { + const door = sampleProject.openings!.find((o) => o.kind === "door")!; + const win = sampleProject.openings!.find((o) => o.kind === "window")!; + const wall0 = sampleProject.walls[0]!; + const src: Project = { + ...sampleProject, + walls: sampleProject.walls.map((w) => (w.id === wall0.id ? { ...w, isExternal: true, loadBearing: true } : w)), + openings: (sampleProject.openings ?? []).map((o) => + o.id === door.id + ? { ...o, fireRating: "EI30", soundClass: "Rw 32 dB", burglaryClass: "RC2", uValue: 1.3, isExternal: false } + : o.id === win.id + ? { ...o, uValue: 0.9, isExternal: true } + : o, + ), + }; + const { project: p } = await importInto(emptyProject, src); + const d = (p.openings ?? []).find((o) => o.kind === "door")!; + expect(d).toMatchObject({ fireRating: "EI30", soundClass: "Rw 32 dB", burglaryClass: "RC2", uValue: 1.3, isExternal: false }); + const w = (p.openings ?? []).find((o) => o.kind === "window" && Math.abs(o.width - win.width) < 1e-6)!; + expect(w).toMatchObject({ uValue: 0.9, isExternal: true }); + expect(p.walls.filter((x) => x.isExternal === true && x.loadBearing === true).length).toBe(1); + }); + it("Tür-Anschlag/Aufschlag und Fensterteilung aus OperationType/PartitioningType (Rundreise)", async () => { // Lage im Raum vergleichen (die Wand kann umgekehrt ankommen): Scharnierpunkt und Aufschlagrichtung. const physical = (o: Opening, w: Wall) => {