Merge branch 'worktree-agent-a82867dee8c275a40' into claude/practical-noether-1hb2s1
This commit is contained in:
7 files changed
+278
-14
No files matched your search
@@ -504,13 +504,12 @@ Kennwort, anonym) als PDF; Austausch mit Fachplanern über DXF/IFC.
|
||||
TERRAIN, Netze auf Umgebungsklassen → Proxy „Kontext", am IfcSite. Entscheid: 2D-Objektbibliothek ([253]) wird NICHT exportiert (kein
|
||||
falscher Körper, kein geometrieloses IfcFurniture). Grösse/Zeit (Linux, unter Last): komplex 1.6 MB / 2.5 s, Wettbewerb 0.9 MB / 0.5 s,
|
||||
Stress-Beispiel `sampleProjectBig` 19.8 MB / 5.8 s. **Offen:** nicht in Archicad/Revit/Solibri/BIMcollab geöffnet (Prüfzeile 13.14 in
|
||||
`doc/RELEASE-1.0.md`); Raumhöhe = Geschosshöhe statt lichter Höhe; keine `IfcPresentationLayerAssignment`
|
||||
(Ebenen nur als Klassifikation); IFC2x3 nur über die bestehenden Tests. **14.11. (spät):** Anbauwand OG Ost (komplex, unter dem
|
||||
`doc/RELEASE-1.0.md`); IFC2x3 nur über die bestehenden Tests. **14.11. (spät):** Anbauwand OG Ost (komplex, unter dem
|
||||
Pultdach mit Fenster) behoben — ihre Stücke um das Fenster (je eigene Dach-Oberkante) lagen als verschweisste Schalen im Face-Set (Kanten
|
||||
3–4-fach), ifcopenshell rechnete beim Abzug 30.4 statt 7.5 m³. Jetzt der vereinigte 3D-Körper je Band (`RWall::body`, `union_bodies`), Ecken auf das 1e-6-Ausgaberaster gelegt (sonst
|
||||
blieb zwischen Nachbarbändern ein Spalt von 1e-15 m und zwei Schalen, Wettbewerb OG2 Ost), dicht nach dem Verschweissen geprüft, sonst Schalen wie bisher;
|
||||
`--known` aus der Prüfung entfernt, komplex 0 Befunde; zwei weitere Dachwände und eine Wand mit Formöffnung genauer (Abweichung NetVolume ↔
|
||||
Geometrie 0.9 % → 0). Test `wand_unter_dem_dach_mit_fenster_als_ein_koerper`. · M
|
||||
Geometrie 0.9 % → 0). Test `wand_unter_dem_dach_mit_fenster_als_ein_koerper`. **15.11.:** (a) Ebenen: `IfcPresentationLayerAssignment` je Klasse (`20_Wände` wie im DXF; ohne Sichtbarkeit, `IfcPresentationLayerWithStyle` verlangt in IFC4 Geometrie-Items), alle Darstellungen eines Bauteils samt Treppenteilen auf genau einer Ebene (Prüfung in `check-ifc-fachplaner.py`); (b) Raum: Körper und `Qto_SpaceBaseQuantities.Height` = lichte Höhe wie Raumbuch, `FinishCeilingHeight` und `Dossier_Qto_RoomBook.ClearHeightMean` = mittlere, `ClearHeightMin` = kleinste Höhe unter Dachschrägen, Boden an der Oberkante der Decke darunter; Test gegen `roomBook` ±1 cm. Offen: Archicad/Revit/Solibri-Sicht der Ebenen ungeprüft; Dachraum-Körper füllt die Schräge nicht aus. · M
|
||||
- ◐ **[255]** Baurecht-Nachweis: Ausnützung gegen Modell als Tabelle (14.11.). Kern `site_proof.rs` (Abfrage `siteProof`) stellt die Vorgaben
|
||||
der Parzelle den Kennzahlen gegenüber: GFZ, AZ, BMZ, ÜZ, GZ (min.), Gesamt-/Fassadenhöhe, Grundfläche ausserhalb Grenzabstand/Baulinie,
|
||||
Gebäudeprofil; je Zeile zulässig · Projekt · Reserve/Überschreitung · erfüllt, fehlende Vorgabe als „—“ (nichts erfunden), dazu Grundlagen
|
||||
|
||||
+3
-2
@@ -55,17 +55,18 @@ Struktur IfcProject → IfcSite → IfcBuilding → IfcBuildingStorey, jedes Bau
|
||||
|---|---|---|---|
|
||||
| Geschosse (`floor`) | `IfcBuildingStorey` (Name, Elevation); verwaiste Bauteile am Gebäude. Mengen wie die Flächentabelle: `Qto_BuildingStoreyBaseQuantities` (GF = NGF + Konstruktionsfläche der Wände, NGF, Höhe, GV) und `CH_Qto_SIA416`; Summen am Gebäude (`Qto_BuildingBaseQuantities`) | Zeichnungs-Ebenen (`kind: drawing`) fehlen | `ifc_data.rs` (Kopf), `flaechen::area_table` |
|
||||
| Wände | Extrusion je Schichtband + `IfcOpeningElement`; sonst öffnungsgenaues Netz | Bogenwand: Profil-Extrusion mit Kreisachse, sonst Netz; Wandtyp nur als Materialschichten | `ifc_data.rs::emit_walls`-Abschnitt, Datensätze `WALL_SOLIDS`/`WALL_MESH`/`WALL_ARC_SOLID` |
|
||||
| Decken, Räume | `IfcSlab` (FLOOR/LANDING), `IfcSpace` (Name = Nummer, LongName = Name, Extrusion über die Geschosshöhe, `Pset_SpaceCommon`, `Qto_SpaceBaseQuantities`, SIA-416-Kategorie in `CH_Raum.SIA416` und als `IfcZone`, Raumbuch-Psets) | Bögen im Umriss bleiben echte Bögen (`CEILING_ARC`, `SPACE_ARC`; vor [259] an der Sehne gespiegelt); Raumhöhe = Geschosshöhe, nicht lichte Höhe | `ifc_data.rs`, Tests `exportIfc.test.ts`, `exportIfc.fachplaner.test.ts` |
|
||||
| Decken, Räume | `IfcSlab` (FLOOR/LANDING), `IfcSpace` (Name = Nummer, LongName = Name, Extrusion über die **lichte Höhe** (Oberkante Boden bis Unterkante Decke darüber bzw. Geschossoberkante, wie das Raumbuch [158]; Geschosshöhe bleibt am `IfcBuildingStorey`), `Pset_SpaceCommon`, `Qto_SpaceBaseQuantities`, SIA-416-Kategorie in `CH_Raum.SIA416` und als `IfcZone`, Raumbuch-Psets) | Bögen im Umriss bleiben echte Bögen (`CEILING_ARC`, `SPACE_ARC`; vor [259] an der Sehne gespiegelt); Dachräume: Körper und `Height` = höchste lichte Höhe, `FinishCeilingHeight` und `Dossier_Qto_RoomBook.ClearHeightMean` = mittlere, `ClearHeightMin` = kleinste lichte Höhe unter der Schräge (Raumbuch-Werte, ±1 cm geprüft); der Körper füllt die Schräge nicht aus | `ifc_data.rs`, Tests `exportIfc.test.ts`, `exportIfc.fachplaner.test.ts` |
|
||||
| Türen, Fenster | `IfcDoor`/`IfcWindow` mit Rahmen, Blatt, Glas als getrennte Körper | nur die im Modell parametrisierten Teile; ohne Teile (Wandöffnung) keine Füllung | `fileio/src/ifc_openings.rs`, Kopf `ifc_export/mod.rs` |
|
||||
| Treppen | `IfcStair` mit Läufen, Podesten, Geländern (`IfcRelAggregates`); Ersatzquader nur ohne Teile | – | `ifc_stairs.rs` |
|
||||
| Dächer | `IfcRoof`, ein Netz je Dach | **Netz statt Parametrik**: Neigung, Typ, Traufe nicht rückholbar | `ifc_data.rs` (Dächer), Datensatz `ROOF` |
|
||||
| Stützen, Bäume, Achsraster, Extrusionskörper | `IfcColumn`, `IfcGeographicElement` (IFC2x3: Proxy), `IfcGrid`, `IfcBuildingElementProxy` | Baum: zwei Netze Stamm + Krone | `ifc_data.rs` |
|
||||
| Psets / Mengen | `Pset_*Common` und `Qto_*BaseQuantities` nur mit **Modellwerten**; `CH_Qto_SIA416`, `Dossier_*` | keine frei definierbaren Eigenschaften | Kopf `ifc_data.rs`, Pset-Namen dort und in `ifc_quantities.rs` |
|
||||
| Ebenen ([259]) | je Dossier-Klasse eine `IfcPresentationLayerAssignment` (Name = Code_Bezeichnung wie die DXF-Ebene, z. B. `20_Wände`), jede `IfcShapeRepresentation` des Bauteils (samt Treppenteilen) auf genau einer Ebene; Klasse ohne Eintrag im Modell: Code als Name. Zusätzlich bleibt die Klassifikation „Dossier-Ebenen" (Option) | Bauteile ohne Klasse (Bäume, Extrusionskörper, Achsraster) liegen auf keiner Ebene; keine Sichtbarkeit/Sperre der Klasse (`IfcPresentationLayerWithStyle` erlaubt in IFC4 nur Geometrie-Items, nicht Darstellungen), keine Linien-/Flächenstile je Ebene; `IfcOpeningElement` ohne Ebene | `ifc_data.rs` (Datensatz `LAYERS`), `ifc_export/mod.rs` (`shape_reps_of`) |
|
||||
| Georeferenz | Geometrie **lokal** (Modell-Meter, z 0 = ±0.00); mit `geoAnchor` `IfcMapConversion` auf `IfcProjectedCRS` EPSG:2056 (Eastings/Northings = LV95 des Modell-Ursprungs, OrthogonalHeight = `referenceElevationMasl`, sonst Höhe des Bezugspunkts; = `IfcSite.RefElevation`); IFC2x3: `ePSet_MapConversion` + RefLatitude/-Longitude | keine Drehung (Modell nordausgerichtet). Vor [259] lag die Geometrie in LV95-Millionen (Revit/Archicad warnen) | Kopf `ifc_data.rs`, `ifc_export/mod.rs` |
|
||||
| GUIDs | `ifcGlobalId` des Bauteils, wenn gesetzt (Import, [201]; Wand, Decke, Dach, Stütze, Treppe, Raum, Extrusion, Tür/Fenster); sonst deterministisch aus der Modell-id. Doppelte oder ungültige GlobalIds fallen auf die abgeleitete zurück | Bäume, `IfcOpeningElement` und Beziehungen bleiben abgeleitet | `ifc_data.rs` (Datensatz `GUIDS`), `ifc_export::ifc_guid` |
|
||||
| Kontext (Option „Kontext mitgeben", CLI `--kontext`; Vorgabe aus) | Gelände-Netz → `IfcGeographicElement` TERRAIN, Netze auf Umgebungsklassen (z. B. „12 Gebäude") → `IfcBuildingElementProxy` „Kontext"; am `IfcSite`, Klasse als Description (IFC2x3: beide Proxy) | Höhenlinien, Baugrube, Luftbild nicht; Netze auf Bauteil-Klassen nicht | `ifc_data.rs` (Datensatz `CONTEXT`) |
|
||||
| 2D-Objektbibliothek ([253], `libobj`) | **nicht exportiert** (Entscheid [259]): reine 2D-Symbole ohne Höhe; ein erfundener Körper oder ein `IfcFurniture`/`IfcSanitaryTerminal` ohne Geometrie würde in Revit/Archicad unsichtbar bleiben oder Mengen verfälschen. Kommt mit 3D-Objekten nach 1.0 | – | Test „2D-Objektbibliothek im IFC" |
|
||||
| **Nicht exportiert** | 2D-Zeichnungen (ausser Raster), Texte, Bemassungen, Schraffuren, Layouts/Blätter, Ebenen als Sichtbarkeit (kein `IfcPresentationLayerAssignment`), Stifte, Gruppen, Netzkörper ausserhalb des Kontexts, Möbel/Blöcke, Ansichtsausschnitte | Im Sammler wird nur über Bauteile iteriert, `drawings2d` (ausser `Grid`) kommen nicht vor | `ifc_data.rs` |
|
||||
| **Nicht exportiert** | 2D-Zeichnungen (ausser Raster), Texte, Bemassungen, Schraffuren, Layouts/Blätter, Ebenen als Sichtbarkeit/Sperre (nur Name und Zuordnung, s. Zeile Ebenen), Stifte, Gruppen, Netzkörper ausserhalb des Kontexts, Möbel/Blöcke, Ansichtsausschnitte | Im Sammler wird nur über Bauteile iteriert, `drawings2d` (ausser `Grid`) kommen nicht vor | `ifc_data.rs` |
|
||||
|
||||
Geprüft mit IfcOpenShell nur, wenn `ifcopenshell` installiert ist (`src/export/exportIfc.validate.test.ts`, für alle drei
|
||||
Beispielprojekte zusätzlich `scripts/check-ifc-fachplaner.py` in `exportIfc.fachplaner.test.ts`: Struktur, Eingliederung,
|
||||
|
||||
@@ -14,6 +14,10 @@ Ergänzt `scripts/validate-ifc.py` (Schema, Express-Regeln, Geometrie) um inhalt
|
||||
• Wände: IfcMaterialLayerSetUsage mit Materialnamen, Schichtsumme = Wanddicke; NetVolume ±1 % gegen die Geometrie;
|
||||
Decken: PredefinedType, NetVolume ±1 %;
|
||||
• Geschoss-Mengen: GrossFloorArea ≥ NetFloorArea;
|
||||
• Ebenen: jedes Bauteil (Wand, Decke, Dach, Stütze, Treppe samt Teilen, Tür/Fenster, Raum) hat Darstellungen auf GENAU EINER
|
||||
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 …).
|
||||
|
||||
Aufruf: python3 scripts/check-ifc-fachplaner.py datei.ifc [--geo] [--context] [--json] [--known=GlobalId,…]
|
||||
@@ -189,6 +193,16 @@ def check(path, want_geo, want_context, known=()):
|
||||
h = us.get_z(sh.geometry)
|
||||
if "Height" in q and abs(q["Height"] - h) > 0.01:
|
||||
problems.append(f"{label}: Height {q['Height']:.3f} ≠ Geometrie {h:.3f}")
|
||||
book = ps.get("Dossier_Qto_RoomBook", {})
|
||||
stats.setdefault("spaceHeights", {})[sp.Name] = {
|
||||
"Height": q.get("Height"),
|
||||
"FinishCeilingHeight": q.get("FinishCeilingHeight"),
|
||||
"ClearHeightMin": book.get("ClearHeightMin"),
|
||||
"ClearHeightMean": book.get("ClearHeightMean"),
|
||||
"geometry": h,
|
||||
}
|
||||
if "FinishCeilingHeight" not in q:
|
||||
problems.append(f"{label}: Qto_SpaceBaseQuantities.FinishCeilingHeight fehlt")
|
||||
|
||||
# ── Wände: Schichten und Volumen ──
|
||||
walls = m.by_type("IfcWall")
|
||||
@@ -237,6 +251,45 @@ def check(path, want_geo, want_context, known=()):
|
||||
problems.append(f"Geschoss {st.Name}: GrossFloorArea = NetFloorArea trotz Wänden (Konstruktionsfläche fehlt)")
|
||||
stats.setdefault("storeyQto", {})[st.Name] = {k: v for k, v in q.items() if k != "id"}
|
||||
|
||||
# ── Ebenen (IfcPresentationLayerAssignment) ──
|
||||
layer_of = {} # Darstellung -> Ebenen
|
||||
for la in m.by_type("IfcPresentationLayerAssignment"):
|
||||
for item in la.AssignedItems:
|
||||
layer_of.setdefault(item.id(), []).append(la.Name)
|
||||
stats["layers"] = sorted({la.Name for la in m.by_type("IfcPresentationLayerAssignment")})
|
||||
|
||||
def parts(e):
|
||||
yield e
|
||||
for r in getattr(e, "IsDecomposedBy", None) or []:
|
||||
for c in r.RelatedObjects:
|
||||
yield from parts(c)
|
||||
|
||||
stats["layered"] = 0
|
||||
for cls in ("IfcWall", "IfcSlab", "IfcRoof", "IfcColumn", "IfcStair", "IfcDoor", "IfcWindow", "IfcSpace"):
|
||||
for e in m.by_type(cls):
|
||||
if cls == "IfcGeographicElement":
|
||||
continue
|
||||
names = set()
|
||||
n_reps = 0
|
||||
for part in parts(e):
|
||||
if part.Representation is None:
|
||||
continue
|
||||
for rep in part.Representation.Representations:
|
||||
n_reps += 1
|
||||
ls = layer_of.get(rep.id(), [])
|
||||
if len(ls) != 1:
|
||||
problems.append(f"{cls} {e.Name!r} #{e.id()}: Darstellung {rep.RepresentationIdentifier} auf {len(ls)} Ebenen")
|
||||
names.update(ls)
|
||||
if len(names) > 1:
|
||||
problems.append(f"{cls} {e.Name!r} #{e.id()}: Darstellungen auf mehreren Ebenen {sorted(names)}")
|
||||
if n_reps and names:
|
||||
stats["layered"] += 1
|
||||
if stats["layered"] == 0 and m.by_type("IfcWall"):
|
||||
problems.append("keine Ebenen (IfcPresentationLayerAssignment) im Modell")
|
||||
for la in m.by_type("IfcPresentationLayerAssignment"):
|
||||
if not la.Name or "_" not in la.Name and not la.Name.isalnum():
|
||||
problems.append(f"Ebene {la.Name!r}: unerwarteter Name")
|
||||
|
||||
# ── Pset_*Common ──
|
||||
for cls, pset in (("IfcWall", "Pset_WallCommon"), ("IfcSlab", "Pset_SlabCommon"), ("IfcDoor", "Pset_DoorCommon"), ("IfcWindow", "Pset_WindowCommon")):
|
||||
missing = [e for e in m.by_type(cls) if pset not in ue.get_psets(e) and not (cls == "IfcSlab" and e.PredefinedType == "LANDING")]
|
||||
|
||||
@@ -57,6 +57,7 @@ const REC_CEILING_ARC: f64 = 21.0;
|
||||
const REC_SPACE_ARC: f64 = 22.0;
|
||||
const REC_GUIDS: f64 = 23.0;
|
||||
const REC_CONTEXT: f64 = 24.0;
|
||||
const REC_LAYERS: f64 = 25.0;
|
||||
|
||||
/// Toleranz des Kerns (`wall_bands.rs::EPS`) für „Öffnung trifft Band".
|
||||
const BAND_EPS: f64 = 1e-4;
|
||||
@@ -1521,12 +1522,23 @@ pub fn ifc_export_data(src: &Project, opt: &IfcOptions) -> Result<Flat, String>
|
||||
|
||||
// ── Räume → IfcSpace (im Geschoss aggregiert), Basismengen, SIA-416-Kategorie ──
|
||||
let mut room_areas: Vec<(String, String, SiaCategory, f64)> = Vec::new();
|
||||
let mut roof_cache: Vec<(String, crate::room_book::RoofPlanes)> = Vec::new();
|
||||
for room in p.rooms.as_deref().unwrap_or(&[]) {
|
||||
if room.boundary.len() < 3 {
|
||||
continue;
|
||||
}
|
||||
let structure = structure_of(&room.floor_id);
|
||||
let height = floors.iter().find(|fl| fl.id == room.floor_id).and_then(|fl| fl.floor_height).filter(|h| *h != 0.0 && !h.is_nan() && *h > 0.0).unwrap_or(2.5);
|
||||
// [259] Lichte Höhe wie im Raumbuch ([158]): Oberkante Boden bis Unterkante Decke darüber (`clear_range`); das
|
||||
// Geschossmass bleibt am IfcBuildingStorey. Unter Dachschrägen: Höhe = höchste Stelle (Körper), FinishCeilingHeight
|
||||
// = mittlere lichte Höhe, kleinste und mittlere Höhe zusätzlich in `Dossier_RoomBook`.
|
||||
let (range_lo, range_hi) = crate::room_book::clear_range(&p, room);
|
||||
let height = range_hi - range_lo;
|
||||
let storey_base_z = floors.iter().find(|fl| fl.id == room.floor_id).and_then(|fl| fl.base_elevation).filter(|v| v.is_finite()).unwrap_or(0.0);
|
||||
let z_rel = range_lo - storey_base_z;
|
||||
if !roof_cache.iter().any(|x| x.0 == room.floor_id) {
|
||||
roof_cache.push((room.floor_id.clone(), crate::room_book::roof_planes(&p, &room.floor_id)));
|
||||
}
|
||||
let roofs = &roof_cache.iter().find(|x| x.0 == room.floor_id).unwrap().1;
|
||||
let external = room.sia_category == SiaCategory::AGF;
|
||||
let area = crate::ring_arc::evaluate(&room.boundary, room.boundary_bulge.as_deref(), 0.0);
|
||||
room_areas.push((room.id.clone(), room.floor_id.clone(), room.sia_category, area.net));
|
||||
@@ -1538,8 +1550,9 @@ pub fn ifc_export_data(src: &Project, opt: &IfcOptions) -> Result<Flat, String>
|
||||
}
|
||||
common.push(Prop::Bool("IsExternal", external));
|
||||
let (id, name, long) = (f.str(&room.id), f.str(number.unwrap_or(&room.id)), f.str(&room.name));
|
||||
let bands = crate::room_book::height_bands(&p, room, roofs, area.net);
|
||||
let arcs = crate::ring_arc::has_arcs(room.boundary_bulge.as_deref(), room.boundary.len());
|
||||
f.nums(&[if arcs { REC_SPACE_ARC } else { REC_SPACE }, structure, id, name, long, if external { 1.0 } else { 0.0 }, height]);
|
||||
f.nums(&[if arcs { REC_SPACE_ARC } else { REC_SPACE }, structure, id, name, long, if external { 1.0 } else { 0.0 }, height, z_rel, bands.mean]);
|
||||
if arcs {
|
||||
w_bpts(&mut f, &room.boundary, room.boundary_bulge.as_deref());
|
||||
} else {
|
||||
@@ -1571,6 +1584,11 @@ pub fn ifc_export_data(src: &Project, opt: &IfcOptions) -> Result<Flat, String>
|
||||
if !book.is_empty() {
|
||||
psets.push(Pset { name: "Dossier_RoomBook", props: book });
|
||||
}
|
||||
// [259] Lichte Höhe unter Dachschrägen: kleinste und mittlere Höhe (Raumbuch [158]) als eigene Menge.
|
||||
psets.push(Pset {
|
||||
name: "Dossier_Qto_RoomBook",
|
||||
props: vec![Prop::Qty("ClearHeightMin", QtyKind::Length, bands.min), Prop::Qty("ClearHeightMean", QtyKind::Length, bands.mean)],
|
||||
});
|
||||
w_psets(&mut f, &psets);
|
||||
}
|
||||
f.num(REC_END_SPACES);
|
||||
@@ -1875,6 +1893,25 @@ pub fn ifc_export_data(src: &Project, opt: &IfcOptions) -> Result<Flat, String>
|
||||
classified.iter().filter_map(|(key, _, code)| layer_classification(&p, code).map(|(c, n)| (key.clone(), c, n))).collect();
|
||||
w_classification(&mut f, ("Dossier-Ebenen", "Dossier", ""), &refs);
|
||||
}
|
||||
// [259] Ebenen als IfcPresentationLayerAssignment (immer; Name wie die DXF-Ebene `Code_Bezeichnung`).
|
||||
let layered: Vec<(&String, String)> = classified
|
||||
.iter()
|
||||
.filter_map(|(key, _, code)| {
|
||||
let code = js_trim(code);
|
||||
if code.is_empty() {
|
||||
return None;
|
||||
}
|
||||
let name = p.layer_category(code).map_or_else(|| code.to_string(), |l| format!("{}_{}", l.code, l.name));
|
||||
Some((key, name))
|
||||
})
|
||||
.collect();
|
||||
if !layered.is_empty() {
|
||||
f.nums(&[REC_LAYERS, layered.len() as f64]);
|
||||
for (key, name) in &layered {
|
||||
let (a, b) = (f.str(key), f.str(name));
|
||||
f.nums(&[a, b]);
|
||||
}
|
||||
}
|
||||
Ok(f)
|
||||
}
|
||||
|
||||
@@ -2265,7 +2302,7 @@ mod tests {
|
||||
p = sample();
|
||||
p.walls[0].wall_type_id = "fehlt".into();
|
||||
let f = ifc_export_data(&p, &IfcOptions::default()).unwrap();
|
||||
assert_eq!(f.nums.last(), Some(&REC_END_COLUMNS));
|
||||
assert!(f.nums.contains(&REC_END_COLUMNS));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -2354,6 +2391,25 @@ mod tests {
|
||||
assert_eq!(fill_params(&p, &opening(ElementKind::Door, Some("dt"))).frame_depth, Some(0.16));
|
||||
}
|
||||
|
||||
/// [259] Ebenen im IFC (Datensatz LAYERS, Name wie die DXF-Ebene) und lichte Raumhöhe (Datensatz SPACE).
|
||||
#[test]
|
||||
fn ebenen_datensatz_und_lichte_raumhoehe() {
|
||||
let p = sample();
|
||||
let f = ifc_export_data(&p, &IfcOptions::default()).unwrap();
|
||||
let at = f.nums.iter().rposition(|v| *v == REC_LAYERS).expect("LAYERS");
|
||||
assert!(f.nums[at + 1] > 0.0);
|
||||
let name = f.strings[f.nums[at + 3] as usize].as_str();
|
||||
assert!(name.contains('_') || name.chars().all(|c| c.is_ascii_digit()), "{name}");
|
||||
// SPACE: height, z_rel, mittlere Höhe hinter `external`.
|
||||
let room = &p.rooms.as_ref().unwrap()[0];
|
||||
let at = (0..f.nums.len() - 9)
|
||||
.find(|&i| (f.nums[i] == REC_SPACE || f.nums[i] == REC_SPACE_ARC) && f.strings.get(f.nums[i + 2] as usize) == Some(&room.id))
|
||||
.expect("SPACE");
|
||||
let (h, z, mean) = (f.nums[at + 6], f.nums[at + 7], f.nums[at + 8]);
|
||||
let (lo, hi) = crate::room_book::clear_range(&p, room);
|
||||
assert!((h - (hi - lo)).abs() < 1e-9 && mean > 0.0 && mean <= h + 1e-9, "{h} {z} {mean}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn klassifikation_ebkph_und_ebenen() {
|
||||
assert_eq!(ebkph_group(Kind::Wall), Some(("C", "Konstruktion Gebäude")));
|
||||
|
||||
@@ -81,7 +81,8 @@
|
||||
// Mit mindestens einem Lauf/Podest/Geländer ist die IfcStair selbst ohne Darstellung und fasst Läufe,
|
||||
// Podest und Geländer per IfcRelAggregates zusammen (nur die Treppe liegt im Geschoss).
|
||||
// EXTRUSION = 6, structure, id, PTS, z_rel, depth
|
||||
// SPACE = 7, structure, id, name, long_name, external (0/1), height, PTS, net_area, gross_area,
|
||||
// SPACE = 7, structure, id, name, long_name, external (0/1), height (lichte Höhe), z_rel (Oberkante Boden über Geschoss),
|
||||
// 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
|
||||
@@ -91,6 +92,10 @@
|
||||
// Profil; EIN IfcColumn mit n Extrusionen in einer SweptSolid-Darstellung, Placement auf dem tiefsten
|
||||
// Abschnitt; Material und Materialzuordnung wie COLUMN; die Mengen stehen fertig in PSETS)
|
||||
// END_COLUMNS = 11 (Materialzuordnung der Stützen)
|
||||
// LAYERS = 25, n_refs, (key, layer_name) x n_refs ([259]) IfcPresentationLayerAssignment je Ebene (Name =
|
||||
// "Code_Bezeichnung" wie im DXF); alle Darstellungen des Bauteils `key` (wie bei CLASSIFICATION, samt
|
||||
// aggregierter Teile) liegen auf genau einer Ebene. (IFC4 erlaubt bei IfcPresentationLayerWithStyle nur
|
||||
// Geometrie-Items; Sichtbarkeit/Sperre der Klasse wird daher nicht geschrieben.)
|
||||
// CLASSIFICATION = 12, name, source, edition (Text, leer = keine), n_refs, (key, code, ref_name) × n_refs
|
||||
// ([B5], 28.10.) Ein Klassifikationssystem (IfcClassification) mit je Code einer
|
||||
// IfcClassificationReference und EINER IfcRelAssociatesClassification für alle Bauteile mit
|
||||
@@ -167,6 +172,7 @@ pub const REC_GRID: f64 = 18.0;
|
||||
pub const REC_GUIDS: f64 = 23.0;
|
||||
pub const REC_TREE: f64 = 19.0;
|
||||
pub const REC_CONTEXT: f64 = 24.0;
|
||||
pub const REC_LAYERS: f64 = 25.0;
|
||||
pub const REC_COLUMN_PIECES: f64 = 20.0;
|
||||
pub const REC_CEILING_ARC: f64 = 21.0;
|
||||
pub const REC_SPACE_ARC: f64 = 22.0;
|
||||
@@ -202,6 +208,7 @@ fn rec_name(code: f64) -> &'static str {
|
||||
c if c == REC_GUIDS => "GUIDS",
|
||||
c if c == REC_TREE => "TREE",
|
||||
c if c == REC_CONTEXT => "CONTEXT",
|
||||
c if c == REC_LAYERS => "LAYERS",
|
||||
c if c == REC_COLUMN_PIECES => "COLUMN_PIECES",
|
||||
_ => "?",
|
||||
}
|
||||
@@ -220,6 +227,80 @@ fn compound_angle(deg: f64, limit: f64) -> String {
|
||||
format!("({},{},{},{})", sg * d, sg * m, sg * s, sg * micro)
|
||||
}
|
||||
|
||||
/// Zerlegt die Parameter einer Entity-Zeile `#n=TYPE(a,b,...);` auf oberster Ebene (Klammern und Strings beachtet).
|
||||
fn split_args(line: &str) -> (String, Vec<String>) {
|
||||
let Some(open) = line.find('(') else { return (String::new(), vec![]) };
|
||||
let ty = line[line.find('=').map_or(0, |i| i + 1)..open].to_string();
|
||||
let body = line[open + 1..].trim_end_matches(';').trim_end_matches(')');
|
||||
let (mut out, mut cur, mut depth, mut quote) = (Vec::new(), String::new(), 0i32, false);
|
||||
for ch in body.chars() {
|
||||
match ch {
|
||||
'\'' => {
|
||||
quote = !quote;
|
||||
cur.push(ch);
|
||||
}
|
||||
'(' if !quote => {
|
||||
depth += 1;
|
||||
cur.push(ch);
|
||||
}
|
||||
')' if !quote => {
|
||||
depth -= 1;
|
||||
cur.push(ch);
|
||||
}
|
||||
',' if !quote && depth == 0 => out.push(std::mem::take(&mut cur)),
|
||||
_ => cur.push(ch),
|
||||
}
|
||||
}
|
||||
out.push(cur);
|
||||
(ty, out)
|
||||
}
|
||||
|
||||
fn ref_ids(arg: &str) -> Vec<usize> {
|
||||
arg.split('#').skip(1).filter_map(|t| t.split(|c: char| !c.is_ascii_digit()).next()?.parse().ok()).collect()
|
||||
}
|
||||
|
||||
/// IfcRelAggregates: Eltern-Entitaet -> Teile.
|
||||
fn aggregate_children(lines: &[String]) -> HashMap<usize, Vec<usize>> {
|
||||
let mut out: HashMap<usize, Vec<usize>> = HashMap::new();
|
||||
for l in lines.iter().filter(|l| l.contains("=IFCRELAGGREGATES(")) {
|
||||
let (_, a) = split_args(l);
|
||||
if let (Some(parent), Some(kids)) = (a.get(4).and_then(|x| ref_ids(x).first().copied()), a.get(5)) {
|
||||
out.entry(parent).or_default().extend(ref_ids(kids));
|
||||
}
|
||||
}
|
||||
out
|
||||
}
|
||||
|
||||
/// Alle IfcShapeRepresentation eines Bauteils samt seiner aggregierten Teile (Treppenlaeufe ...).
|
||||
fn shape_reps_of(lines: &[String], agg: &HashMap<usize, Vec<usize>>, entity: usize) -> Vec<usize> {
|
||||
let mut out = Vec::new();
|
||||
let mut todo = vec![entity];
|
||||
let mut guard = 0;
|
||||
while let Some(e) = todo.pop() {
|
||||
guard += 1;
|
||||
if guard > 10_000 {
|
||||
break;
|
||||
}
|
||||
if let Some(l) = lines.get(e.wrapping_sub(1)) {
|
||||
let (_, a) = split_args(l);
|
||||
// Product: GlobalId, OwnerHistory, Name, Description, ObjectType, ObjectPlacement, Representation
|
||||
if let Some(def) = a.get(6).and_then(|x| ref_ids(x).first().copied()) {
|
||||
if let Some(dl) = lines.get(def.wrapping_sub(1)) {
|
||||
let (ty, da) = split_args(dl);
|
||||
if ty == "IFCPRODUCTDEFINITIONSHAPE" {
|
||||
out.extend(da.get(2).map(|x| ref_ids(x)).unwrap_or_default());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if let Some(kids) = agg.get(&e) {
|
||||
todo.extend(kids.iter().copied());
|
||||
}
|
||||
}
|
||||
out
|
||||
}
|
||||
|
||||
|
||||
/// Baut aus dem flachen Puffer die STEP-Datei (IFC4 oder IFC2x3, je nach META). Fehler als Text.
|
||||
pub fn build_ifc(flat: &[f64], strings: &str) -> Result<String, String> {
|
||||
let mut r = Reader { buf: flat, pos: 0, strings: strings.split('\0').collect() };
|
||||
@@ -892,16 +973,18 @@ pub fn build_ifc(flat: &[f64], strings: &str) -> Result<String, String> {
|
||||
let long_name = r.string()?;
|
||||
let external = r.flag()?;
|
||||
let height = r.f()?;
|
||||
let z_rel = r.f()?;
|
||||
let ceiling_height = r.f()?;
|
||||
let pts = if arcs { r.bpts()? } else { r.pts()?.into_iter().map(|p| (p.0, p.1, 0.0)).collect() };
|
||||
let net = r.f()?;
|
||||
let gross = r.f()?;
|
||||
let sia = r.string()?;
|
||||
let psets = r.psets()?;
|
||||
let (placement, shape) = if arcs {
|
||||
w.emit_box_product_voids_arcs(&pts, &[], 0.0, height, w.placement_of(structure))
|
||||
w.emit_box_product_voids_arcs(&pts, &[], z_rel, height, w.placement_of(structure))
|
||||
} else {
|
||||
let plain: Vec<(f64, f64)> = pts.iter().map(|p| (p.0, p.1)).collect();
|
||||
w.emit_box_product(&plain, 0.0, height, w.placement_of(structure))
|
||||
w.emit_box_product(&plain, z_rel, height, w.placement_of(structure))
|
||||
};
|
||||
let g = w.gid(&format!("space/{id}"));
|
||||
let space = w.add(
|
||||
@@ -924,6 +1007,7 @@ pub fn build_ifc(flat: &[f64], strings: &str) -> Result<String, String> {
|
||||
let q_net = w.emit_quantity("IFCQUANTITYAREA", "NetFloorArea", net);
|
||||
let q_gross = w.emit_quantity("IFCQUANTITYAREA", "GrossFloorArea", gross);
|
||||
let q_height = w.emit_quantity("IFCQUANTITYLENGTH", "Height", height);
|
||||
let q_ceiling = w.emit_quantity("IFCQUANTITYLENGTH", "FinishCeilingHeight", ceiling_height);
|
||||
let g = w.gid(&format!("space/{id}/qto"));
|
||||
let qto = w.add(
|
||||
"IFCELEMENTQUANTITY",
|
||||
@@ -931,7 +1015,7 @@ pub fn build_ifc(flat: &[f64], strings: &str) -> Result<String, String> {
|
||||
"{g},#{},{},$,$,{}",
|
||||
w.owner_history,
|
||||
ifc_string("Qto_SpaceBaseQuantities"),
|
||||
refs(&[q_net, q_gross, q_height])
|
||||
refs(&[q_net, q_gross, q_height, q_ceiling])
|
||||
),
|
||||
);
|
||||
let g = w.gid(&format!("space/{id}/qto-rel"));
|
||||
@@ -1123,6 +1207,31 @@ pub fn build_ifc(flat: &[f64], strings: &str) -> Result<String, String> {
|
||||
}
|
||||
}
|
||||
}
|
||||
c if c == REC_LAYERS => {
|
||||
let n = r.idx()?;
|
||||
// Je Ebene in Reihenfolge des ersten Auftretens: (Name, Flags, Darstellungen); jede Darstellung nur einmal.
|
||||
let mut by_layer: Vec<(String, Vec<usize>)> = Vec::new();
|
||||
let mut seen: std::collections::HashSet<usize> = std::collections::HashSet::new();
|
||||
let agg = aggregate_children(&w.lines);
|
||||
for _ in 0..n {
|
||||
let key = r.string()?;
|
||||
let name = r.string()?;
|
||||
let Some(&entity) = w.elements.get(&key) else { continue };
|
||||
let reps: Vec<usize> = shape_reps_of(&w.lines, &agg, entity).into_iter().filter(|x| seen.insert(*x)).collect();
|
||||
if reps.is_empty() {
|
||||
continue;
|
||||
}
|
||||
if let Some((_, v)) = by_layer.iter_mut().find(|(c, _)| *c == name) {
|
||||
v.extend(reps);
|
||||
} else {
|
||||
by_layer.push((name, reps));
|
||||
}
|
||||
}
|
||||
for (name, items) in by_layer {
|
||||
// IfcPresentationLayerAssignment: Name, Description, AssignedItems, Identifier
|
||||
w.add("IFCPRESENTATIONLAYERASSIGNMENT", format!("{},$,{},$", ifc_string(&name), refs(&items)));
|
||||
}
|
||||
}
|
||||
c if c == REC_ZONE => {
|
||||
let key = r.string()?;
|
||||
let name = r.string()?;
|
||||
|
||||
@@ -257,7 +257,7 @@ fn full_house_in(mut b: B, with_geo: bool) -> B {
|
||||
b.str("R1");
|
||||
b.str("101");
|
||||
b.str("Wohnen");
|
||||
b.n(&[0.0, 2.5]);
|
||||
b.n(&[0.0, 2.5, 0.0, 2.5]);
|
||||
b.pts(&SQUARE);
|
||||
b.n(&[1.9, 2.0]);
|
||||
b.str("HNF");
|
||||
@@ -1355,3 +1355,29 @@ fn netz_wird_verschweisst() {
|
||||
assert_eq!(m.indices, vec![0, 1, 2, 1, 3, 2]);
|
||||
assert!(m.closed);
|
||||
}
|
||||
|
||||
/// [259] Ebenen: Darstellungen eines Bauteils (hier Raum und Stütze) liegen auf genau einer IfcPresentationLayerAssignment.
|
||||
#[test]
|
||||
fn ebenen_als_presentation_layer() {
|
||||
let mut b = full_house(true);
|
||||
b.n(&[REC_LAYERS, 3.0]);
|
||||
for (key, name) in [("space/R1", "60_Räume"), ("column/C1", "50_Stützen"), ("space/unbekannt", "99_x")] {
|
||||
b.str(key);
|
||||
b.str(name);
|
||||
}
|
||||
let ifc = build(&b).unwrap();
|
||||
check_structure(&ifc);
|
||||
assert_eq!(count(&ifc, "IFCPRESENTATIONLAYERASSIGNMENT"), 2, "unbekannte Schlüssel erzeugen keine Ebene");
|
||||
let layer = ifc.lines().find(|l| l.contains("IFCPRESENTATIONLAYERASSIGNMENT(\x27") && l.contains("St\\X2\\00FC\\X0\\tzen")).expect("Stützen-Ebene");
|
||||
assert!(layer.ends_with(",$);"), "{layer}");
|
||||
let mut seen = std::collections::HashSet::new();
|
||||
for l in ifc.lines().filter(|l| l.contains("IFCPRESENTATIONLAYERASSIGNMENT")) {
|
||||
let items = &l[l.find(",$,(").unwrap() + 4..];
|
||||
for id in items[..items.find(')').unwrap()].split(',') {
|
||||
assert!(seen.insert(id.to_string()), "Darstellung {id} doppelt");
|
||||
let target = ifc.lines().find(|x| x.starts_with(&format!("{id}="))).unwrap();
|
||||
assert!(target.contains("IFCSHAPEREPRESENTATION"), "{target}");
|
||||
}
|
||||
}
|
||||
assert_eq!(seen.len(), 2);
|
||||
}
|
||||
@@ -16,6 +16,7 @@ import { sampleProject } from "../model/sampleProject";
|
||||
import { buildComplexSampleProject } from "../model/sampleProjectComplex";
|
||||
import { buildWettbewerbSampleProject } from "../model/sampleProjectWettbewerb";
|
||||
import type { Drawing2D, Project } from "../model/types";
|
||||
import { roomBook } from "./roomBook";
|
||||
|
||||
const hasIfcOpenShell = spawnSync("python3", ["-c", "import ifcopenshell, ifcopenshell.validate, ifcopenshell.util.shape, _pytest"]).status === 0;
|
||||
|
||||
@@ -27,7 +28,7 @@ function writeIfc(name: string, ifc: string): string {
|
||||
|
||||
interface Check {
|
||||
problems: string[];
|
||||
stats: Record<string, unknown> & { counts: Record<string, number>; context: number; far: number; known: string[]; map?: number[]; storeyQto?: Record<string, Record<string, number>> };
|
||||
stats: Record<string, unknown> & { spaceHeights?: Record<string, { Height: number; FinishCeilingHeight: number; ClearHeightMin?: number; ClearHeightMean?: number }>; layers: string[]; layered: number; counts: Record<string, number>; context: number; far: number; known: string[]; map?: number[]; storeyQto?: Record<string, Record<string, number>> };
|
||||
}
|
||||
|
||||
/** Beide Prüfskripte; liefert die Kennwerte der inhaltlichen Prüfung. */
|
||||
@@ -43,6 +44,22 @@ function check(name: string, ifc: string, flags: string[]): Check {
|
||||
return out;
|
||||
}
|
||||
|
||||
/** [259] Lichte Raumhöhe = Raumbuch ±1 cm (Height = höchste Stelle, FinishCeilingHeight/Mittel unter Schrägen), Ebenen. */
|
||||
function expectRoomHeightsAndLayers(p: Project, c: Check) {
|
||||
const rows = roomBook(p).rows;
|
||||
expect(rows.length).toBeGreaterThan(0);
|
||||
for (const row of rows) {
|
||||
const h = c.stats.spaceHeights![row.number || row.id];
|
||||
expect(h, row.number).toBeDefined();
|
||||
expect(Math.abs(h.Height - row.clearHeight)).toBeLessThan(0.01);
|
||||
expect(Math.abs(h.FinishCeilingHeight - row.heightMean)).toBeLessThan(0.01);
|
||||
expect(Math.abs(h.ClearHeightMin! - row.heightMin)).toBeLessThan(0.01);
|
||||
expect(Math.abs(h.ClearHeightMean! - row.heightMean)).toBeLessThan(0.01);
|
||||
}
|
||||
expect(c.stats.layered).toBeGreaterThan(0);
|
||||
expect(c.stats.layers.some((n) => /^20_/.test(n))).toBe(true); // Wände wie die DXF-Ebene „20_…"
|
||||
}
|
||||
|
||||
/** Export mit festem Zeitstempel (Vergleich zweier Dateien). */
|
||||
function exportAt(p: Project, options: IfcExportOptions = {}): string {
|
||||
vi.useFakeTimers();
|
||||
@@ -59,6 +76,7 @@ describe.skipIf(!hasIfcOpenShell)("[259] IFC für Fachplaner (ifcopenshell)", {
|
||||
const c = check("musterhaus", exportIfcSpf(sampleProject), []);
|
||||
expect(c.stats.counts.IfcWall).toBe(sampleProject.walls.length);
|
||||
expect(c.stats.context).toBe(0);
|
||||
expectRoomHeightsAndLayers(sampleProject, c);
|
||||
});
|
||||
|
||||
it("Wettbewerb: georeferenziert (lokal + IfcMapConversion, ±0.00 = 441.30), Geschoss-GF mit Konstruktionsfläche", () => {
|
||||
@@ -69,6 +87,7 @@ describe.skipIf(!hasIfcOpenShell)("[259] IFC für Fachplaner (ifcopenshell)", {
|
||||
const eg = c.stats.storeyQto!.Erdgeschoss;
|
||||
expect(eg.GrossFloorArea).toBeGreaterThan(eg.NetFloorArea);
|
||||
expect(c.stats.spaces).toBe(p.rooms!.length);
|
||||
expectRoomHeightsAndLayers(p, c);
|
||||
});
|
||||
|
||||
it("Wettbewerb mit Kontext: Nachbargebäude am IfcSite, sonst nichts geändert", () => {
|
||||
@@ -83,6 +102,7 @@ describe.skipIf(!hasIfcOpenShell)("[259] IFC für Fachplaner (ifcopenshell)", {
|
||||
// (vereinigt) statt verschweisster Schalen — ifcopenshell zieht die Öffnung richtig ab (vorher 30.4 statt 7.5 m³).
|
||||
const k = check("komplex", exportIfcSpf(p), ["--geo"]);
|
||||
expect(k.stats.known).toEqual([]);
|
||||
expectRoomHeightsAndLayers(p, k);
|
||||
const c = check("komplex-kontext", exportIfcSpf(p, { context: true }), ["--geo", "--context"]);
|
||||
expect(c.stats.counts.IfcGeographicElement).toBeGreaterThanOrEqual(1); // Gelände (TERRAIN)
|
||||
expect(c.stats.context).toBe(2); // Gelände + Nachbargebäude; Höhenlinien und Baugrube nicht
|
||||
|
||||
Reference in new issue
Block a user