[95] Fenster/Türen: Schiebe-, Hebeschiebe-, Pendeltür, Oberlicht-Einteilung, Typen-Bibliothek

Türtyp kind hebeschiebe/pendel neu, schiebe wird gezeichnet (Grundriss nach SIA, Schnitt,
Ansicht, 3D, IFC-OperationType). Tür-Oberlicht in der Ansicht. Fenster transomSashes
(Pfosten/Riegel im Oberlicht) in Ansicht und 3D. Vorlagen in opening_presets.rs, in den
Ressourcen-Tabs über „Aus Bibliothek…“.
This commit is contained in:
Claude committed 2026-10-29 22:51:49 +00:00
1 parent 754ed4d3c2
commit 85e2f63b20
27 files changed
+874 -124

No files matched your search

+13
View File
@@ -1389,6 +1389,19 @@ Reihenfolge = Abhängigkeiten. Neue Geometrie entsteht in Rust ([K]).
Kasten jetzt auch im Schnitt; 3D nur Schienen). UI: „Fenster bearbeiten" (Rahmen/Sonnenschutz). Geprüft: Rust-Tests,
CLI-Grundriss/-Schnitt/-Ansicht als PNG angesehen (Linux). Offen: Anschlag im Schnitt (Sturz-Nase), Brüstung als
eigenes Bauteil, Anschlag/Leibung in den Ressourcen-Tabs (nur im Bearbeiten-Dialog).
- ◐ **[95] Fenster/Türen: mehr Bauarten und Typen-Bibliothek.** (29.10.) Türtyp `kind` neu `hebeschiebe` und `pendel`;
`schiebe` wird jetzt auch gezeichnet: Grundriss nach SIA (Schiebetür: Blatt-Rechteck vor der Wand auf der Aufschlagseite +
Pfeil zur Parkseite, zweiflügelig zwei Pfeile; Hebeschiebe: zwei Flügel auf versetzten Gleisen im Rahmen mit Glaslinien
und Pfeil; Pendel: Blatt + gepunktetes Gegenblatt, Bögen beidseitig), Schnitt (Blatt vor der Fläche bzw. zwei Flügel),
Ansicht (Pfeil, zwei Glasfelder), 3D (Blatt vor der Wand, Hebeschiebe mit Flügelrahmen und Glas), IFC-OperationType
(Pendel → DOUBLE_SWING_*, Hebeschiebe → SLIDING_*). Türtyp `kind: "wandoeffnung"` wirkt jetzt auch im Grundriss/Schnitt.
Tür-Oberlicht (`transomHeight`) jetzt auch in der Ansicht. Fenster `transomSashes` (Pfosten/Riegel: Einteilung des
Oberlichts, je Feld fest/kipp/dreh): Ansicht und 3D (Pfosten, Flügelrahmen, Symbole). Zweiflügelige Türen gab es schon
(`leafCount`). Bibliothek: `opening_presets.rs` (6 Fenster-, 7 Türvorlagen, Namen über `preset.<id>`), Ressourcen-Tabs
„Aus Bibliothek…“; Dialog „Fenster bearbeiten“: Türarten, Oberlicht-Felder/-Öffnung. Geprüft: Rust-/vitest-Tests,
CLI-Grundriss/-Schnitt/-Ansicht angesehen (Linux). Offen: Taschen-Schiebetür (in der Wand), Ansicht zeigt bei
zweiflügeliger Schiebetür nur einen Pfeil, 3D/Ansicht ohne Hebeschiebe-Bandseite in der Ansicht, Brüstungs-/Riegel-
Einteilung unten (nur Oberlicht), nicht in der Tauri-App geprüft.
## Priorität 4 — später
+3 -2
View File
@@ -341,7 +341,7 @@ struct FillParams {
wing_count: f64,
panes: f64,
sashes: Vec<FillSash>,
/// Tür: 0 Dreh, 1 Schiebe, 2 reine Wandöffnung.
/// Tür: 0 Dreh, 1 Schiebe (auch Hebeschiebe), 2 reine Wandöffnung, 3 Pendel.
door_kind: f64,
leaf_count: f64,
/// +1 Aufschlag links der Achse, −1 rechts; Richtung +1 innen, −1 aussen.
@@ -383,7 +383,8 @@ fn fill_params(p: &Project, o: &Opening) -> FillParams {
.collect(),
// Türart: Typ vor Öffnung.
door_kind: match dt.map(|t| t.kind) {
Some(DoorTypeKind::Schiebe) => 1.0,
Some(DoorTypeKind::Schiebe | DoorTypeKind::Hebeschiebe) => 1.0,
Some(DoorTypeKind::Pendel) => 3.0,
Some(DoorTypeKind::Wandoeffnung) => 2.0,
Some(_) => 0.0,
None if o.door_type == Some(OpeningDoorType::Wandoeffnung) => 2.0,
+1
View File
@@ -106,6 +106,7 @@ pub mod cmd_split;
pub mod snap_model;
pub mod solid_specs;
pub mod highlight3d;
pub mod opening_presets;
#[cfg(feature = "web")]
mod web;
+11
View File
@@ -574,6 +574,12 @@ pub enum DoorTypeKind {
Schiebe,
#[serde(rename = "wandoeffnung")]
Wandoeffnung,
/// Hebeschiebetür: Rahmen in der Wand, ein festes und ein schiebbares Glasfeld ([95]).
#[serde(rename = "hebeschiebe")]
Hebeschiebe,
/// Pendeltür: schlägt nach beiden Seiten auf ([95]).
#[serde(rename = "pendel")]
Pendel,
#[serde(other)]
#[ts(skip)]
Unknown,
@@ -1055,6 +1061,11 @@ pub struct WindowType {
#[serde(rename = "transomHeight", default, skip_serializing_if = "Option::is_none")]
#[ts(optional)]
pub transom_height: Option<f64>,
/// Einteilung des Oberlichts über dem Riegel (Pfosten/Riegel, [95]): Felder und Pfosten wie
/// {@link sashes}, je Feld fest oder öffenbar (meist Kipp). Fehlt ⇒ ein festes Feld (bisher).
#[serde(rename = "transomSashes", default, skip_serializing_if = "Option::is_none")]
#[ts(optional)]
pub transom_sashes: Option<Vec<SashDef>>,
/// Auf-/Untersicht-Andeutung im Grundriss (mittel/fein): eine Referenzlinie an
/// der gewählten Fläche(n) — sinnvoll, wenn die Öffnung die Schnittebene NICHT
/// regulär durchschneidet (z. B. bodentiefes Fenster oder hoch sitzendes
+21
View File
@@ -678,6 +678,18 @@ fn write_opening(w: &mut FlatWriter, p: &Project, op: &Opening) {
flag(s.hinge_side != Some(SashDefHingeSide::Right)),
]);
}
let transom = wt.transom_sashes.as_deref().unwrap_or(&[]);
w.num(transom.len() as f64);
for s in transom {
w.nums(&[
if s.kind == SashDefKind::Fluegel { 0.0 } else { 1.0 },
flag(s.auto_width == Some(false)),
opt(s.width),
opt(s.post_width),
opening_kind_code(s.opening),
flag(s.hinge_side != Some(SashDefHingeSide::Right)),
]);
}
return;
}
let Some(dt) = p.door_type(op) else {
@@ -703,6 +715,15 @@ fn write_opening(w: &mut FlatWriter, p: &Project, op: &Opening) {
flag(dt.frame_kind != Some(DoorTypeFrameKind::Blockrahmen)),
opt(dt.panel_cols),
opt(dt.panel_rows),
match dt.kind {
DoorTypeKind::Schiebe => 1.0,
DoorTypeKind::Hebeschiebe => 2.0,
DoorTypeKind::Pendel => 3.0,
_ => 0.0,
},
// Aufschlagseite wie im Grundriss (linke Normale), hier entlang der rechten Normalen.
-(if matches!(op.swing, None | Some(SwingSide::Left)) { 1.0 } else { -1.0 }) * (if matches!(op.opening_dir, None | Some(OpeningOpeningDir::In)) { 1.0 } else { -1.0 }),
flag(op.hinge == Some(OpeningHinge::End)),
]);
}
+109
View File
@@ -0,0 +1,109 @@
//! Kleine Typen-Bibliothek für Fenster und Türen ([95]): übliche Schweizer Bauarten als Vorlagen,
//! die das Projekt über `typeId` wiederverwendet. Die ids sind stabil (die UI übersetzt den Namen
//! über `preset.<id>`); der Name hier ist nur der deutsche Rückfall.
use crate::model::{DoorType, WindowType};
const WINDOWS: &str = r#"[
{"id": "fe-dk-1", "name": "Dreh-Kipp 1-flügelig", "kind": "drehkipp", "wingCount": 1, "glazing": "dreifach",
"frameThickness": 0.08, "frameDepth": 0.08, "frameWidth": 0.08, "insetFromFace": 0.12, "insetFace": "aussen",
"rebateDepth": 0.05, "lintelHeight": 0.2, "sillBoard": "beide",
"shading": {"create": true, "kind": "raffstore", "box": {"width": 0, "height": 0.3, "depth": 0.16}, "mount": "sturz"},
"defaultSillHeight": 0.9, "defaultWidth": 1.2, "defaultHeight": 1.4},
{"id": "fe-dk-2", "name": "Dreh-Kipp 2-flügelig (Stulp)", "kind": "drehkipp", "wingCount": 2, "glazing": "dreifach",
"frameThickness": 0.08, "frameDepth": 0.08, "frameWidth": 0.08, "insetFromFace": 0.12, "insetFace": "aussen",
"rebateDepth": 0.05, "lintelHeight": 0.2, "sillBoard": "beide",
"sashes": [{"kind": "fluegel", "autoWidth": true, "opening": "dreh", "hingeSide": "left"},
{"kind": "fluegel", "autoWidth": true, "opening": "drehkipp", "hingeSide": "right"}],
"shading": {"create": true, "kind": "raffstore", "box": {"width": 0, "height": 0.3, "depth": 0.16}, "mount": "sturz"},
"defaultSillHeight": 0.9, "defaultWidth": 1.6, "defaultHeight": 1.5},
{"id": "fe-fest", "name": "Festverglasung", "kind": "fest", "wingCount": 1, "glazing": "dreifach",
"frameThickness": 0.07, "frameDepth": 0.08, "frameWidth": 0.06, "insetFromFace": 0.12, "insetFace": "aussen",
"rebateDepth": 0.05, "sillBoard": "aussen", "defaultSillHeight": 0.9, "defaultWidth": 1.0, "defaultHeight": 1.4},
{"id": "fe-oberlicht", "name": "Dreh-Kipp mit Kipp-Oberlicht", "kind": "drehkipp", "wingCount": 1, "glazing": "dreifach",
"frameThickness": 0.08, "frameDepth": 0.08, "frameWidth": 0.08, "insetFromFace": 0.12, "insetFace": "aussen",
"rebateDepth": 0.05, "lintelHeight": 0.2, "sillBoard": "beide", "transomHeight": 0.5,
"transomSashes": [{"kind": "fluegel", "autoWidth": true, "opening": "kipp"}],
"defaultSillHeight": 0.6, "defaultWidth": 1.2, "defaultHeight": 2.0},
{"id": "fe-pfosten-riegel", "name": "Pfosten-Riegel 3-teilig", "kind": "drehkipp", "wingCount": 3, "glazing": "dreifach",
"frameThickness": 0.08, "frameDepth": 0.1, "frameWidth": 0.06, "insetFace": "mitte", "rebateDepth": 0.05,
"lintelHeight": 0.25, "sillBoard": "beide", "transomHeight": 0.6,
"sashes": [{"kind": "fluegel", "autoWidth": true, "opening": "drehkipp", "hingeSide": "left"},
{"kind": "pfosten", "postWidth": 0.08},
{"kind": "fluegel", "autoWidth": true, "opening": "fest"},
{"kind": "pfosten", "postWidth": 0.08},
{"kind": "fluegel", "autoWidth": true, "opening": "drehkipp", "hingeSide": "right"}],
"transomSashes": [{"kind": "fluegel", "autoWidth": true, "opening": "kipp"},
{"kind": "pfosten", "postWidth": 0.08},
{"kind": "fluegel", "autoWidth": true, "opening": "fest"},
{"kind": "pfosten", "postWidth": 0.08},
{"kind": "fluegel", "autoWidth": true, "opening": "kipp"}],
"defaultSillHeight": 0.3, "defaultWidth": 3.0, "defaultHeight": 2.3},
{"id": "fe-schiebe", "name": "Schiebefenster 2-teilig", "kind": "schiebe", "wingCount": 2, "glazing": "dreifach",
"frameThickness": 0.1, "frameDepth": 0.12, "frameWidth": 0.08, "insetFromFace": 0.12, "insetFace": "aussen",
"rebateDepth": 0.05, "sillBoard": "beide",
"sashes": [{"kind": "fluegel", "autoWidth": true, "opening": "fest"},
{"kind": "fluegel", "autoWidth": true, "opening": "schiebe", "hingeSide": "right"}],
"defaultSillHeight": 0.9, "defaultWidth": 2.0, "defaultHeight": 1.4}
]"#;
const DOORS: &str = r#"[
{"id": "tu-zimmer", "name": "Zimmertür (Zarge)", "kind": "dreh", "leafCount": 1, "leafStyle": "glatt",
"frameThickness": 0.05, "frameKind": "zarge", "frameWidth": 0.06, "defaultWidth": 0.8, "defaultHeight": 2.0},
{"id": "tu-zimmer-2", "name": "Zimmertür 2-flügelig", "kind": "dreh", "leafCount": 2, "leafStyle": "glatt",
"frameThickness": 0.05, "frameKind": "zarge", "frameWidth": 0.06, "defaultWidth": 1.4, "defaultHeight": 2.0},
{"id": "tu-schiebe", "name": "Schiebetür vor der Wand", "kind": "schiebe", "leafCount": 1, "leafStyle": "glatt",
"frameThickness": 0.04, "frameWidth": 0.04, "defaultWidth": 0.9, "defaultHeight": 2.1},
{"id": "tu-hebeschiebe", "name": "Hebeschiebetür", "kind": "hebeschiebe", "leafCount": 2, "leafStyle": "glas",
"frameThickness": 0.1, "frameDepth": 0.16, "frameKind": "blockrahmen", "frameWidth": 0.1, "insetFromFace": 0.12,
"insetFace": "aussen", "rebateDepth": 0.05, "lintelHeight": 0.25, "threshold": true,
"defaultWidth": 2.4, "defaultHeight": 2.2},
{"id": "tu-pendel", "name": "Pendeltür", "kind": "pendel", "leafCount": 1, "leafStyle": "glatt",
"frameThickness": 0.05, "frameKind": "zarge", "frameWidth": 0.06, "defaultWidth": 0.9, "defaultHeight": 2.1},
{"id": "tu-haus", "name": "Haustür mit Oberlicht", "kind": "dreh", "leafCount": 1, "leafStyle": "glas", "glazingRatio": 0.3,
"frameThickness": 0.08, "frameKind": "blockrahmen", "frameWidth": 0.09, "insetFromFace": 0.12, "insetFace": "aussen",
"rebateDepth": 0.05, "lintelHeight": 0.25, "transomHeight": 0.4, "threshold": true,
"defaultWidth": 1.1, "defaultHeight": 2.5},
{"id": "tu-wand", "name": "Wandöffnung", "kind": "wandoeffnung", "leafCount": 1, "leafStyle": "glatt",
"frameThickness": 0.0, "defaultWidth": 1.0, "defaultHeight": 2.1}
]"#;
/// Fenstertyp-Vorlagen.
pub fn window_presets() -> Vec<WindowType> {
serde_json::from_str(WINDOWS).unwrap_or_default()
}
/// Türtyp-Vorlagen.
pub fn door_presets() -> Vec<DoorType> {
serde_json::from_str(DOORS).unwrap_or_default()
}
/// Beide Listen als JSON `{ windowTypes, doorTypes }` (Bindung `opening_type_presets_json`).
pub fn presets_json() -> String {
serde_json::json!({ "windowTypes": window_presets(), "doorTypes": door_presets() }).to_string()
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn vorlagen_lesen_sich_vollstaendig_und_ohne_unbekannte_felder() {
let w = window_presets();
let d = door_presets();
assert_eq!(w.len(), 6);
assert_eq!(d.len(), 7);
for t in &w {
assert!(t.extra.0.is_empty(), "{}: {:?}", t.id, t.extra);
assert!(t.default_width > 0.0 && t.default_height > 0.0);
}
for t in &d {
assert!(t.extra.0.is_empty(), "{}: {:?}", t.id, t.extra);
assert!(t.kind != crate::model::DoorTypeKind::Unknown, "{}", t.id);
}
let mut ids: Vec<&str> = w.iter().map(|t| t.id.as_str()).chain(d.iter().map(|t| t.id.as_str())).collect();
ids.sort();
ids.dedup();
assert_eq!(ids.len(), 13);
}
}
+194 -71
View File
@@ -135,6 +135,12 @@ pub struct DoorTypeIn {
pub zarge: bool,
pub panel_cols: f64,
pub panel_rows: f64,
/// Türart ([95]): 0 Dreh, 1 Schiebe (vor der Wand), 2 Hebeschiebe, 3 Pendel.
pub kind: f64,
/// Schiebetür: Seite des Blatts (+1 = +n, aussen; −1 innen).
pub slide_side: f64,
/// Bandseite am Ende (Hebeschiebe: festes Feld dort).
pub hinge_end: bool,
}
/// Fenster-spezifische Typwerte (NaN = fehlt).
@@ -153,6 +159,8 @@ pub struct WindowTypeIn {
pub default_opening: SashOpening,
/// Rollladenkasten (Breite, Höhe, Tiefe), nur bei `shading.create`.
pub shading: Option<[f64; 3]>,
/// Einteilung des Oberlichts (Pfosten/Riegel, [95]); leer ⇒ ein festes Feld.
pub transom_sashes: Vec<SashIn>,
/// Kasten im Sturz (verdeckt, kein Quader) statt vorgesetzt.
pub shading_sturz: bool,
/// Führungsschienen in der Leibung (Kasten im Sturz, nicht Markise).
@@ -399,6 +407,7 @@ struct FrameParams<'a> {
glazing_panes: f64,
glazed_fraction: f64,
sashes: std::borrow::Cow<'a, [SashIn]>,
transom_sashes: &'a [SashIn],
half_thickness: f64,
draw_sill: bool,
draw_interior_sill: bool,
@@ -408,6 +417,9 @@ struct FrameParams<'a> {
panel_cols: f64,
panel_rows: f64,
corner_join: CornerJoin,
door_kind: f64,
slide_side: f64,
hinge_end: bool,
}
/// Rahmentiefe quer zur Wand: `frame_depth` (> EPS) oder Default, auf die Wanddicke geklemmt.
@@ -444,10 +456,12 @@ fn resolve_frame(o: &OpeningIn) -> Option<FrameParams<'_>> {
wing_count: jmax(1.0, js_round(or(d.leaf_count, 1.0))),
mullion_rows: 1.0,
mullion_cols: 1.0,
glazed: d.leaf_style == LeafStyle::Glass,
// Schiebe-/Hebeschiebeflügel zeichnet `door_leaf` selbst (eigene Lage bzw. Glasfelder).
glazed: d.leaf_style == LeafStyle::Glass && d.kind != 1.0 && d.kind != 2.0,
glazing_panes: 1.0,
glazed_fraction: jmax(0.05, jmin(1.0, or(d.glazing_ratio, 1.0))),
sashes: std::borrow::Cow::Borrowed(&[]),
transom_sashes: &[],
half_thickness: half,
draw_sill: false,
draw_interior_sill: false,
@@ -456,6 +470,9 @@ fn resolve_frame(o: &OpeningIn) -> Option<FrameParams<'_>> {
panelled: d.leaf_style == LeafStyle::Panelled,
panel_cols: jmax(1.0, js_round(or(d.panel_cols, 2.0))),
panel_rows: jmax(1.0, js_round(or(d.panel_rows, 3.0))),
door_kind: d.kind,
slide_side: d.slide_side,
hinge_end: d.hinge_end,
},
KindIn::Window(w) => {
// Flügeltabelle: explizite gewinnt; sonst gleichmässig aus der effektiven Flügelzahl.
@@ -493,6 +510,7 @@ fn resolve_frame(o: &OpeningIn) -> Option<FrameParams<'_>> {
glazing_panes: w.glazing_panes,
glazed_fraction: 1.0,
sashes,
transom_sashes: &w.transom_sashes,
half_thickness: half,
draw_sill: w.sill_board != SillBoard::None && w.sill_board != SillBoard::Inner,
draw_interior_sill: w.sill_board == SillBoard::Inner || w.sill_board == SillBoard::Both,
@@ -501,6 +519,9 @@ fn resolve_frame(o: &OpeningIn) -> Option<FrameParams<'_>> {
panelled: false,
panel_cols: 1.0,
panel_rows: 1.0,
door_kind: 0.0,
slide_side: 1.0,
hinge_end: false,
}
}
})
@@ -577,11 +598,22 @@ fn frame_meshes(em: &mut Emitter, o: &OpeningIn, p: &FrameParams, detail: Detail
let sash_to = to0 - fw;
let sash_bottom = zb0 + if p.has_sill { fw } else { 0.0 };
let mut sash_top = zt0 - fw;
// Oberlicht-Band (über dem Riegel) für dessen Einteilung.
let mut transom_band: Option<(f64, f64)> = None;
if p.transom_height > EPS {
let split_z = clamp_range(zt0 - p.transom_height, sash_bottom, sash_top);
em.axis_box(sash_from, sash_to, split_z - fw / 2.0, split_z + fw / 2.0, p.n_min, p.n_max, Part::Frame);
transom_band = Some((split_z + fw / 2.0, sash_top));
sash_top = split_z - fw / 2.0;
}
// Pfosten im Oberlicht (mittel/fein).
if let (true, Some((tb, tt))) = (sashes_on, transom_band) {
for (s, cf, ct) in sash_spans(p.transom_sashes, sash_from, sash_to) {
if s.kind == SashKind::Post {
em.axis_box(cf, ct, tb, tt, p.n_min, p.n_max, Part::Frame);
}
}
}
if fine {
// Senkrechte Teiler laufen durch, waagrechte Kämpfer-Zeilen dazwischen unterbrochen.
let mut posts: Vec<f64> = Vec::new();
@@ -623,60 +655,66 @@ fn frame_meshes(em: &mut Emitter, o: &OpeningIn, p: &FrameParams, detail: Detail
}
}
// Flügelrahmen je öffenbarem Flügel (zurückgesetztes, flacheres Quer-Band) + SIA-Symbole.
if sashes_on && !p.sashes.is_empty() && sash_to - sash_from > EPS && sash_top - sash_bottom > EPS {
let segs = sash_spans(&p.sashes, sash_from, sash_to);
let sfw = fw * 0.7;
let sash_front_n = p.n_max - 0.005;
let sash_back_n = jmax(p.n_min, p.n_max - 0.055);
let glass_front_n = p.n_max - 0.02;
let sym_back_n = glass_front_n;
let sym_front_n = glass_front_n + 0.003;
let symbol = |em: &mut Emitter, u0: f64, h0: f64, u1: f64, h1: f64| {
em.plane_box(u0, h0, u1, h1, SYMBOL_HALF_WIDTH, sym_front_n, sym_back_n, Part::Symbol);
};
for (s, cf, ct) in segs {
if s.kind != SashKind::Sash || s.opening == SashOpening::None || s.opening == SashOpening::Fixed {
continue;
}
let bz = sash_bottom;
let tz = sash_top;
if ct - cf <= EPS || tz - bz <= EPS {
continue;
}
for q in frame_ring_quads(cf, ct, bz, tz, sfw, p.corner_join, true) {
em.plane_quad(&q, sash_back_n, sash_front_n, Part::Frame);
}
if !fine {
continue;
}
let g_a = cf + sfw;
let g_b = ct - sfw;
let gbz = bz + sfw;
let gtz = tz - sfw;
if g_b - g_a <= EPS || gtz - gbz <= EPS {
continue;
}
let kind = s.opening;
if kind == SashOpening::Turn || kind == SashOpening::TurnTilt {
let apex_u = if s.hinge_left { g_a } else { g_b };
let apex_h = (gbz + gtz) / 2.0;
let far_u = if s.hinge_left { g_b } else { g_a };
symbol(em, far_u, gbz, apex_u, apex_h);
symbol(em, far_u, gtz, apex_u, apex_h);
}
if kind == SashOpening::Tilt || kind == SashOpening::TurnTilt {
let apex_u = (g_a + g_b) / 2.0;
symbol(em, g_a, gbz, apex_u, gtz);
symbol(em, g_b, gbz, apex_u, gtz);
}
if kind == SashOpening::Slide {
let zc = (gbz + gtz) / 2.0;
let tail = if s.hinge_left { g_a } else { g_b };
let head = if s.hinge_left { g_b } else { g_a };
let barb = (head - tail) * 0.22;
symbol(em, tail, zc, head, zc);
symbol(em, head - barb, gbz + (gtz - gbz) * 0.32, head, zc);
symbol(em, head - barb, gbz + (gtz - gbz) * 0.68, head, zc);
let mut bands: Vec<(&[SashIn], f64, f64)> = vec![(&p.sashes, sash_bottom, sash_top)];
if let Some((tb, tt)) = transom_band {
bands.push((p.transom_sashes, tb, tt));
}
for (band_sashes, band_bottom, band_top) in bands {
if sashes_on && !band_sashes.is_empty() && sash_to - sash_from > EPS && band_top - band_bottom > EPS {
let segs = sash_spans(band_sashes, sash_from, sash_to);
let sfw = fw * 0.7;
let sash_front_n = p.n_max - 0.005;
let sash_back_n = jmax(p.n_min, p.n_max - 0.055);
let glass_front_n = p.n_max - 0.02;
let sym_back_n = glass_front_n;
let sym_front_n = glass_front_n + 0.003;
let symbol = |em: &mut Emitter, u0: f64, h0: f64, u1: f64, h1: f64| {
em.plane_box(u0, h0, u1, h1, SYMBOL_HALF_WIDTH, sym_front_n, sym_back_n, Part::Symbol);
};
for (s, cf, ct) in segs {
if s.kind != SashKind::Sash || s.opening == SashOpening::None || s.opening == SashOpening::Fixed {
continue;
}
let bz = band_bottom;
let tz = band_top;
if ct - cf <= EPS || tz - bz <= EPS {
continue;
}
for q in frame_ring_quads(cf, ct, bz, tz, sfw, p.corner_join, true) {
em.plane_quad(&q, sash_back_n, sash_front_n, Part::Frame);
}
if !fine {
continue;
}
let g_a = cf + sfw;
let g_b = ct - sfw;
let gbz = bz + sfw;
let gtz = tz - sfw;
if g_b - g_a <= EPS || gtz - gbz <= EPS {
continue;
}
let kind = s.opening;
if kind == SashOpening::Turn || kind == SashOpening::TurnTilt {
let apex_u = if s.hinge_left { g_a } else { g_b };
let apex_h = (gbz + gtz) / 2.0;
let far_u = if s.hinge_left { g_b } else { g_a };
symbol(em, far_u, gbz, apex_u, apex_h);
symbol(em, far_u, gtz, apex_u, apex_h);
}
if kind == SashOpening::Tilt || kind == SashOpening::TurnTilt {
let apex_u = (g_a + g_b) / 2.0;
symbol(em, g_a, gbz, apex_u, gtz);
symbol(em, g_b, gbz, apex_u, gtz);
}
if kind == SashOpening::Slide {
let zc = (gbz + gtz) / 2.0;
let tail = if s.hinge_left { g_a } else { g_b };
let head = if s.hinge_left { g_b } else { g_a };
let barb = (head - tail) * 0.22;
symbol(em, tail, zc, head, zc);
symbol(em, head - barb, gbz + (gtz - gbz) * 0.32, head, zc);
symbol(em, head - barb, gbz + (gtz - gbz) * 0.68, head, zc);
}
}
}
}
@@ -762,11 +800,22 @@ fn door_leaf(em: &mut Emitter, o: &OpeningIn, p: &FrameParams) {
let split_z = clamp_range(o.z_top - p.transom_height, leaf_bottom, field_top);
field_top = split_z - fw / 2.0;
}
if p.door_kind == 2.0 {
lift_slide_sashes(em, leaf_from, leaf_to, leaf_bottom, field_top, p);
return;
}
let frac = if p.glazed { jmax(0.05, jmin(1.0, p.glazed_fraction)) } else { 0.0 };
let leaf_top = field_top - frac * (field_top - leaf_bottom);
if leaf_top - leaf_bottom <= EPS || leaf_to - leaf_from <= EPS {
return;
}
if p.door_kind == 1.0 {
// Schiebetür vor der Wand: Blatt in Schliessstellung vor der Fläche, beidseitig 5 cm über die Lichte.
let side = if p.slide_side < 0.0 { -1.0 } else { 1.0 };
let (a, b) = (side * (p.half_thickness + 0.01), side * (p.half_thickness + 0.01 + DOOR_LEAF_THICK));
em.axis_box(o.from - 0.05, o.to + 0.05, o.z_bottom, leaf_top, jmin(a, b), jmax(a, b), Part::DoorLeaf);
return;
}
let n1 = p.n_max - 0.02 + DOOR_LEAF_THICK / 2.0;
let n0 = jmax(p.n_min, n1 - DOOR_LEAF_THICK);
if p.panelled {
@@ -776,6 +825,30 @@ fn door_leaf(em: &mut Emitter, o: &OpeningIn, p: &FrameParams) {
em.axis_box(leaf_from, leaf_to, leaf_bottom, leaf_top, n0, n1, Part::DoorLeaf);
}
/// Hebeschiebetür: festes Feld (Bandseite, aussen) und Schiebefeld (innen) auf versetzten Gleisen,
/// je Flügelrahmen + Glas, in der Mitte überlappend.
fn lift_slide_sashes(em: &mut Emitter, from: f64, to: f64, bottom: f64, top: f64, p: &FrameParams) {
let span = p.n_max - p.n_min;
if to - from <= EPS || top - bottom <= EPS || span <= EPS {
return;
}
let ts = jmin(0.05, span / 2.5);
let gap = (span - 2.0 * ts) / 3.0;
let outer = (p.n_max - gap - ts, p.n_max - gap);
let inner = (p.n_min + gap, p.n_min + gap + ts);
let mid = (from + to) / 2.0;
let ov = 0.03;
let (fixed, slide) = if p.hinge_end { ((mid - ov, to), (from, mid + ov)) } else { ((from, mid + ov), (mid - ov, to)) };
let sfw = jmin(p.frame_width, (to - from) / 6.0);
for ((u0, u1), (n0, n1)) in [(fixed, outer), (slide, inner)] {
for q in frame_ring_quads(u0, u1, bottom, top, sfw, p.corner_join, true) {
em.plane_quad(&q, n0, n1, Part::Frame);
}
let c = (n0 + n1) / 2.0;
em.axis_box(u0 + sfw, u1 - sfw, bottom + sfw, top - sfw, c - GLASS_HALF_THICK, c + GLASS_HALF_THICK, Part::Glass);
}
}
/// Kassettentür-Blatt: Rahmen + Trennstege in voller Blattdicke, Felder dünner und vertieft.
#[allow(clippy::too_many_arguments)]
fn kassette(em: &mut Emitter, leaf_from: f64, leaf_to: f64, leaf_bottom: f64, leaf_top: f64, n0: f64, n1: f64, p: &FrameParams) {
@@ -906,10 +979,11 @@ pub fn opening_meshes(walls: &[WallIn], detail: Detail) -> Vec<BoxMesh> {
// Typ = `frameDepth, insetFromFace, einzugSeite (0 aussen, 1 innen, 2 mitte), Eckstoss (0 vertikal,
// 1 horizontal, 2 Gehrung), frameWidth, transomHeight, Anschlag,` dann
// Tür: `threshold, leafCount, leafStyle (0 glatt, 1 glas, 2 kassette), glazingRatio, zarge,
// panelCols, panelRows`
// panelCols, panelRows, Türart (0 Dreh, 1 Schiebe, 2 Hebeschiebe, 3 Pendel), Schiebeseite (±1),
// BandEnde`
// Fenster: `glazingPanes, mullionRows, mullionCols, sillBoard (0 aussen/fehlt, 1 keine,
// 2 innen, 3 beide), Rollladen (0/1), Breite, Höhe, Tiefe, imSturz, Schienen, Flügelzahl-Default,
// Öffnungsart-Default, nFlügel, Flügel…`
// Öffnungsart-Default, nFlügel, Flügel…, nOberlicht, Flügel… ([95])`
// Flügel = `Art (0 Flügel, 1 Pfosten, 2 andere), festeBreite, width, postWidth, Öffnungsart,
// BandLinks`
// Öffnungsart: 0 fehlt, 1 dreh, 2 kipp, 3 drehkipp, 4 fest, 5 schiebe, 6 andere. NaN = fehlt.
@@ -958,6 +1032,9 @@ fn decode_type(r: &mut Reader, door: bool) -> Option<TypeIn> {
zarge: flag(r)?,
panel_cols: r.num()?,
panel_rows: r.num()?,
kind: r.num()?,
slide_side: r.num()?,
hinge_end: flag(r)?,
})
} else {
let glazing_panes = r.num()?;
@@ -975,6 +1052,27 @@ fn decode_type(r: &mut Reader, door: bool) -> Option<TypeIn> {
let shading_rails = flag(r)?;
let default_wing_count = r.num()?;
let default_opening = opening_kind(r.num()?);
let sashes = decode_sashes(r)?;
let transom_sashes = decode_sashes(r)?;
KindIn::Window(WindowTypeIn {
glazing_panes,
mullion_rows,
mullion_cols,
sill_board,
sashes,
transom_sashes,
default_wing_count,
default_opening,
shading: if create { Some(shading_box) } else { None },
shading_sturz,
shading_rails,
})
};
Some(TypeIn { frame_depth, inset_from_face, inset_inner, inset_mid, rebate_depth, corner_join, frame_width, transom_height, kind })
}
/// Flügelliste `[n, Flügel × n]`.
fn decode_sashes(r: &mut Reader) -> Option<Vec<SashIn>> {
let n = r.count()?;
let mut sashes = Vec::with_capacity(n.min(1024));
for _ in 0..n {
@@ -991,20 +1089,7 @@ fn decode_type(r: &mut Reader, door: bool) -> Option<TypeIn> {
hinge_left: flag(r)?,
});
}
KindIn::Window(WindowTypeIn {
glazing_panes,
mullion_rows,
mullion_cols,
sill_board,
sashes,
default_wing_count,
default_opening,
shading: if create { Some(shading_box) } else { None },
shading_sturz,
shading_rails,
})
};
Some(TypeIn { frame_depth, inset_from_face, inset_inner, inset_mid, rebate_depth, corner_join, frame_width, transom_height, kind })
Some(sashes)
}
fn decode(buf: &[f64]) -> Option<(Vec<WallIn>, Detail)> {
@@ -1077,6 +1162,7 @@ mod tests {
mullion_cols: f64::NAN,
sill_board: sill,
sashes: vec![],
transom_sashes: vec![],
default_wing_count: 1.0,
default_opening: SashOpening::TurnTilt,
shading: None,
@@ -1104,6 +1190,9 @@ mod tests {
zarge: true,
panel_cols: f64::NAN,
panel_rows: f64::NAN,
kind: 0.0,
slide_side: 1.0,
hinge_end: false,
}),
}
}
@@ -1309,4 +1398,38 @@ mod tests {
}
assert_eq!(n(&parts(&ty, Detail::Fine), Part::Shading), 2, "im Sturz: nur zwei Führungsschienen");
}
/// [95] Oberlicht-Einteilung (Pfosten + Kippflügel) und Türarten in 3D.
#[test]
fn oberlicht_einteilung_und_tuerarten() {
let count = |ty: &TypeIn, door: bool, part: Part| opening_meshes(&[wall(op(door, Some(ty.clone())))], Detail::Fine).iter().filter(|m| m.part == part).count();
let mut ty = window_type(SillBoard::None);
ty.transom_height = 0.4;
let base = count(&ty, false, Part::Frame);
let sash = |kind: SashKind, opening: SashOpening| SashIn { kind, fixed_width: false, width: f64::NAN, post_width: f64::NAN, opening, hinge_left: true };
if let KindIn::Window(w) = &mut ty.kind {
w.transom_sashes = vec![sash(SashKind::Sash, SashOpening::Tilt), sash(SashKind::Post, SashOpening::None), sash(SashKind::Sash, SashOpening::Fixed)];
}
// + Pfosten + Flügelrahmen (4 Profile) des Kippflügels.
assert_eq!(count(&ty, false, Part::Frame), base + 1 + 4);
assert!(count(&ty, false, Part::Symbol) >= 2 + 2);
let mut d = door_type(LeafStyle::Glass);
if let KindIn::Door(k) = &mut d.kind {
k.kind = 2.0;
}
assert_eq!(count(&d, true, Part::DoorLeaf), 0);
assert_eq!(count(&d, true, Part::Glass), 2, "Hebeschiebe: zwei Glasfelder");
if let KindIn::Door(k) = &mut d.kind {
k.kind = 1.0;
k.slide_side = -1.0;
}
let m = opening_meshes(&[wall(op(true, Some(d.clone())))], Detail::Fine);
let leaf = m.iter().find(|m| m.part == Part::DoorLeaf).expect("Schiebeblatt");
// Vor der Innenfläche (y > 0.15 bei Wand entlang +x, rechte Normale −y) und breiter als die Lichte.
let ys: Vec<f64> = (0..8).map(|i| leaf.positions[i * 3 + 1]).collect();
assert!(ys.iter().all(|y| *y > 0.15), "{ys:?}");
let xs: Vec<f64> = (0..8).map(|i| leaf.positions[i * 3]).collect();
assert!(xs.iter().cloned().fold(f64::INFINITY, f64::min) < 1.0 && xs.iter().cloned().fold(f64::NEG_INFINITY, f64::max) > 2.2);
}
}
+20 -1
View File
@@ -267,7 +267,7 @@ fn collect_openings(p: &Project, frame: &[f64; 9]) -> Vec<ProjOpening> {
if dt.is_some_and(|d| d.leaf_style == DoorTypeLeafStyle::Glas) { 1.0 } else { 0.0 },
dt.and_then(|d| d.glazing_ratio).unwrap_or(f64::NAN),
wt.and_then(|t| t.frame_width).unwrap_or(0.06),
wt.and_then(|t| t.transom_height).unwrap_or(0.0),
if door { dt.and_then(|t| t.transom_height) } else { wt.and_then(|t| t.transom_height) }.unwrap_or(0.0),
wt.and_then(|t| t.mullion_rows).unwrap_or(f64::NAN),
wt.and_then(|t| t.mullion_cols).unwrap_or(f64::NAN),
if matches!(wt.and_then(|t| t.sill_board), Some(WindowTypeSillBoard::Keine | WindowTypeSillBoard::Innen)) { 0.0 } else { 1.0 },
@@ -279,6 +279,12 @@ fn collect_openings(p: &Project, frame: &[f64; 9]) -> Vec<ProjOpening> {
_ => 0.0,
},
if (door && dt.and_then(|t| t.inset_face) == Some(DoorTypeInsetFace::Innen)) || (!door && wt.and_then(|t| t.inset_face) == Some(WindowTypeInsetFace::Innen)) { -1.0 } else { 1.0 },
match dt.map(|t| t.kind) {
Some(DoorTypeKind::Schiebe) => 1.0,
Some(DoorTypeKind::Hebeschiebe) => 2.0,
Some(DoorTypeKind::Pendel) => 3.0,
_ => 0.0,
},
]);
// Flügel: (pfosten, postWidth, autoWidth, width, opening, hingeLeft).
let mut sashes: Vec<[f64; 6]> = Vec::new();
@@ -312,6 +318,19 @@ fn collect_openings(p: &Project, frame: &[f64; 9]) -> Vec<ProjOpening> {
for s in &sashes {
b.extend(s);
}
// Oberlicht-Einteilung (Pfosten/Riegel, [95]).
let transom = if door { &[][..] } else { wt.and_then(|t| t.transom_sashes.as_deref()).unwrap_or(&[]) };
b.push(transom.len() as f64);
for s in transom {
b.extend([
if s.kind == SashDefKind::Pfosten { 1.0 } else { 0.0 },
s.post_width.unwrap_or(f64::NAN),
if s.auto_width == Some(false) { 0.0 } else { 1.0 },
s.width.unwrap_or(f64::NAN),
s.opening.map_or(0.0, sash_kind),
if s.hinge_side.unwrap_or(SashDefHingeSide::Left) == SashDefHingeSide::Left { 1.0 } else { 0.0 },
]);
}
ids.push(&op.id);
b[0] += 1.0;
}
+24 -1
View File
@@ -1523,12 +1523,35 @@ fn lintel_cut(out: &mut Vec<Primitive>, o: &Opening, c: &CrossSection, height: O
fn door_cut(p: &Project, o: &Opening, c: &CrossSection) -> Vec<Primitive> {
let mut out = vec![opening_poly(rect(c.u_at(c.face_min), c.u_at(c.face_max), c.z_bottom, c.z_top), false, &o.id)];
lintel_cut(&mut out, o, c, p.door_type(o).and_then(|t| t.lintel_height), 0.0);
if o.door_type == Some(OpeningDoorType::Wandoeffnung) {
let kind = p.door_type(o).map(|t| t.kind);
if o.door_type == Some(OpeningDoorType::Wandoeffnung) || kind == Some(DoorTypeKind::Wandoeffnung) {
return out;
}
let mid = (c.face_min + c.face_max) / 2.0;
let fw = min(DEFAULT_FRAME_WIDTH, (c.z_top - c.z_bottom) / 4.0);
if kind == Some(DoorTypeKind::Schiebe) {
// Schiebetür vor der Wand ([95]): Blatt vor der Fläche auf der Aufschlagseite (linke Normale wie im Grundriss).
let swing = if matches!(o.swing, None | Some(SwingSide::Left)) { 1.0 } else { -1.0 };
let dir = if matches!(o.opening_dir, None | Some(OpeningOpeningDir::In)) { 1.0 } else { -1.0 };
let face = if swing * dir > 0.0 { c.face_max } else { c.face_min };
let s = swing * dir;
out.push(opening_poly(rect(c.u_at(face + s * 0.01), c.u_at(face + s * (0.01 + DOOR_LEAF_THICKNESS)), c.z_bottom + 0.01, c.z_top + 0.03), true, &o.id));
return out;
}
out.push(opening_poly(rect(c.u_at(mid - DEFAULT_FRAME_DEPTH / 2.0), c.u_at(mid + DEFAULT_FRAME_DEPTH / 2.0), c.z_top - fw, c.z_top), true, &o.id));
if kind == Some(DoorTypeKind::Hebeschiebe) {
// Zwei Flügel auf versetzten Gleisen, je mit Glaslinie.
for off in [-0.035, 0.035] {
let (a, b) = (mid + off - 0.02, mid + off + 0.02);
out.push(opening_poly(rect(c.u_at(a), c.u_at(b), c.z_bottom + 0.03, c.z_top - fw), true, &o.id));
let mut l = line(v2(c.u_at(mid + off), c.z_bottom + 0.03 + fw), v2(c.u_at(mid + off), c.z_top - 2.0 * fw), "section-window-glass", GLASS_MM, OPENING_INK);
if let Primitive::Line { opening_id, .. } = &mut l {
*opening_id = Some(o.id.clone());
}
out.push(l);
}
return out;
}
out.push(opening_poly(rect(c.u_at(mid - DOOR_LEAF_THICKNESS / 2.0), c.u_at(mid + DOOR_LEAF_THICKNESS / 2.0), c.z_bottom + 0.01, c.z_top - fw), true, &o.id));
out
}
+7 -1
View File
@@ -311,7 +311,7 @@ fn opening_symbol(c: &Ctx, out: &mut Vec<Primitive>, w: &Wall, o: &Opening, colo
b.push(b01(o.opening_dir.is_some_and(|s| s != OpeningOpeningDir::In)));
b.push(b01(o.hinge.is_some_and(|s| s != OpeningHinge::Start)));
b.push(o.swing_angle.unwrap_or(f64::NAN));
b.push(b01(o.door_type == Some(OpeningDoorType::Wandoeffnung)));
b.push(b01(o.door_type == Some(OpeningDoorType::Wandoeffnung) || (door && door_type(p, o).is_some_and(|t| t.kind == DoorTypeKind::Wandoeffnung))));
b.push(if door { crate::jsnum::max(1.0, round(door_type(p, o).map_or(1.0, |t| t.leaf_count))) } else { 1.0 });
b.push(match o.lintel_lines.unwrap_or(OpeningLintelLines::Beide) {
OpeningLintelLines::Keine => 0.0,
@@ -381,6 +381,12 @@ fn opening_symbol(c: &Ctx, out: &mut Vec<Primitive>, w: &Wall, o: &Opening, colo
Some(WindowShadingKind::Markise) => 2.0,
_ => 0.0,
});
b.push(match dt.map(|t| t.kind) {
Some(DoorTypeKind::Schiebe) => 1.0,
Some(DoorTypeKind::Hebeschiebe) => 2.0,
Some(DoorTypeKind::Pendel) => 3.0,
_ => 0.0,
});
b.push(sash_list.len() as f64);
for s in &sash_list {
b.extend([
+124 -37
View File
@@ -39,7 +39,7 @@
//! rahmenbreite, kaempferHoehe, sprossenZeilen (NaN = 1), sprossenSpalten (NaN = 1),
//! bankAn, typArt (0 fest, 1 dreh, 2 kipp, 3 drehkipp, 4 schiebe),
//! anschlag (Meter, 0 keiner), anschlagSeite (1 aussen | −1 innen; [94]),
//! nFluegel, (pfosten, pfostenBreite (NaN), autoBreite (0/1), breite (NaN), art (-1 = typArt), bandLinks) × nFluegel
//! tuerArt (0 Dreh | 1 Schiebe | 2 Hebeschiebe | 3 Pendel; [95]), nFluegel, (pfosten, pfostenBreite (NaN), autoBreite (0/1), breite (NaN), art (-1 = typArt), bandLinks) × nFluegel
//! ```
//! → `[n, (ok, tiefe, istTuer, 8 Ecken, Listen) × n]`; `ok` 0 = nicht sichtbar (sonst nichts mehr).
//! Listen in dieser Reihenfolge, je `[anzahl, Einträge]`: glas, tuerblatt (Vierecke à 8 Werte),
@@ -827,7 +827,7 @@ fn rect(q: &Quad, fa0: f64, fa1: f64, fz0: f64, fz1: f64) -> Quad {
}
/// Feste Werte je Öffnung vor der Flügelliste (der letzte = Flügelzahl).
const REC: usize = 21;
const REC: usize = 22;
/// Projiziert die zum Betrachter zeigende Wand-Langseite der Öffnung; `None` ohne sichtbare Seite.
fn project_opening_rect(f: &Frame, o: &[f64]) -> Option<(Quad, f64)> {
@@ -873,34 +873,9 @@ fn project_opening_side(f: &Frame, o: &[f64]) -> Option<(Quad, f64, f64)> {
None
}
fn layout_opening(o: &[f64], sashes: &[f64], pts: &Quad) -> OpeningOut {
let mut out = OpeningOut::default();
let (from, to, z_bottom, z_top) = (o[5], o[6], o[7], o[8]);
let w = to - from;
let h = z_top - z_bottom;
if o[9] != 0.0 {
// Tür: Blatt-Fläche, bei Glasblatt mit Teilverglasung (Kämpferhöhe von OBEN).
if o[10] != 0.0 {
let ratio = max(0.05, min(1.0, if o[11].is_nan() { 1.0 } else { o[11] }));
if ratio >= 1.0 - EPS {
out.glass.push(rect(pts, 0.04, 0.96, 0.0, 0.97));
} else {
let split_z = 0.97 * (1.0 - ratio);
out.glass.push(rect(pts, 0.04, 0.96, split_z, 0.97));
out.door_leaf.push(rect(pts, 0.04, 0.96, 0.0, split_z));
out.divisions.push((quad_at(pts, 0.04, split_z), quad_at(pts, 0.96, split_z)));
}
} else {
out.door_leaf.push(rect(pts, 0.04, 0.96, 0.0, 0.97));
}
return out;
}
let fw = o[12];
let fa = min(0.45, fw / max(w, 1e-6));
let fz = min(0.45, fw / max(h, 1e-6));
let transom = max(0.0, o[13]);
let f_tr = if transom > EPS && transom < h - fw { 1.0 - transom / h } else { 0.0 };
let field_top = if f_tr > 0.0 { f_tr - fz / 2.0 } else { 1.0 - fz };
/// Flügel/Pfosten eines Feldbands `fz..field_top` (Anteile der Öffnungshöhe) über die lichte Breite.
#[allow(clippy::too_many_arguments)]
fn sash_band(out: &mut OpeningOut, o: &[f64], sashes: &[f64], pts: &Quad, w: f64, h: f64, fa: f64, fw: f64, fz: f64, field_top: f64, rows_in: f64, cols_in: f64) {
let inner_w = max(1e-6, w * (1.0 - 2.0 * fa));
let n_sashes = sashes.len() / 6;
let sash = |k: usize| &sashes[6 * k..6 * k + 6];
@@ -942,8 +917,8 @@ fn layout_opening(o: &[f64], sashes: &[f64], pts: &Quad) -> OpeningOut {
let g_b = fa1 - g_u;
let gz0 = fz + g_v;
let gz1 = field_top - g_v;
let rows = max(1.0, round(if o[14].is_nan() { 1.0 } else { o[14] })) as usize;
let cols = max(1.0, round(if o[15].is_nan() { 1.0 } else { o[15] })) as usize;
let rows = max(1.0, round(if rows_in.is_nan() { 1.0 } else { rows_in })) as usize;
let cols = max(1.0, round(if cols_in.is_nan() { 1.0 } else { cols_in })) as usize;
if g_b - g_a > 1e-6 && gz1 - gz0 > 1e-6 {
for r in 0..rows {
let rf = r as f64;
@@ -1000,6 +975,59 @@ fn layout_opening(o: &[f64], sashes: &[f64], pts: &Quad) -> OpeningOut {
out.symbol.push((quad_at(pts, head - barb, gz0 + (gz1 - gz0) * 0.68), head_pt));
}
}
}
fn layout_opening(o: &[f64], sashes: &[f64], transom_sashes: &[f64], pts: &Quad) -> OpeningOut {
let mut out = OpeningOut::default();
let (from, to, z_bottom, z_top) = (o[5], o[6], o[7], o[8]);
let w = to - from;
let h = z_top - z_bottom;
if o[9] != 0.0 {
// Oberlicht über dem Kämpfer ([95]): festes Glasfeld, das Blatt endet darunter.
let transom = if o[13].is_nan() { 0.0 } else { o[13] };
let top = if transom > EPS && transom < h * 0.8 {
let f_tr = 1.0 - transom / h;
out.glass.push(rect(pts, 0.04, 0.96, f_tr + 0.015, 0.97));
out.divisions.push((quad_at(pts, 0.0, f_tr), quad_at(pts, 1.0, f_tr)));
f_tr - 0.015
} else {
0.97
};
let kind = o[20];
if kind == 2.0 {
// Hebeschiebetür: zwei Glasfelder, Pfeil auf dem Schiebefeld (zur Mitte hin).
out.glass.push(rect(pts, 0.04, 0.5, 0.03, top));
out.glass.push(rect(pts, 0.5, 0.96, 0.03, top));
out.divisions.push((quad_at(pts, 0.5, 0.0), quad_at(pts, 0.5, top)));
slide_arrow(&mut out, pts, 0.85, 0.6, top * 0.5, top);
return out;
}
// Tür: Blatt-Fläche, bei Glasblatt mit Teilverglasung (Kämpferhöhe von OBEN).
if o[10] != 0.0 {
let ratio = max(0.05, min(1.0, if o[11].is_nan() { 1.0 } else { o[11] }));
if ratio >= 1.0 - EPS {
out.glass.push(rect(pts, 0.04, 0.96, 0.0, top));
} else {
let split_z = top * (1.0 - ratio);
out.glass.push(rect(pts, 0.04, 0.96, split_z, top));
out.door_leaf.push(rect(pts, 0.04, 0.96, 0.0, split_z));
out.divisions.push((quad_at(pts, 0.04, split_z), quad_at(pts, 0.96, split_z)));
}
} else {
out.door_leaf.push(rect(pts, 0.04, 0.96, 0.0, top));
}
if kind == 1.0 {
slide_arrow(&mut out, pts, 0.75, 0.25, top * 0.5, top);
}
return out;
}
let fw = o[12];
let fa = min(0.45, fw / max(w, 1e-6));
let fz = min(0.45, fw / max(h, 1e-6));
let transom = max(0.0, o[13]);
let f_tr = if transom > EPS && transom < h - fw { 1.0 - transom / h } else { 0.0 };
let field_top = if f_tr > 0.0 { f_tr - fz / 2.0 } else { 1.0 - fz };
sash_band(&mut out, o, sashes, pts, w, h, fa, fw, fz, field_top, o[14], o[15]);
if o[16] != 0.0 {
let ov1 = 0.02 / max(w, 1e-6);
let ov2 = 0.05 / max(w, 1e-6);
@@ -1009,12 +1037,26 @@ fn layout_opening(o: &[f64], sashes: &[f64], pts: &Quad) -> OpeningOut {
out.sill.push(rect(pts, -ov2, 1.0 + ov2, -(h1 + h2), -h1));
}
if f_tr > 0.0 {
out.glass.push(rect(pts, fa, 1.0 - fa, f_tr + fz / 2.0, 1.0 - fz));
if transom_sashes.is_empty() {
out.glass.push(rect(pts, fa, 1.0 - fa, f_tr + fz / 2.0, 1.0 - fz));
} else {
// Oberlicht mit Einteilung (Pfosten/Riegel, [95]).
sash_band(&mut out, o, transom_sashes, pts, w, h, fa, fw, f_tr + fz / 2.0, 1.0 - fz, f64::NAN, f64::NAN);
}
out.divisions.push((quad_at(pts, 0.0, f_tr), quad_at(pts, 1.0, f_tr)));
}
out
}
/// Schiebe-Pfeil (Schaft + zwei Widerhaken) von `tail` nach `head` (Anteile der Breite) auf Höhe `zc`.
fn slide_arrow(out: &mut OpeningOut, pts: &Quad, tail: f64, head: f64, zc: f64, top: f64) {
let barb = (head - tail) * 0.22;
let head_pt = quad_at(pts, head, zc);
out.symbol.push((quad_at(pts, tail, zc), head_pt));
out.symbol.push((quad_at(pts, head - barb, zc - top * 0.08), head_pt));
out.symbol.push((quad_at(pts, head - barb, zc + top * 0.08), head_pt));
}
fn push_quads(f: &mut Vec<f64>, list: &[Quad]) {
f.push(list.len() as f64);
for q in list {
@@ -1058,6 +1100,13 @@ pub fn openings(frame: &[f64], inp: &[f64]) -> Vec<f64> {
let ns = ns as usize;
let sashes = &inp[i + REC..i + REC + 6 * ns];
i += REC + 6 * ns;
// Oberlicht-Einteilung ([95]): `[n, Flügel × n]`.
let nt = inp.get(i).copied().unwrap_or(f64::NAN);
if !(nt >= 0.0) || nt.fract() != 0.0 || i + 1 + 6 * nt as usize > inp.len() {
return Vec::new();
}
let transom_sashes = &inp[i + 1..i + 1 + 6 * nt as usize];
i += 1 + 6 * nt as usize;
let geo = &o[..9];
if geo.iter().any(|v| !v.is_finite()) {
return Vec::new();
@@ -1080,7 +1129,7 @@ pub fn openings(frame: &[f64], inp: &[f64]) -> Vec<f64> {
for p in &pts {
f.extend([p.0, p.1]);
}
let out = layout_opening(o, sashes, &pts);
let out = layout_opening(o, sashes, transom_sashes, &pts);
push_quads(&mut f, &out.glass);
push_quads(&mut f, &out.door_leaf);
push_lines(&mut f, &out.divisions);
@@ -1189,9 +1238,7 @@ mod tests_ts {
fn anschlag_verkleinert_die_ansicht_nur_von_seiner_seite() {
let frame = [0.0, 0.0, -3.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0];
let rec = |rebate: f64, side: f64| {
let mut b = vec![1.0, 0.0, 0.0, 5.0, 0.0, 0.3, 1.0, 2.2, 0.9, 2.3, 0.0, 0.0, f64::NAN, 0.06, 0.0, f64::NAN, f64::NAN, 1.0, 1.0, rebate, side, 0.0];
b.truncate(1 + REC);
b
vec![1.0, 0.0, 0.0, 5.0, 0.0, 0.3, 1.0, 2.2, 0.9, 2.3, 0.0, 0.0, f64::NAN, 0.06, 0.0, f64::NAN, f64::NAN, 1.0, 1.0, rebate, side, 0.0, 0.0, 0.0]
};
let width = |f: &[f64]| {
assert_eq!(f[1], 1.0);
@@ -1203,4 +1250,44 @@ mod tests_ts {
let w2 = width(&openings(&frame, &rec(0.05, -1.0)));
assert!((w0 - 1.2).abs() < 1e-9 && (w1 - 1.1).abs() < 1e-9 && (w2 - 1.2).abs() < 1e-9, "{w0} {w1} {w2}");
}
/// [95] Türarten/Oberlicht in der Ansicht: Hebeschiebe = zwei Glasfelder + Pfeil; Tür-Oberlicht;
/// Oberlicht-Einteilung eines Fensters mit Kippflügel und Pfosten.
#[test]
fn tuerarten_und_oberlicht_in_der_ansicht() {
let frame = [0.0, 0.0, -3.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0];
let rec = |door: f64, transom: f64, kind: f64, transom_sashes: &[[f64; 6]]| {
let mut b = vec![1.0, 0.0, 0.0, 5.0, 0.0, 0.3, 1.0, 2.2, 0.0, 2.3, door, 0.0, f64::NAN, 0.06, transom, f64::NAN, f64::NAN, 1.0, 1.0, 0.0, 1.0, kind];
if door == 0.0 {
b.extend([1.0, 0.0, f64::NAN, 1.0, f64::NAN, 3.0, 1.0]);
} else {
b.push(0.0);
}
b.push(transom_sashes.len() as f64);
for t in transom_sashes {
b.extend(t);
}
b
};
// Listen ab Index 12: glas, tuerblatt, teilungen, fluegel, bank, symbol.
let lists = |f: &[f64]| {
let mut i = 12;
let mut n = Vec::new();
for size in [8, 8, 4, 8, 8, 4] {
let c = f[i] as usize;
n.push(c);
i += 1 + c * size;
}
assert_eq!(i, f.len());
n
};
let hs = lists(&openings(&frame, &rec(1.0, 0.0, 2.0, &[])));
assert_eq!((hs[0], hs[1], hs[5]), (2, 0, 3));
let tr = lists(&openings(&frame, &rec(1.0, 0.4, 0.0, &[])));
assert_eq!((tr[0], tr[1], tr[2]), (1, 1, 1));
let plain = lists(&openings(&frame, &rec(0.0, 0.5, 0.0, &[])));
let split = lists(&openings(&frame, &rec(0.0, 0.5, 0.0, &[[0.0, f64::NAN, 1.0, f64::NAN, 2.0, 1.0], [1.0, 0.08, 1.0, f64::NAN, 0.0, 1.0], [0.0, f64::NAN, 1.0, f64::NAN, 0.0, 1.0]])));
assert_eq!(split[3], plain[3] + 2, "zwei Oberlicht-Felder");
assert!(split[5] >= plain[5] + 2, "Kipp-Symbol im Oberlicht");
}
}
+133 -2
View File
@@ -14,6 +14,7 @@
//! Stärken: haar, rahmenHaar, rahmenAufsicht, fluegel, sims,
//! Details ([94]): anschlag (Meter, 0 keiner), bank (0 fehlt | 1 keine | 2 innen | 3 beide | 4 aussen),
//! kastenSturz (0 vorgesetzt | 1 im Sturz), kastenTiefe, kastenArt (0 Rollladen | 1 Raffstore | 2 Markise),
//! Türart ([95]): 0 Dreh | 1 Schiebe (vor der Wand, Aufschlagseite) | 2 Hebeschiebe | 3 Pendel,
//! nFluegel, (pfosten, auto, breite, pfostenbreite, oeffenbar) × n]`.
//!
//! Ausgabe `[n, Eintrag × n]` in Zeichenreihenfolge:
@@ -117,6 +118,7 @@ fn plan_opening_inner(buf: &[f64]) -> Option<Vec<f64>> {
let shading_sturz = r.num()? != 0.0;
let shading_depth = r.num()?;
let shading_kind = r.num()? as i64;
let door_kind = r.num()? as i64;
let n_sash = r.count()?;
let mut sashes = Vec::with_capacity(n_sash);
for _ in 0..n_sash {
@@ -140,14 +142,47 @@ fn plan_opening_inner(buf: &[f64]) -> Option<Vec<f64>> {
if let Some(gap) = opening_gap_quad(&w, position, width) {
o.polygon(0.0, 0.0, 0.0, &gap);
}
if !wandoeffnung {
let count = max(1.0, round(if leaf_count.is_nan() { 1.0 } else { leaf_count }));
let count = max(1.0, round(if leaf_count.is_nan() { 1.0 } else { leaf_count }));
if wandoeffnung {
// Reine Wandöffnung: nur Lücke (und Sturzlinien).
} else if door_kind == 1 {
sliding_leaves(&mut o, &w, jamb_start, jamb_end, &door, count, hair);
} else if door_kind == 2 {
// Gleise im Rahmen: hinter der Anschlag-Zone (bzw. mittig ohne Rahmentyp).
let half = total / 2.0;
let depth = max(0.12, if frame_width.is_nan() { 0.0 } else { frame_width });
let (lo, hi) = if !has_frame {
(ref_off - depth / 2.0, ref_off + depth / 2.0)
} else if frame_inset_side == 1.0 {
let e = ref_off + half - max(0.0, min(frame_inset, total));
(max(ref_off - half, e - depth), e)
} else if frame_inset_side == 2.0 {
(ref_off - depth / 2.0, ref_off + depth / 2.0)
} else {
let e = ref_off - half + max(0.0, min(frame_inset, total));
(e, min(ref_off + half, e + depth))
};
lift_slide(&mut o, jamb_start, jamb_end, wn, lo, hi, door.hinge_end, hair);
} else {
for leaf in door_leaves(&w, position, width, &door, count) {
o.line(C_LEAF, hair, 0.0, 0.0, leaf.hinge, leaf.open_end);
if detail != Detail::Grob {
o.arc(hair, leaf.hinge, leaf.closed_end, leaf.open_end, leaf.radius);
}
}
if door_kind == 3 {
// Pendeltür: schlägt auch zur Gegenseite auf (Blatt gepunktet, Bogen).
let other = DoorParams { swing_right: !door.swing_right, ..door };
for leaf in door_leaves(&w, position, width, &other, count) {
o.line(C_LEAF, hair, 0.0, 3.0, leaf.hinge, leaf.open_end);
if detail != Detail::Grob {
// Bögen laufen gegen den Uhrzeigersinn von `from` nach `to`: kurzen Bogen wählen.
let (a, b) = (sub(leaf.closed_end, leaf.hinge), sub(leaf.open_end, leaf.hinge));
let (from, to) = if a.x * b.y - a.y * b.x >= 0.0 { (leaf.closed_end, leaf.open_end) } else { (leaf.open_end, leaf.closed_end) };
o.arc(hair, leaf.hinge, from, to, leaf.radius);
}
}
}
}
if detail == Detail::Fein {
let reveal = 0.06;
@@ -319,6 +354,73 @@ fn plan_opening_inner(buf: &[f64]) -> Option<Vec<f64>> {
Some(finish(o))
}
/// Pfeil von `a` nach `b` (Schaft + zwei Widerhaken) in Richtung der Schiebebewegung.
fn arrow(o: &mut Out, a: V, b: V, side: V, hair: f64) {
let d = normalize(sub(b, a));
let l = hypot2(b.x - a.x, b.y - a.y);
let barb = min(0.12, l * 0.35);
o.line(C_LEAF, hair, 0.0, 0.0, a, b);
for k in [-1.0, 1.0] {
o.line(C_LEAF, hair, 0.0, 0.0, b, add(sub(b, scale(d, barb)), scale(side, k * barb * 0.45)));
}
}
/// Schiebetür vor der Wand (SIA): Blatt als schmales Rechteck in Schliessstellung auf der
/// Aufschlagseite vor der Wandfläche, je Blatt ein Pfeil zur Parkseite (Bandseite bzw. aussen).
fn sliding_leaves(o: &mut Out, w: &WallRef, js: V, je: V, p: &DoorParams, count: f64, hair: f64) {
let n = w.frame().1;
let side = (if p.swing_right { -1.0 } else { 1.0 }) * (if p.open_out { -1.0 } else { 1.0 });
let face = w.ref_off + side * w.total / 2.0;
let (n0, n1) = (face + side * 0.01, face + side * 0.05);
let wd = hypot2(je.x - js.x, je.y - js.y);
let ov = 0.05;
let leaf = |o: &mut Out, u0: f64, u1: f64| {
let a = along(js, je, u0);
let b = along(js, je, u1);
o.ring(C_LEAF, hair, 0.0, &[add(a, scale(n, n0)), add(b, scale(n, n0)), add(b, scale(n, n1)), add(a, scale(n, n1))]);
};
let mid_n = face + side * 0.12;
let at = |u: f64| add(along(js, je, u), scale(n, mid_n));
if count >= 2.0 {
leaf(o, -ov, wd / 2.0);
leaf(o, wd / 2.0, wd + ov);
arrow(o, at(wd * 0.4), at(wd * 0.1), n, hair);
arrow(o, at(wd * 0.6), at(wd * 0.9), n, hair);
} else {
leaf(o, -ov, wd + ov);
let (from, to) = if p.hinge_end { (wd * 0.25, wd * 0.75) } else { (wd * 0.75, wd * 0.25) };
arrow(o, at(from), at(to), n, hair);
}
}
/// Hebeschiebetür (SIA wie Schiebefenster): zwei Flügel auf versetzten Gleisen im Rahmen
/// (`lo..hi` quer zur Wand), das feste Feld an der Bandseite, das Schiebefeld mit Pfeil dorthin.
#[allow(clippy::too_many_arguments)]
fn lift_slide(o: &mut Out, js: V, je: V, n: V, lo: f64, hi: f64, hinge_end: bool, hair: f64) {
let wd = hypot2(je.x - js.x, je.y - js.y);
let span = hi - lo;
if span <= 1e-3 || wd <= 1e-3 {
return;
}
let ts = min(0.05, span / 2.5);
let gap = (span - 2.0 * ts) / 3.0;
let outer = (lo + gap, lo + gap + ts);
let inner = (hi - gap - ts, hi - gap);
let ov = 0.03;
let (fixed_u, slide_u) = if hinge_end { ((wd / 2.0 - ov, wd), (0.0, wd / 2.0 + ov)) } else { ((0.0, wd / 2.0 + ov), (wd / 2.0 - ov, wd)) };
for ((u0, u1), (n0, n1)) in [(fixed_u, outer), (slide_u, inner)] {
let a = along(js, je, u0);
let b = along(js, je, u1);
o.ring(C_LEAF, hair, 0.0, &[add(a, scale(n, n0)), add(b, scale(n, n0)), add(b, scale(n, n1)), add(a, scale(n, n1))]);
let g = (n0 + n1) / 2.0;
o.line(C_GLASS, hair, 0.0, 0.0, add(a, scale(n, g)), add(b, scale(n, g)));
}
// Pfeil auf der Innenseite des Schiebefelds, zur Bandseite (über das feste Feld).
let an = inner.1 + gap.max(0.04);
let (from, to) = if hinge_end { (wd * 0.15, wd * 0.6) } else { (wd * 0.85, wd * 0.4) };
arrow(o, add(along(js, je, from), scale(n, an)), add(along(js, je, to), scale(n, an)), n, hair);
}
fn finish(o: Out) -> Vec<f64> {
let mut out = Vec::with_capacity(o.buf.len() + 1);
out.push(o.n as f64);
@@ -410,6 +512,7 @@ mod tests {
b.extend([has_type as u8 as f64, 0.06, NAN, NAN, 0.0, NAN, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0]); // Fenster
b.extend([0.02, 0.02, 0.02, 0.02, 0.02]); // Strichstärken
b.extend([0.0, 0.0, 0.0, 0.0, 0.0]); // Details: kein Anschlag, Bank fehlt, Kasten vorgesetzt
b.push(0.0); // Türart Dreh
b.push(sashes.len() as f64);
for s in sashes {
b.extend(s);
@@ -574,4 +677,32 @@ mod tests {
b[DETAILS] = 0.04;
assert_eq!(polygons(&plan_opening(&b), 2.0).len(), 2);
}
/// [95] Türarten im Grundriss: Schiebetür (Blatt-Rechteck + Pfeil, kein Bogen), Hebeschiebe
/// (zwei Flügel auf versetzten Gleisen + Glaslinien + Pfeil), Pendel (Bögen beidseitig).
#[test]
fn tuerarten_nach_sia() {
const KIND: usize = DETAILS + 5;
let mut b = input(true, 1.0, false, &[]);
let arcs = |f: &[f64]| tags(f).iter().filter(|t| **t == 3.0).count();
assert_eq!(arcs(&plan_opening(&b)), 1);
b[KIND] = 1.0;
let f = plan_opening(&b);
assert_eq!(arcs(&f), 0);
assert_eq!(count_cls(&f, C_LEAF), 4 + 3);
b[15] = 2.0; // zwei Blätter
assert_eq!(count_cls(&plan_opening(&b), C_LEAF), 8 + 6);
b[15] = 1.0;
b[KIND] = 2.0;
let f = plan_opening(&b);
assert_eq!(count_cls(&f, C_LEAF), 8 + 3);
assert_eq!(count_cls(&f, C_GLASS), 2);
b[KIND] = 3.0;
assert_eq!(arcs(&plan_opening(&b)), 2);
// Grob: keine Bögen, aber beide Blätter.
b[9] = 0.0;
let f = plan_opening(&b);
assert_eq!(arcs(&f), 0);
assert_eq!(count_cls(&f, C_LEAF), 2);
}
}
+1
View File
@@ -44,6 +44,7 @@ mod cmd_create;
mod area_report;
mod rich_text;
mod geo_mesh;
mod opening_presets;
use wasm_bindgen::prelude::wasm_bindgen;
@@ -0,0 +1,9 @@
//! Bindung der Fenster-/Türtyp-Vorlagen (`crate::opening_presets`, [95]).
use wasm_bindgen::prelude::wasm_bindgen;
/// Vorlagen als JSON `{ windowTypes, doorTypes }`.
#[wasm_bindgen]
pub fn opening_type_presets_json() -> String {
crate::opening_presets::presets_json()
}
+2
View File
@@ -462,6 +462,7 @@ impl<'a> Reader<'a> {
0 => DoorKind::Swing,
1 => DoorKind::Sliding,
2 => DoorKind::WallOpening,
3 => DoorKind::DoubleSwing,
k => return Err(format!("unbekannte Türart {k} bei {}", self.pos - 1)),
};
let leaf_count = self.f()?;
@@ -2251,6 +2252,7 @@ mod tests {
DoorKind::Swing => 0.0,
DoorKind::Sliding => 1.0,
DoorKind::WallOpening => 2.0,
DoorKind::DoubleSwing => 3.0,
};
self.n(&[k, p.leaf_count, p.swing_sign, p.dir_sign, if p.hinge_at_start { 1.0 } else { 0.0 }, p.transom_height]);
self.n(&[if p.glazed { 1.0 } else { 0.0 }]);
+11
View File
@@ -122,6 +122,8 @@ pub enum DoorKind {
Swing,
Sliding,
WallOpening,
/// Pendeltür (schlägt nach beiden Seiten auf).
DoubleSwing,
}
/// Parameter einer Füllung aus dem Modell (TS `fillParams`); fehlende Typwerte als `None`.
@@ -387,6 +389,14 @@ pub fn fill_geometry(p: &FillParams) -> FillGeometry {
} else {
"SLIDING_TO_RIGHT"
}
} else if p.door_kind == DoorKind::DoubleSwing {
if p.leaf_count >= 2.0 {
"DOUBLE_DOOR_DOUBLE_SWING"
} else if left {
"DOUBLE_SWING_LEFT"
} else {
"DOUBLE_SWING_RIGHT"
}
} else if p.leaf_count >= 2.0 {
"DOUBLE_DOOR_SINGLE_SWING"
} else if left {
@@ -556,6 +566,7 @@ mod tests {
assert_eq!(kind(FillParams { swing_sign: -1.0, ..door() }), Some("SINGLE_SWING_LEFT"));
assert_eq!(kind(FillParams { door_kind: DoorKind::Sliding, ..door() }), Some("SLIDING_TO_RIGHT"));
assert_eq!(kind(FillParams { door_kind: DoorKind::Sliding, leaf_count: 2.0, ..door() }), Some("DOUBLE_DOOR_SLIDING"));
assert_eq!(kind(FillParams { door_kind: DoorKind::DoubleSwing, leaf_count: 2.0, ..door() }), Some("DOUBLE_DOOR_DOUBLE_SWING"));
let g = fill_geometry(&door());
assert_eq!(g.origin, (1.5, 0.0));
assert!(close(g.u.0, 1.0) && close(g.u.1, 0.0));
+21
View File
@@ -582,6 +582,8 @@ export const de = {
"oed.cornerJoin.horizontal": "Riegel durchlaufend",
"oed.cornerJoin.gehrung": "Gehrung",
"oed.f.transomHeight": "Oberlichthöhe (m)",
"oed.f.transomFields": "Oberlicht-Felder",
"oed.f.transomOpening": "Oberlicht-Öffnung",
"oed.f.mullionRows": "Kämpfer-/Sprossenzeilen",
"oed.f.mullionCols": "Sprossen-Spalten",
"oed.f.sillLineFaces": "Auf-/Untersicht-Linie",
@@ -628,6 +630,8 @@ export const de = {
"oed.door.kassette": "Kassette",
"oed.door.glas": "Glas",
"oed.door.wandoeffnung": "Wandöffnung",
"oed.door.hebeschiebe": "Hebeschiebetür",
"oed.door.pendel": "Pendeltür",
"objinfo.stair.type": "Typ",
"objinfo.type.none": "(kein Typ)",
"objinfo.opening.kind": "Art",
@@ -1012,6 +1016,21 @@ export const de = {
"Wiederverwendbare Fenstertypen mit Öffnungsart, Verglasung und Standardmaßen für neu platzierte Fenster.",
"resources.windowTypes.empty": "Noch keine Fenstertypen.",
"resources.windowTypes.placeholder": "Fenstertyp",
"resources.addPreset": "Aus Bibliothek…",
"resources.addPreset.hint": "Übliche Bauart als Vorlage übernehmen",
"preset.fe-dk-1": "Dreh-Kipp 1-flügelig",
"preset.fe-dk-2": "Dreh-Kipp 2-flügelig (Stulp)",
"preset.fe-fest": "Festverglasung",
"preset.fe-oberlicht": "Dreh-Kipp mit Kipp-Oberlicht",
"preset.fe-pfosten-riegel": "Pfosten-Riegel 3-teilig",
"preset.fe-schiebe": "Schiebefenster 2-teilig",
"preset.tu-zimmer": "Zimmertür (Zarge)",
"preset.tu-zimmer-2": "Zimmertür 2-flügelig",
"preset.tu-schiebe": "Schiebetür vor der Wand",
"preset.tu-hebeschiebe": "Hebeschiebetür",
"preset.tu-pendel": "Pendeltür",
"preset.tu-haus": "Haustür mit Oberlicht",
"preset.tu-wand": "Wandöffnung",
"resources.stairTypes.hint":
"Wiederverwendbare Treppentypen mit Tragart, Stufenausbildung und Geländer für neu platzierte Treppen.",
"resources.stairTypes.empty": "Noch keine Treppentypen.",
@@ -1058,6 +1077,8 @@ export const de = {
"resources.doorKind.dreh": "Drehflügel",
"resources.doorKind.schiebe": "Schiebe",
"resources.doorKind.hebeschiebe": "Hebeschiebe",
"resources.doorKind.pendel": "Pendel",
"resources.doorKind.wandoeffnung": "Wandöffnung",
"resources.leafCount.1": "1-flügelig",
"resources.leafCount.2": "2-flügelig",
+21
View File
@@ -581,6 +581,8 @@ export const en: Record<TranslationKey, string> = {
"oed.cornerJoin.horizontal": "Rails through",
"oed.cornerJoin.gehrung": "Mitre",
"oed.f.transomHeight": "Transom height (m)",
"oed.f.transomFields": "Transom fields",
"oed.f.transomOpening": "Transom opening",
"oed.f.mullionRows": "Transom/muntin rows",
"oed.f.mullionCols": "Muntin columns",
"oed.f.sillLineFaces": "Top-/bottom-view line",
@@ -627,6 +629,8 @@ export const en: Record<TranslationKey, string> = {
"oed.door.kassette": "Panelled",
"oed.door.glas": "Glass",
"oed.door.wandoeffnung": "Wall opening",
"oed.door.hebeschiebe": "Lift-and-slide door",
"oed.door.pendel": "Swing door (double-acting)",
"objinfo.stair.type": "Type",
"objinfo.type.none": "(no type)",
"objinfo.opening.kind": "Type",
@@ -1006,6 +1010,21 @@ export const en: Record<TranslationKey, string> = {
"Reusable window types with opening style, glazing and default dimensions for newly placed windows.",
"resources.windowTypes.empty": "No window types yet.",
"resources.windowTypes.placeholder": "Window type",
"resources.addPreset": "From library…",
"resources.addPreset.hint": "Add a common construction as a template",
"preset.fe-dk-1": "Tilt-and-turn, single sash",
"preset.fe-dk-2": "Tilt-and-turn, double sash",
"preset.fe-fest": "Fixed glazing",
"preset.fe-oberlicht": "Tilt-and-turn with tilting transom",
"preset.fe-pfosten-riegel": "Mullion-transom, 3 bays",
"preset.fe-schiebe": "Sliding window, 2 parts",
"preset.tu-zimmer": "Interior door (frame)",
"preset.tu-zimmer-2": "Interior door, double leaf",
"preset.tu-schiebe": "Surface sliding door",
"preset.tu-hebeschiebe": "Lift-and-slide door",
"preset.tu-pendel": "Double-acting swing door",
"preset.tu-haus": "Entrance door with transom",
"preset.tu-wand": "Wall opening",
"resources.stairTypes.hint":
"Reusable stair types with structure, tread style and railing for newly placed stairs.",
"resources.stairTypes.empty": "No stair types yet.",
@@ -1052,6 +1071,8 @@ export const en: Record<TranslationKey, string> = {
"resources.doorKind.dreh": "Hinged",
"resources.doorKind.schiebe": "Sliding",
"resources.doorKind.hebeschiebe": "Lift-and-slide",
"resources.doorKind.pendel": "Double-acting",
"resources.doorKind.wandoeffnung": "Wall opening",
"resources.leafCount.1": "Single-leaf",
"resources.leafCount.2": "Double-leaf",
+26
View File
@@ -0,0 +1,26 @@
import { describe, expect, it } from "vitest";
import { instantiatePreset, openingTypePresets } from "./openingPresets";
import { de } from "../i18n/de";
import { en } from "../i18n/en";
describe("openingTypePresets ([95])", () => {
it("liefert Fenster- und Türvorlagen mit übersetzten Namen", () => {
const { windowTypes, doorTypes } = openingTypePresets();
expect(windowTypes.length).toBeGreaterThanOrEqual(5);
expect(doorTypes.map((d) => d.kind)).toEqual(expect.arrayContaining(["schiebe", "hebeschiebe", "pendel"]));
for (const t of [...windowTypes, ...doorTypes]) {
expect((de as Record<string, string>)[`preset.${t.id}`]).toBeTruthy();
expect((en as Record<string, string>)[`preset.${t.id}`]).toBeTruthy();
}
expect(windowTypes.some((w) => (w.transomSashes ?? []).length > 1)).toBe(true);
});
it("instantiatePreset kopiert tief und setzt id/Name", () => {
const w = openingTypePresets().windowTypes.find((t) => t.sashes)!;
const c = instantiatePreset(w, "ft-neu", "Neu");
expect(c.id).toBe("ft-neu");
expect(c.name).toBe("Neu");
c.sashes![0].opening = "fest";
expect(w.sashes![0].opening).not.toBe("fest");
});
});
+31
View File
@@ -0,0 +1,31 @@
// Fenster-/Türtyp-Bibliothek ([95]) — dünne Fassade über die Vorlagen des Rust-Kerns
// (`src-tauri/core/src/opening_presets.rs`). Die Vorlagen kommen ohne Projekt-ids; wer eine
// übernimmt, vergibt eine neue id (`instantiatePreset`).
import { core } from "../engine/coreWasm";
import type { DoorType, WindowType } from "./types";
export interface OpeningTypePresets {
windowTypes: WindowType[];
doorTypes: DoorType[];
}
let cache: OpeningTypePresets | null = null;
/** Alle Vorlagen (einmal aus dem Kern gelesen). `id` ist die stabile Vorlagen-id (i18n `preset.<id>`). */
export function openingTypePresets(): OpeningTypePresets {
if (!cache) {
try {
const parsed = JSON.parse(core().opening_type_presets_json()) as Partial<OpeningTypePresets>;
cache = { windowTypes: parsed.windowTypes ?? [], doorTypes: parsed.doorTypes ?? [] };
} catch {
cache = { windowTypes: [], doorTypes: [] };
}
}
return cache;
}
/** Kopie einer Vorlage mit neuer id und Namen (tiefe Kopie, damit Flügellisten nicht geteilt werden). */
export function instantiatePreset<T extends { id: string; name: string }>(preset: T, id: string, name: string): T {
return { ...(JSON.parse(JSON.stringify(preset)) as T), id, name };
}
+6 -1
View File
@@ -500,7 +500,7 @@ export type DoorType = {
* Bauart: normaler Drehflügel, reine Wandöffnung (kein Blatt/Schwenk),
* Schiebetür. Ersetzt/ergänzt das Inline-Feld `Opening.doorType`.
*/
kind: "dreh" | "schiebe" | "wandoeffnung";
kind: "dreh" | "schiebe" | "wandoeffnung" | "hebeschiebe" | "pendel";
/** Anzahl Türblätter (1 = einflügelig, 2 = zweiflügelig). */
leafCount: 1 | 2;
/** Blatt-Ausführung (3D/Detail): glatt, Kassette, Glasfüllung. */
@@ -2852,6 +2852,11 @@ export type WindowType = {
* (Meter), abgeteilt durch einen Kämpfer. 0/fehlt ⇒ kein Oberlicht.
*/
transomHeight?: number;
/**
* Einteilung des Oberlichts über dem Riegel (Pfosten/Riegel, [95]): Felder und Pfosten wie
* {@link sashes}, je Feld fest oder öffenbar (meist Kipp). Fehlt ⇒ ein festes Feld (bisher).
*/
transomSashes?: Array<SashDef>;
/**
* Auf-/Untersicht-Andeutung im Grundriss (mittel/fein): eine Referenzlinie an
* der gewählten Fläche(n) — sinnvoll, wenn die Öffnung die Schnittebene NICHT
+6 -2
View File
@@ -13,6 +13,7 @@ import { addItems, fieldOps, patchItem, removeItems } from "../core";
import type { CoreOp } from "../core";
import { t } from "../i18n";
import { uniqueId } from "../tools/types";
import { instantiatePreset } from "../model/openingPresets";
import type {
CeilingType,
ContextObject,
@@ -208,8 +209,10 @@ export function useProjectActions(
// (kein eigener Slice). Löschen ist geschützt, solange ein Element den Typ
// per `typeId` referenziert. Defaults orientieren sich an den Element-Inline-
// Werten (Tür 0.9×2.0, Fenster 1.2×1.4 Brüstung 0.9).
const addDoorType = () =>
const addDoorType = (preset?: DoorType) =>
applyChange(() => {
// Aus der Typen-Bibliothek ([95]): Kopie der Vorlage mit neuer id.
if (preset) return addItems("doorTypes", [instantiatePreset(preset, uniqueId("dt"), preset.name)]);
const dt: DoorType = {
id: uniqueId("dt"),
name: t("default.doorTypeName"),
@@ -234,8 +237,9 @@ export function useProjectActions(
}
return removeItems(p, "doorTypes", [id]);
});
const addWindowType = () =>
const addWindowType = (preset?: WindowType) =>
applyChange(() => {
if (preset) return addItems("windowTypes", [instantiatePreset(preset, uniqueId("ft"), preset.name)]);
const wt: WindowType = {
id: uniqueId("ft"),
name: t("default.windowTypeName"),
+40
View File
@@ -291,6 +291,8 @@ const DOOR_KIND_OPTS = (): { value: DoorKind; label: string }[] => [
{ value: "dreh", label: t("oed.kind.dreh") },
{ value: "schiebe", label: t("oed.kind.schiebe") },
{ value: "wandoeffnung", label: t("oed.door.wandoeffnung") },
{ value: "hebeschiebe", label: t("oed.door.hebeschiebe") },
{ value: "pendel", label: t("oed.door.pendel") },
];
function BasisPanel({
@@ -557,6 +559,23 @@ function cornerJoinOptions(): { value: FrameCornerJoin; label: string }[] {
];
}
/** Oberlicht-Einteilung ([95]): Anzahl Felder und Öffnungsart des ersten Felds. */
function transomFields(wt: WindowType): { count: number; opening: OpeningKind } {
const fields = (wt.transomSashes ?? []).filter((s) => s.kind === "fluegel");
return { count: Math.max(1, fields.length), opening: fields[0]?.opening ?? "fest" };
}
/** Gleichmässige Oberlicht-Einteilung: `count` Felder, dazwischen Pfosten; ein festes Feld = keine Liste. */
function transomSashes(count: number, opening: OpeningKind): SashDef[] | undefined {
if (count <= 1 && opening === "fest") return undefined;
const out: SashDef[] = [];
for (let i = 0; i < count; i++) {
if (i > 0) out.push({ kind: "pfosten", postWidth: 0.06 });
out.push({ kind: "fluegel", autoWidth: true, opening, hingeSide: i % 2 === 0 ? "left" : "right" });
}
return out;
}
/** Flügeleinteilung: Tabelle mit Flügel/Pfosten, Öffnungsart + Anschlag je Zeile. */
function FluegelPanel({
wt,
@@ -589,6 +608,27 @@ function FluegelPanel({
min={0}
onCommit={(n) => patchWt({ transomHeight: n || undefined })}
/>
{(wt.transomHeight ?? 0) > 0 && (
<>
<NumField
label={t("oed.f.transomFields")}
value={transomFields(wt).count}
step={1}
min={1}
onCommit={(n) => patchWt({ transomSashes: transomSashes(Math.max(1, Math.min(6, Math.round(n))), transomFields(wt).opening) })}
/>
<SelField<OpeningKind>
label={t("oed.f.transomOpening")}
value={transomFields(wt).opening}
options={[
{ value: "fest", label: t("oed.kind.fest") },
{ value: "kipp", label: t("oed.kind.kipp") },
{ value: "dreh", label: t("oed.kind.dreh") },
]}
onChange={(v) => patchWt({ transomSashes: transomSashes(transomFields(wt).count, v) })}
/>
</>
)}
<NumField
label={t("oed.f.mullionRows")}
value={wt.mullionRows ?? 1}
+2 -2
View File
@@ -126,10 +126,10 @@ export interface ResourceManagerHandlers {
* Deckentypen. Optional, damit ältere Einbettungen ohne diesen Handler
* weiter kompilieren; ohne Handler bleiben die Tabs verborgen.
*/
onAddDoorType?: () => void;
onAddDoorType?: (preset?: DoorType) => void;
onPatchDoorType?: (id: string, patch: Partial<DoorType>) => void;
onDeleteDoorType?: (id: string) => void;
onAddWindowType?: () => void;
onAddWindowType?: (preset?: WindowType) => void;
onPatchWindowType?: (id: string, patch: Partial<WindowType>) => void;
onDeleteWindowType?: (id: string) => void;
onAddStairType?: () => void;
+10 -2
View File
@@ -6,6 +6,7 @@ import { t } from "../../i18n";
import { FieldRow, NumberField, Segmented, SelectField } from "./fields";
import { INSET_FACE_OPTIONS, TypeLibraryTab } from "./TypeLibraryTab";
import { ElevationPreview } from "../ElevationPreview";
import { openingTypePresets } from "../../model/openingPresets";
/**
* Synthetische Öffnungs-Instanz NUR für die Vorschau — s. WindowStylesTab.
@@ -30,6 +31,8 @@ const DOOR_KIND_OPTIONS: { value: DoorType["kind"]; labelKey: string }[] = [
{ value: "dreh", labelKey: "resources.doorKind.dreh" },
{ value: "schiebe", labelKey: "resources.doorKind.schiebe" },
{ value: "wandoeffnung", labelKey: "resources.doorKind.wandoeffnung" },
{ value: "hebeschiebe", labelKey: "resources.doorKind.hebeschiebe" },
{ value: "pendel", labelKey: "resources.doorKind.pendel" },
];
const DOOR_LEAF_STYLE_OPTIONS: { value: DoorType["leafStyle"]; labelKey: string }[] = [
@@ -50,7 +53,7 @@ export function DoorStylesTab({
onDeleteDoorType,
}: {
project: Project;
onAddDoorType?: () => void;
onAddDoorType?: (preset?: DoorType) => void;
onPatchDoorType?: (id: string, patch: Partial<DoorType>) => void;
onDeleteDoorType?: (id: string) => void;
}) {
@@ -61,7 +64,12 @@ export function DoorStylesTab({
emptyKey="resources.doorTypes.empty"
placeholderKey="resources.doorTypes.placeholder"
deleteKeyPrefix="resources.delete.doorType"
onAdd={onAddDoorType}
onAdd={() => onAddDoorType?.()}
presets={openingTypePresets().doorTypes.map((p) => ({ id: p.id, label: t(`preset.${p.id}`) }))}
onAddPreset={(id) => {
const p = openingTypePresets().doorTypes.find((x) => x.id === id);
if (p) onAddDoorType?.({ ...p, name: t(`preset.${p.id}`) });
}}
onPatch={onPatchDoorType}
onDelete={onDeleteDoorType}
renderFields={(door, patch) => (
+20
View File
@@ -26,6 +26,8 @@ export function TypeLibraryTab<T extends { id: string; name: string }>({
placeholderKey,
deleteKeyPrefix,
onAdd,
presets,
onAddPreset,
onPatch,
onDelete,
renderFields,
@@ -36,6 +38,9 @@ export function TypeLibraryTab<T extends { id: string; name: string }>({
placeholderKey: string;
deleteKeyPrefix: string;
onAdd?: () => void;
/** Vorlagen aus der Typen-Bibliothek ([95]); Auswahl legt eine Kopie an. */
presets?: { id: string; label: string }[];
onAddPreset?: (presetId: string) => void;
onPatch?: (id: string, patch: Partial<T>) => void;
onDelete?: (id: string) => void;
renderFields: (item: T, onPatch: (patch: Partial<T>) => void) => React.ReactNode;
@@ -64,6 +69,21 @@ export function TypeLibraryTab<T extends { id: string; name: string }>({
<button className="res-add" onClick={() => onAdd?.()}>
<span className="res-add-plus">+</span> {t("resources.add")}
</button>
{presets && presets.length > 0 && onAddPreset && (
<select
className="res-input res-add-preset"
value=""
title={t("resources.addPreset.hint")}
onChange={(e) => e.target.value && onAddPreset(e.target.value)}
>
<option value="">{t("resources.addPreset")}</option>
{presets.map((p) => (
<option key={p.id} value={p.id}>
{p.label}
</option>
))}
</select>
)}
</div>
</div>
<div className="res-md-detail">
+8 -2
View File
@@ -6,6 +6,7 @@ import { t } from "../../i18n";
import { FieldRow, NumberField, SelectField } from "./fields";
import { INSET_FACE_OPTIONS, TypeLibraryTab } from "./TypeLibraryTab";
import { ElevationPreview } from "../ElevationPreview";
import { openingTypePresets } from "../../model/openingPresets";
/**
* Synthetische Öffnungs-Instanz NUR für die Vorschau: `ElevationPreview`
@@ -56,7 +57,7 @@ export function WindowStylesTab({
onDeleteWindowType,
}: {
project: Project;
onAddWindowType?: () => void;
onAddWindowType?: (preset?: WindowType) => void;
onPatchWindowType?: (id: string, patch: Partial<WindowType>) => void;
onDeleteWindowType?: (id: string) => void;
}) {
@@ -67,7 +68,12 @@ export function WindowStylesTab({
emptyKey="resources.windowTypes.empty"
placeholderKey="resources.windowTypes.placeholder"
deleteKeyPrefix="resources.delete.windowType"
onAdd={onAddWindowType}
onAdd={() => onAddWindowType?.()}
presets={openingTypePresets().windowTypes.map((p) => ({ id: p.id, label: t(`preset.${p.id}`) }))}
onAddPreset={(id) => {
const p = openingTypePresets().windowTypes.find((x) => x.id === id);
if (p) onAddWindowType?.({ ...p, name: t(`preset.${p.id}`) });
}}
onPatch={onPatchWindowType}
onDelete={onDeleteWindowType}
renderFields={(win, patch) => (