[97] Fenster- und Türliste: Kern-Abfrage (Nummer, Räume, Mass, Aufschlag, Brand-/Schallschutz, U-Wert, RC, aussen/innen), editierbare Tabelle in der Flächenbilanz, CSV/SVG/PDF, CLI schedule --openings

This commit is contained in:
Claude committed 2026-10-29 21:40:36 +00:00
1 parent d45f318f1e
commit a14da3e817
17 files changed
+737 -3

No files matched your search

+13 -1
View File
@@ -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
+1
View File
@@ -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;
+44
View File
@@ -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,
+256
View File
@@ -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());
}
}
+1
View File
@@ -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()),
+10
View File
@@ -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
View File
@@ -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`);
+1
View File
@@ -80,6 +80,7 @@ export type QueryName =
| "stairRailings"
| "roofMeshes"
| "roofCutLayers"
| "openingSchedule"
| "scheduleRows"
| "scheduleCsv"
| "pickGeometry"
+2
View File
@@ -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";
+35
View File
@@ -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([]);
});
});
+94
View File
@@ -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")] };
}
+34
View File
@@ -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;
+34
View File
@@ -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",
};
+22
View File
@@ -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). */
+147
View File
@@ -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>
);
}
+5
View File
@@ -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">
+19
View File
@@ -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;
}