[97][98] Merge: Fenster-/Türliste (Panel, CSV/SVG/PDF, CLI) und IFC Pset_*Common (Brand-/Schallschutz, U-Wert, RC, IsExternal/LoadBearing)
Claude-Session: https://claude.ai/code/session_01NTYBZBvLYCtugMJoKXaB67
This commit is contained in:
25 files changed
+984
-12
No files matched your search
@@ -1378,10 +1378,22 @@ Reihenfolge = Abhängigkeiten. Neue Geometrie entsteht in Rust ([K]).
|
||||
Zuständigkeitsbereich); Kanten-/Hof-Griffe im Grundriss; Mansarde mit Hof UND verschieden geneigten
|
||||
Kanten: zweite Dachschicht (Versatz > Knickbreite) nicht geschlossen; Schattenwurf (`sun.rs`) nimmt
|
||||
weiter die Hülle der Dachpunkte (Hof wirft Schatten).
|
||||
- ✅ **[97] Fenster- und Türliste** (= Teil von [29]). (29.10.) Kern `opening_schedule.rs` (Abfrage
|
||||
`openingSchedule`): je Öffnung Nummer (eingetragen oder automatisch `F1.01`/`T1.01` je Geschoss und Art),
|
||||
Typ, Geschoss, Räume beidseits der Wand (aus den Raum-Umrissen), Rohbau- und lichtes Mass (Tür: minus
|
||||
Rahmen), Brüstung, Band/Aufschlag/Richtung, Brandschutz (EI30), Schallschutz, U-Wert, Einbruchhemmung (RC),
|
||||
aussen/innen (eigene Angabe > Wand > Raumlage), Bemerkung. Neue optionale Modellfelder (nur Rust-Modell):
|
||||
`Opening.mark/fireRating/soundClass/uValue/burglaryClass/notes/isExternal`, `Wall`/`Ceiling` `isExternal`/
|
||||
`loadBearing`. Anzeige editierbar in der Flächenbilanz (`OpeningScheduleSection`), Export CSV/SVG/PDF über das
|
||||
Berichtsmodell des Flächennachweises, CLI `schedule --openings [--format json|csv|svg|pdf]`.
|
||||
Offen: Wand/Decke `isExternal`/`loadBearing` ohne UI (nur über Ops/IFC-Import setzbar; Objekt-Info fehlt);
|
||||
Tabelle noch nicht als Element auf dem Layout-Blatt (Layout-Blatt hat keinen Tabellen-Baustein); Typ-Vorgaben
|
||||
(Brand/Schall/U am Tür-/Fenstertyp) fehlen — die Werte liegen je Öffnung; Nummern nicht stabil bei
|
||||
Umordnung (automatisch nach Dokumentreihenfolge); nicht in der Tauri-App getestet.
|
||||
|
||||
## Priorität 4 — später
|
||||
|
||||
Alle ○: [27] Punktwolken (Leser ✅ [B9], Anzeige ◐ s. u., Modell offen) · [28] Phasen · [29] Bauteillisten (◐, Export vorhanden) · [43] Verknüpfte
|
||||
Alle ○: [27] Punktwolken (Leser ✅ [B9], Anzeige ◐ s. u., Modell offen) · [28] Phasen · [29] Bauteillisten (◐, Export vorhanden; Fenster-/Türliste ✅ [97]) · [43] Verknüpfte
|
||||
Modelle · [44] Aus Datei einfügen · [45] Favoriten · [68] Gelände mit Baugrube (= [T6]) · [71] U-Werte ·
|
||||
[72] Graue Energie KBOB · [73] eBKP-H · [74] SIA 500 · [75] Fluchtwege VKF · [83] Befehlspalette ·
|
||||
[85] Makro-Rekorder · [86] Pipette · [87] Fang mit Begründung · [48] Web-Worker
|
||||
@@ -1550,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,
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
// Fenster- und Türliste ([97]) im Flächenbilanz-Panel: Zeilen je Öffnung, Nummer und Kennwerte editieren.
|
||||
// Mit DOSSIER_SHOTS=<ordner> entsteht zusätzlich ein Screenshot für die Abnahme.
|
||||
import { expect, openSample, openTab, startNewProject, test } from "./app";
|
||||
|
||||
test("Fenster- und Türliste: Zeilen, Nummer und Brandschutz eintragen", async ({ page }) => {
|
||||
await startNewProject(page);
|
||||
await openSample(page);
|
||||
await openTab(page, "Flächenbilanz");
|
||||
const table = page.locator(".opening-table");
|
||||
await expect(table).toBeVisible();
|
||||
const rows = table.locator("tbody tr");
|
||||
expect(await rows.count()).toBeGreaterThan(1);
|
||||
// Automatische Nummern stehen als Platzhalter, das Feld selbst ist leer.
|
||||
const first = rows.first().locator(".opening-mark");
|
||||
await expect(first).toHaveAttribute("placeholder", /^F1\.01$/);
|
||||
await first.fill("F-Süd");
|
||||
await expect(rows.first().locator(".opening-mark")).toHaveValue("F-Süd");
|
||||
const door = table.locator("tbody tr", { hasText: "Tür" }).first();
|
||||
await door.locator("td").nth(9).locator("input").fill("EI30");
|
||||
await expect(door.locator("td").nth(9).locator("input")).toHaveValue("EI30");
|
||||
const shots = process.env.DOSSIER_SHOTS;
|
||||
if (shots) await page.locator(".opening-section").screenshot({ path: `${shots}/fenster-tuerliste.png` });
|
||||
});
|
||||
@@ -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<bool>, load_bearing: Option<bool>) -> Vec<Prop> {
|
||||
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<Flat, String>
|
||||
let openings: Vec<Opening> = p.openings.clone().unwrap_or_default();
|
||||
let wall_ident = |p: &Project, wall: &Wall, quantities: Vec<Qty>| -> (String, Option<TypeData>, Vec<Pset>) {
|
||||
let q = qto("Qto_WallBaseQuantities", quantities);
|
||||
// Aussen/tragend nur mit Angabe im Modell (nichts erfunden).
|
||||
let mut props: Vec<Prop> = 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<Flat, String>
|
||||
let mut name = c.id.clone();
|
||||
let mut ty: Option<TypeData> = None;
|
||||
let mut psets: Vec<Pset> = Vec::new();
|
||||
let mut slab_props: Vec<Prop> = 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<Flat, String>
|
||||
}
|
||||
"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<String>| 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);
|
||||
|
||||
@@ -45,6 +45,21 @@ struct Info {
|
||||
type_name: Option<String>,
|
||||
layers: Vec<MatLayer>,
|
||||
classified: bool,
|
||||
/// Eigenschaften aus `Pset_*Common` (Text).
|
||||
common: Map<String, Value>,
|
||||
}
|
||||
|
||||
impl Info {
|
||||
fn flag(&self, key: &str) -> Option<bool> {
|
||||
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<String> {
|
||||
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<String, Value>, 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<String, Value>, 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::<f64>().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<String, Value>, 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))}));
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
//! Datenübergabe: flache `f64`-Puffer (s. [`flat`]), kein JSON — schnell und ohne Serde-Kosten.
|
||||
|
||||
pub mod export_schedule;
|
||||
pub mod opening_schedule;
|
||||
pub mod flat;
|
||||
pub mod flat_write;
|
||||
pub mod polygon_bool;
|
||||
|
||||
@@ -1551,6 +1551,14 @@ pub struct Wall {
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub locked: Option<bool>,
|
||||
/// Aussen (true) / innen (false); fehlt = nicht angegeben (IFC `IsExternal`).
|
||||
#[serde(rename = "isExternal", default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub is_external: Option<bool>,
|
||||
/// Tragend (IFC `LoadBearing`); fehlt = nicht angegeben.
|
||||
#[serde(rename = "loadBearing", default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub load_bearing: Option<bool>,
|
||||
/// Achs-Startpunkt im Grundriss (Meter).
|
||||
pub start: Vec2,
|
||||
/// Achs-Endpunkt im Grundriss (Meter).
|
||||
@@ -1694,6 +1702,14 @@ pub struct Ceiling {
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub locked: Option<bool>,
|
||||
/// Aussen (true) / innen (false); fehlt = nicht angegeben (IFC `IsExternal`).
|
||||
#[serde(rename = "isExternal", default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub is_external: Option<bool>,
|
||||
/// Tragend (IFC `LoadBearing`); fehlt = nicht angegeben.
|
||||
#[serde(rename = "loadBearing", default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub load_bearing: Option<bool>,
|
||||
/// Geschlossener Umriss im Grundriss (Meter). Der Schlusspunkt wird NICHT
|
||||
/// dupliziert (die letzte Kante läuft von outline[n-1] zu outline[0]).
|
||||
pub outline: Vec<Vec2>,
|
||||
@@ -2092,6 +2108,34 @@ pub struct Opening {
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub locked: Option<bool>,
|
||||
/// Bauteilnummer (Fenster-/Türliste); leer = automatisch je Geschoss nummeriert.
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub mark: Option<String>,
|
||||
/// Feuerwiderstand (z. B. "EI30", "EI60"); Türliste, IFC `FireRating`.
|
||||
#[serde(rename = "fireRating", default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub fire_rating: Option<String>,
|
||||
/// Schallschutz (z. B. "Rw 32 dB"); IFC `AcousticRating`.
|
||||
#[serde(rename = "soundClass", default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub sound_class: Option<String>,
|
||||
/// Wärmedurchgang U in W/(m²K); IFC `ThermalTransmittance`.
|
||||
#[serde(rename = "uValue", default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub u_value: Option<f64>,
|
||||
/// Einbruchhemmung (z. B. "RC2"); IFC `SecurityRating`.
|
||||
#[serde(rename = "burglaryClass", default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub burglary_class: Option<String>,
|
||||
/// Bemerkung (Fenster-/Türliste).
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub notes: Option<String>,
|
||||
/// Aussen (true) / innen (false); fehlt = aus der Wand und den Räumen abgeleitet.
|
||||
#[serde(rename = "isExternal", default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub is_external: Option<bool>,
|
||||
/// Fenster oder Tür.
|
||||
#[ts(inline)]
|
||||
pub kind: ElementKind,
|
||||
|
||||
@@ -0,0 +1,256 @@
|
||||
//! Fenster- und Türliste ([97]): eine Zeile je Öffnung mit Nummer, Typ, Geschoss, angrenzenden Räumen
|
||||
//! (aus den Raum-Umrissen), Rohbau- und lichtem Mass, Brüstung, Aufschlag, Brandschutz, Schallschutz,
|
||||
//! U-Wert, Einbruchhemmung, aussen/innen und Bemerkung. Die Tabelle wird im Kern gerechnet; CSV, SVG und
|
||||
//! PDF formatiert die TS-Seite über das allgemeine Berichtsmodell (`export/openingSchedule.ts`).
|
||||
|
||||
use crate::jsmath::hypot2;
|
||||
use crate::model::*;
|
||||
use serde::Serialize;
|
||||
use std::collections::HashMap;
|
||||
|
||||
/// Eine Zeile der Fenster-/Türliste (JSON-Form: `OpeningScheduleRow` in TS).
|
||||
#[derive(Debug, Clone, PartialEq, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct OpeningScheduleRow {
|
||||
/// "door" oder "window".
|
||||
pub kind: &'static str,
|
||||
pub id: String,
|
||||
pub wall_id: String,
|
||||
/// Nummer: eingetragene oder automatische.
|
||||
pub mark: String,
|
||||
pub mark_auto: bool,
|
||||
pub type_name: String,
|
||||
pub floor: String,
|
||||
pub floor_id: String,
|
||||
/// Räume beidseits der Wand (links/rechts der Wandrichtung), `None` = kein Raum.
|
||||
pub room_left: Option<String>,
|
||||
pub room_right: Option<String>,
|
||||
/// Rohbaumass (Öffnung in der Wand), Meter.
|
||||
pub width: f64,
|
||||
pub height: f64,
|
||||
/// Lichtes Mass (Tür: abzüglich Rahmen), Meter.
|
||||
pub clear_width: f64,
|
||||
pub clear_height: f64,
|
||||
pub sill: f64,
|
||||
/// Nur Türen: "start"/"end" (Band), "left"/"right" (Aufschlag), "in"/"out".
|
||||
pub hinge: Option<&'static str>,
|
||||
pub swing: Option<&'static str>,
|
||||
pub dir: Option<&'static str>,
|
||||
pub fire_rating: String,
|
||||
pub sound_class: String,
|
||||
pub u_value: Option<f64>,
|
||||
pub burglary_class: String,
|
||||
/// Aussen (true) / innen (false); `None` = nicht bestimmbar.
|
||||
pub external: Option<bool>,
|
||||
pub notes: String,
|
||||
}
|
||||
|
||||
fn in_ring(x: f64, y: f64, ring: &[Vec2]) -> bool {
|
||||
let mut inside = false;
|
||||
let mut j = ring.len().wrapping_sub(1);
|
||||
for i in 0..ring.len() {
|
||||
let (a, b) = (&ring[i], &ring[j]);
|
||||
if (a.y > y) != (b.y > y) && x < (b.x - a.x) * (y - a.y) / (b.y - a.y) + a.x {
|
||||
inside = !inside;
|
||||
}
|
||||
j = i;
|
||||
}
|
||||
inside
|
||||
}
|
||||
|
||||
fn room_label(r: &Room) -> String {
|
||||
match r.stamp.as_ref().and_then(|s| s.number.as_deref()).filter(|n| !n.is_empty()) {
|
||||
Some(n) => format!("{n} {}", r.name),
|
||||
None => r.name.clone(),
|
||||
}
|
||||
}
|
||||
|
||||
fn room_at(p: &Project, floor_id: &str, x: f64, y: f64) -> Option<String> {
|
||||
p.rooms.as_deref().unwrap_or(&[]).iter().find(|r| r.floor_id == floor_id && in_ring(x, y, &r.boundary)).map(room_label)
|
||||
}
|
||||
|
||||
/// Räume links/rechts der Wand an der Achsposition `at` (Meter ab Wandanfang).
|
||||
fn rooms_beside(p: &Project, w: &Wall, at: f64) -> (Option<String>, Option<String>) {
|
||||
let (dx, dy) = (w.end.x - w.start.x, w.end.y - w.start.y);
|
||||
let len = hypot2(dx, dy);
|
||||
if !(len > 1e-9) {
|
||||
return (None, None);
|
||||
}
|
||||
let (ux, uy) = (dx / len, dy / len);
|
||||
let (px, py) = (w.start.x + ux * at, w.start.y + uy * at);
|
||||
let (nx, ny) = (-uy, ux);
|
||||
let d = Project::type_thickness(&p.wall_type_or_fallback(w).layers) + 0.1;
|
||||
(room_at(p, &w.floor_id, px + nx * d, py + ny * d), room_at(p, &w.floor_id, px - nx * d, py - ny * d))
|
||||
}
|
||||
|
||||
fn has_rooms(p: &Project, floor_id: &str) -> bool {
|
||||
p.rooms.as_deref().unwrap_or(&[]).iter().any(|r| r.floor_id == floor_id)
|
||||
}
|
||||
|
||||
/// Aussen/innen einer Öffnung: eigene Angabe, sonst die der Wand, sonst aus den Räumen (Raum auf nur
|
||||
/// einer Seite = Aussenwand; kein Raum auf beiden Seiten oder keine Räume im Geschoss = unbekannt).
|
||||
fn external_of(p: &Project, o: &Opening, w: &Wall, rooms: &(Option<String>, Option<String>)) -> Option<bool> {
|
||||
if let Some(e) = o.is_external.or(w.is_external) {
|
||||
return Some(e);
|
||||
}
|
||||
if !has_rooms(p, &w.floor_id) {
|
||||
return None;
|
||||
}
|
||||
match (rooms.0.is_some(), rooms.1.is_some()) {
|
||||
(false, false) => None,
|
||||
(a, b) => Some(a != b),
|
||||
}
|
||||
}
|
||||
|
||||
/// Aussen/innen für das IFC-Pset (gleiche Regel wie die Liste).
|
||||
pub fn opening_external(p: &Project, o: &Opening) -> Option<bool> {
|
||||
let w = p.walls.iter().find(|w| w.id == o.host_wall_id)?;
|
||||
external_of(p, o, w, &rooms_beside(p, w, o.position + o.width / 2.0))
|
||||
}
|
||||
|
||||
fn nz(s: &Option<String>) -> String {
|
||||
s.as_deref().map(str::trim).unwrap_or("").to_string()
|
||||
}
|
||||
|
||||
/// Alle Fenster und Türen als Tabelle: je Geschoss (Reihenfolge der Ebenen), Fenster vor Türen, dann
|
||||
/// Dokumentreihenfolge. Öffnungen ohne Wirtswand fehlen.
|
||||
pub fn opening_schedule(p: &Project) -> Vec<OpeningScheduleRow> {
|
||||
let mut rows = Vec::new();
|
||||
for o in p.openings.as_deref().unwrap_or(&[]) {
|
||||
let Some(w) = p.walls.iter().find(|w| w.id == o.host_wall_id) else { continue };
|
||||
let is_door = o.kind != ElementKind::Window;
|
||||
let rooms = rooms_beside(p, w, o.position + o.width / 2.0);
|
||||
let (type_name, frame) = if is_door {
|
||||
match p.door_type(o) {
|
||||
Some(t) => (t.name.clone(), o.frame_thickness.unwrap_or(t.frame_thickness)),
|
||||
None => (String::new(), o.frame_thickness.unwrap_or(0.0)),
|
||||
}
|
||||
} else {
|
||||
(p.window_type(o).map(|t| t.name.clone()).unwrap_or_default(), 0.0)
|
||||
};
|
||||
let (hinge, swing, dir) = if is_door && o.door_type != Some(OpeningDoorType::Wandoeffnung) {
|
||||
(
|
||||
Some(if o.hinge == Some(OpeningHinge::End) { "end" } else { "start" }),
|
||||
Some(if o.swing == Some(SwingSide::Right) { "right" } else { "left" }),
|
||||
Some(if o.opening_dir == Some(OpeningOpeningDir::Out) { "out" } else { "in" }),
|
||||
)
|
||||
} else {
|
||||
(None, None, None)
|
||||
};
|
||||
rows.push(OpeningScheduleRow {
|
||||
kind: if is_door { "door" } else { "window" },
|
||||
id: o.id.clone(),
|
||||
wall_id: w.id.clone(),
|
||||
mark: nz(&o.mark),
|
||||
mark_auto: false,
|
||||
type_name,
|
||||
floor: p.floor(&w.floor_id).map_or(w.floor_id.clone(), |f| f.name.clone()),
|
||||
floor_id: w.floor_id.clone(),
|
||||
external: external_of(p, o, w, &rooms),
|
||||
room_left: rooms.0,
|
||||
room_right: rooms.1,
|
||||
width: o.width,
|
||||
height: o.height,
|
||||
clear_width: if is_door { (o.width - 2.0 * frame).max(0.0) } else { o.width },
|
||||
clear_height: if is_door { (o.height - frame).max(0.0) } else { o.height },
|
||||
sill: o.sill_height,
|
||||
hinge,
|
||||
swing,
|
||||
dir,
|
||||
fire_rating: nz(&o.fire_rating),
|
||||
sound_class: nz(&o.sound_class),
|
||||
u_value: o.u_value.filter(|u| *u > 0.0),
|
||||
burglary_class: nz(&o.burglary_class),
|
||||
notes: nz(&o.notes),
|
||||
});
|
||||
}
|
||||
// Reihenfolge: Geschoss (Ebenen-Reihenfolge, unbekannte zuletzt), Fenster vor Türen, Dokument.
|
||||
let level_index = |id: &str| p.drawing_levels.iter().position(|l| l.id == id).unwrap_or(usize::MAX);
|
||||
rows.sort_by_key(|r| (level_index(&r.floor_id), r.kind == "door"));
|
||||
// Automatische Nummern: Präfix F/T + Geschoss-Nummer + laufende Zahl je Geschoss und Art.
|
||||
let mut count: HashMap<(String, &str), usize> = HashMap::new();
|
||||
for r in rows.iter_mut() {
|
||||
let n = count.entry((r.floor_id.clone(), r.kind)).or_insert(0);
|
||||
*n += 1;
|
||||
if r.mark.is_empty() {
|
||||
let lv = level_index(&r.floor_id);
|
||||
let lv = if lv == usize::MAX { 0 } else { lv + 1 };
|
||||
r.mark = format!("{}{}.{:02}", if r.kind == "door" { "T" } else { "F" }, lv, n);
|
||||
r.mark_auto = true;
|
||||
}
|
||||
}
|
||||
rows
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
fn v(x: f64, y: f64) -> Vec2 {
|
||||
Vec2 { x, y }
|
||||
}
|
||||
|
||||
fn sample() -> Project {
|
||||
let wall = |id: &str, a: Vec2, b: Vec2| Wall { id: id.into(), floor_id: "eg".into(), start: a, end: b, wall_type_id: "wt".into(), height: 2.6, ..Default::default() };
|
||||
let op = |id: &str, host: &str, kind: ElementKind, pos: f64| Opening { id: id.into(), host_wall_id: host.into(), kind, position: pos, width: 1.0, height: 2.1, ..Default::default() };
|
||||
let room = |id: &str, name: &str, pts: Vec<Vec2>| Room { id: id.into(), floor_id: "eg".into(), name: name.into(), boundary: pts, ..Default::default() };
|
||||
Project {
|
||||
drawing_levels: vec![DrawingLevel { id: "eg".into(), name: "EG".into(), ..Default::default() }, DrawingLevel { id: "og".into(), name: "OG".into(), ..Default::default() }],
|
||||
wall_types: vec![WallType { id: "wt".into(), name: "W".into(), layers: vec![Layer { thickness: 0.3, ..Default::default() }], ..Default::default() }],
|
||||
// Haus 0..6 × 0..4, Innenwand bei x = 3; Raum links "Wohnen", Raum rechts "Küche".
|
||||
walls: vec![wall("s", v(0.0, 0.0), v(6.0, 0.0)), wall("m", v(3.0, 0.0), v(3.0, 4.0))],
|
||||
rooms: Some(vec![
|
||||
room("r1", "Wohnen", vec![v(0.15, 0.15), v(2.85, 0.15), v(2.85, 3.85), v(0.15, 3.85)]),
|
||||
room("r2", "Küche", vec![v(3.15, 0.15), v(5.85, 0.15), v(5.85, 3.85), v(3.15, 3.85)]),
|
||||
]),
|
||||
openings: Some(vec![
|
||||
op("t1", "m", ElementKind::Door, 1.0),
|
||||
op("f1", "s", ElementKind::Window, 1.0),
|
||||
Opening { mark: Some("T-Eingang".into()), fire_rating: Some(" EI30 ".into()), u_value: Some(1.3), ..op("t2", "s", ElementKind::Door, 4.0) },
|
||||
]),
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn nummern_je_geschoss_fenster_vor_tueren() {
|
||||
let r = opening_schedule(&sample());
|
||||
let marks: Vec<_> = r.iter().map(|x| (x.id.as_str(), x.mark.as_str(), x.mark_auto)).collect();
|
||||
assert_eq!(marks, vec![("f1", "F1.01", true), ("t1", "T1.01", true), ("t2", "T-Eingang", false)]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn raeume_und_aussen_innen() {
|
||||
let r = opening_schedule(&sample());
|
||||
let t1 = r.iter().find(|x| x.id == "t1").unwrap();
|
||||
// Innenwand x = 3, Richtung +y: links (−x) = Wohnen, rechts = Küche.
|
||||
assert_eq!((t1.room_left.as_deref(), t1.room_right.as_deref()), (Some("Wohnen"), Some("Küche")));
|
||||
assert_eq!(t1.external, Some(false));
|
||||
// Südwand y = 0, Richtung +x: links (+y) liegt der Raum, rechts nichts → aussen.
|
||||
let f1 = r.iter().find(|x| x.id == "f1").unwrap();
|
||||
assert_eq!((f1.room_left.as_deref(), f1.room_right.as_deref()), (Some("Wohnen"), None));
|
||||
assert_eq!(f1.external, Some(true));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn eigene_angaben_und_lichtes_mass() {
|
||||
let mut p = sample();
|
||||
p.openings.as_mut().unwrap()[0].is_external = Some(true);
|
||||
p.walls[0].is_external = Some(false);
|
||||
let r = opening_schedule(&p);
|
||||
assert_eq!(r.iter().find(|x| x.id == "t1").unwrap().external, Some(true));
|
||||
assert_eq!(r.iter().find(|x| x.id == "f1").unwrap().external, Some(false), "Wandangabe gilt");
|
||||
let t2 = r.iter().find(|x| x.id == "t2").unwrap();
|
||||
assert_eq!((t2.fire_rating.as_str(), t2.u_value), ("EI30", Some(1.3)));
|
||||
assert_eq!((t2.hinge, t2.swing, t2.dir), (Some("start"), Some("left"), Some("in")));
|
||||
// Ohne Räume im Geschoss: unbekannt.
|
||||
p.rooms = None;
|
||||
p.walls[0].is_external = None;
|
||||
assert_eq!(opening_schedule(&p).iter().find(|x| x.id == "f1").unwrap().external, None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn leeres_projekt() {
|
||||
assert!(opening_schedule(&Project::default()).is_empty());
|
||||
}
|
||||
}
|
||||
@@ -37,6 +37,7 @@ pub fn run(p: &Project, name: &str, args: &[f64], text: &str) -> Result<String,
|
||||
("roofMeshes", _) => json(&model3d::emit_roofs(p, if text.is_empty() { None } else { Some(text) })?),
|
||||
("roofCutLayers", _) => json(&model3d::emit_roof_cut_layers(p)?),
|
||||
("scheduleRows", _) => json(&export_schedule::schedule_rows(p)),
|
||||
("openingSchedule", _) => json(&crate::opening_schedule::opening_schedule(p)),
|
||||
("scheduleCsv", 1) => Ok(export_schedule::export_schedule_csv(p, text, args[0] != 0.0)),
|
||||
("pickGeometry", _) => json(&model3d::pick_geometry(p)?),
|
||||
("modelJson", _) => crate::model::to_value_typed_only(p).map(|v| v.to_string()).map_err(|e| e.to_string()),
|
||||
|
||||
@@ -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(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,8 +77,14 @@ pub struct Info {
|
||||
pub layers: Vec<MatLayer>,
|
||||
/// Klassifikationen (eBKP-H, BKP ...) des Bauteils, sonst seines Typs.
|
||||
pub classifications: Vec<Classification>,
|
||||
/// Eigenschaften aus `Pset_*Common` (IsExternal, LoadBearing, FireRating, AcousticRating,
|
||||
/// ThermalTransmittance, SecurityRating, Reference) als Text; Wahrheitswerte "true"/"false".
|
||||
pub common: BTreeMap<String, String>,
|
||||
}
|
||||
|
||||
/// 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<u64, u64>,
|
||||
fills: HashMap<u64, Vec<u64>>,
|
||||
sia: HashMap<u64, String>,
|
||||
common: HashMap<u64, BTreeMap<String, String>>,
|
||||
storey_index: HashMap<u64, usize>,
|
||||
}
|
||||
|
||||
@@ -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<u64, Vec<u64>> = HashMap::new();
|
||||
let mut sia = HashMap::new();
|
||||
let mut common: HashMap<u64, BTreeMap<String, String>> = 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<f64>) {
|
||||
"typeName": i.type_name,
|
||||
"layers": i.layers.iter().map(|l| json!({ "material": l.material, "thickness": l.thickness, "color": l.color })).collect::<Vec<_>>(),
|
||||
"classifications": crate::ifc_import::classifications_json(&i.classifications),
|
||||
"common": i.common,
|
||||
})
|
||||
};
|
||||
let mut push = |kind: &str, i: &Info, extra: serde_json::Value, nums: Vec<f64>, data: &mut Vec<f64>| {
|
||||
@@ -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,
|
||||
|
||||
@@ -85,6 +85,16 @@ describe("dossier-cli", () => {
|
||||
}
|
||||
});
|
||||
|
||||
it("schedule --openings: Fenster- und Türliste als CSV und JSON", async () => {
|
||||
const out = join(dir, "fenster.csv");
|
||||
expect(await call("schedule", "--openings", "--out", out)).toBe(0);
|
||||
expect(readFileSync(out, "utf8")).toContain("Nr.;Typ;Geschoss");
|
||||
const json = join(dir, "fenster.json");
|
||||
expect(await call("schedule", "--openings", "--format", "json", "--out", json)).toBe(0);
|
||||
expect(JSON.parse(readFileSync(json, "utf8")).length).toBeGreaterThan(0);
|
||||
await expect(call("schedule", "--openings", "--format", "xls", "--out", out)).rejects.toThrow("--format");
|
||||
});
|
||||
|
||||
it("IFC mit --schema: 4 (Standard) und 2x3 (Coordination View 2.0), anderes ist ein Fehler", async () => {
|
||||
const out = join(dir, "schema.ifc");
|
||||
expect(await call("ifc", "--out", out)).toBe(0);
|
||||
|
||||
+19
-2
@@ -11,7 +11,7 @@
|
||||
// dossier-cli <projekt.obp> elevation <Name> [--out ansicht.svg]
|
||||
// dossier-cli <projekt.obp> ifc [--ebkph] [--ebenen] (IFC mit eBKP-H-Hauptgruppen bzw. Modell-Ebenen als Klassifikation)
|
||||
// --schema 4|2x3: IFC4 (Standard) oder IFC2x3 (Coordination View 2.0)
|
||||
// dossier-cli <projekt.obp> dxf [--binary] [--scale 100] [--dim-unit cm] [--layout]|dwg|ifc|step|obj|stl|glb|gltf|schedule|kennzahlen [--sia416] [--ivhb] [--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]
|
||||
// dossier-cli <projekt.obp> dxf [--binary] [--scale 100] [--dim-unit cm] [--layout]|dwg|ifc|step|obj|stl|glb|gltf|schedule [--openings] [--format json|csv|svg|pdf]|kennzahlen [--sia416] [--ivhb] [--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)
|
||||
// dossier-cli convert <eingabe> <ausgabe> [--cmd "befehl"]… Format nach Endung: dxf/dwg/ifc/obp → obp-Import,
|
||||
// obp → dxf/dwg/ifc/obj/stl/glb/gltf/step; --cmd: weitere Befehle
|
||||
@@ -61,6 +61,8 @@ import {
|
||||
computeAreaTable,
|
||||
computeIvhb,
|
||||
buildAreaReport,
|
||||
buildOpeningReport,
|
||||
openingSchedule,
|
||||
areaReportToCsv,
|
||||
areaReportToSvg,
|
||||
buildAreaReportPdf,
|
||||
@@ -714,9 +716,24 @@ async function execute(project: Project, file: string, command: string, rest: st
|
||||
out(args, JSON.stringify({ when: when.toISOString(), lat, lon, sun, shadows: shadowPolygons(project, sun) }, null, 2), `${project.name || "projekt"}-sonne.json`);
|
||||
return 0;
|
||||
}
|
||||
case "schedule":
|
||||
case "schedule": {
|
||||
// --openings: Fenster- und Türliste statt Bauteilliste [--format json|csv|svg|pdf] (Default csv)
|
||||
if (args.flags.has("openings")) {
|
||||
const format = args.flags.get("format") ?? "csv";
|
||||
const stem = `${project.name || "projekt"}-fenster-tueren`;
|
||||
if (format === "json") out(args, JSON.stringify(openingSchedule(project), null, 2), `${stem}.json`);
|
||||
else {
|
||||
const report = buildOpeningReport(project);
|
||||
if (format === "csv") out(args, areaReportToCsv(report), `${stem}.csv`);
|
||||
else if (format === "svg") out(args, areaReportToSvg(report), `${stem}.svg`);
|
||||
else if (format === "pdf") out(args, new Uint8Array(buildAreaReportPdf(report).output("arraybuffer")), `${stem}.pdf`);
|
||||
else throw new Error("--format: json, csv, svg oder pdf");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
out(args, exportScheduleCsv(project), `${project.name || "projekt"}-liste.csv`);
|
||||
return 0;
|
||||
}
|
||||
case "step": {
|
||||
const r = await exportProjectStep(project, project.name || "projekt");
|
||||
if (r.skipped.length) process.stderr.write(`${r.skipped.length} Körper übersprungen/ungeschnitten.\n`);
|
||||
|
||||
@@ -80,6 +80,7 @@ export type QueryName =
|
||||
| "stairRailings"
|
||||
| "roofMeshes"
|
||||
| "roofCutLayers"
|
||||
| "openingSchedule"
|
||||
| "scheduleRows"
|
||||
| "scheduleCsv"
|
||||
| "pickGeometry"
|
||||
|
||||
@@ -31,6 +31,8 @@ export type { RoomProgramCompare, RoomProgramLayout, CompareRow, CompareSum, Lig
|
||||
export { readSheetFile, suggestMapping, mapRows, importedRows, applyRoomProgram, roomProgramOps, cellNumber, cellText, detectHeaderRow, parseKind, PROGRAM_FIELDS } from "../io/roomProgramImport";
|
||||
export type { SheetData, SheetCell, Mapping, ColumnMap, ProgramField, ImportLine, ImportMode, SkipReason } from "../io/roomProgramImport";
|
||||
export { buildProgramReport } from "../export/programReport";
|
||||
export { openingSchedule, buildOpeningReport, roomsText, externalText, swingText } from "../export/openingSchedule";
|
||||
export type { OpeningScheduleRow } from "../export/openingSchedule";
|
||||
export { computeAreaTable, computeIvhb } from "../analysis/areaTable";
|
||||
export type { AreaTable, AreaRow, Ivhb, IvhbOptions, AgfBasis } from "../analysis/areaTable";
|
||||
export { buildAreaReport, areaReportToCsv, parseAreaReportCsv, areaReportToSvg, buildAreaReportPdf } from "../export/areaReport";
|
||||
|
||||
@@ -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'");
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { sampleProject } from "../model/sampleProject";
|
||||
import type { Project } from "../model/types";
|
||||
import { areaReportToCsv, parseAreaReportCsv } from "./areaReport";
|
||||
import { buildOpeningReport, openingSchedule } from "./openingSchedule";
|
||||
|
||||
const p: Project = {
|
||||
...sampleProject,
|
||||
name: "Test",
|
||||
openings: (sampleProject.openings ?? []).map((o, i) =>
|
||||
i === 0 ? { ...o, mark: "T-Haus", fireRating: "EI30", soundClass: "Rw 32 dB", uValue: 1.4, burglaryClass: "RC2", notes: 'Eingang; mit "Zusatz"', isExternal: true } : o,
|
||||
),
|
||||
};
|
||||
|
||||
describe("Fenster- und Türliste", () => {
|
||||
it("eine Zeile je Öffnung, eigene Angaben übernommen, Rest automatisch nummeriert", () => {
|
||||
const rows = openingSchedule(p);
|
||||
expect(rows.length).toBe((p.openings ?? []).length);
|
||||
const first = rows.find((r) => r.id === p.openings![0]!.id)!;
|
||||
expect(first).toMatchObject({ mark: "T-Haus", markAuto: false, fireRating: "EI30", soundClass: "Rw 32 dB", uValue: 1.4, burglaryClass: "RC2", external: true });
|
||||
for (const r of rows.filter((r) => r.id !== first.id)) expect(r.markAuto).toBe(true);
|
||||
expect(new Set(rows.map((r) => r.mark)).size).toBe(rows.length);
|
||||
});
|
||||
it("Bericht: Abschnitte je Art, CSV-Rundreise", () => {
|
||||
const rep = buildOpeningReport(p);
|
||||
expect(rep.sections.length).toBeGreaterThan(0);
|
||||
const parsed = parseAreaReportCsv(areaReportToCsv(rep));
|
||||
const all = parsed.sections.flatMap((s) => s.rows);
|
||||
expect(all.length).toBe((p.openings ?? []).length);
|
||||
expect(all.some((r) => r[0] === "T-Haus" && r.includes('Eingang; mit "Zusatz"'))).toBe(true);
|
||||
});
|
||||
it("leeres Projekt: kein Abschnitt", () => {
|
||||
expect(buildOpeningReport({ ...p, openings: [] }).sections).toEqual([]);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,94 @@
|
||||
// Fenster- und Türliste ([97]): eine Zeile je Öffnung. Gerechnet wird im Rust-Kern
|
||||
// (`src-tauri/core/src/opening_schedule.rs`, Abfrage `openingSchedule`); hier nur die Beschriftung mit `t()`
|
||||
// und der Berichtsaufbau, damit CSV, SVG und PDF dieselbe Quelle haben wie der Flächennachweis
|
||||
// (`areaReport.ts`: `areaReportToCsv` / `areaReportToSvg` / `buildAreaReportPdf`).
|
||||
|
||||
import type { Project } from "../model/types";
|
||||
import { t } from "../i18n";
|
||||
import { documentFor } from "../core/document";
|
||||
import type { AreaReport, Cell, ReportRow, ReportSection } from "./areaReport";
|
||||
|
||||
/** Eine Zeile der Fenster-/Türliste (Form wie `OpeningScheduleRow` im Kern). */
|
||||
export interface OpeningScheduleRow {
|
||||
kind: "door" | "window";
|
||||
id: string;
|
||||
wallId: string;
|
||||
/** Nummer: eingetragene oder automatische. */
|
||||
mark: string;
|
||||
markAuto: boolean;
|
||||
typeName: string;
|
||||
floor: string;
|
||||
floorId: string;
|
||||
/** Räume links/rechts der Wandrichtung; `null` = kein Raum. */
|
||||
roomLeft: string | null;
|
||||
roomRight: string | null;
|
||||
/** Rohbaumass in Metern. */
|
||||
width: number;
|
||||
height: number;
|
||||
/** Lichtes Mass in Metern (Tür: abzüglich Rahmen). */
|
||||
clearWidth: number;
|
||||
clearHeight: number;
|
||||
sill: number;
|
||||
hinge: "start" | "end" | null;
|
||||
swing: "left" | "right" | null;
|
||||
dir: "in" | "out" | null;
|
||||
fireRating: string;
|
||||
soundClass: string;
|
||||
uValue: number | null;
|
||||
burglaryClass: string;
|
||||
/** `null` = nicht bestimmbar. */
|
||||
external: boolean | null;
|
||||
notes: string;
|
||||
}
|
||||
|
||||
/** Alle Fenster und Türen des Projekts (Kern-Abfrage). */
|
||||
export function openingSchedule(project: Project): OpeningScheduleRow[] {
|
||||
return documentFor(project).query<OpeningScheduleRow[]>("openingSchedule");
|
||||
}
|
||||
|
||||
const num = (n: number | null, d: number): Cell => ({ n: n !== null && Number.isFinite(n) ? n : null, d });
|
||||
|
||||
/** „Wohnen ↔ Küche" bzw. der eine Raum; leer ohne Räume. */
|
||||
export function roomsText(r: Pick<OpeningScheduleRow, "roomLeft" | "roomRight">): string {
|
||||
const rooms = [r.roomLeft, r.roomRight].filter((x): x is string => !!x);
|
||||
return rooms.join(" ↔ ");
|
||||
}
|
||||
|
||||
export function externalText(e: boolean | null): string {
|
||||
return e === null ? "" : e ? t("openings.external") : t("openings.internal");
|
||||
}
|
||||
|
||||
/** Aufschlag einer Tür als Text (Band, Aufschlagseite, Richtung). */
|
||||
export function swingText(r: Pick<OpeningScheduleRow, "hinge" | "swing" | "dir">): string {
|
||||
if (!r.hinge || !r.swing || !r.dir) return "";
|
||||
return `${t(`openings.hinge.${r.hinge}`)} · ${t(`openings.swing.${r.swing}`)} · ${t(`openings.dir.${r.dir}`)}`;
|
||||
}
|
||||
|
||||
function windowSection(rows: OpeningScheduleRow[]): ReportSection {
|
||||
return {
|
||||
heading: t("openings.windows"),
|
||||
columns: [t("openings.col.mark"), t("openings.col.type"), t("openings.col.floor"), t("openings.col.rooms"), t("openings.col.width"), t("openings.col.height"), t("openings.col.sill"), t("openings.col.sound"), t("openings.col.u"), t("openings.col.rc"), t("openings.col.ext"), t("openings.col.notes")],
|
||||
widths: [1.4, 2.4, 1.4, 3.2, 1.2, 1.2, 1.2, 1.6, 1.1, 1.1, 1.4, 3],
|
||||
rows: rows.map((r): ReportRow => ({ cells: [r.mark, r.typeName, r.floor, roomsText(r), num(r.width, 2), num(r.height, 2), num(r.sill, 2), r.soundClass, num(r.uValue, 2), r.burglaryClass, externalText(r.external), r.notes] })),
|
||||
};
|
||||
}
|
||||
|
||||
function doorSection(rows: OpeningScheduleRow[]): ReportSection {
|
||||
return {
|
||||
heading: t("openings.doors"),
|
||||
columns: [t("openings.col.mark"), t("openings.col.type"), t("openings.col.floor"), t("openings.col.rooms"), t("openings.col.width"), t("openings.col.height"), t("openings.col.clearWidth"), t("openings.col.clearHeight"), t("openings.col.swing"), t("openings.col.fire"), t("openings.col.sound"), t("openings.col.u"), t("openings.col.rc"), t("openings.col.ext"), t("openings.col.notes")],
|
||||
widths: [1.4, 2.2, 1.3, 3, 1.1, 1.1, 1.2, 1.2, 2.6, 1.1, 1.5, 1, 1, 1.3, 2.6],
|
||||
rows: rows.map((r): ReportRow => ({ cells: [r.mark, r.typeName, r.floor, roomsText(r), num(r.width, 2), num(r.height, 2), num(r.clearWidth, 2), num(r.clearHeight, 2), swingText(r), r.fireRating, r.soundClass, num(r.uValue, 2), r.burglaryClass, externalText(r.external), r.notes] })),
|
||||
};
|
||||
}
|
||||
|
||||
/** Bericht „Fenster- und Türliste": ein Abschnitt je Art (nur wenn vorhanden), Masse in Metern. */
|
||||
export function buildOpeningReport(project: Project): AreaReport {
|
||||
const rows = openingSchedule(project);
|
||||
const sections: ReportSection[] = [];
|
||||
const windows = rows.filter((r) => r.kind === "window");
|
||||
const doors = rows.filter((r) => r.kind === "door");
|
||||
if (windows.length) sections.push(windowSection(windows));
|
||||
if (doors.length) sections.push(doorSection(doors));
|
||||
return { title: t("openings.title"), projectName: project.name ?? "", sections, notes: [t("openings.foot")] };
|
||||
}
|
||||
@@ -2632,6 +2632,40 @@ export const de = {
|
||||
"history.coll.penSets": "Stiftsatz",
|
||||
"history.coll.customPalettes": "Palette",
|
||||
"history.coll.blockDefs": "Blockdefinition",
|
||||
"openings.title": "Fenster- und Türliste",
|
||||
"openings.windows": "Fenster",
|
||||
"openings.doors": "Türen",
|
||||
"openings.foot": "Rohbaumasse in Metern; lichtes Mass der Tür = Rohbaumass abzüglich Rahmen. Aussen/innen folgt aus der Raumlage der Wand, wenn nichts angegeben ist.",
|
||||
"openings.external": "aussen",
|
||||
"openings.internal": "innen",
|
||||
"openings.hinge.start": "Band am Anfang",
|
||||
"openings.hinge.end": "Band am Ende",
|
||||
"openings.swing.left": "Aufschlag links",
|
||||
"openings.swing.right": "Aufschlag rechts",
|
||||
"openings.dir.in": "nach innen",
|
||||
"openings.dir.out": "nach aussen",
|
||||
"openings.col.mark": "Nr.",
|
||||
"openings.col.type": "Typ",
|
||||
"openings.col.floor": "Geschoss",
|
||||
"openings.col.rooms": "Räume",
|
||||
"openings.col.width": "Breite [m]",
|
||||
"openings.col.height": "Höhe [m]",
|
||||
"openings.col.clearWidth": "Lichte Breite [m]",
|
||||
"openings.col.clearHeight": "Lichte Höhe [m]",
|
||||
"openings.col.sill": "Brüstung [m]",
|
||||
"openings.col.swing": "Aufschlag",
|
||||
"openings.col.fire": "Brand",
|
||||
"openings.col.sound": "Schall",
|
||||
"openings.col.u": "U [W/m²K]",
|
||||
"openings.col.rc": "Einbruch",
|
||||
"openings.col.ext": "Aussen/innen",
|
||||
"openings.col.notes": "Bemerkung",
|
||||
"openings.exportCsv": "CSV",
|
||||
"openings.exportPdf": "PDF",
|
||||
"openings.exportPdf.fail": "PDF konnte nicht erstellt werden.",
|
||||
"openings.empty": "Keine Fenster oder Türen im Projekt.",
|
||||
"openings.markAuto": "automatische Nummer, zum Festlegen eintippen",
|
||||
"openings.extAuto": "automatisch",
|
||||
} as const;
|
||||
|
||||
export type TranslationKey = keyof typeof de;
|
||||
@@ -2618,4 +2618,38 @@ export const en: Record<TranslationKey, string> = {
|
||||
"history.coll.penSets": "pen set",
|
||||
"history.coll.customPalettes": "palette",
|
||||
"history.coll.blockDefs": "block definition",
|
||||
"openings.title": "Window and door schedule",
|
||||
"openings.windows": "Windows",
|
||||
"openings.doors": "Doors",
|
||||
"openings.foot": "Structural sizes in metres; clear door size = structural size minus frame. External/internal follows from the rooms beside the wall unless set.",
|
||||
"openings.external": "external",
|
||||
"openings.internal": "internal",
|
||||
"openings.hinge.start": "hinge at start",
|
||||
"openings.hinge.end": "hinge at end",
|
||||
"openings.swing.left": "swings left",
|
||||
"openings.swing.right": "swings right",
|
||||
"openings.dir.in": "inwards",
|
||||
"openings.dir.out": "outwards",
|
||||
"openings.col.mark": "No.",
|
||||
"openings.col.type": "Type",
|
||||
"openings.col.floor": "Level",
|
||||
"openings.col.rooms": "Rooms",
|
||||
"openings.col.width": "Width [m]",
|
||||
"openings.col.height": "Height [m]",
|
||||
"openings.col.clearWidth": "Clear width [m]",
|
||||
"openings.col.clearHeight": "Clear height [m]",
|
||||
"openings.col.sill": "Sill [m]",
|
||||
"openings.col.swing": "Swing",
|
||||
"openings.col.fire": "Fire",
|
||||
"openings.col.sound": "Sound",
|
||||
"openings.col.u": "U [W/m²K]",
|
||||
"openings.col.rc": "Burglary",
|
||||
"openings.col.ext": "Ext./int.",
|
||||
"openings.col.notes": "Notes",
|
||||
"openings.exportCsv": "CSV",
|
||||
"openings.exportPdf": "PDF",
|
||||
"openings.exportPdf.fail": "Could not create the PDF.",
|
||||
"openings.empty": "No windows or doors in the project.",
|
||||
"openings.markAuto": "automatic number, type to set your own",
|
||||
"openings.extAuto": "automatic",
|
||||
};
|
||||
@@ -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) => {
|
||||
|
||||
@@ -69,6 +69,10 @@ export type Ceiling = {
|
||||
categoryCode: string;
|
||||
/** Objekt-Sperre, analog `Wall.locked`. */
|
||||
locked?: boolean;
|
||||
/** Aussen (true) / innen (false); fehlt = nicht angegeben (IFC `IsExternal`). */
|
||||
isExternal?: boolean;
|
||||
/** Tragend (IFC `LoadBearing`); fehlt = nicht angegeben. */
|
||||
loadBearing?: boolean;
|
||||
/**
|
||||
* Geschlossener Umriss im Grundriss (Meter). Der Schlusspunkt wird NICHT
|
||||
* dupliziert (die letzte Kante läuft von outline[n-1] zu outline[0]).
|
||||
@@ -1525,6 +1529,20 @@ export type Opening = {
|
||||
categoryCode: string;
|
||||
/** Objekt-Sperre, analog `Wall.locked`. */
|
||||
locked?: boolean;
|
||||
/** Bauteilnummer (Fenster-/Türliste); leer = automatisch je Geschoss nummeriert. */
|
||||
mark?: string;
|
||||
/** Feuerwiderstand (z. B. "EI30", "EI60"); Türliste, IFC `FireRating`. */
|
||||
fireRating?: string;
|
||||
/** Schallschutz (z. B. "Rw 32 dB"); IFC `AcousticRating`. */
|
||||
soundClass?: string;
|
||||
/** Wärmedurchgang U in W/(m²K); IFC `ThermalTransmittance`. */
|
||||
uValue?: number;
|
||||
/** Einbruchhemmung (z. B. "RC2"); IFC `SecurityRating`. */
|
||||
burglaryClass?: string;
|
||||
/** Bemerkung (Fenster-/Türliste). */
|
||||
notes?: string;
|
||||
/** Aussen (true) / innen (false); fehlt = aus der Wand und den Räumen abgeleitet. */
|
||||
isExternal?: boolean;
|
||||
/** Fenster oder Tür. */
|
||||
kind: "window" | "door";
|
||||
/** Abstand des ersten Pfostens vom Wand-Startpunkt entlang der Achse (Meter). */
|
||||
@@ -2636,6 +2654,10 @@ export type Wall = {
|
||||
* Geschoss-Sperrmodus (`DisplayMode`) ist das hier persistiert.
|
||||
*/
|
||||
locked?: boolean;
|
||||
/** Aussen (true) / innen (false); fehlt = nicht angegeben (IFC `IsExternal`). */
|
||||
isExternal?: boolean;
|
||||
/** Tragend (IFC `LoadBearing`); fehlt = nicht angegeben. */
|
||||
loadBearing?: boolean;
|
||||
/** Achs-Startpunkt im Grundriss (Meter). */
|
||||
start: Vec2;
|
||||
/** Achs-Endpunkt im Grundriss (Meter). */
|
||||
|
||||
@@ -0,0 +1,147 @@
|
||||
// Fenster- und Türliste im Flächenbilanz-Panel ([97]): eine Zeile je Öffnung mit Nummer, Typ, Geschoss,
|
||||
// angrenzenden Räumen, Mass, Aufschlag und den Kennwerten (Brand-, Schallschutz, U-Wert, Einbruchhemmung,
|
||||
// aussen/innen, Bemerkung). Die Zeilen rechnet der Kern (`openingSchedule`, abgeleitet aus Modell und
|
||||
// Räumen); die Kennwert-Felder sind direkt in der Tabelle editierbar (Ops mit coalesceKey: Tippen = ein
|
||||
// Undo-Schritt). CSV und PDF kommen aus demselben Berichtsmodell wie der Flächennachweis.
|
||||
|
||||
import { useMemo } from "react";
|
||||
import { t } from "../i18n";
|
||||
import { usePanelHost } from "./host";
|
||||
import { areaReportToCsv, buildAreaReportPdf, buildOpeningReport, externalText, openingSchedule, patchItem, roomsText, swingText } from "../core";
|
||||
import type { OpeningScheduleRow } from "../core";
|
||||
import type { Opening, Project } from "../model/types";
|
||||
import { downloadCsv } from "./downloadFile";
|
||||
import { useStore } from "../state/appStore";
|
||||
|
||||
type TextField = "mark" | "fireRating" | "soundClass" | "burglaryClass" | "notes";
|
||||
|
||||
const m2 = (v: number) => v.toFixed(2);
|
||||
|
||||
export function OpeningScheduleSection() {
|
||||
const host = usePanelHost();
|
||||
const project = host.project;
|
||||
const applyChange = useStore((s) => s.applyChange);
|
||||
const notify = useStore((s) => s.notify);
|
||||
const rows = useMemo(() => openingSchedule(project), [project]);
|
||||
const stem = `${project.name || "projekt"}-fenster-tueren`;
|
||||
|
||||
const patch = (id: string, change: Partial<Opening>, field: string) =>
|
||||
applyChange((p: Project) => patchItem(p, "openings", id, change), `opening:${id}:${field}`);
|
||||
const setText = (id: string, field: TextField, text: string) => patch(id, { [field]: text.trim() === "" ? undefined : text } as Partial<Opening>, field);
|
||||
const setU = (id: string, text: string) => {
|
||||
const v = Number(text.replace(",", "."));
|
||||
patch(id, { uValue: text.trim() !== "" && Number.isFinite(v) && v > 0 ? v : undefined }, "uValue");
|
||||
};
|
||||
const setExternal = (id: string, value: string) => patch(id, { isExternal: value === "" ? undefined : value === "ext" }, "isExternal");
|
||||
|
||||
const exportPdf = () => {
|
||||
try {
|
||||
buildAreaReportPdf(buildOpeningReport(project)).save(`${stem}.pdf`);
|
||||
} catch {
|
||||
notify(t("openings.exportPdf.fail"));
|
||||
}
|
||||
};
|
||||
const select = (r: OpeningScheduleRow) => host.onSelectScheduleRow(r.kind === "door" ? "Tür" : "Fenster", r.id, r.floorId);
|
||||
|
||||
const textInput = (r: OpeningScheduleRow, field: TextField, value: string, className = "") => (
|
||||
<input type="text" className={`kz-input opening-input ${className}`} value={value} onChange={(e) => setText(r.id, field, e.target.value)} />
|
||||
);
|
||||
|
||||
return (
|
||||
<div className="area-section opening-section">
|
||||
<div className="balance-head">
|
||||
<span className="balance-section-label">{t("openings.title")}</span>
|
||||
{rows.length > 0 && (
|
||||
<span className="area-actions">
|
||||
<button type="button" className="balance-export" onClick={() => downloadCsv(`${stem}.csv`, areaReportToCsv(buildOpeningReport(project)))}>
|
||||
{t("openings.exportCsv")}
|
||||
</button>
|
||||
<button type="button" className="balance-export" onClick={exportPdf}>
|
||||
{t("openings.exportPdf")}
|
||||
</button>
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
{rows.length === 0 ? (
|
||||
<div className="balance-empty">{t("openings.empty")}</div>
|
||||
) : (
|
||||
<div className="area-scroll">
|
||||
<table className="area-table opening-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{t("openings.col.mark")}</th>
|
||||
<th>{t("openings.col.type")}</th>
|
||||
<th>{t("openings.col.floor")}</th>
|
||||
<th>{t("openings.col.rooms")}</th>
|
||||
<th className="num">{t("openings.col.width")}</th>
|
||||
<th className="num">{t("openings.col.height")}</th>
|
||||
<th className="num">{t("openings.col.clearWidth")}</th>
|
||||
<th className="num">{t("openings.col.sill")}</th>
|
||||
<th>{t("openings.col.swing")}</th>
|
||||
<th>{t("openings.col.fire")}</th>
|
||||
<th>{t("openings.col.sound")}</th>
|
||||
<th className="num">{t("openings.col.u")}</th>
|
||||
<th>{t("openings.col.rc")}</th>
|
||||
<th>{t("openings.col.ext")}</th>
|
||||
<th>{t("openings.col.notes")}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{rows.map((r) => {
|
||||
const own = project.openings?.find((o) => o.id === r.id);
|
||||
const door = r.kind === "door";
|
||||
return (
|
||||
<tr key={r.id}>
|
||||
<td title={r.markAuto ? t("openings.markAuto") : undefined}>
|
||||
<input
|
||||
type="text"
|
||||
className="kz-input opening-input opening-mark"
|
||||
value={r.markAuto ? "" : r.mark}
|
||||
placeholder={r.mark}
|
||||
onChange={(e) => setText(r.id, "mark", e.target.value)}
|
||||
/>
|
||||
</td>
|
||||
<td>{r.typeName}</td>
|
||||
<td className="opening-select" onClick={() => select(r)}>
|
||||
{r.floor}
|
||||
</td>
|
||||
<td>{roomsText(r)}</td>
|
||||
<td className="num">{m2(r.width)}</td>
|
||||
<td className="num">{m2(r.height)}</td>
|
||||
<td className="num">{door ? `${m2(r.clearWidth)} × ${m2(r.clearHeight)}` : ""}</td>
|
||||
<td className="num">{door ? "" : m2(r.sill)}</td>
|
||||
<td>{swingText(r)}</td>
|
||||
<td>{door ? textInput(r, "fireRating", r.fireRating, "opening-short") : ""}</td>
|
||||
<td>{textInput(r, "soundClass", r.soundClass, "opening-short")}</td>
|
||||
<td className="num">
|
||||
<input
|
||||
type="text"
|
||||
inputMode="decimal"
|
||||
className="kz-input kz-num opening-input opening-short"
|
||||
defaultValue={r.uValue === null ? "" : String(r.uValue)}
|
||||
key={`${r.id}:${r.uValue}`}
|
||||
onBlur={(e) => setU(r.id, e.target.value)}
|
||||
/>
|
||||
</td>
|
||||
<td>{textInput(r, "burglaryClass", r.burglaryClass, "opening-short")}</td>
|
||||
<td>
|
||||
<select className="kz-input" value={own?.isExternal === undefined ? "" : own.isExternal ? "ext" : "int"} onChange={(e) => setExternal(r.id, e.target.value)}>
|
||||
<option value="">{`${t("openings.extAuto")}${r.external === null ? "" : `: ${externalText(r.external)}`}`}</option>
|
||||
<option value="ext">{t("openings.external")}</option>
|
||||
<option value="int">{t("openings.internal")}</option>
|
||||
</select>
|
||||
</td>
|
||||
<td>{textInput(r, "notes", r.notes)}</td>
|
||||
</tr>
|
||||
);
|
||||
})}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
)}
|
||||
<ul className="area-notes">
|
||||
<li>{t("openings.foot")}</li>
|
||||
</ul>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -14,6 +14,7 @@ import type { Room } from "../model/types";
|
||||
import { roomDisplayName } from "../model/roomStamp";
|
||||
import { KennzahlenSection } from "./KennzahlenSection";
|
||||
import { AreaTableSection } from "./AreaTableSection";
|
||||
import { OpeningScheduleSection } from "./OpeningScheduleSection";
|
||||
import { downloadCsv } from "./downloadFile";
|
||||
|
||||
/** Löst je Raum die anrechenbare (Netto-)Fläche + Kategorie auf. */
|
||||
@@ -42,6 +43,7 @@ export function RoomBalancePanel() {
|
||||
<div className="balance-panel">
|
||||
<KennzahlenSection />
|
||||
<AreaTableSection />
|
||||
<OpeningScheduleSection />
|
||||
<div className="balance-empty">{t("balance.empty")}</div>
|
||||
</div>
|
||||
);
|
||||
@@ -77,6 +79,9 @@ export function RoomBalancePanel() {
|
||||
{/* Flächentabelle und IVHB-Kennziffern. */}
|
||||
<AreaTableSection />
|
||||
|
||||
{/* Fenster- und Türliste. */}
|
||||
<OpeningScheduleSection />
|
||||
|
||||
{/* Raumliste (je Raum: Name · Geschoss · SIA · Fläche). */}
|
||||
<div className="balance-section-label">{t("balance.rooms")}</div>
|
||||
<div className="balance-table">
|
||||
|
||||
@@ -8592,3 +8592,22 @@ body {
|
||||
.history-row.future {
|
||||
opacity: 0.45;
|
||||
}
|
||||
|
||||
/* Fenster- und Türliste im Flächenbilanz-Panel ([97]). */
|
||||
.opening-input {
|
||||
width: 100%;
|
||||
min-width: 70px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.opening-input.opening-short {
|
||||
min-width: 52px;
|
||||
width: 64px;
|
||||
}
|
||||
.opening-input.opening-mark {
|
||||
min-width: 56px;
|
||||
width: 64px;
|
||||
}
|
||||
.opening-table td.opening-select {
|
||||
cursor: pointer;
|
||||
text-decoration: underline dotted;
|
||||
}
|
||||
Reference in new issue
Block a user