diff --git a/TODO.md b/TODO.md index d88b84a3..31e2193a 100644 --- a/TODO.md +++ b/TODO.md @@ -72,7 +72,7 @@ Kennwort, anonym) als PDF; Austausch mit Fachplanern über DXF/IFC. - ◐ **[263]** Visuelle und UX-Prüfung des Referenz-Ablaufs (15.11., Chromium/Linux, `e2e/uxReview263.spec.ts`; Befunde 1–3, 5–10 und Statusleiste behoben). Offen: Punkt 4 Sprachumschalter ist mit [264] erledigt, aber Projektvorgaben (Namen wie „Leeres Projekt“, „Erdgeschoss“, „Süd“, „Schnitt A“, Ebenen „20 Wände“) erscheinen in englischer Oberfläche deutsch (Vorgabenamen beim Anlegen über `t()`) · M; nicht geprüft: Tauri/Mac (Nebenfenster, native Menüs, Metal; Hilfe-Einträge „Kurzanleitung“/„Fehler melden“ und System-Browser-Öffnung dort), Ansichtsleiste-Überlauf „⋯“, Dock-Einklappen und Statusleisten-Kürzung auf dem Mac, 3D-Ansicht und Zeichenfläche pixelgenau (SwiftShader), Layout-Inhalt im Druck, englisch/dunkel bei 1440, Tab-Reihenfolge/Screenreader ausserhalb der Dialoge ([249]); dunkles Thema: Plan bleibt als Papier hell (Absicht?). · S–M - ◐ **[261]** Version 1.0.0-beta.1 und Buildnummer `JJMMTT.N` (15.11.; Doku 18.11. auf Stand der Beta (Kurzanleitung, Release-Notes „Neu in der Beta“; Kurzanleitung-Zahlen wie „Höhe 9.50“ nach [285] nicht neu gegengelesen); `scripts/build-number.cjs`, `src/update/buildInfo.ts`). Offen: nicht in der Tauri-App/auf dem Mac geprüft (Prüfschritt 13.35); Projektdatei trägt kein Feld für schreibende App-Version/Build (Modellfeld in Rust + `KNOWN_KEYS` + Fassade); Zähler zählt Commits, nicht Builds (Abhilfe `DOSSIER_BUILD=261115.3`). · S - ◐ **[260]** Fenster/Türen im Grundriss symbolisch oder geschnitten (15.11.; `Opening.planMode`, `OpeningPlanMode`, `plan/walls.rs`, Feld „Im Grundriss“ in Objekteinstellungen und Typeditor). Offen: auf dem Mac nicht geprüft (Metal-Fläche, natives Objekteinstellungsfenster, PDF/DXF; `doc/RELEASE-1.0.md` 13.29). · M -- ◐ **[253]** Standard-Objektbibliothek 2D (14.11.): 48 parametrische Objekte (`Drawing2DGeom::Libobj`, Kern `furniture_lib.rs`, Palette „Objekte“, Befehl `libobj`, DXF als Blöcke). Offen: auf dem Mac nicht geprüft (Ziehen aus der Palette mit dem nativen Metal-Renderer, `doc/RELEASE-1.0.md` 13.17; Symbole nur im CLI-SVG/Chromium angesehen); 3D-Entourage 18.11. ([253] 3D: `furniture_3d.rs`, Person stehend/gehend, Velo, Auto, Sitzbank, Stuhl, Tische mit Stühlen als Low-Poly-Netz im 3D, 3D-Dokument, Cycles, Schatten; Parameter `h`; Beispiel `:wettbewerb`; 18.11. Schnitt/Ansicht (`plan/entourage.rs`: konvexe Hüllen der Teilnetze, Ansicht gefüllt in Maler-Reihenfolge, Schnitt als Umriss von Bauteilen verdeckt, Objekte vor der Schnittebene entfallen statt geschnitten; Hüllen statt exakter Silhouette), 3D-Pick (wählt die Zeichnung) und `military`/`military30` im 3D-Dokument (Normalen über `mesh_view::hlr_faces_n`; dort nur Entourage, nicht die Kontext-Netze); offen: weitere Möbel, nicht im IFC (IfcFurnishingElement offen), nur im Linux-Container als CLI-SVG/Chromium angesehen, nicht in der Tauri-App/Metal); DXF-Block ohne Attribute (Id/Parameter nur im Blocknamen); Klassen-Namen („23 Sanitär“) bleiben im englischen UI deutsch (Projektdaten). · M +- ◐ **[253]** Standard-Objektbibliothek 2D (14.11.): 48 parametrische Objekte (`Drawing2DGeom::Libobj`, Kern `furniture_lib.rs`, Palette „Objekte“, Befehl `libobj`, DXF als Blöcke). Offen: auf dem Mac nicht geprüft (Ziehen aus der Palette mit dem nativen Metal-Renderer, `doc/RELEASE-1.0.md` 13.17; Symbole nur im CLI-SVG/Chromium angesehen); 3D-Entourage 18.11. ([253] 3D: `furniture_3d.rs`, Person stehend/gehend, Velo, Auto, Sitzbank, Stuhl, Tische mit Stühlen als Low-Poly-Netz im 3D, 3D-Dokument, Cycles, Schatten; Parameter `h`; Beispiel `:wettbewerb`; 18.11. Schnitt/Ansicht (`plan/entourage.rs`: konvexe Hüllen der Teilnetze, Ansicht gefüllt in Maler-Reihenfolge, Schnitt als Umriss von Bauteilen verdeckt, Objekte vor der Schnittebene entfallen statt geschnitten; Hüllen statt exakter Silhouette), 3D-Pick (wählt die Zeichnung) und `military`/`military30` im 3D-Dokument (Normalen über `mesh_view::hlr_faces_n`; dort nur Entourage, nicht die Kontext-Netze); IFC 18.11.: Möbel mit Netz (Tisch, Stuhl, Bank) als IfcFurniture/IfcFurnishingElement im Geschoss (Datensatz 29, Umbau-Status, Name aus der Katalog-Id), Person/Velo/Auto nur mit Option „Entourage mitexportieren" als IfcBuildingElementProxy; offen: weitere Möbel, nur im Linux-Container als CLI-SVG/Chromium angesehen, nicht in der Tauri-App/Metal); DXF-Block ohne Attribute (Id/Parameter nur im Blocknamen); Klassen-Namen („23 Sanitär“) bleiben im englischen UI deutsch (Projektdaten). · M ## Phase 1 (13.–19.11.): Stabil und baubar Konsolen-Audit (14.11., `node scripts/console-audit.mjs [--gpu]`): Rest nur headless/SwiftShader (`[longtask]` 200–300 ms beim Laden grosser Beispiele, im Dev-Build bis 11 s); `csp.spec.ts` schlägt gegen `vite dev` erwartungsgemäss fehl. Offen: Tauri/Metal-Konsole auf dem Mac nicht geprüft. diff --git a/scripts/check-ifc-fachplaner.py b/scripts/check-ifc-fachplaner.py index d4ae5ef9..b597209a 100644 --- a/scripts/check-ifc-fachplaner.py +++ b/scripts/check-ifc-fachplaner.py @@ -18,7 +18,7 @@ Ergänzt `scripts/validate-ifc.py` (Schema, Express-Regeln, Geometrie) um inhalt IfcPresentationLayerAssignment; Ebenennamen `Code_Bezeichnung` (wie im DXF); • Räume: Height = Geometrie ±1 cm, `stats.spaceHeights` (Nummer → Height, FinishCeilingHeight, ClearHeightMin/Mean) für den Vergleich mit dem Raumbuch im Test; - • keine Objekte der 2D-Objektbibliothek als 3D-Körper (IfcFurniture/IfcSanitaryTerminal …). + • keine Sanitärobjekte der 2D-Objektbibliothek als 3D-Körper (IfcSanitaryTerminal …); Möbel mit Netz sind IfcFurniture ([253]). Aufruf: python3 scripts/check-ifc-fachplaner.py datei.ifc [--geo] [--context] [--json] [--known=GlobalId,…] --geo die Datei MUSS georeferenziert sein @@ -40,7 +40,7 @@ import ifcopenshell.util.shape as us TOL = 0.01 # ±1 % LOCAL_LIMIT = 5000.0 # m: weiter vom Ursprung = „nicht lokal" -LIBRARY_CLASSES = ["IfcFurniture", "IfcFurnishingElement", "IfcSanitaryTerminal", "IfcSystemFurnitureElement"] +LIBRARY_CLASSES = ["IfcSanitaryTerminal", "IfcSystemFurnitureElement"] # [253] Möbel mit 3D-Netz (IfcFurniture) sind erlaubt def rel_err(a, b): diff --git a/src-tauri/core/src/furniture_3d.rs b/src-tauri/core/src/furniture_3d.rs index ddc2fcba..01812fef 100644 --- a/src-tauri/core/src/furniture_3d.rs +++ b/src-tauri/core/src/furniture_3d.rs @@ -292,6 +292,26 @@ pub fn bike(p: &Params, _chairs: &[(f64, f64, f64)], b: &mut B3) { b.cuboid(cx - 0.06, seat[1] - 0.12, 0.84 * h, cx + 0.06, seat[1] + 0.08, 0.84 * h + 0.04, TYRE); } +/// [253] IFC: Personen, Velo und Auto sind Entourage, keine Bauteile (nur mit Option „Entourage mitexportieren"). +pub fn is_entourage(lib_id: &str) -> bool { + matches!(lib_id, "lib:person-stehend" | "lib:person-gehend" | "lib:velo" | "lib:auto") +} + +/// [253] IFC-Name aus der Katalog-Id (`lib:tisch-rund-120` → „Tisch rund 120") und `IfcFurnitureTypeEnum` (IFC4). +pub fn ifc_name_and_type(lib_id: &str) -> (String, &'static str) { + let raw = lib_id.strip_prefix("lib:").unwrap_or(lib_id).replace('-', " "); + let mut cs = raw.chars(); + let name = cs.next().map_or(String::new(), |c| c.to_uppercase().chain(cs).collect()); + let kind = if lib_id.starts_with("lib:tisch") { + "TABLE" + } else if lib_id.starts_with("lib:stuhl") { + "CHAIR" + } else { + "NOTDEFINED" + }; + (name, kind) +} + /// Alle Platzierungen einer Instanz in Weltkoordinaten (Modell-x/y, z = absolute Höhe). fn place(meshes: &[Mesh3], at: [f64; 2], rot: f64, base: f64) -> Vec { let (c, s) = (cos(rot), sin(rot)); diff --git a/src-tauri/core/src/ifc_data.rs b/src-tauri/core/src/ifc_data.rs index a052cc23..746a2f77 100644 --- a/src-tauri/core/src/ifc_data.rs +++ b/src-tauri/core/src/ifc_data.rs @@ -45,6 +45,8 @@ const REC_ROOF: f64 = 9.0; const REC_COLUMN: f64 = 10.0; const REC_END_COLUMNS: f64 = 11.0; const REC_BEAM: f64 = 28.0; +/// [253] Bibliotheksobjekt mit 3D-Netz (Möbel) → `IfcFurniture`; Entourage nur mit `IfcOptions::entourage`. +const REC_FURNITURE: f64 = 29.0; const REC_CLASSIFICATION: f64 = 12.0; const REC_ZONE: f64 = 13.0; const REC_ATTACH: f64 = 14.0; @@ -80,6 +82,8 @@ pub struct IfcOptions { /// [259] Kontext mitgeben: Gelände-Netze (IfcGeographicElement TERRAIN) und Netze auf Umgebungsklassen /// (Nachbargebäude → IfcBuildingElementProxy), am IfcSite. Fachplaner wollen oft nur das Gebäude: Vorgabe aus. pub context: bool, + /// [253] Entourage (Person, Velo, Auto) mitgeben: IfcBuildingElementProxy ObjectType „Entourage". Vorgabe aus (keine Bauteile). + pub entourage: bool, /// Zeitstempel (Sekunden seit 1970) und dieselbe Zeit als ISO-Text ohne Sekundenbruchteil. pub now: f64, pub iso: String, @@ -2069,6 +2073,41 @@ pub fn ifc_export_data(src: &Project, opt: &IfcOptions) -> Result w_mesh(&mut f, &positions, &indices, false); } + // ── [253] Möbel der Bibliothek (3D-Netz) → IfcFurniture (IFC2x3: IfcFurnishingElement); Person/Velo/Auto sind Entourage + // und nur mit Option als IfcBuildingElementProxy dabei. Netz Welt rel. Geschoss-UK, Status wie andere Bauteile. ── + for (i, parts) in crate::furniture_3d::placed(&p) { + let d = &p.drawings2d[i]; + let Drawing2DGeom::Libobj { lib_id, .. } = &d.geom else { continue }; + let entourage = crate::furniture_3d::is_entourage(lib_id); + if entourage && !opt.entourage { + continue; + } + let structure = structure_of(&d.level_id); + let base = base_of(structure); + let (mut positions, mut indices) = (Vec::new(), Vec::new()); + for m in &parts { + let at = (positions.len() / 3) as u32; + positions.extend_from_slice(&m.positions); + indices.extend(m.indices.iter().map(|k| k + at)); + } + if indices.is_empty() { + continue; + } + for z in positions.iter_mut().skip(2).step_by(3) { + *z -= base; + } + let (name, kind) = crate::furniture_3d::ifc_name_and_type(lib_id); + let mut psets = vec![Pset { name: "Pset_FurnitureTypeCommon", props: vec![ident("Reference", &name)] }]; + renovation_props(&p, &mut psets, "Pset_FurnitureTypeCommon", d.renovation.as_ref()); + psets.push(Pset { name: "Dossier_Furniture", props: vec![ident("LibId", lib_id)] }); + let (id, nm, ty) = (f.str(&d.id), f.str(&name), f.str(lib_id)); + let kind = f.str(if entourage { "ENTOURAGE" } else { kind }); + f.nums(&[REC_FURNITURE, structure, id, nm, ty, kind, if entourage { 1.0 } else { 0.0 }]); + w_psets(&mut f, &psets); + // Teile einzeln geschlossen, zusammen kein dichtes Netz (IFC2x3: Flächenmodell). + w_mesh(&mut f, &positions, &indices, false); + } + // ── [279] Geländer → IfcRailing (GUARDRAIL; HANDRAIL, wenn nur der Handlauf bleibt), Netz aus den Prismen ── for r in p.railings.as_deref().unwrap_or(&[]) { let (Some(s), Some(ax)) = (crate::railing::spec(&p, r), crate::railing::axis(r)) else { continue }; @@ -2391,6 +2430,26 @@ mod tests { assert!(!strings(&ifc_export_data(&p, &IfcOptions::default()).unwrap()).iter().any(|x| x == "Dossier_Qto_Tree")); } + /// [253] Möbel mit 3D-Netz als eigener Datensatz (Name aus der Katalog-Id, Status wie Bauteile); Person/Velo/Auto nur mit Option. + #[test] + fn moebel_datensatz_ohne_entourage() { + let mut p = sample(); + let floor = p.drawing_levels.iter().find(|l| l.kind == DrawingLevelKind::Floor).unwrap().id.clone(); + let lib = |id: &str, lib_id: &str, x: f64| -> Drawing2D { + serde_json::from_value(serde_json::json!({"id": id, "type": "drawing2d", "levelId": floor, "categoryCode": "22", "geom": {"shape": "libobj", "libId": lib_id, "at": {"x": x, "y": 2.0}, "rotation": 0.0}})).unwrap() + }; + p.drawings2d.extend([lib("m1", "lib:tisch-rund-120", 1.0), lib("m2", "lib:sitzbank", 3.0), lib("m3", "lib:person-stehend", 5.0), lib("m4", "lib:wc-wand", 7.0)]); + let has = |f: &Flat, id: &str| strings(f).iter().any(|x| x == id); + let f = ifc_export_data(&p, &IfcOptions::default()).unwrap(); + let s = strings(&f); + assert!(has(&f, "lib:tisch-rund-120") && has(&f, "lib:sitzbank"), "Tisch und Bank"); + assert!(!has(&f, "lib:person-stehend") && !has(&f, "lib:wc-wand"), "Person (Entourage) und WC (kein Netz) nicht"); + assert!(s.iter().any(|x| x == "Tisch rund 120") && s.iter().any(|x| x == "TABLE") && s.iter().any(|x| x == "Sitzbank")); + let f = ifc_export_data(&p, &IfcOptions { entourage: true, ..Default::default() }).unwrap(); + assert!(has(&f, "lib:person-stehend") && !has(&f, "lib:wc-wand")); + assert!(strings(&f).iter().any(|x| x == "ENTOURAGE")); + } + /// [G3]/[103] Formöffnung und Dachfenster als Öffnungskörper-Datensatz mit Wirt. #[test] fn formoeffnung_und_dachfenster() { diff --git a/src-tauri/core/src/queries.rs b/src-tauri/core/src/queries.rs index 0a472064..d6a953c7 100644 --- a/src-tauri/core/src/queries.rs +++ b/src-tauri/core/src/queries.rs @@ -400,13 +400,13 @@ pub fn run_bin(p: &Project, name: &str, args: &[f64], text: &str) -> Result crate::plan::domains::plan_domains_buf(p, &crate::plan::domains::PlanArgs::parse_in(p, args[0], text)?), // Export-Sammler ([K4], [B5], [C11]): flacher Puffer für `fileio` (Byte-Hülle `export_flat.rs`). - ("ifcExportData", 4 | 5) => { - // 5. Argument [259]: Kontext (Gelände, Nachbarn) mitgeben. + ("ifcExportData", 4..=6) => { + // 5. Argument [259]: Kontext (Gelände, Nachbarn) mitgeben; 6. [253]: Entourage mitgeben. // [272] `text` = Zeitstempel (ISO) oder `{"iso", "designOptions", "renovation"}`: Kombination der Ansicht. let json_text = text.trim_start().starts_with('{'); let iso = if json_text { serde_json::from_str::(text).ok().and_then(|v| v.get("iso").and_then(|x| x.as_str()).map(String::from)).unwrap_or_default() } else { text.to_string() }; let q = options_state(p, text); - let opt = crate::ifc_data::IfcOptions { now: args[0], ifc2x3: args[1] != 0.0, ebkph: args[2] != 0.0, layer_codes: args[3] != 0.0, context: args.get(4).is_some_and(|v| *v != 0.0), iso }; + let opt = crate::ifc_data::IfcOptions { now: args[0], ifc2x3: args[1] != 0.0, ebkph: args[2] != 0.0, layer_codes: args[3] != 0.0, context: args.get(4).is_some_and(|v| *v != 0.0), entourage: args.get(5).is_some_and(|v| *v != 0.0), iso }; crate::ifc_data::ifc_export_data(&q, &opt).map(|f| f.to_bytes()) } ("meshExportData", 3 | 4) => { diff --git a/src-tauri/fileio/src/ifc_export/mod.rs b/src-tauri/fileio/src/ifc_export/mod.rs index d23e7afe..70019df2 100644 --- a/src-tauri/fileio/src/ifc_export/mod.rs +++ b/src-tauri/fileio/src/ifc_export/mod.rs @@ -123,6 +123,9 @@ // TREE = 19 ([149] Baum), structure, id, name, PSETS, MESH (Stamm + Krone, Welt rel. Geschoss-UK) // IFC4: IfcGeographicElement (ObjectType „Baum", PredefinedType USERDEFINED); IFC2x3 (kennt die // Klasse nicht): IfcBuildingElementProxy mit ObjectType „Baum". GlobalId aus `tree/`. +// FURNITURE = 29 ([253] Bibliotheksobjekt mit 3D-Netz), structure, id, name, object_type (Katalog-Id), predefined (IfcFurnitureTypeEnum, +// nur IFC4), entourage (0/1), PSETS, MESH (Welt rel. Geschoss-UK): IFC4 IfcFurniture, IFC2x3 IfcFurnishingElement; +// entourage = 1 (Person/Velo/Auto, nur mit Option): IfcBuildingElementProxy, ObjectType „Entourage". GlobalId `furniture/`. // RAILING = 26 ([279] Geländer), structure, id, name, predefined (GUARDRAIL | HANDRAIL | BALUSTRADE), PSETS, MESH (Prismen, // Welt rel. Geschoss-UK): IfcRailing mit PredefinedType (IFC4 und IFC2x3). GlobalId aus `railing/`. // CONTEXT = 24 ([259] Kontext, nur mit Option), kind (0 Netz auf Umgebungsklasse, 1 Gelände), id, name, class @@ -191,6 +194,8 @@ pub const REC_SPACE_ARC: f64 = 22.0; /// [281] Geneigte Decke als Netz (Flag Rampe ⇒ `IfcRamp` + `IfcRampFlight`). pub const REC_CEILING_MESH: f64 = 27.0; pub const REC_BEAM: f64 = 28.0; +/// [253] Möbel/Entourage der Bibliothek mit 3D-Netz. +pub const REC_FURNITURE: f64 = 29.0; mod format; mod reader; @@ -228,6 +233,7 @@ fn rec_name(code: f64) -> &'static str { c if c == REC_RAILING => "RAILING", c if c == REC_COLUMN_PIECES => "COLUMN_PIECES", c if c == REC_BEAM => "BEAM", + c if c == REC_FURNITURE => "FURNITURE", _ => "?", } } @@ -1133,6 +1139,33 @@ pub fn build_ifc(flat: &[f64], strings: &str) -> Result { w.add_pset(p, entity, &key); } } + c if c == REC_FURNITURE => { + let structure = r.structure(n_storeys)?; + let id = r.string()?; + let name = r.string()?; + let object_type = r.string()?; + let predefined = r.string()?; + let entourage = r.idx()? == 1; + let psets = r.psets()?; + let mesh = r.mesh()?; + let (placement, shape) = w.emit_triangulated_product(&mesh, w.placement_of(structure)); + let key = format!("furniture/{id}"); + let g = w.gid(&key); + let head = format!("{g},#{},{},$,{},#{placement},#{shape},$", w.owner_history, ifc_string(&name), ifc_string(if entourage { "Entourage" } else { &object_type })); + let entity = if entourage { + w.add("IFCBUILDINGELEMENTPROXY", format!("{head},$")) + } else if w.v2() { + w.add("IFCFURNISHINGELEMENT", head) + } else { + let kind = if ["CHAIR", "TABLE", "DESK", "BED", "FILECABINET", "SHELF", "SOFA", "TECHNICALCABINET", "USERDEFINED"].contains(&predefined.as_str()) { predefined } else { "NOTDEFINED".to_string() }; + w.add("IFCFURNITURE", format!("{head},{}", enum_(&kind))) + }; + w.add_to_containment(structure, entity); + w.elements.insert(key.clone(), entity); + for p in &psets { + w.add_pset(p, entity, &key); + } + } c if c == REC_RAILING => { let structure = r.structure(n_storeys)?; let id = r.string()?; diff --git a/src-tauri/fileio/src/ifc_export/tests.rs b/src-tauri/fileio/src/ifc_export/tests.rs index 6f10b08d..c0f5e319 100644 --- a/src-tauri/fileio/src/ifc_export/tests.rs +++ b/src-tauri/fileio/src/ifc_export/tests.rs @@ -1142,6 +1142,38 @@ fn baum_als_geografisches_element() { } } +/// [253] Möbel: IFC4 IfcFurniture (PredefinedType), IFC2x3 IfcFurnishingElement, Entourage als Proxy „Entourage"; im Geschoss +/// enthalten, GlobalId aus `furniture/`. +#[test] +fn moebel_als_ifc_furniture() { + for v2 in [false, true] { + let mut b = mini_in(if v2 { B::v2() } else { B::new() }); + for (id, name, kind, entourage) in [("M1", "Tisch 80x140", "TABLE", 0.0), ("P1", "Person stehend", "NOTDEFINED", 1.0)] { + b.n(&[REC_FURNITURE, -1.0]); + b.str(id); + b.str(name); + b.str(&format!("lib:{id}")); + b.str(kind); + b.n(&[entourage]); + b.qto("Dossier_Qto_Tree", &[("Height", 3.0, 1.0)]); + b.n(&[4.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 12.0]); + b.n(&[4.0, 0.0, 2.0, 1.0, 0.0, 1.0, 3.0, 1.0, 2.0, 3.0, 0.0, 3.0, 2.0, 0.0]); + } + let ifc = build(&b).unwrap(); + check_structure(&ifc); + let ty = if v2 { "IFCFURNISHINGELEMENT" } else { "IFCFURNITURE" }; + assert_eq!(count(&ifc, ty), 1, "{ifc}"); + assert_eq!(count(&ifc, "IFCBUILDINGELEMENTPROXY"), 1); + let line = ifc.lines().find(|l| l.contains(&format!("={ty}("))).unwrap(); + assert!(line.contains("'Tisch 80x140'") && line.contains("'lib:M1'"), "{line}"); + assert_eq!(line.ends_with(".TABLE.);"), !v2, "{line}"); + assert!(line.contains(&ifc_guid("t/furniture/M1")), "{line}"); + let proxy = ifc.lines().find(|l| l.contains("=IFCBUILDINGELEMENTPROXY(")).unwrap(); + assert!(proxy.contains("'Entourage'"), "{proxy}"); + assert_eq!(count(&ifc, "IFCRELCONTAINEDINSPATIALSTRUCTURE"), 1); + } +} + /// [259] Kontext: Gelände als IfcGeographicElement TERRAIN, Nachbar als Proxy „Kontext"; beide am IfcSite (eigene /// Eingliederung, nicht im Gebäude/Geschoss), Klasse als Beschreibung. IFC2x3: beide als Proxy. #[test] diff --git a/src/cli/main.ts b/src/cli/main.ts index b43758c5..b05d6f84 100644 --- a/src/cli/main.ts +++ b/src/cli/main.ts @@ -35,7 +35,7 @@ // [--scale 200] [--hatch] [--color] [--format svg|json|dxf|dxfbin|dwg] [--out axo.svg] // [266] 3D-Dokument: Vektor-Axonometrie/-Perspektive mit verdeckten Kanten aus dem Kern // (Linienzeichnung, Silhouette kräftig, Flächen nach Lage grau; ohne GPU) -// dossier-cli ifc [--ebkph] [--ebenen] [--kontext] (IFC mit eBKP-H-Hauptgruppen bzw. Modell-Ebenen als Klassifikation; --kontext: Gelände/Nachbarn mitgeben) +// dossier-cli ifc [--ebkph] [--ebenen] [--kontext] [--entourage] (IFC mit eBKP-H-Hauptgruppen bzw. Modell-Ebenen als Klassifikation; --kontext: Gelände/Nachbarn mitgeben; --entourage: Person/Velo/Auto als Proxy, Möbel gehen immer als IfcFurniture) // --schema 4|2x3: IFC4 (Standard) oder IFC2x3 (Coordination View 2.0) // dossier-cli dxf [--binary] [--scale 100] [--dim-unit cm] [--layout]|dwg|ifc|step|obj [--no-mtl]|stl|glb|gltf|schedule [--openings|--elements|--rooms] [--format json|csv|svg|pdf]|kennzahlen [--sia416] [--ivhb] [--nachweis] [--wohnungsspiegel] [--format json|csv|svg|pdf] [--agsf m2] [--gruenflaeche m2] [--agf-basis gf|ngf|nf] [--untergeschosse]|raumprogramm [--import tabelle] [--sheet name|nr] [--mode replace|append] [--tolerance %] [--generate] [--format json|csv|svg|pdf] [--save projekt.obp]|sun [--level EG] [--out datei] // glb/gltf = glTF 2.0 (Y-up, Meter, Geschoss als Eltern; --flat ohne Geschoss-Knoten) @@ -1334,7 +1334,7 @@ async function execute(project: Project, file: string, command: string, rest: st case "ifc": await loadFileio(); // --ebkph: eBKP-H-Hauptgruppen je Bauteilart; --ebenen: Ebene (categoryCode) des Modells als Klassifikation. - out(args, exportIfcSpf(project, { ebkph: args.flags.has("ebkph"), layerCodes: args.flags.has("ebenen"), context: args.flags.has("kontext"), schema: ifcSchemaFlag(args), view: exportViewFlags(project, args) }), `${exportProjectName(project) || "projekt"}.ifc`); + out(args, exportIfcSpf(project, { ebkph: args.flags.has("ebkph"), layerCodes: args.flags.has("ebenen"), context: args.flags.has("kontext"), entourage: args.flags.has("entourage"), schema: ifcSchemaFlag(args), view: exportViewFlags(project, args) }), `${exportProjectName(project) || "projekt"}.ifc`); return 0; case "obj": await loadFileio(); diff --git a/src/export/exportIfc.fachplaner.test.ts b/src/export/exportIfc.fachplaner.test.ts index 19b2f457..a60dcc2c 100644 --- a/src/export/exportIfc.fachplaner.test.ts +++ b/src/export/exportIfc.fachplaner.test.ts @@ -109,15 +109,43 @@ describe.skipIf(!hasIfcOpenShell)("[259] IFC für Fachplaner (ifcopenshell)", { }); }); -describe("[259] 2D-Objektbibliothek im IFC", () => { - it("bleibt draussen: die Datei ist mit und ohne Objekte zeichengleich", () => { - const objs: Drawing2D[] = [ - { id: "wc", type: "drawing2d", levelId: "eg", categoryCode: "23", geom: { shape: "libobj", libId: "lib:wc-wand", at: { x: 1, y: 1 }, rotation: 0 } }, - { id: "ti", type: "drawing2d", levelId: "eg", categoryCode: "22", geom: { shape: "libobj", libId: "lib:tisch-80x140", at: { x: 3, y: 2 }, rotation: 0.5, seed: 3 } }, - ]; +describe("[259][253] 2D-Objektbibliothek im IFC", () => { + const libobj = (id: string, libId: string, x: number, y: number): Drawing2D => ({ id, type: "drawing2d", levelId: "eg", categoryCode: "22", geom: { shape: "libobj", libId, at: { x, y }, rotation: 0.5, seed: 3 } }); + + it("Objekte ohne 3D-Netz (WC) bleiben draussen: die Datei ist zeichengleich", () => { const without = exportAt(sampleProject); - const withObjs = exportAt({ ...sampleProject, drawings2d: [...sampleProject.drawings2d, ...objs] }); + const withObjs = exportAt({ ...sampleProject, drawings2d: [...sampleProject.drawings2d, libobj("wc", "lib:wc-wand", 1, 1)] }); expect(withObjs).toBe(without); - expect(withObjs).not.toMatch(/IFCFURNITURE|IFCSANITARYTERMINAL|IFCFURNISHINGELEMENT/); + }); + + it("Möbel mit Netz als IfcFurniture (IFC2x3: IfcFurnishingElement), Entourage nur mit Option als Proxy", () => { + const p: Project = { ...sampleProject, drawings2d: [...sampleProject.drawings2d, libobj("ti", "lib:tisch-80x140", 3, 2), libobj("pe", "lib:person-stehend", 5, 2), libobj("ve", "lib:velo", 6, 2)] }; + const ifc = exportAt(p); + expect(ifc.match(/=IFCFURNITURE\(/g)).toHaveLength(1); + expect(ifc).toMatch(/=IFCFURNITURE\([^\n]*'Tisch 80x140'[^\n]*\.TABLE\.\);/); + expect(ifc).not.toMatch(/Person|Velo|Entourage/); + const v2 = exportAt(p, { schema: "IFC2X3" }); + expect(v2.match(/=IFCFURNISHINGELEMENT\(/g)).toHaveLength(1); + const ent = exportAt(p, { entourage: true }); + expect(ent.match(/=IFCFURNITURE\(/g)).toHaveLength(1); + expect(ent.match(/=IFCBUILDINGELEMENTPROXY\([^\n]*'Entourage'/g)).toHaveLength(2); + }); +}); + +describe.skipIf(!hasIfcOpenShell)("[253] Möbel im IFC (ifcopenshell)", { timeout: 900_000 }, () => { + it("Wettbewerb: Bank als IfcFurniture im Geschoss, keine Personen/Velo/Auto; mit Option als Proxy", () => { + const p = buildWettbewerbSampleProject(); + const libs = p.drawings2d.flatMap((d) => (d.geom.shape === "libobj" ? [d.geom.libId] : [])); + const entourage = libs.filter((l) => /person|velo|auto/.test(l)).length; + expect(libs).toContain("lib:sitzbank"); + expect(entourage).toBeGreaterThan(0); + const c = check("wettbewerb-moebel", exportIfcSpf(p), ["--geo"]); + expect(c.stats.counts.IfcFurniture).toBe(libs.filter((l) => /sitzbank|tisch|stuhl/.test(l)).length); + expect(c.stats.counts.IfcBuildingElementProxy ?? 0).toBe(0); + const e = check("wettbewerb-entourage", exportIfcSpf(p, { entourage: true }), ["--geo"]); + expect(e.stats.counts.IfcBuildingElementProxy).toBe(entourage); + // IFC2x3: Schema-Prüfung (das inhaltliche Skript kennt nur IFC4-Geometrie). + const v = spawnSync("python3", ["scripts/validate-ifc.py", writeIfc("wettbewerb-moebel-2x3", exportIfcSpf(p, { schema: "IFC2X3", entourage: true }))], { encoding: "utf8", timeout: 400_000 }); + expect(`${v.stdout}\n${v.stderr}`).toContain(" 0 Befunde"); }); }); diff --git a/src/export/exportIfc.ts b/src/export/exportIfc.ts index 0fc59fbe..dfe2f89c 100644 --- a/src/export/exportIfc.ts +++ b/src/export/exportIfc.ts @@ -36,6 +36,8 @@ export interface IfcExportOptions { * (IfcBuildingElementProxy „Kontext"), am IfcSite. Ohne Angabe nicht: Fachplaner wollen meist nur das Gebäude. */ context?: boolean; + /** [253] Entourage (Person, Velo, Auto) als IfcBuildingElementProxy „Entourage" mitgeben; Möbel gehen immer als IfcFurniture. */ + entourage?: boolean; /** [271][272] Ansicht der Ausgabe: Umbaufilter und Variantenkombination (ohne Angabe kein Filter, Hauptvarianten). */ view?: ExportView; } @@ -82,7 +84,7 @@ export function decodeExportFlat(bytes: Uint8Array): [Float64Array, string] { export function exportIfcSpf(project: Project, options: IfcExportOptions = {}): string { const now = Date.now(); const iso = new Date(now).toISOString().replace(/\.\d+Z$/, ""); - const args = [Math.floor(now / 1000), options.schema === "IFC2X3" ? 1 : 0, options.ebkph ? 1 : 0, options.layerCodes ? 1 : 0, options.context ? 1 : 0]; + const args = [Math.floor(now / 1000), options.schema === "IFC2X3" ? 1 : 0, options.ebkph ? 1 : 0, options.layerCodes ? 1 : 0, options.context ? 1 : 0, options.entourage ? 1 : 0]; const [buf, strings] = decodeExportFlat(documentFor(project).queryBin("ifcExportData", args, exportViewText(options.view, { iso }))); const m = fileio(); const text = m.export_ifc_flat(buf, strings); diff --git a/src/i18n/de.ts b/src/i18n/de.ts index df9846b1..4f7eb72c 100644 --- a/src/i18n/de.ts +++ b/src/i18n/de.ts @@ -3016,6 +3016,8 @@ export const de = { "exportSave.ifc.layers": "Ebene (Kategorie-Code) des Modells als Klassifikation", "exportSave.ifc.layersHint": "System «Dossier-Ebenen»: Code und Name der Grafik-Ebene jedes Bauteils (kein Baukostenplan).", "exportSave.ifc.context": "Kontext mitgeben (Gelände, Nachbargebäude)", + "exportSave.ifc.entourage": "Entourage mitexportieren (Personen, Velos, Autos)", + "exportSave.ifc.entourageHint": "Möbel (Tische, Stühle, Bänke) gehen immer als IfcFurniture mit. Personen, Velos und Autos sind keine Bauteile und kommen nur mit dieser Option, als IfcBuildingElementProxy «Entourage».", "exportSave.ifc.contextHint": "Gelände als IfcGeographicElement, Netze auf Umgebungsklassen (z. B. 12 Gebäude) als IfcBuildingElementProxy «Kontext», am Grundstück statt im Geschoss. Für Fachplaner meist aus lassen: sie brauchen nur das Gebäude.", "exportSave.ifc.zonesNote": "SIA-416-Zonen (HNF, NNF …) und Geschossflächen sind immer enthalten, sobald Räume vorhanden sind.", "exportSave.ifc.schema": "IFC-Schema", diff --git a/src/i18n/en.ts b/src/i18n/en.ts index ede5b19f..3c6f037a 100644 --- a/src/i18n/en.ts +++ b/src/i18n/en.ts @@ -3348,6 +3348,8 @@ export const en: Record = { "exportSave.ifc.layers": "Model layer (category code) as classification", "exportSave.ifc.layersHint": "System “Dossier-Ebenen”: code and name of each element's graphic layer (not a cost plan).", "exportSave.ifc.context": "Include context (terrain, neighbouring buildings)", + "exportSave.ifc.entourage": "Export entourage (people, bicycles, cars)", + "exportSave.ifc.entourageHint": "Furniture (tables, chairs, benches) is always exported as IfcFurniture. People, bicycles and cars are not building elements and only come with this option, as IfcBuildingElementProxy “Entourage”.", "exportSave.ifc.contextHint": "Terrain as IfcGeographicElement, meshes on context classes (e.g. 12 Buildings) as IfcBuildingElementProxy “Kontext”, placed on the site instead of a storey. Usually leave off for consultants: they only need the building.", "exportSave.ifc.zonesNote": "SIA 416 zones (HNF, NNF …) and floor areas are always included when rooms exist.", "exportSave.ifc.schema": "IFC schema", diff --git a/src/ui/ExportSaveDialog.tsx b/src/ui/ExportSaveDialog.tsx index 26de11aa..64db8691 100644 --- a/src/ui/ExportSaveDialog.tsx +++ b/src/ui/ExportSaveDialog.tsx @@ -77,13 +77,14 @@ export function ExportSaveDialog({ const [ebkph, setEbkph] = useState(false); const [layerCodes, setLayerCodes] = useState(false); const [context, setContext] = useState(false); + const [entourage, setEntourage] = useState(false); // IFC-Schema: IFC4 (Standard) oder IFC2x3 für ältere Fachplaner-Programme. const [schema, setSchema] = useState("IFC4"); // [271][272] Die Ansicht der aktiven Ebene gilt für alle 3D-Formate (IFC, OBJ, STL, glTF, STEP); die Bauteilliste (CSV) nicht. const viewApplies = format !== "csv"; const viewActive = hasExportView(view); const [useView, setUseView] = useState(true); - const onConfirm = () => onSave(format, filename, format === "ifc" ? { schema, ebkph, layerCodes, context } : undefined, viewApplies && viewActive && useView ? view : undefined); + const onConfirm = () => onSave(format, filename, format === "ifc" ? { schema, ebkph, layerCodes, context, entourage } : undefined, viewApplies && viewActive && useView ? view : undefined); return (
@@ -147,6 +148,11 @@ export function ExportSaveDialog({ {t("exportSave.ifc.context")}
{t("exportSave.ifc.contextHint")}
+ +
{t("exportSave.ifc.entourageHint")}
{t("exportSave.ifc.zonesNote")}
)}