[255] Baurecht-Nachweis: Ausnützung (GFZ/AZ/BMZ/ÜZ/GZ), Höhen und Grenzabstand gegen das Modell als Tabelle (Panel, CSV/PDF, Blatt-Tabelle, CLI)

This commit is contained in:
Claude committed 2026-11-14 02:14:12 +00:00
1 parent 4d8500104d
commit 3eef56563e
21 files changed
+690 -15

No files matched your search

+9 -2
View File
@@ -10,7 +10,7 @@ Wer zu einer ID mehr wissen will (Entscheide, Tests, Bilder), sucht dort nach `*
stehen im Archiv („Bewusst nicht übernommen“).
- **Grösse** (eine Person mit Agenten): S ≤ 1 Tag · M ≤ 1 Woche · L ≤ 1 Monat · XL > 1 Monat.
Steht keine Grösse im Archiv, ist sie hier geschätzt.
- **IDs sind stabil.** Neue ID = nächste freie Zahl nach der höchsten im Archiv und hier (aktuell 254);
- **IDs sind stabil.** Neue ID = nächste freie Zahl nach der höchsten im Archiv und hier (aktuell 255);
nie eine ID wiederverwenden oder umnummerieren. Präfix-IDs (`[K]`, `[G]`, `[T]`, `[B]`, `[C]`) bleiben.
- **Pro Punkt:** was fehlt · wo im Code · Grösse. Höchstens ein bis drei Sätze je Punkt;
Messwerte und Befunde gehören in den Commit.
@@ -267,7 +267,14 @@ Kennwort, anonym) als PDF; Austausch mit Fachplanern über DXF/IFC.
- 1:100-Pläne in Abgabequalität (Bemassung, Koten, Raumstempel, Öffnungen nach Detailgrad) — Plan-Review-Runde 4 nach [199].
- Fachplaner-Austausch: DXF/DWG je Geschoss/Schnitt/Ansicht ([200]), IFC mit Räumen/Psets ([201]); Rundreise in Archicad/Revit einmal
real prüfen ([C9]).
- Baurecht-Hülle/Ausnützung (AZ/ÜZ) gegen Modell als Nachweis-Tabelle.
- ◐ **[255]** Baurecht-Nachweis: Ausnützung gegen Modell als Tabelle (14.11.). Kern `site_proof.rs` (Abfrage `siteProof`) stellt die Vorgaben
der Parzelle den Kennzahlen gegenüber: GFZ, AZ, BMZ, ÜZ, GZ (min.), Gesamt-/Fassadenhöhe, Grundfläche ausserhalb Grenzabstand/Baulinie,
Gebäudeprofil; je Zeile zulässig · Projekt · Reserve/Überschreitung · erfüllt, fehlende Vorgabe als „—“ (nichts erfunden), dazu Grundlagen
(aGSF, zulässige Fläche, GF, aGF, aGbF, Baumasse, Grünfläche) mit Quelle. Neue Modellfelder `SiteRules.maxGfz/maxAz/maxBmz/maxUz/minGz/
maxFacadeHeight` (Eingabe im Lage-Panel, Baurecht). Ausgabe: Flächenbilanz-Panel (zwei Abschnitte im Berichtsmodell, daher auch CSV/PDF/SVG),
Blatt-Tabelle Quelle „siteProof“ (wie [209]), CLI `kennzahlen --nachweis`. Tests: `site_proof::tests`, `sheet_table::tests::baurecht_nachweis_tabelle`,
`src/analysis/siteProof.test.ts`. Offen: Blatt-Tabelle nimmt aGSF/Grünfläche nicht aus den Panel-Eingaben (nur Parzellenfläche/-grenze),
Grünfläche nur per Eingabe, Grenzabstand als Verstossfläche statt kleinster Abstand, Fassadenhöhe nur über ±0.00, Mac/Tauri nicht geprüft. · S
### Phase 4 (4.–12.12.): Härten und veröffentlichen
- Nur noch Fehler aus dem Referenz-Ablauf; Leistung mit grossen Kontext-Importen; keine neuen Funktionen.
+2 -2
View File
@@ -572,7 +572,7 @@ pub fn ivhb(p: &Project, opt: &IvhbOptions) -> Ivhb {
}
#[cfg(test)]
mod tests {
pub(crate) mod tests {
use super::*;
fn close(a: f64, b: f64) -> bool {
@@ -582,7 +582,7 @@ mod tests {
/// Einfaches Haus: Achsen 10 × 8 m, Wände 0.3 m, Räume innen 9.7 × 7.7 m.
/// EG (HNF 9.7×4 = 38.8, NNF 9.7×1.7 = 16.49, VF 9.7×2 = 19.4), OG (HNF 74.69),
/// UG (FF 74.69) unter ±0.00. Geschosshöhe 2.6 m.
fn house() -> Project {
pub(crate) fn house() -> Project {
let json = r#"{
"drawingLevels":[
{"id":"ug","name":"UG","kind":"floor","visible":true,"locked":false,"baseElevation":-2.6,"floorHeight":2.6},
+1
View File
@@ -23,6 +23,7 @@ pub mod sun;
pub mod tree;
pub mod camera;
pub mod site_rules;
pub mod site_proof;
pub mod auto_dimensions;
pub mod kennzahlen;
pub mod flaechen;
+27
View File
@@ -2733,6 +2733,30 @@ pub struct SiteRules {
#[serde(rename = "maxHeight", default, skip_serializing_if = "Option::is_none")]
#[ts(optional)]
pub max_height: Option<f64>,
/// Zulässige Fassadenhöhe (m, höchste Wandoberkante über ±0.00) für den Baurecht-Nachweis.
#[serde(rename = "maxFacadeHeight", default, skip_serializing_if = "Option::is_none")]
#[ts(optional)]
pub max_facade_height: Option<f64>,
/// Zulässige Geschossflächenziffer GFZ (IVHB) für den Baurecht-Nachweis.
#[serde(rename = "maxGfz", default, skip_serializing_if = "Option::is_none")]
#[ts(optional)]
pub max_gfz: Option<f64>,
/// Zulässige Ausnützungsziffer AZ (aGF / aGSF) für den Baurecht-Nachweis.
#[serde(rename = "maxAz", default, skip_serializing_if = "Option::is_none")]
#[ts(optional)]
pub max_az: Option<f64>,
/// Zulässige Baumassenziffer BMZ (m³/m²) für den Baurecht-Nachweis.
#[serde(rename = "maxBmz", default, skip_serializing_if = "Option::is_none")]
#[ts(optional)]
pub max_bmz: Option<f64>,
/// Zulässige Überbauungsziffer ÜZ (aGbF / aGSF) für den Baurecht-Nachweis.
#[serde(rename = "maxUz", default, skip_serializing_if = "Option::is_none")]
#[ts(optional)]
pub max_uz: Option<f64>,
/// Mindest-Grünflächenziffer GZ für den Baurecht-Nachweis.
#[serde(rename = "minGz", default, skip_serializing_if = "Option::is_none")]
#[ts(optional)]
pub min_gz: Option<f64>,
/// Parzelle, zulässige Fläche und Verstösse im Grundriss zeigen (Default: ja).
#[serde(default, skip_serializing_if = "Option::is_none")]
#[ts(optional)]
@@ -5570,6 +5594,9 @@ pub enum LayoutTableSource {
/// [209] Kostenschätzung grob (eBKP-H-Hauptgruppen, Zuschläge, Total).
#[serde(rename = "costs")]
Costs,
/// [255] Baurecht-Nachweis (AZ/ÜZ/Höhen: zulässig, Projekt, Reserve, erfüllt).
#[serde(rename = "siteProof")]
SiteProof,
#[serde(other)]
#[ts(skip)]
Unknown,
+5
View File
@@ -80,6 +80,11 @@ pub fn run(p: &Project, name: &str, args: &[f64], text: &str) -> Result<String,
let opt: flaechen::IvhbOptions = if text.trim().is_empty() { Default::default() } else { serde_json::from_str(text).map_err(|e| format!("ivhb: {e}"))? };
json(&flaechen::ivhb(p, &opt))
}
// [255] Baurecht-Nachweis (Vorgaben der Parzelle gegen Kennzahlen); Text = `IvhbOptions` als JSON.
("siteProof", _) => {
let opt: flaechen::IvhbOptions = if text.trim().is_empty() { Default::default() } else { serde_json::from_str(text).map_err(|e| format!("siteProof: {e}"))? };
json(&crate::site_proof::site_proof(p, &opt))
}
("programCompare", _) => json(&room_program::compare(p)),
("programLayout", _) => {
let opt: room_program::LayoutOptions = if text.trim().is_empty() { Default::default() } else { serde_json::from_str(text).map_err(|e| format!("programLayout: {e}"))? };
+67 -1
View File
@@ -128,6 +128,15 @@ const COSTS: &[Col] = &[
c("amount", "sheetTable.col.amount", 1.8, true, true),
];
/// [255] Baurecht-Nachweis.
const SITE_PROOF: &[Col] = &[
c("item", "siteProof.col.item", 4.6, false, true),
c("allowed", "siteProof.col.allowed", 1.4, true, true),
c("actual", "siteProof.col.actual", 1.4, true, true),
c("reserve", "siteProof.col.reserve", 1.8, true, true),
c("ok", "siteProof.col.ok", 1.0, false, true),
];
/// [158] Raumbuch-Spalten, die nur erscheinen, wenn ein Raum eine Dachschräge hat.
const SLOPE_COLS: &[&str] = &["heightMin", "heightMean", "areaUnder1", "area1To15"];
@@ -178,6 +187,18 @@ pub const VALUE_KEYS: &[&str] = &[
"costs.row.vat",
"costs.row.gross",
"costs.lump",
"siteProof.ok.yes",
"siteProof.ok.no",
"siteProof.none",
"siteProof.row.gfz",
"siteProof.row.az",
"siteProof.row.bmz",
"siteProof.row.uz",
"siteProof.row.gz",
"siteProof.row.totalHeight",
"siteProof.row.facadeHeight",
"siteProof.row.setback",
"siteProof.row.profile",
];
pub fn catalog(source: LayoutTableSource) -> &'static [Col] {
@@ -189,6 +210,7 @@ pub fn catalog(source: LayoutTableSource) -> &'static [Col] {
LayoutTableSource::Earthworks => EARTHWORKS,
LayoutTableSource::RoomBook => ROOM_BOOK,
LayoutTableSource::Costs => COSTS,
LayoutTableSource::SiteProof => SITE_PROOF,
}
}
@@ -196,7 +218,7 @@ pub fn catalog(source: LayoutTableSource) -> &'static [Col] {
pub fn catalog_json() -> Value {
let one = |s: &[Col]| s.iter().map(|k| json!({"id": k.id, "key": k.key, "numeric": k.numeric, "default": k.default})).collect::<Vec<_>>();
json!({
"sources": {"openings": one(OPENINGS), "areas": one(AREAS), "rooms": one(ROOMS), "elements": one(ELEMENTS), "earthworks": one(EARTHWORKS), "roomBook": one(ROOM_BOOK), "costs": one(COSTS)},
"sources": {"openings": one(OPENINGS), "areas": one(AREAS), "rooms": one(ROOMS), "elements": one(ELEMENTS), "earthworks": one(EARTHWORKS), "roomBook": one(ROOM_BOOK), "costs": one(COSTS), "siteProof": one(SITE_PROOF)},
"valueKeys": VALUE_KEYS,
})
}
@@ -333,6 +355,7 @@ fn data_of(p: &Project, t: &LayoutTable, lb: &Labels) -> Data {
LayoutTableSource::Earthworks => earthworks_data(p, lb),
LayoutTableSource::RoomBook => room_book_data(p, lb),
LayoutTableSource::Costs => costs_data(p, lb),
LayoutTableSource::SiteProof => site_proof_data(p, lb),
}
}
@@ -395,6 +418,27 @@ fn costs_data(p: &Project, lb: &Labels) -> Data {
Data { rows, sloped: false, total_last: true }
}
/// [255] Baurecht-Nachweis: eine Zeile je Prüfgrösse; fehlende Vorgabe/Projektwert als „—“. Ohne Angaben aus dem
/// Dokument (IVHB-Optionen) rechnet der Nachweis mit Parzellenfläche bzw. Parzellengrenze.
fn site_proof_data(p: &Project, lb: &Labels) -> Data {
let pr = crate::site_proof::site_proof(p, &Default::default());
let dash = || txt(lb.get("siteProof.none"));
let val = |v: Option<f64>, d: usize| v.filter(|x| x.is_finite()).map_or_else(dash, |x| num(x, d));
let rows = pr
.rows
.iter()
.map(|r| {
let ok = match r.ok {
Some(true) => txt(lb.get("siteProof.ok.yes")),
Some(false) => txt(lb.get("siteProof.ok.no")),
None => dash(),
};
vec![txt(lb.get(&format!("siteProof.row.{}", r.key))), val(r.allowed, r.decimals), val(r.actual, r.decimals), val(r.reserve, r.decimals), ok]
})
.collect();
Data { rows, sloped: false, total_last: false }
}
/// [68] Erdarbeiten je Baugrube (m³ gegen das gewachsene Terrain) mit Summenzeile.
fn earthworks_data(p: &Project, lb: &Labels) -> Data {
let q = crate::excavation::quantities(p);
@@ -830,4 +874,26 @@ mod tests {
assert_eq!(crate::area_report::fmt_num(-999.0, 0, true), "-999");
assert_eq!(crate::area_report::fmt_num(-1000.0, 0, true), "-1'000");
}
/// [255] Baurecht-Nachweis als Blatt-Tabelle: ohne Vorgaben überall „—“, mit Vorgabe zulässig/Projekt/Reserve/ja-nein.
#[test]
fn baurecht_nachweis_tabelle() {
let mut t = table("n", None);
t.source = LayoutTableSource::SiteProof;
let mut p = project(0, vec![t]);
p.parcel_area = Some(400.0);
let lb = Labels::parse(&json!({"siteProof.none": "—", "siteProof.ok.yes": "ja", "siteProof.ok.no": "nein", "siteProof.row.az": "AZ", "siteProof.row.totalHeight": "Gesamthöhe"}));
let r = render(&p, &p.layouts.as_ref().unwrap()[0], &lb);
assert_eq!(r[0].total, 8, "7 Ziffern/Höhen + Grenzabstand");
let tx = texts(&r[0]);
assert!(tx.contains(&"AZ".to_string()) && tx.contains(&"—".to_string()), "{tx:?}");
assert!(!tx.contains(&"ja".to_string()) && !tx.contains(&"nein".to_string()), "ohne Vorgaben nichts erfüllt/verletzt: {tx:?}");
// Mit Vorgabe AZ 0.001 (überschritten, falls das Projekt Flächen hat) bzw. Höhe 100 m.
let mut rules = crate::model::SiteRules::default();
rules.max_height = Some(100.0);
p.site_rules = Some(rules);
let tx = texts(&render(&p, &p.layouts.as_ref().unwrap()[0], &lb)[0]);
assert!(tx.contains(&"100.00".to_string()), "{tx:?}");
assert_eq!(serde_json::to_value(LayoutTableSource::SiteProof).unwrap(), "siteProof");
assert!(catalog_json()["sources"]["siteProof"].as_array().unwrap().len() == 5);
}
}
+255
View File
@@ -0,0 +1,255 @@
//! Baurecht-Nachweis ([255]): die Vorgaben der Parzelle (`Project.siteRules`) gegen die Kennzahlen des Modells
//! (IVHB-Ziffern, Höhen, Grundfläche gegen Grenzabstand/Baulinie). Eine Zeile je Prüfgrösse: zulässig · Projekt ·
//! Reserve (positiv) bzw. Überschreitung (negativ) · erfüllt. Fehlt die Vorgabe, bleibt `allowed`/`ok` leer (die UI
//! zeigt „—“) — nichts wird erfunden. Dazu die Grundlagen (aGSF, GF, aGF, aGbF, Baumasse, Grünfläche) mit Quelle.
//! Die Ziffern kommen aus `flaechen::ivhb`, die Prüfung der Grundfläche aus `site_rules::check_project`:
//! eine Quelle mit Flächentabelle und Lage-Panel.
use crate::flaechen::{self, AgfBasis, AgsfSource, IvhbOptions};
use crate::model::Project;
use crate::site_rules;
use serde::Serialize;
/// Obergrenze (`Max`: Projekt ≤ zulässig) oder Untergrenze (`Min`: Projekt ≥ zulässig).
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize)]
#[serde(rename_all = "camelCase")]
pub enum Limit {
Max,
Min,
}
#[derive(Debug, Clone, PartialEq, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ProofRow {
/// gfz, az, bmz, uz, gz, totalHeight, facadeHeight, setback, profile.
pub key: &'static str,
pub limit: Limit,
pub allowed: Option<f64>,
pub actual: Option<f64>,
/// Max: zulässig − Projekt; Min: Projekt − zulässig (negativ = Überschreitung bzw. Unterschreitung).
pub reserve: Option<f64>,
/// `None`, wenn Vorgabe oder Projektwert fehlt.
pub ok: Option<bool>,
pub decimals: usize,
pub unit: &'static str,
}
#[derive(Debug, Clone, PartialEq, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ProofBasis {
/// agsf, allowedArea, gf, agf, agbf, baumasse, greenArea.
pub key: &'static str,
pub value: Option<f64>,
pub decimals: usize,
pub unit: &'static str,
/// Schlüssel der Quelle (UI: `siteProof.src.<source>`).
pub source: &'static str,
}
#[derive(Debug, Clone, PartialEq, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct SiteProof {
pub rows: Vec<ProofRow>,
pub basis: Vec<ProofBasis>,
/// Hinweis-Schlüssel (UI: `siteProof.note.<key>`).
pub notes: Vec<&'static str>,
/// Mindestens eine Vorgabe ist gesetzt.
pub has_limits: bool,
/// Alle gesetzten Vorgaben mit Projektwert sind erfüllt; `None` ohne prüfbare Vorgabe.
pub all_ok: Option<bool>,
}
/// Vorgabe nur, wenn endlich und > 0 (0/negativ/NaN = nicht gesetzt).
fn limit(v: Option<f64>) -> Option<f64> {
v.filter(|x| x.is_finite() && *x > 0.0)
}
fn row(key: &'static str, limit: Limit, allowed: Option<f64>, actual: Option<f64>, decimals: usize, unit: &'static str, tol: f64) -> ProofRow {
let actual = actual.filter(|a| a.is_finite());
let reserve = allowed.zip(actual).map(|(a, x)| if limit == Limit::Max { a - x } else { x - a });
let ok = reserve.map(|r| r >= -tol);
ProofRow { key, limit, allowed, actual, reserve, ok, decimals, unit }
}
/// Nachweis des Projekts; `opt` wie bei `flaechen::ivhb` (aGSF-Eingabe, Grünfläche, Basis der aGF).
pub fn site_proof(p: &Project, opt: &IvhbOptions) -> SiteProof {
let v = flaechen::ivhb(p, opt);
let rules = p.site_rules.as_ref();
let check = site_rules::check_project(p);
let mut notes: Vec<&'static str> = vec![];
if rules.is_none() {
notes.push("noRules");
}
// Gesamthöhe: mit Gelände über dem massgebenden Terrain, sonst über ±0.00 (wie das Lage-Panel).
let (top, above_terrain) = match &check {
Some(c) => (c.height_above_terrain.or(c.max_top), c.height_above_terrain.is_some()),
None => (v.total_height, false),
};
notes.push(if above_terrain { "heightTerrain" } else { "heightZero" });
notes.push("facadeApprox");
let l = |f: fn(&crate::model::SiteRules) -> Option<f64>| limit(rules.and_then(f));
let mut rows = vec![
row("gfz", Limit::Max, l(|r| r.max_gfz), v.gfz, 2, "", 1e-6),
row("az", Limit::Max, l(|r| r.max_az), v.az, 2, "", 1e-6),
row("bmz", Limit::Max, l(|r| r.max_bmz), v.bmz, 2, "m", 1e-6),
row("uz", Limit::Max, l(|r| r.max_uz), v.uz, 2, "", 1e-6),
row("gz", Limit::Min, l(|r| r.min_gz), v.gz, 2, "", 1e-6),
row("totalHeight", Limit::Max, l(|r| r.max_height), top, 2, "m", 1e-6),
row("facadeHeight", Limit::Max, l(|r| r.max_facade_height), v.facade_height, 2, "m", 1e-6),
];
let numeric_limits = rows.iter().any(|r| r.allowed.is_some());
// Grenzabstände und Baulinien: erlaubt ist keine Grundfläche ausserhalb der zulässigen Fläche (Splitter < 0.01 m² zählen nicht).
rows.push(row("setback", Limit::Max, check.as_ref().map(|_| 0.0), check.as_ref().map(|c| c.violation_area), 2, "m²", 0.01));
if rules.is_some_and(|r| r.profile_angle.is_some()) {
// Gebäudeprofil: Anzahl Bauteile über dem Profil.
rows.push(row("profile", Limit::Max, check.as_ref().map(|_| 0.0), check.as_ref().map(|c| c.profile_violations.len() as f64), 0, "", 0.0));
}
if !numeric_limits {
notes.push("noLimits");
}
let checked: Vec<bool> = rows.iter().filter_map(|r| r.ok).collect();
let all_ok = if checked.is_empty() { None } else { Some(checked.iter().all(|b| *b)) };
let has_limits = rows.iter().any(|r| r.allowed.is_some());
let agsf_src = match v.agsf_source {
AgsfSource::Input => "agsfInput",
AgsfSource::ParcelArea => "parcelArea",
AgsfSource::ParcelRing => "parcelRing",
AgsfSource::None => "none",
};
let agf_src = match v.agf_basis {
AgfBasis::Gf => "agfGf",
AgfBasis::Ngf => "agfNgf",
AgfBasis::Nf => "agfNf",
};
let basis = vec![
ProofBasis { key: "agsf", value: v.agsf, decimals: 2, unit: "m²", source: agsf_src },
ProofBasis { key: "allowedArea", value: check.as_ref().map(|c| c.allowed_area), decimals: 2, unit: "m²", source: "setbacks" },
ProofBasis { key: "gf", value: Some(v.gf_sum), decimals: 2, unit: "m²", source: "sia416" },
ProofBasis { key: "agf", value: Some(v.agf), decimals: 2, unit: "m²", source: agf_src },
ProofBasis { key: "agbf", value: Some(v.agbf), decimals: 2, unit: "m²", source: "footprint" },
ProofBasis { key: "baumasse", value: Some(v.baumasse), decimals: 1, unit: "m³", source: "volumeAbove" },
ProofBasis { key: "greenArea", value: v.green_area, decimals: 2, unit: "m²", source: "greenInput" },
];
SiteProof { rows, basis, notes, has_limits, all_ok }
}
#[cfg(test)]
mod tests {
use super::*;
use crate::model::SiteRules;
use crate::model::Vec2;
fn v2(x: f64, y: f64) -> Vec2 {
Vec2 { x, y }
}
/// Einfaches Haus (siehe `flaechen::tests::house`): 10.3 × 8.3 m Grundfläche, EG + OG oberirdisch.
fn project(rules: Option<SiteRules>) -> Project {
let mut p = flaechen::tests::house();
p.site_rules = rules;
p
}
fn rules() -> SiteRules {
// Parzelle 20 × 20 m = 400 m² um das Haus (Achsen 0..10 × 0..8), Grenzabstand 1 m.
SiteRules { parcel: vec![v2(-5.0, -5.0), v2(15.0, -5.0), v2(15.0, 15.0), v2(-5.0, 15.0)], default_setback: 1.0, ..Default::default() }
}
fn get<'a>(p: &'a SiteProof, k: &str) -> &'a ProofRow {
p.rows.iter().find(|r| r.key == k).unwrap()
}
fn close(a: f64, b: f64) -> bool {
(a - b).abs() < 1e-4
}
#[test]
fn ohne_baurecht_keine_vorgaben_keine_erfindung() {
let pr = site_proof(&project(None), &IvhbOptions::default());
assert!(!pr.has_limits && pr.all_ok.is_none());
assert!(pr.rows.iter().all(|r| r.allowed.is_none() && r.ok.is_none() && r.reserve.is_none()));
assert!(pr.notes.contains(&"noRules") && pr.notes.contains(&"noLimits"));
// Projektwerte der Höhen gibt es trotzdem (kein Gelände → über ±0.00).
assert!(close(get(&pr, "totalHeight").actual.unwrap(), 5.2));
// Ziffern ohne Parzellenfläche: nicht berechenbar.
assert!(get(&pr, "az").actual.is_none());
}
#[test]
fn ziffern_reserve_und_ueberschreitung() {
let mut r = rules();
r.max_az = Some(0.5); // Ist: 2·74.69/400 = 0.373
r.max_gfz = Some(0.4); // Ist: 2·85.49/400 = 0.427 → überschritten
r.max_uz = Some(0.3); // Ist: 85.49/400 = 0.214
r.min_gz = Some(0.5); // keine Grünfläche eingegeben → nicht prüfbar
r.max_height = Some(6.0);
r.max_facade_height = Some(5.0); // Ist 5.2 → überschritten
let o = IvhbOptions { agsf: Some(400.0), ..Default::default() };
let pr = site_proof(&project(Some(r)), &o);
let az = get(&pr, "az");
assert!(close(az.actual.unwrap(), 2.0 * 74.69 / 400.0) && close(az.reserve.unwrap(), 0.5 - 2.0 * 74.69 / 400.0));
assert_eq!(az.ok, Some(true));
let gfz = get(&pr, "gfz");
assert_eq!(gfz.ok, Some(false));
assert!(close(gfz.reserve.unwrap(), 0.4 - 2.0 * 85.49 / 400.0));
assert_eq!(get(&pr, "uz").ok, Some(true));
assert_eq!(get(&pr, "gz").ok, None, "Untergrenze ohne Grünfläche ist nicht prüfbar");
assert_eq!(get(&pr, "bmz").allowed, None);
assert_eq!(get(&pr, "totalHeight").ok, Some(true));
let fh = get(&pr, "facadeHeight");
assert_eq!(fh.ok, Some(false));
assert!(close(fh.reserve.unwrap(), -0.2));
assert_eq!(pr.all_ok, Some(false));
assert!(pr.has_limits && !pr.notes.contains(&"noLimits"));
}
#[test]
fn untergrenze_gruenflaeche_und_grundlagen() {
let mut r = rules();
r.min_gz = Some(0.3);
let o = IvhbOptions { agsf: Some(400.0), green_area: Some(160.0), ..Default::default() };
let pr = site_proof(&project(Some(r)), &o);
let gz = get(&pr, "gz");
assert!(close(gz.actual.unwrap(), 0.4) && close(gz.reserve.unwrap(), 0.1));
assert_eq!(gz.ok, Some(true));
let b = |k: &str| pr.basis.iter().find(|b| b.key == k).unwrap();
assert!(close(b("agsf").value.unwrap(), 400.0) && b("agsf").source == "agsfInput");
assert!(close(b("gf").value.unwrap(), 2.0 * 85.49) && b("gf").source == "sia416");
assert!(close(b("agf").value.unwrap(), 2.0 * 74.69) && b("agf").source == "agfNgf");
assert!(close(b("agbf").value.unwrap(), 85.49));
assert!(close(b("greenArea").value.unwrap(), 160.0));
// Zulässige Fläche: 18 × 18 m nach 1 m Grenzabstand.
assert!(close(b("allowedArea").value.unwrap(), 18.0 * 18.0));
}
#[test]
fn grenzabstand_wird_geprueft() {
// Abstand 6 m: zulässig ist nur noch 8 × 8 m, das Haus (10.3 × 8.3) ragt hinaus.
let mut r = rules();
r.default_setback = 6.0;
let pr = site_proof(&project(Some(r)), &IvhbOptions::default());
let s = get(&pr, "setback");
assert_eq!(s.ok, Some(false));
assert!(s.actual.unwrap() > 1.0 && s.reserve.unwrap() < 0.0);
// Abstand 1 m: alles innerhalb.
let pr = site_proof(&project(Some(rules())), &IvhbOptions::default());
assert_eq!(get(&pr, "setback").ok, Some(true));
assert_eq!(get(&pr, "setback").allowed, Some(0.0));
assert_eq!(pr.all_ok, Some(true));
}
#[test]
fn unsinn_wird_nicht_zur_vorgabe() {
let mut r = rules();
r.max_az = Some(f64::NAN);
r.max_gfz = Some(-1.0);
r.max_uz = Some(0.0);
let pr = site_proof(&project(Some(r)), &IvhbOptions { agsf: Some(400.0), ..Default::default() });
for k in ["az", "gfz", "uz"] {
assert!(get(&pr, k).allowed.is_none(), "{k}");
}
}
}
+71
View File
@@ -0,0 +1,71 @@
import { describe, expect, it } from "vitest";
import { sampleProject } from "../model/sampleProject";
import type { Project, Room, SiteRules, Wall } from "../model/types";
import { applyOps } from "../core/ops";
import { setField } from "../core/opsBuild";
import { computeSiteProof } from "./siteProof";
import { areaReportToCsv, buildAreaReport } from "../export/areaReport";
// Einfaches Haus wie in areaReport.test.ts: Achsen 10 × 8 m, EG-Räume innen 9.7 × 7.7 m, Parzelle 400 m².
function house(rules?: Partial<SiteRules>): Project {
const base = structuredClone(sampleProject) as Project;
const wt = base.wallTypes[0]!;
const type = { ...wt, id: "w30", layers: [{ ...wt.layers[0]!, thickness: 0.3 }] };
const pts = [[0, 0], [10, 0], [10, 8], [0, 8]] as const;
const walls = pts.map((a, i): Wall => {
const b = pts[(i + 1) % 4]!;
return { ...(base.walls[0] as Wall), id: `hw${i}`, floorId: "eg", start: { x: a[0], y: a[1] }, end: { x: b[0], y: b[1] }, wallTypeId: "w30", height: 2.6, bottom: undefined, top: undefined };
});
const room = (id: string, cat: Room["siaCategory"], y0: number, y1: number): Room => ({
...(base.rooms![0] as Room), id, floorId: "eg", siaCategory: cat, name: id,
boundary: [{ x: 0.15, y: y0 }, { x: 9.85, y: y0 }, { x: 9.85, y: y1 }, { x: 0.15, y: y1 }],
});
const p: Project = { ...base, name: "Haus", wallTypes: [type], walls, rooms: [room("a", "HNF", 0.15, 4.15), room("b", "NNF", 4.15, 5.85), room("c", "VF", 5.85, 7.85)], openings: [], extrudedSolids: undefined, roofs: undefined, parcelArea: 400, siteRules: undefined };
if (!rules) return p;
const siteRules: SiteRules = { parcel: [{ x: -5, y: -5 }, { x: 15, y: -5 }, { x: 15, y: 15 }, { x: -5, y: 15 }], defaultSetback: 1, ...rules };
return applyOps(p, [setField("siteRules", siteRules)]);
}
const row = (p: ReturnType<typeof computeSiteProof>, k: string) => p.rows.find((r) => r.key === k)!;
describe("computeSiteProof (Kern site_proof.rs)", () => {
it("ohne Baurecht: Projektwerte da, keine Vorgaben, nichts erfüllt/verletzt", () => {
const pr = computeSiteProof(house());
expect(pr.hasLimits).toBe(false);
expect(pr.allOk).toBeNull();
expect(pr.rows.every((r) => r.allowed === null && r.ok === null)).toBe(true);
expect(row(pr, "az").actual).toBeCloseTo(74.69 / 400, 5);
expect(row(pr, "totalHeight").actual).toBeCloseTo(2.6, 4);
expect(pr.notes).toContain("noRules");
});
it("Vorgaben: Reserve, Überschreitung, Untergrenze", () => {
const pr = computeSiteProof(house({ maxAz: 0.5, maxGfz: 0.2, maxHeight: 6, minGz: 0.3 }), { greenArea: 160 });
expect(row(pr, "az").ok).toBe(true);
expect(row(pr, "az").reserve).toBeCloseTo(0.5 - 74.69 / 400, 5);
expect(row(pr, "gfz").ok).toBe(false);
expect(row(pr, "gfz").reserve!).toBeLessThan(0);
expect(row(pr, "totalHeight").ok).toBe(true);
expect(row(pr, "gz").actual).toBeCloseTo(0.4, 5);
expect(row(pr, "gz").ok).toBe(true);
expect(row(pr, "setback").ok).toBe(true);
expect(pr.allOk).toBe(false);
expect(pr.basis.find((b) => b.key === "agsf")).toMatchObject({ value: 400, source: "parcelArea" });
});
});
describe("Baurecht-Nachweis im Bericht", () => {
it("Abschnitte Nachweis + Grundlagen; fehlende Vorgabe als Strich; CSV enthält sie", () => {
const rep = buildAreaReport(house({ maxAz: 0.5 }), { areas: false, siteProof: true });
expect(rep.sections).toHaveLength(2);
const az = rep.sections[0]!.rows.find((r) => typeof r.cells[0] === "string" && r.cells[0].startsWith("AZ"))!;
expect(az.cells[1]).toEqual({ n: 0.5, d: 2 });
expect(az.cells[4]).toBe("ja");
const gfz = rep.sections[0]!.rows.find((r) => typeof r.cells[0] === "string" && r.cells[0].startsWith("GFZ"))!;
expect(gfz.cells[1]).toBe("—");
expect(gfz.cells[4]).toBe("—");
const csv = areaReportToCsv(rep);
expect(csv).toContain("0.50");
expect(csv).toContain("aGSF");
});
});
+48
View File
@@ -0,0 +1,48 @@
// Baurecht-Nachweis ([255]): Vorgaben der Parzelle (`Project.siteRules`) gegen die Kennzahlen des Modells —
// zulässig · Projekt · Reserve/Überschreitung · erfüllt, dazu die Grundlagen mit Quelle. Rechnet der Kern
// (`src-tauri/core/src/site_proof.rs`) auf dem Projekt-Dokument; diese Datei ist die typisierte Fassade.
import type { Project } from "../model/types";
import { documentFor } from "../core/document";
import type { IvhbOptions } from "./areaTable";
export interface ProofRow {
/** gfz, az, bmz, uz, gz, totalHeight, facadeHeight, setback, profile. */
key: string;
/** `max`: Projekt ≤ zulässig; `min`: Projekt ≥ zulässig. */
limit: "max" | "min";
/** `null` = keine Vorgabe im Projekt. */
allowed: number | null;
actual: number | null;
/** Positiv = Reserve, negativ = Überschreitung (Unterschreitung bei `min`). */
reserve: number | null;
/** `null` = nicht prüfbar (Vorgabe oder Projektwert fehlt). */
ok: boolean | null;
decimals: number;
unit: string;
}
export interface ProofBasis {
/** agsf, allowedArea, gf, agf, agbf, baumasse, greenArea. */
key: string;
value: number | null;
decimals: number;
unit: string;
/** Schlüssel der Quelle (`siteProof.src.<source>`). */
source: string;
}
export interface SiteProof {
rows: ProofRow[];
basis: ProofBasis[];
/** Hinweis-Schlüssel (`siteProof.note.<key>`). */
notes: string[];
hasLimits: boolean;
/** Alle prüfbaren Vorgaben erfüllt; `null` ohne prüfbare Vorgabe. */
allOk: boolean | null;
}
/** Baurecht-Nachweis; die Optionen wie bei {@link computeIvhb} (aGSF, Grünfläche, Basis der aGF). */
export function computeSiteProof(project: Project, options: IvhbOptions = {}): SiteProof {
return documentFor(project).query<SiteProof>("siteProof", [], JSON.stringify(options));
}
+6 -4
View File
@@ -23,7 +23,7 @@
// --snapshot <Name|id> übernimmt Geschoss, Massstab, Vorlage und Sichtbarkeit eines Ausschnitts [207]
// 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 [--no-mtl]|stl|glb|gltf|schedule [--openings|--elements|--rooms] [--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]
// dossier-cli <projekt.obp> dxf [--binary] [--scale 100] [--dim-unit cm] [--layout]|dwg|ifc|step|obj [--no-mtl]|stl|glb|gltf|schedule [--openings|--elements|--rooms] [--format json|csv|svg|pdf]|kennzahlen [--sia416] [--ivhb] [--nachweis] [--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
@@ -85,6 +85,7 @@ import {
computeKennzahlen,
computeAreaTable,
computeIvhb,
computeSiteProof,
buildAreaReport,
buildOpeningReport,
openingSchedule,
@@ -1025,7 +1026,7 @@ async function execute(project: Project, file: string, command: string, rest: st
return 0;
case "kennzahlen": {
// --sia416 / --ivhb: Flächentabelle bzw. IVHB-Kennziffern [70]; --format json|csv|svg|pdf (Default json).
if (args.flags.has("sia416") || args.flags.has("ivhb")) {
if (args.flags.has("sia416") || args.flags.has("ivhb") || args.flags.has("nachweis")) {
const num = (k: string): number | undefined => {
const v = args.flags.get(k);
if (v === undefined) return undefined;
@@ -1038,14 +1039,15 @@ async function execute(project: Project, file: string, command: string, rest: st
const ivhbOptions = { agsf: num("agsf"), greenArea: num("gruenflaeche"), agfBasis: basis, includeUnderground: args.flags.has("untergeschosse") } as const;
const wantAreas = args.flags.has("sia416");
const wantIvhb = args.flags.has("ivhb");
const wantProof = args.flags.has("nachweis");
const format = args.flags.get("format") ?? "json";
const stem = `${exportProjectName(project) || "projekt"}-flaechen`;
if (format === "json") {
const json = { ...(wantAreas ? { flaechentabelle: computeAreaTable(project) } : {}), ...(wantIvhb ? { ivhb: computeIvhb(project, ivhbOptions) } : {}) };
const json = { ...(wantAreas ? { flaechentabelle: computeAreaTable(project) } : {}), ...(wantIvhb ? { ivhb: computeIvhb(project, ivhbOptions) } : {}), ...(wantProof ? { baurechtNachweis: computeSiteProof(project, ivhbOptions) } : {}) };
out(args, JSON.stringify(json, null, 2), `${stem}.json`);
return 0;
}
const report = buildAreaReport(project, { areas: wantAreas, ivhb: wantIvhb, ivhbOptions });
const report = buildAreaReport(project, { areas: wantAreas, ivhb: wantIvhb, siteProof: wantProof, ivhbOptions });
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`);
+1
View File
@@ -186,6 +186,7 @@ export type QueryName =
| "programCompare"
| "programLayout"
| "ivhb"
| "siteProof"
| "siteCheck"
| "excavationQuantities"
| "dormerStatus"
+2
View File
@@ -43,6 +43,8 @@ export { sheetTables, createTable, drawTablesPdf, tableCatalog, tableLabels, tab
export type { TableOut, TablePrim, TableColumn } from "../export/sheetTable";
export { computeAreaTable, computeIvhb } from "../analysis/areaTable";
export type { AreaTable, AreaRow, Ivhb, IvhbOptions, AgfBasis } from "../analysis/areaTable";
export { computeSiteProof } from "../analysis/siteProof";
export type { SiteProof, ProofRow, ProofBasis } from "../analysis/siteProof";
export { exportProjectName, competitionIdentity, isAnonymous, competitionKeyword, identityLeaks, NEUTRAL_DATE, NEUTRAL_ISO } from "../export/competitionIdentity";
export type { CompetitionIdentity } from "../export/competitionIdentity";
export { buildAreaReport, areaReportToCsv, parseAreaReportCsv, areaReportToSvg, buildAreaReportPdf } from "../export/areaReport";
+27
View File
@@ -17,6 +17,7 @@ import { t } from "../i18n/translate";
import { core } from "../engine/coreWasm";
import { computeAreaTable, computeIvhb } from "../analysis/areaTable";
import type { AreaRow, IvhbOptions } from "../analysis/areaTable";
import { computeSiteProof } from "../analysis/siteProof";
/** Zelle: Text oder Zahl (`d` Nachkommastellen, `null` = nicht berechenbar). */
export type Cell = string | { n: number | null; d: number; g?: boolean };
@@ -51,6 +52,8 @@ export interface AreaReportOptions {
/** IVHB-Kennziffern aufnehmen (Default nein). */
ivhb?: boolean;
ivhbOptions?: IvhbOptions;
/** Baurecht-Nachweis ([255]): Vorgaben der Parzelle gegen Kennzahlen, mit Grundlagen (Default nein). */
siteProof?: boolean;
}
const num = (n: number | null | undefined, d: number): Cell => ({ n: n === undefined || n === null || !Number.isFinite(n) ? null : n, d });
@@ -115,6 +118,30 @@ export function buildAreaReport(project: Project, opts: AreaReportOptions = {}):
notes.push(t("areas.foot.ivhb"));
addNotes(v.notes);
}
if (opts.siteProof) {
const pr = computeSiteProof(project, opts.ivhbOptions);
const dash = t("siteProof.none");
const val = (n: number | null, d: number): Cell => (n === null || !Number.isFinite(n) ? dash : { n, d });
sections.push({
heading: t("siteProof.table"),
columns: [t("siteProof.col.item"), t("siteProof.col.allowed"), t("siteProof.col.actual"), t("siteProof.col.reserve"), t("siteProof.col.ok")],
widths: [5, 1.6, 1.6, 2.2, 1.1],
rows: pr.rows.map((r) => ({
cells: [t(`siteProof.row.${r.key}`), val(r.allowed, r.decimals), val(r.actual, r.decimals), val(r.reserve, r.decimals), r.ok === null ? dash : t(r.ok ? "siteProof.ok.yes" : "siteProof.ok.no")],
})),
});
sections.push({
heading: t("siteProof.basis.title"),
columns: [t("siteProof.col.item"), t("siteProof.col.value"), t("siteProof.col.source")],
widths: [5, 1.8, 4.5],
rows: pr.basis.map((b) => ({ cells: [t(`siteProof.basis.${b.key}`), val(b.value, b.decimals), t(`siteProof.src.${b.source}`)] })),
});
notes.push(t("siteProof.foot"));
for (const k of pr.notes) {
const text = t(`siteProof.note.${k}`);
if (!notes.includes(text)) notes.push(text);
}
}
return { title: t("areas.title"), ...reportHead(project), sections, notes };
}
+3 -3
View File
@@ -55,10 +55,10 @@ describe("Tabellen auf dem Blatt ([111])", () => {
it("alle Quellen liefern Primitive; Katalog nennt die Spalten", () => {
const cat = tableCatalog(sampleProject);
expect(Object.keys(cat.sources).sort()).toEqual(["areas", "costs", "earthworks", "elements", "openings", "roomBook", "rooms"]);
const p = withTables((["openings", "areas", "rooms", "elements", "earthworks", "roomBook", "costs"] as const).map((source) => table({ id: source, source })));
expect(Object.keys(cat.sources).sort()).toEqual(["areas", "costs", "earthworks", "elements", "openings", "roomBook", "rooms", "siteProof"]);
const p = withTables((["openings", "areas", "rooms", "elements", "earthworks", "roomBook", "costs", "siteProof"] as const).map((source) => table({ id: source, source })));
const out = sheetTables(p, "L1");
expect(out.map((o) => o.id)).toEqual(["openings", "areas", "rooms", "elements", "earthworks", "roomBook", "costs"]);
expect(out.map((o) => o.id)).toEqual(["openings", "areas", "rooms", "elements", "earthworks", "roomBook", "costs", "siteProof"]);
for (const o of out) expect(o.prims.some((x) => x.k === "text")).toBe(true);
});
+1 -1
View File
@@ -38,7 +38,7 @@ interface Catalog {
valueKeys: string[];
}
export const TABLE_SOURCES: readonly LayoutTableSource[] = ["openings", "areas", "rooms", "elements", "earthworks", "roomBook", "costs"];
export const TABLE_SOURCES: readonly LayoutTableSource[] = ["openings", "areas", "rooms", "elements", "earthworks", "roomBook", "costs", "siteProof"];
export function tableSourceLabel(s: LayoutTableSource): string {
return t(`sheetTable.source.${s}`);
+56
View File
@@ -4158,6 +4158,62 @@ export const de = {
"render.toLayout.done": "Rendering ins Blatt „{name}“ eingesetzt.",
// ── [209] Kostenschätzung grob ──
"sheetTable.source.costs": "Kostenschätzung grob (eBKP-H)",
"siteProof.title": "Baurecht-Nachweis",
"siteProof.table": "Nachweis gegen das Baurecht",
"siteProof.basis.title": "Grundlagen des Nachweises",
"siteProof.col.item": "Prüfgrösse",
"siteProof.col.allowed": "Zulässig",
"siteProof.col.actual": "Projekt",
"siteProof.col.reserve": "Reserve (+) / Überschr. (−)",
"siteProof.col.ok": "Erfüllt",
"siteProof.col.basis": "Grundlage",
"siteProof.col.value": "Wert",
"siteProof.col.source": "Quelle",
"siteProof.ok.yes": "ja",
"siteProof.ok.no": "nein",
"siteProof.none": "—",
"siteProof.row.gfz": "GFZ Geschossflächenziffer (max.)",
"siteProof.row.az": "AZ Ausnützungsziffer (max.)",
"siteProof.row.bmz": "BMZ Baumassenziffer [m] (max.)",
"siteProof.row.uz": "ÜZ Überbauungsziffer (max.)",
"siteProof.row.gz": "GZ Grünflächenziffer (min.)",
"siteProof.row.totalHeight": "Gesamthöhe [m] (max.)",
"siteProof.row.facadeHeight": "Fassadenhöhe [m] (max.)",
"siteProof.row.setback": "Grundfläche ausserhalb Grenzabstand/Baulinie [m²]",
"siteProof.row.profile": "Bauteile über dem Gebäudeprofil [Anzahl]",
"siteProof.basis.agsf": "Anrechenbare Grundstücksfläche aGSF [m²]",
"siteProof.basis.allowedArea": "Zulässige Grundfläche nach Grenzabstand [m²]",
"siteProof.basis.gf": "Geschossfläche GF, angerechnet [m²]",
"siteProof.basis.agf": "Anrechenbare Geschossfläche aGF [m²]",
"siteProof.basis.agbf": "Anrechenbare Gebäudefläche aGbF [m²]",
"siteProof.basis.baumasse": "Baumasse oberirdisch [m³]",
"siteProof.basis.greenArea": "Anrechenbare Grünfläche [m²]",
"siteProof.src.agsfInput": "Eingabe",
"siteProof.src.parcelArea": "Parzellenfläche des Projekts",
"siteProof.src.parcelRing": "Fläche der Parzellengrenze (Baurecht)",
"siteProof.src.none": "nicht gesetzt",
"siteProof.src.setbacks": "Parzelle abzüglich Grenzabstände und Baulinien",
"siteProof.src.sia416": "Flächentabelle SIA 416, oberirdisch",
"siteProof.src.agfNgf": "SIA 416, NGF oberirdisch",
"siteProof.src.agfGf": "SIA 416, GF oberirdisch",
"siteProof.src.agfNf": "SIA 416, NF oberirdisch",
"siteProof.src.footprint": "Grundfläche der Wände über ±0.00 (IVHB)",
"siteProof.src.volumeAbove": "Volumen über ±0.00",
"siteProof.src.greenInput": "Eingabe",
"siteProof.note.noRules": "Kein Baurecht erfasst (Panel Lage): alle Vorgaben fehlen.",
"siteProof.note.noLimits": "Keine Vorgaben für Ziffern oder Höhen gesetzt (Panel Lage, Baurecht); Zeilen mit „—“ sind nicht prüfbar.",
"siteProof.note.heightTerrain": "Gesamthöhe über dem massgebenden Terrain (tiefstes gewachsenes Terrain an der Fassade).",
"siteProof.note.heightZero": "Gesamthöhe über ±0.00 (kein Geländemodell).",
"siteProof.note.facadeApprox": "Fassadenhöhe = höchste Wandoberkante über ±0.00 (Näherung).",
"siteProof.foot": "Zulässige Werte aus den Baurecht-Eingaben des Projekts (kantonales Recht); Begriffe nach IVHB, Flächen nach SIA 416. Reserve = zulässig − Projekt (bei Mindestwerten Projekt − zulässig).",
"siteRules.maxGfz": "GFZ max.",
"siteRules.maxAz": "AZ max.",
"siteRules.maxBmz": "BMZ max.",
"siteRules.maxUz": "ÜZ max.",
"siteRules.minGz": "GZ min.",
"siteRules.maxFacadeHeight": "Fassadenhöhe max.",
"siteRules.ratios.hint": "Zulässige Ziffern für den Baurecht-Nachweis (Flächenbilanz); leer = keine Vorgabe.",
"sheetTable.source.siteProof": "Baurecht-Nachweis (AZ, ÜZ, Höhen)",
"sheetTable.col.costCode": "eBKP-H",
"sheetTable.col.costGroup": "Gruppe",
"sheetTable.col.quantity": "Menge",
+56
View File
@@ -4144,6 +4144,62 @@ export const en: Record<TranslationKey, string> = {
"render.toLayout.done": "Rendering placed on sheet \"{name}\".",
// ── [209] Kostenschätzung grob ──
"sheetTable.source.costs": "Cost estimate (eBKP-H)",
"siteProof.title": "Zoning compliance",
"siteProof.table": "Compliance with building regulations",
"siteProof.basis.title": "Basis of the check",
"siteProof.col.item": "Item",
"siteProof.col.allowed": "Allowed",
"siteProof.col.actual": "Project",
"siteProof.col.reserve": "Reserve (+) / excess (−)",
"siteProof.col.ok": "Met",
"siteProof.col.basis": "Basis",
"siteProof.col.value": "Value",
"siteProof.col.source": "Source",
"siteProof.ok.yes": "yes",
"siteProof.ok.no": "no",
"siteProof.none": "—",
"siteProof.row.gfz": "GFA ratio (GFZ) (max.)",
"siteProof.row.az": "Floor area ratio (AZ) (max.)",
"siteProof.row.bmz": "Building mass ratio (BMZ) [m] (max.)",
"siteProof.row.uz": "Site coverage ratio (ÜZ) (max.)",
"siteProof.row.gz": "Green space ratio (GZ) (min.)",
"siteProof.row.totalHeight": "Total height [m] (max.)",
"siteProof.row.facadeHeight": "Facade height [m] (max.)",
"siteProof.row.setback": "Footprint outside setbacks/building lines [m²]",
"siteProof.row.profile": "Parts above the building profile [count]",
"siteProof.basis.agsf": "Eligible site area (aGSF) [m²]",
"siteProof.basis.allowedArea": "Buildable area after setbacks [m²]",
"siteProof.basis.gf": "Gross floor area (GF), counted [m²]",
"siteProof.basis.agf": "Eligible floor area (aGF) [m²]",
"siteProof.basis.agbf": "Eligible building footprint (aGbF) [m²]",
"siteProof.basis.baumasse": "Building mass above ground [m³]",
"siteProof.basis.greenArea": "Eligible green area [m²]",
"siteProof.src.agsfInput": "Input",
"siteProof.src.parcelArea": "Site area of the project",
"siteProof.src.parcelRing": "Area of the site boundary (zoning)",
"siteProof.src.none": "not set",
"siteProof.src.setbacks": "Site minus setbacks and building lines",
"siteProof.src.sia416": "SIA 416 area table, above ground",
"siteProof.src.agfNgf": "SIA 416, NGF above ground",
"siteProof.src.agfGf": "SIA 416, GF above ground",
"siteProof.src.agfNf": "SIA 416, NF above ground",
"siteProof.src.footprint": "Wall footprint above ±0.00 (IVHB)",
"siteProof.src.volumeAbove": "Volume above ±0.00",
"siteProof.src.greenInput": "Input",
"siteProof.note.noRules": "No zoning rules entered (Site panel): all limits are missing.",
"siteProof.note.noLimits": "No limits set for ratios or heights (Site panel, zoning); rows with “—” cannot be checked.",
"siteProof.note.heightTerrain": "Total height above the reference terrain (lowest natural terrain at the facade).",
"siteProof.note.heightZero": "Total height above ±0.00 (no terrain model).",
"siteProof.note.facadeApprox": "Facade height = highest wall top above ±0.00 (approximation).",
"siteProof.foot": "Allowed values come from the project's zoning inputs (cantonal law); terms follow IVHB, areas follow SIA 416. Reserve = allowed − project (for minimum values project − allowed).",
"siteRules.maxGfz": "Max. GFZ",
"siteRules.maxAz": "Max. AZ",
"siteRules.maxBmz": "Max. BMZ",
"siteRules.maxUz": "Max. ÜZ",
"siteRules.minGz": "Min. GZ",
"siteRules.maxFacadeHeight": "Max. facade height",
"siteRules.ratios.hint": "Allowed ratios for the zoning compliance check (area balance); empty = no limit.",
"sheetTable.source.siteProof": "Zoning compliance (AZ, ÜZ, heights)",
"sheetTable.col.costCode": "eBKP-H",
"sheetTable.col.costGroup": "Group",
"sheetTable.col.quantity": "Quantity",
+2
View File
@@ -286,6 +286,8 @@ export function buildWettbewerbSampleProject(): Project {
// Grenzabstände je Parzellenkante (Süd, Ost, Nord/Strasse, West).
setbacks: [4, 4, 5, 4], defaultSetback: 4,
maxHeight: 12, show: true, show3d: true,
// Beispielwerte (fiktive Zone) für den Baurecht-Nachweis [255].
maxAz: 0.8, maxUz: 0.35, maxFacadeHeight: 12,
},
referenceElevationMasl: 441.3,
geoAnchor: { lv95: { e: 2697450, n: 1261800 }, height: 441.3, model: P(0, 0), label: "Hofwiesenstrasse, 8400 Winterthur (fiktiv)" },
+16 -1
View File
@@ -2047,7 +2047,8 @@ export type LayoutTableSource =
| "elements"
| "earthworks"
| "roomBook"
| "costs";
| "costs"
| "siteProof";
/**
* Einfache Textfelder des Titelblocks (Master). Alle optional — leere Felder
@@ -3644,6 +3645,20 @@ export type SiteRules = {
buildingLines?: Array<{ a: Vec2; b: Vec2 }>;
/** Zulässige Gesamthöhe über ±0.00 (m). */
maxHeight?: number;
/**
* Zulässige Fassadenhöhe (m, höchste Wandoberkante über ±0.00) für den Baurecht-Nachweis.
*/
maxFacadeHeight?: number;
/** Zulässige Geschossflächenziffer GFZ (IVHB) für den Baurecht-Nachweis. */
maxGfz?: number;
/** Zulässige Ausnützungsziffer AZ (aGF / aGSF) für den Baurecht-Nachweis. */
maxAz?: number;
/** Zulässige Baumassenziffer BMZ (m³/m²) für den Baurecht-Nachweis. */
maxBmz?: number;
/** Zulässige Überbauungsziffer ÜZ (aGbF / aGSF) für den Baurecht-Nachweis. */
maxUz?: number;
/** Mindest-Grünflächenziffer GZ für den Baurecht-Nachweis. */
minGz?: number;
/** Parzelle, zulässige Fläche und Verstösse im Grundriss zeigen (Default: ja). */
show?: boolean;
/**
+1 -1
View File
@@ -21,7 +21,7 @@ export function AreaTableSection() {
const [inputs, setInputs] = useState<AreaInputs>(DEFAULT_AREA_INPUTS);
const notify = useStore((s) => s.notify);
const report = useMemo(
() => buildAreaReport(project, { areas: true, ivhb: true, ivhbOptions: ivhbOptionsOf(inputs) }),
() => buildAreaReport(project, { areas: true, ivhb: true, siteProof: true, ivhbOptions: ivhbOptionsOf(inputs) }),
// eslint-disable-next-line react-hooks/exhaustive-deps
[project, inputs],
);
+34
View File
@@ -3,6 +3,7 @@
// Grundriss entsteht aus `Project.siteRules` (`plan/generatePlan/siteRules.ts`).
import { t } from "../i18n";
import type { TranslationKey } from "../i18n";
import { useSelectionInfo } from "../state/useSelectionInfo";
import { useStore } from "../state/appStore";
import { checkSiteRules, patchItem, setField } from "../core";
@@ -44,6 +45,16 @@ function withProjection<T extends { siteProjection?: boolean }>(e: T, on: boolea
return (on ? { ...rest, siteProjection: true } : rest) as T;
}
/** Zulässige Ziffern/Höhen für den Baurecht-Nachweis ([255]); leer oder 0 = keine Vorgabe. */
const PROOF_FIELDS: { field: "maxFacadeHeight" | "maxGfz" | "maxAz" | "maxBmz" | "maxUz" | "minGz"; label: TranslationKey; step: number; unit: string }[] = [
{ field: "maxFacadeHeight", label: "siteRules.maxFacadeHeight", step: 0.5, unit: "m" },
{ field: "maxGfz", label: "siteRules.maxGfz", step: 0.05, unit: "" },
{ field: "maxAz", label: "siteRules.maxAz", step: 0.05, unit: "" },
{ field: "maxBmz", label: "siteRules.maxBmz", step: 0.1, unit: "m" },
{ field: "maxUz", label: "siteRules.maxUz", step: 0.05, unit: "" },
{ field: "minGz", label: "siteRules.minGz", step: 0.05, unit: "" },
];
export function SiteRulesSection() {
const project = useStore((s) => s.project);
const applyChange = useStore((s) => s.applyChange);
@@ -170,6 +181,29 @@ export function SiteRulesSection() {
<span>m</span>
</label>
{PROOF_FIELDS.map((f) => (
<label key={f.field} className="kz-parcel" title={t("siteRules.ratios.hint")}>
<span>{t(f.label)}</span>
<input
type="number"
min={0}
step={f.step}
className="kz-input kz-num"
value={rules[f.field] ?? ""}
placeholder="–"
onChange={(e) => {
const v = parseLen(e.target.value);
if (v === null) return;
write((r) => {
const { [f.field]: _old, ...rest } = r;
return v === undefined || v === 0 ? rest : { ...rest, [f.field]: v };
}, `siteRules:${f.field}`);
}}
/>
<span>{f.unit}</span>
</label>
))}
<label className="kz-parcel" title={t("siteRules.profileAngle.hint")}>
<span>{t("siteRules.profileAngle")}</span>
<input