[285] Bedienung: Decke-Lage, Wandtyp/Aussenbauteil, λ der Standard-Baustoffe, Fenster-Abstand, Rampen-Hinweis, Bäume in der Axo, Baurecht ohne Gebäude
This commit is contained in:
17 files changed
+573
-72
No files matched your search
@@ -55,7 +55,7 @@ Raumprogramm gegen Modell → Grundrisse/Schnitte/Ansichten 1:200 (Vorprojekt 1:
|
||||
Kennwort, anonym) als PDF; Austausch mit Fachplanern über DXF/IFC.
|
||||
|
||||
- ◐ **[266]** Wettbewerb einmal ganz durchgespielt (16.11., Chromium/Linux, Bilder `doc/review-266/`); alle Befunde behoben bis auf: GV (18.11., `flaechen.rs`): Studienkörper (frei, ≥ 9 m² Grundfläche und ≥ 2.4 m hoch) zählen, aber nur ausserhalb der Geschossgrundrisse (innerhalb sonst doppelt); Bodenplatte = Decke unter dem untersten Geschoss zählt von ihrer UK bis Fertigboden (SIA 416: untere Begrenzung = Unterseite der untersten Bodenkonstruktion; Fundamente/Kies/Magerbeton nicht) — FRAGE: SIA-416-Wortlaut zu Fundamenten/Sauberkeitsschicht nicht im Repo, gegen die Norm prüfen; Schwellen 9 m²/2.4 m sind Annahmen (Alternative: Merkmal „Gebäudekörper" am Körper); Aufstockungen über dem Haus als Geschoss modellieren, nicht als Körper. Offen: Innenhöfe ohne Dach werden im Dachraum gefüllt (`core/building_volume.rs`); Tabellen wandern aufs 2. Blatt trotz freier Spalten oben (`presentation_poster.rs`); Schnittmarken im Plakat: Marken ungewählter Schnitte erscheinen mit, Linien > 40 mm Papier vom Haus beschnitten, beim Blatt ohne Plakat keine Marken; Plakat-Grundrisse zeigen alle Bemassungsketten statt nur Gesamtmass; Situation: eigenständige Layouts „Situation WBW“ setzen Nordpfeil/Massstab weiter unter die Lage, Kataster-Gebäude unter eigenem Fussabdruck nicht ausgeblendet; Wendeltreppen und Treppen nach unten/Teilhöhe bekommen kein Deckenloch automatisch (`stair_hole_ops`, `cmd_solid.rs`); 3D-Dokument ([266]/12, `plan/axo.rs`): nicht auf dem Mac geprüft (passt die Zeichnung zur 3D-Kamera?), kein eigener Reiter (nur Blatt-Viewport), kein Live-Schnitt, Fenster als Löcher ohne Rahmen/Glas, keine Rückseiten verdeckter Flächen, Gelände nicht, Kontext-Netze nur mit `context`, Flächen < 1/1200 Bildbreite ungetönt. Nicht geprüft: Tauri-App/Mac (Metal, 3D-Bild, Schatten, Rendering), Mausbedienung, Druck des A1-Plakats, DXF/IFC in Fremdsoftware. · M
|
||||
- ◐ **[285]** Referenz-Ablauf zum zweiten Mal durchgespielt (18.11., Chromium/Linux, Haus 18 × 11 m, 2 Geschosse, 4 Wohnungen, Bilder `doc/review-285/`; nicht auf dem Mac, kein 3D-Live/Rendering/Druck). Behoben: Gesamthöhe (Baurecht, Kennzahlen) zählt die Attika (`site_rules.rs` `model_top`; vorher 5.80 statt Oberkante Attika, Ansicht zeigte +6.30; `KURZANLEITUNG` „Höhe 9.50" nicht neu geprüft). Offen, nach Schritt: Baurecht: Meldung „Gebäude innerhalb der zulässigen Fläche" steht grün schon ohne Bauteil (`panels/SiteRulesSection.tsx`) · S. Volumen: `decke` setzt die Decke immer oben ans aktive Geschoss, Bodenplatte unter EG und Balkonplatte brauchen je 6 Schritte in der Objekt-Info (OK/UK „Eigene"), kein Befehl/Option dafür (`cmds/ceiling.ts`) · S; `wand` hat keine Wandtyp-Option (Innenwände nachträglich umstellen) und setzt „Aussenbauteil"/„Tragend" nie, dadurch kein IsExternal an Aussenwänden im IFC und U-Wert „unvollständig (4 Schicht(en) ohne λ)" für den Standardaufbau (`cmds/wall.ts`, Standard-Wandtypen) · S; Zeichnungsebene „kataster" liegt im Arbeitsgrundriss über den neuen Wänden (Kataster-Gebäude deckt sie zu, bis man die Ebene ausblendet) · S; Fenster-Befehl: eine Zahl bei „Position entlang der Wand (Abstand tippen)" setzt stillschweigend die Breite (3 m statt Abstand 3 m, `cmds/opening.ts`) · S; Rampe: falsche Richtung (Anfang aussen, +6 %) hebt die Rampe über Geschosshöhe ohne Hinweis (`cmds/ramp.ts`) · S. Räume/Einheiten: `raum` legt je Aufruf nur einen Raum an, Name/Nutzung/Kategorie je Raum einzeln (10 Räume ≈ 40 Eingaben) · M; Einheit löschen/verschieben lässt leere Einheiten („0 Zi · 0.0 m²") und zählt Nummern weiter (Whg 5, 6) · S; Statusleiste: Feld „Ebene" zeigt die Klasse („20 Wände"), „Geschoss" die Zeichnungsebene (Bezeichnungen nach [180] vereinheitlichen, `ui/StatusBar.tsx`) · S; Projektname bleibt „Leeres Projekt" (Titel von Plakat/Spiegel), bis er im Mappe-Panel gesetzt wird · S. Abgabe: Präsentationsplan A1 quer lässt bei 18 m Hauslänge über die Hälfte leer (Vorgabe 1:200, Tabellen fix unten rechts, Spalten fix; „automatisch" wäre ≈ 1:100) · M; Wohnungsspiegel fehlt auf dem Plakat (nur Kennzahlen + Baurecht, `presentation_poster.rs`) · S; Situation auf dem Plakat zeigt alle vier Kataster-Parzellen als kleine Kacheln statt Ausschnitt um die eigene · M; Axo: Bäume fehlen (Entourage-Objekte da), Rampe/Haustür auf der abgewandten Seite nicht zu sehen (`plan/axo.rs`) · S. Geprüft ok: Kataster-Import und Baurecht-Zahlen (484 m² zulässig, AZ 0.41, ÜZ 0.23), GV mit Bodenplatte (686.8 = 603.5 + 83.3 m³), Wohnungsspiegel CSV/SVG, Kosten (1'094 CHF/m³), Plakat anonym (Kennwort im Titel, Projektname nirgends im PDF), PDF-Ebenen (17 OCG), IFC (Geländer, Träger, Rampe, Treppe, Dach, Räume), DXF. Nicht durchgespielt: Umbau (Abbruch Kataster-Bestand) und Varianten (nur Hinweise „noch kein Variantensatz"/„Zuerst Bauteile wählen" gesehen), Rendering-Fenster, Mac. · M
|
||||
- ◐ **[285]** Referenz-Ablauf zum zweiten Mal durchgespielt (18.11., Chromium/Linux, Haus 18 × 11 m, 2 Geschosse, 4 Wohnungen, Bilder `doc/review-285/`; nicht auf dem Mac, kein 3D-Live/Rendering/Druck). Behoben: Gesamthöhe (Baurecht, Kennzahlen) zählt die Attika (`site_rules.rs` `model_top`; vorher 5.80 statt Oberkante Attika, Ansicht zeigte +6.30; `KURZANLEITUNG` „Höhe 9.50" nicht neu geprüft). Behoben (19.11., Bedienung/Modell): Baurecht-Meldung „innerhalb der zulässigen Fläche" erst mit Gebäude (sonst „Noch kein Gebäude gezeichnet", neutral) · `decke`: Option „Lage" (oben / unter dem Geschoss = Bodenplatte / frei mit getippter Oberkante, Kern `top`) · `wand`: Optionen „Wandtyp" (reihum durch die Projekt-Typen) und „Aussenbauteil" (nach Typ / ja / nein); Vorgabe `isExternal` nach dem Wandtypnamen („Aussenwand" ⇒ aussen, „Innenwand" ⇒ innen), der IFC-Export schreibt `IsExternal` nur mit Angabe im Modell (`ifc_data.rs`) · Standard-Baustoffe des Beispiel-/Leerprojekts (`sampleProject.ts`) haben λ (SIA-Richtwerte, wie `core/standards.rs`), U-Wert nicht mehr „unvollständig" · Fenster/Tür: getippte Zahl im Positionsschritt = Abstand (neues erstes Tab-Feld „Abstand"), nicht Breite · Rampe: Hinweis, wenn sie über die Geschosshöhe steigt bzw. tiefer als eine Geschosshöhe fällt · Axo: Bäume (Stamm + Krone) wie im 3D (`furniture_3d::with_context_meshes`). Nicht auf dem Mac/in der Tauri-App geprüft. Offen, nach Schritt: Zeichnungsebene „kataster" liegt im Arbeitsgrundriss über den neuen Wänden (Kataster-Gebäude deckt sie zu, bis man die Ebene ausblendet): Zeichnungen sind eine Gruppe NACH Decken/Wänden (`plan/domains.rs` `GROUPS`, Chunk-Cache `plan_drawings_chunked`) — weitreichende Klassen (`drawings::is_far_class`) müssten in eine Gruppe darunter · M, Frage: Gruppenreihenfolge/Cache-Schlüssel ändern (betrifft render2d und alle Goldens) oder die Ebene im Arbeitsgrundriss standardmässig als Unterlage halbtransparent zeigen? · Rampe abwärts: Hinweis erst ab einer Geschosshöhe Gefälle nach unten (Keller-/Garagenrampen sind gewollt), andere Schwelle? · Räume/Einheiten: `raum` legt je Aufruf nur einen Raum an, Name/Nutzung/Kategorie je Raum einzeln (10 Räume ≈ 40 Eingaben) · M; Einheit löschen/verschieben lässt leere Einheiten („0 Zi · 0.0 m²") und zählt Nummern weiter (Whg 5, 6) · S; Statusleiste: Feld „Ebene" zeigt die Klasse („20 Wände"), „Geschoss" die Zeichnungsebene (Bezeichnungen nach [180] vereinheitlichen, `ui/StatusBar.tsx`) · S; Projektname bleibt „Leeres Projekt" (Titel von Plakat/Spiegel), bis er im Mappe-Panel gesetzt wird · S. Abgabe: Präsentationsplan A1 quer lässt bei 18 m Hauslänge über die Hälfte leer (Vorgabe 1:200, Tabellen fix unten rechts, Spalten fix; „automatisch" wäre ≈ 1:100) · M; Wohnungsspiegel fehlt auf dem Plakat (nur Kennzahlen + Baurecht, `presentation_poster.rs`) · S; Situation auf dem Plakat zeigt alle vier Kataster-Parzellen als kleine Kacheln statt Ausschnitt um die eigene · M; Axo: Rampe/Haustür auf der abgewandten Seite nicht zu sehen (`plan/axo.rs`) · S. Geprüft ok: Kataster-Import und Baurecht-Zahlen (484 m² zulässig, AZ 0.41, ÜZ 0.23), GV mit Bodenplatte (686.8 = 603.5 + 83.3 m³), Wohnungsspiegel CSV/SVG, Kosten (1'094 CHF/m³), Plakat anonym (Kennwort im Titel, Projektname nirgends im PDF), PDF-Ebenen (17 OCG), IFC (Geländer, Träger, Rampe, Treppe, Dach, Räume), DXF. Nicht durchgespielt: Umbau (Abbruch Kataster-Bestand) und Varianten (nur Hinweise „noch kein Variantensatz"/„Zuerst Bauteile wählen" gesehen), Rendering-Fenster, Mac. · M
|
||||
- ◐ **[270]** Blickrichtungen überall gleich (3D-Spiegelung behoben, Marken weichen aus; 17.11.). Offen: 3D-Bild nur numerisch (Kameramatrix, Pick-Strahl) geprüft, kein Bild aus render3d unter Linux, nicht auf dem Mac/Metal (`doc/RELEASE-1.0.md` 13.36); natives Spike-Fenster `src-tauri/src/native.rs` (Orbit-Richtung) nicht angepasst. · M
|
||||
- ◐ **[279]** Geländer als eigenes Bauteil (18.11.; Lücke 7 `doc/VERGLEICH-1.0.md`; Linux/Chromium, nicht auf dem Mac geprüft): Modell, Grundriss, Schnitt/Ansicht/3D, IFC, DXF, Befehl `gelaender` umgesetzt (`railing.rs`, `plan/railings.rs`). Nachgeführt 18.11.: Glas in Ansicht und 3D-Dokument durchscheinend (helle Füllung wie Fensterglas, Deckkraft 0.4, verdeckt nichts; Schnitt unverändert), Objektfang auf Achse (und Längskanten dicker Brüstungen), Schatten der Sonnenstudie (Prismen aus `railing::pieces`, ab 400 Teilen ohne Stäbe/Pfosten). Offen: Lochblech ohne Lochmuster; Handlauf über Schnitthöhe im Grundriss nicht eigens gestrichelt; kein IfcRailing-Import; Loggia-Brüstung an Wänden bleibt Wand. · M
|
||||
- ◐ **[278]** Nutzungseinheiten und Wohnungsspiegel (17.11.; Lücke 6; nicht auf dem Mac geprüft): `unit_schedule.rs`, Panel Flächenbilanz „Nutzungseinheiten“, CLI `--wohnungsspiegel` umgesetzt. Offen: Einheiten im Grundriss als farbige Fläche/Stempel auf eigener Klasse ([180]; `Unit.color` ist da); Summen je Typ/Geschoss nicht als eigene Blatt-Tabelle; Mindestfläche Zimmer und NWF nach kantonaler Definition fehlen; Einheit nicht in IFC/DXF; Spiegel im schmalen Dock als Karten. · M
|
||||
|
||||
@@ -351,6 +351,18 @@ fn wall_type_for_thickness(root: &Map<String, Value>, base: &Value, thickness: f
|
||||
(add_op("wallTypes", vec![nt]), s(&id))
|
||||
}
|
||||
|
||||
/// [285] `IsExternal` aus dem Namen eines Wandtyps: „Aussenwand“/„Außenwand“ ⇒ aussen, „Innenwand“ ⇒ innen, sonst keine Angabe.
|
||||
fn external_by_type_name(name: Option<&str>) -> Option<bool> {
|
||||
let n = name?.to_lowercase();
|
||||
if n.contains("aussen") || n.contains("außen") || n.contains("external") || n.contains("exterior") {
|
||||
Some(true)
|
||||
} else if n.contains("innen") || n.contains("internal") || n.contains("interior") {
|
||||
Some(false)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
/// Wand-Befehl: je Achssegment eine Wand des aktiven Typs (Null-Strecken übersprungen); eine gelockte
|
||||
/// Dicke (einschichtig) wählt/erzeugt den passenden Wandtyp.
|
||||
fn wall_ops(root: &Map<String, Value>, p: &Project, v: &Value, ctx: &Ctx, ids: &mut IdGen) -> Vec<Op> {
|
||||
@@ -365,6 +377,11 @@ fn wall_ops(root: &Map<String, Value>, p: &Project, v: &Value, ctx: &Ctx, ids: &
|
||||
type_id = id;
|
||||
}
|
||||
}
|
||||
// [285] Aussenbauteil (IFC `IsExternal`): ausdrücklich gewählt, sonst nach dem Namen des Wandtyps.
|
||||
let external = match v.get("external") {
|
||||
Some(Value::Bool(b)) => Some(*b),
|
||||
_ => external_by_type_name(active_wall_type(root, ctx).and_then(|t| field(t, "name")).and_then(Value::as_str)),
|
||||
};
|
||||
// Bogen-Modus ([T2]): `segs` je Segment wie bei der Polylinie (gerade, tangential, Durchgangspunkt).
|
||||
let bulges = crate::cmd_draw::poly_bulges(&pts, arr(v.get("segs")));
|
||||
let mut walls = Vec::new();
|
||||
@@ -386,6 +403,9 @@ fn wall_ops(root: &Map<String, Value>, p: &Project, v: &Value, ctx: &Ctx, ids: &
|
||||
}
|
||||
f.push(("wallTypeId", type_id.clone()));
|
||||
f.push(("height", js_num(height)));
|
||||
if let Some(e) = external {
|
||||
f.push(("isExternal", Value::Bool(e)));
|
||||
}
|
||||
walls.push(obj(f));
|
||||
}
|
||||
if walls.is_empty() {
|
||||
@@ -448,7 +468,13 @@ fn ceiling_ops(p: &Project, v: &Value, ctx: &Ctx, ids: &mut IdGen) -> Vec<Op> {
|
||||
if abs_area(&outline) < 1e-4 {
|
||||
return Vec::new();
|
||||
}
|
||||
add_op("ceilings", vec![ceiling_item(p, ctx.level, &outline, ctx, ids)])
|
||||
let mut item = ceiling_item(p, ctx.level, &outline, ctx, ids);
|
||||
// [285] Lage: `top` = Oberkante in m über dem Boden des Geschosses (0 = Bodenplatte unter dem Geschoss, negativ =
|
||||
// abgesenkt, positiv = Brüstung/Podest); ohne Angabe bleibt die Oberkante am Geschoss.
|
||||
if let Some(z) = opt_n(v, "top").filter(|z| z.is_finite()) {
|
||||
item["top"] = json!({"mode": "floor", "floorId": ctx.level, "offset": js_num(z)});
|
||||
}
|
||||
add_op("ceilings", vec![item])
|
||||
}
|
||||
|
||||
/// [281] Rampe: Decke aus dem Umriss mit Neigung längs `from` → `to`; `percent` = Gefälle in % (positiv = steigt zum
|
||||
@@ -1545,6 +1571,48 @@ mod tests {
|
||||
assert_eq!(items(&o, 1)[0]["wallTypeId"], "WT-s-1");
|
||||
}
|
||||
|
||||
/// [285] Aussenbauteil (IFC `IsExternal`): ausdrücklich `external` der Anfrage, sonst aus dem Namen des Wandtyps
|
||||
/// („Aussenwand“ ⇒ aussen, „Innenwand“ ⇒ innen, anderes ⇒ keine Angabe).
|
||||
#[test]
|
||||
fn wand_aussenbauteil_aus_wandtyp_oder_option() {
|
||||
let r = root(json!({"wallTypes": [
|
||||
{"id": "WT1", "name": "Aussenwand 36 cm", "layers": [{"componentId": "c", "thickness": 0.36}]},
|
||||
{"id": "WT2", "name": "Innenwand", "layers": [{"componentId": "c", "thickness": 0.12}]},
|
||||
{"id": "WT3", "name": "Beton", "layers": [{"componentId": "c", "thickness": 0.2}]}
|
||||
]}));
|
||||
let wall = |wt: &str, extra: Value| {
|
||||
let mut q = json!({"cmd": "wall", "pts": [[0, 0], [4, 0]], "thick": null});
|
||||
q.as_object_mut().unwrap().extend(extra.as_object().unwrap().clone());
|
||||
let mut q = req(q);
|
||||
q["ctx"]["wallType"] = json!(wt);
|
||||
let o = ops(&r, &crate::model::lenient::typed_for_test(&r), &q).unwrap();
|
||||
items(&o, 0)[0].clone()
|
||||
};
|
||||
assert_eq!(wall("WT1", json!({}))["isExternal"], true);
|
||||
assert_eq!(wall("WT2", json!({}))["isExternal"], false);
|
||||
assert!(wall("WT3", json!({})).get("isExternal").is_none());
|
||||
assert_eq!(wall("WT3", json!({"external": true}))["isExternal"], true);
|
||||
assert_eq!(wall("WT1", json!({"external": false}))["isExternal"], false);
|
||||
assert!(wall("WT1", json!({"external": null}))["isExternal"] == true);
|
||||
}
|
||||
|
||||
/// [285] Decke mit Lage: `top` = Oberkante in m über dem Boden des Geschosses (0 = Bodenplatte unter dem Geschoss);
|
||||
/// ohne Angabe bleibt die Oberkante am Geschoss.
|
||||
#[test]
|
||||
fn decke_mit_lage() {
|
||||
let r = root(json!({"wallTypes": [{"id": "WT1", "name": "W", "layers": [{"componentId": "c", "thickness": 0.3}]}]}));
|
||||
let q = |extra: Value| {
|
||||
let mut q = json!({"cmd": "ceiling", "pts": [[0, 0], [4, 0], [4, 3], [0, 3]]});
|
||||
q.as_object_mut().unwrap().extend(extra.as_object().unwrap().clone());
|
||||
let o = ops(&r, &crate::model::lenient::typed_for_test(&r), &req(q)).unwrap();
|
||||
items(&o, 0)[0].clone()
|
||||
};
|
||||
assert!(q(json!({})).get("top").is_none());
|
||||
assert!(q(json!({"top": null})).get("top").is_none());
|
||||
assert_eq!(q(json!({"top": 0}))["top"], json!({"mode": "floor", "floorId": "F1", "offset": 0}));
|
||||
assert_eq!(q(json!({"top": -0.02}))["top"], json!({"mode": "floor", "floorId": "F1", "offset": -0.02}));
|
||||
}
|
||||
|
||||
/// [149] Baum setzen (Ebene 13, Vorgaben, Unsinn verworfen) und Kreise in Bäume umwandeln.
|
||||
#[test]
|
||||
fn baum_setzen_und_kreise_umwandeln() {
|
||||
|
||||
@@ -331,10 +331,12 @@ pub fn placed(p: &Project) -> Vec<(usize, Vec<Mesh3>)> {
|
||||
|
||||
/// Kopie des Projekts für Ansichten, die nur Netze aus `Project::context` kennen (3D-Dokument, `plan/axo.rs`): die Teilnetze der
|
||||
/// Entourage als `ImportedMesh` mit Klasse und Id der Zeichnung angehängt; `context = false` lässt die übrigen Netze des Kontexts
|
||||
/// weg (nur Entourage). `None`, wenn das Projekt keine Entourage hat.
|
||||
/// weg (nur Entourage). [285] Auch die Bäume (`Project.trees`, Stamm + Krone wie im 3D) kommen so hinein. `None`, wenn das
|
||||
/// Projekt weder Entourage noch Bäume hat.
|
||||
pub fn with_context_meshes(p: &Project, context: bool) -> Option<Project> {
|
||||
let placed = placed(p);
|
||||
if placed.is_empty() {
|
||||
let trees = crate::tree::geoms(p);
|
||||
if placed.is_empty() && trees.is_empty() {
|
||||
return None;
|
||||
}
|
||||
let mut q = p.clone();
|
||||
@@ -357,6 +359,22 @@ pub fn with_context_meshes(p: &Project, context: bool) -> Option<Project> {
|
||||
}));
|
||||
}
|
||||
}
|
||||
let list = p.trees.as_deref().unwrap_or(&[]);
|
||||
for (i, g) in trees {
|
||||
let t = &list[i];
|
||||
let (trunk, crown) = crate::tree::colors(t);
|
||||
for ((positions, indices), rgb) in [(g.trunk_mesh(8), trunk), (g.crown_mesh(8, 12), crown)] {
|
||||
ctx.push(crate::model::ContextObject::ImportedMesh(crate::model::ImportedMesh {
|
||||
id: t.id.clone(),
|
||||
name: t.id.clone(),
|
||||
category_code: t.category_code.clone(),
|
||||
color: Some(hex(rgb)),
|
||||
positions,
|
||||
indices: indices.iter().map(|&k| k as f64).collect(),
|
||||
..Default::default()
|
||||
}));
|
||||
}
|
||||
}
|
||||
q.context = Some(ctx);
|
||||
Some(q)
|
||||
}
|
||||
|
||||
@@ -356,3 +356,20 @@ fn entourage_in_schiefen_projektionen() {
|
||||
assert!(n1 > n0 + 10, "{kind}: {n0} -> {n1}");
|
||||
}
|
||||
}
|
||||
|
||||
/// [285] Bäume (`Project.trees`) erscheinen im 3D-Dokument wie im 3D (Stamm + Krone); ihre Klasse schaltet sie ab, auch in
|
||||
/// den schiefen Projektionen.
|
||||
#[test]
|
||||
fn baeume_im_3d_dokument() {
|
||||
let mut p = cubes(&[(0.0, 0.0, 0.0)]);
|
||||
p.trees = Some(vec![serde_json::from_value(serde_json::json!({
|
||||
"id": "T1", "type": "tree", "floorId": "l0", "categoryCode": "13", "position": {"x": 6.0, "y": -4.0},
|
||||
"trunkDiameter": 0.4, "crownDiameter": 5.0, "crownBase": 2.0, "height": 8.0
|
||||
}))
|
||||
.unwrap()]);
|
||||
for kind in ["iso", "military"] {
|
||||
let n1 = lines(&prims_of(&p, serde_json::json!({"view": "southeast", "projection": kind}))).len();
|
||||
let n0 = lines(&prims_of(&p, serde_json::json!({"view": "southeast", "projection": kind, "hasVis": true, "invisible": ["13"]}))).len();
|
||||
assert!(n1 > n0 + 10, "{kind}: {n0} -> {n1}");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
/**
|
||||
* [285] `ceilingCommand` — Option „Lage": Geschossdecke (oben, wie bisher), Bodenplatte unter dem Geschoss, frei (Oberkante getippt).
|
||||
*/
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { ceilingCommand } from "./ceiling";
|
||||
import type { CommandContext, CmdInput, CommandState, Project, Vec2 } from "../types";
|
||||
|
||||
function project(): Project {
|
||||
return {
|
||||
id: "t",
|
||||
name: "T",
|
||||
lineStyles: [],
|
||||
hatches: [],
|
||||
components: [{ id: "beton", name: "Beton", color: "#999999", joinPriority: 100 }],
|
||||
wallTypes: [{ id: "aw", name: "AW", layers: [{ componentId: "beton", thickness: 0.2 }] }],
|
||||
ceilingTypes: [{ id: "ct", name: "Platte", layers: [{ componentId: "beton", thickness: 0.25 }] }],
|
||||
drawingLevels: [{ id: "eg", name: "EG", kind: "floor", visible: true, locked: false, floorHeight: 2.6, cutHeight: 1.0, baseElevation: 0 }],
|
||||
layers: [{ code: "30", name: "Decken", color: "#000000", lw: 0.35, visible: true, locked: false }],
|
||||
walls: [],
|
||||
openings: [],
|
||||
ceilings: [],
|
||||
stairs: [],
|
||||
rooms: [],
|
||||
drawings2d: [],
|
||||
context: [],
|
||||
} as unknown as Project;
|
||||
}
|
||||
|
||||
const ctxOf = (p: Project): CommandContext => ({
|
||||
project: p,
|
||||
level: p.drawingLevels[0],
|
||||
defaultCategoryCode: "30",
|
||||
activeLineStyleId: "solid",
|
||||
activeWallTypeId: "aw",
|
||||
lastPoint: null,
|
||||
selection: { wallIds: [], drawingId: null },
|
||||
});
|
||||
|
||||
const outline: Vec2[] = [
|
||||
{ x: 0, y: 0 },
|
||||
{ x: 4, y: 0 },
|
||||
{ x: 4, y: 3 },
|
||||
{ x: 0, y: 3 },
|
||||
];
|
||||
|
||||
/** Eingaben nacheinander; liefert das Projekt nach dem Commit. */
|
||||
function run(inputs: CmdInput[]): Project {
|
||||
const p = project();
|
||||
const ctx = ctxOf(p);
|
||||
let state: CommandState = ceilingCommand.init();
|
||||
let commit: ((q: Project) => Project) | undefined;
|
||||
for (const input of inputs) {
|
||||
const [ns, res] = ceilingCommand.onInput(state, input, ctx);
|
||||
state = ns;
|
||||
commit = res.commit ?? commit;
|
||||
}
|
||||
return commit ? commit(p) : p;
|
||||
}
|
||||
|
||||
const pts = (): CmdInput[] => outline.map((point) => ({ kind: "point", point }));
|
||||
const close: CmdInput = { kind: "option", id: "close" };
|
||||
const pos: CmdInput = { kind: "option", id: "pos" };
|
||||
|
||||
describe("ceilingCommand Lage [285]", () => {
|
||||
it("Vorgabe „oben“: Oberkante am Geschoss (kein top)", () => {
|
||||
const q = run([...pts(), close]);
|
||||
expect(q.ceilings).toHaveLength(1);
|
||||
expect(q.ceilings![0].top).toBeUndefined();
|
||||
});
|
||||
|
||||
it("„unter dem Geschoss“ (Bodenplatte): Oberkante auf dem Geschossboden", () => {
|
||||
const q = run([pos, ...pts(), close]);
|
||||
expect(q.ceilings![0].top).toEqual({ mode: "floor", floorId: "eg", offset: 0 });
|
||||
});
|
||||
|
||||
it("„frei“: nach dem Umriss die Oberkante tippen (−0.02 = abgesenkte Balkonplatte)", () => {
|
||||
const q = run([pos, pos, ...pts(), close, { kind: "number", value: -0.02 }]);
|
||||
expect(q.ceilings).toHaveLength(1);
|
||||
expect(q.ceilings![0].top).toEqual({ mode: "floor", floorId: "eg", offset: -0.02 });
|
||||
});
|
||||
|
||||
it("„frei“ ohne Eingabe: nichts angelegt; Enter nimmt 0", () => {
|
||||
expect(run([pos, pos, ...pts(), close]).ceilings ?? []).toHaveLength(0);
|
||||
const p = project();
|
||||
const ctx = ctxOf(p);
|
||||
let state: CommandState = ceilingCommand.init();
|
||||
for (const input of [pos, pos, ...pts(), close]) state = ceilingCommand.onInput(state, input, ctx)[0];
|
||||
const [, res] = ceilingCommand.onConfirm(state, ctx);
|
||||
expect(res.commit!(p).ceilings![0].top).toEqual({ mode: "floor", floorId: "eg", offset: 0 });
|
||||
});
|
||||
});
|
||||
@@ -4,6 +4,12 @@
|
||||
// 1) „Erster Umrisspunkt der Decke:" → Punkt
|
||||
// 2) „Nächster Punkt ( Schliessen Zurück ):" → Punkt … Der Umriss schließt per
|
||||
// Klick auf den Startpunkt, Option „Schliessen" (C) oder Enter (≥3 Punkte).
|
||||
// 3) nur bei Lage „Frei": „Oberkante in m über Geschossboden <0>:" → Zahl, Enter = 0.
|
||||
//
|
||||
// Option „Lage" ([285], sticky über den Befehl): „Oben" = Oberkante am Geschoss (Geschossdecke, wie bisher) ·
|
||||
// „Unter" = Bodenplatte, Oberkante auf dem Geschossboden (UK = OK − Dicke, also unter dem Geschoss) ·
|
||||
// „Frei" = Oberkante getippt (z. B. −0.02 für eine abgesenkte Balkonplatte). Vorher ging das nur über OK/UK
|
||||
// „Eigene" in der Objekt-Info (6 Schritte).
|
||||
//
|
||||
// Akzeptiert je Punkt Maus-Picks UND getippte Koordinaten (0,0 · r3,0 · 5<45) —
|
||||
// derselbe Eingabepfad wie Polylinie/Wand. Die fertige Decke rendert über die
|
||||
@@ -27,6 +33,7 @@ import type {
|
||||
Vec2,
|
||||
} from "../types";
|
||||
import { createMutation, xy } from "../createCore";
|
||||
import { t } from "../../i18n";
|
||||
|
||||
const EPS = 1e-6;
|
||||
const DEG = Math.PI / 180;
|
||||
@@ -55,18 +62,31 @@ function nextFromFields(
|
||||
return { x: last.x + Math.cos(ang) * length, y: last.y + Math.sin(ang) * length };
|
||||
}
|
||||
|
||||
/** Lage der Decke ([285]): am Geschoss oben, unter dem Geschoss (Bodenplatte) oder frei (OK getippt). */
|
||||
export type CeilPos = "top" | "below" | "free";
|
||||
const POS_NEXT: Record<CeilPos, CeilPos> = { top: "below", below: "free", free: "top" };
|
||||
|
||||
interface CeilIdle extends CommandState {
|
||||
phase: "start";
|
||||
pos: CeilPos;
|
||||
}
|
||||
interface CeilDrawing extends CommandState {
|
||||
phase: "next";
|
||||
points: Vec2[];
|
||||
cursor: Vec2 | null;
|
||||
pos: CeilPos;
|
||||
}
|
||||
type CeilState = CeilIdle | CeilDrawing;
|
||||
/** Lage „Frei": Umriss steht, die Oberkante fehlt noch. */
|
||||
interface CeilZ extends CommandState {
|
||||
phase: "z";
|
||||
points: Vec2[];
|
||||
pos: CeilPos;
|
||||
}
|
||||
type CeilState = CeilIdle | CeilDrawing | CeilZ;
|
||||
|
||||
const CLOSE: CmdOption = { id: "close", labelKey: "cmd.polyline.close" };
|
||||
const UNDO: CmdOption = { id: "undo", labelKey: "cmd.polyline.undo" };
|
||||
const posOption = (pos: CeilPos): CmdOption => ({ id: "pos", labelKey: "cmd.ceiling.pos", value: t(`cmd.ceiling.pos.${pos}`), key: "L" });
|
||||
|
||||
/** Vorschau: geschlossener Umriss-Ring (ab 3 Punkten) + Gummiband + HUD. */
|
||||
function ceilingDraft(points: Vec2[], cursor: Vec2 | null): ToolDraft {
|
||||
@@ -90,56 +110,81 @@ function ceilingDraft(points: Vec2[], cursor: Vec2 | null): ToolDraft {
|
||||
* Commit: Decke aus dem Umriss (normalisiert, CCW; entartet → nichts), Typ = aktiver Aufbau, Ebene
|
||||
* „30“ falls vorhanden — im Kern (`cmd_create.rs`).
|
||||
*/
|
||||
const appendCeiling = (pts: Vec2[], ctx: CommandContext) => createMutation(ctx, { cmd: "ceiling", pts: pts.map(xy) });
|
||||
const appendCeiling = (pts: Vec2[], ctx: CommandContext, top: number | null = null) =>
|
||||
createMutation(ctx, { cmd: "ceiling", pts: pts.map(xy), top });
|
||||
|
||||
const idle = (): [CommandState, CommandResult] => [
|
||||
{ phase: "start", lastPoint: null } as CeilIdle,
|
||||
{ draft: null, done: true },
|
||||
];
|
||||
const idleOf = (pos: CeilPos): CeilIdle => ({ phase: "start", lastPoint: null, pos });
|
||||
const idle = (pos: CeilPos = "top"): [CommandState, CommandResult] => [idleOf(pos), { draft: null, done: true }];
|
||||
|
||||
/** Umriss steht: „Frei" fragt nach der Oberkante, sonst gleich anlegen („Unter" = OK auf dem Geschossboden). */
|
||||
function finish(s: CeilDrawing, ctx: CommandContext): [CommandState, CommandResult] {
|
||||
if (s.pos === "free") {
|
||||
const ns: CeilZ = { phase: "z", points: s.points, pos: s.pos, lastPoint: null };
|
||||
return [ns, { draft: ceilingDraft(s.points, null) }];
|
||||
}
|
||||
return [idleOf(s.pos), { draft: null, done: true, commit: appendCeiling(s.points, ctx, s.pos === "below" ? 0 : null) }];
|
||||
}
|
||||
|
||||
export const ceilingCommand: Command = {
|
||||
name: "ceiling",
|
||||
labelKey: "cmd.ceiling.label",
|
||||
// Decken leben auf Geschossen — wie die Wand nur dort aktiv.
|
||||
floorOnly: true,
|
||||
prompt: (s) =>
|
||||
(s as CeilState).phase === "next" ? "cmd.ceiling.next" : "cmd.ceiling.start",
|
||||
accepts: (s) =>
|
||||
(s as CeilState).phase === "next"
|
||||
? ["point", "number", "option"]
|
||||
: ["point", "number"],
|
||||
prompt: (s) => {
|
||||
const ph = (s as CeilState).phase;
|
||||
return ph === "z" ? "cmd.ceiling.z" : ph === "next" ? "cmd.ceiling.next" : "cmd.ceiling.start";
|
||||
},
|
||||
accepts: (s) => {
|
||||
const ph = (s as CeilState).phase;
|
||||
return ph === "z" ? ["number", "option"] : ph === "next" ? ["point", "number", "option"] : ["point", "number", "option"];
|
||||
},
|
||||
options: (s) => {
|
||||
const ps = s as CeilState;
|
||||
if (ps.phase !== "next") return [];
|
||||
return ps.points.length >= 3 ? [CLOSE, UNDO] : [UNDO];
|
||||
const pos = posOption(ps.pos);
|
||||
if (ps.phase === "z") return [pos];
|
||||
if (ps.phase !== "next") return [pos];
|
||||
return ps.points.length >= 3 ? [CLOSE, UNDO, pos] : [UNDO, pos];
|
||||
},
|
||||
init: (): CeilIdle => ({ phase: "start", lastPoint: null }),
|
||||
init: (): CeilIdle => idleOf("top"),
|
||||
|
||||
onInput: (state, input, ctx): [CommandState, CommandResult] => {
|
||||
const s = state as CeilState;
|
||||
|
||||
// Lage umschalten (jederzeit); steht der Umriss schon und fehlt nur die Oberkante, entscheidet die neue Lage.
|
||||
if (input.kind === "option" && input.id === "pos") {
|
||||
const pos = POS_NEXT[s.pos];
|
||||
if (s.phase === "z") {
|
||||
if (pos === "free") return [{ ...s, pos } as CeilZ, { draft: ceilingDraft(s.points, null) }];
|
||||
return [idleOf(pos), { draft: null, done: true, commit: appendCeiling(s.points, ctx, pos === "below" ? 0 : null) }];
|
||||
}
|
||||
const ns = { ...s, pos } as CeilState;
|
||||
return [ns, { draft: ns.phase === "next" ? ceilingDraft(ns.points, ns.cursor) : null }];
|
||||
}
|
||||
|
||||
// Oberkante getippt (Lage „Frei"), m über dem Geschossboden; Unsinn bleibt im Schritt.
|
||||
if (s.phase === "z") {
|
||||
if (input.kind === "number" && Number.isFinite(input.value)) {
|
||||
return [idleOf(s.pos), { draft: null, done: true, commit: appendCeiling(s.points, ctx, input.value) }];
|
||||
}
|
||||
return [s, { draft: ceilingDraft(s.points, null) }];
|
||||
}
|
||||
|
||||
if (input.kind === "option") {
|
||||
if (s.phase !== "next") return [s, { draft: null }];
|
||||
if (input.id === "undo") {
|
||||
const pts = s.points.slice(0, -1);
|
||||
if (pts.length === 0)
|
||||
return [{ phase: "start", lastPoint: null } as CeilIdle, { draft: null }];
|
||||
if (pts.length === 0) return [idleOf(s.pos), { draft: null }];
|
||||
const ns: CeilDrawing = {
|
||||
phase: "next",
|
||||
points: pts,
|
||||
cursor: s.cursor,
|
||||
lastPoint: pts[pts.length - 1],
|
||||
pos: s.pos,
|
||||
};
|
||||
return [ns, { draft: ceilingDraft(pts, s.cursor) }];
|
||||
}
|
||||
// Sofort schließen: committet die Decke (unabhängig, ≥3 Punkte).
|
||||
if (input.id === "close" && s.points.length >= 3) {
|
||||
const pts = s.points;
|
||||
return [
|
||||
{ phase: "start", lastPoint: null } as CeilIdle,
|
||||
{ draft: null, done: true, commit: appendCeiling(pts, ctx) },
|
||||
];
|
||||
}
|
||||
// Sofort schließen (≥3 Punkte).
|
||||
if (input.id === "close" && s.points.length >= 3) return finish(s, ctx);
|
||||
return [s, { draft: ceilingDraft(s.points, s.cursor) }];
|
||||
}
|
||||
|
||||
@@ -151,30 +196,24 @@ export const ceilingCommand: Command = {
|
||||
}
|
||||
const pt = input.point;
|
||||
if (s.phase !== "next") {
|
||||
const ns: CeilDrawing = { phase: "next", points: [pt], cursor: pt, lastPoint: pt };
|
||||
const ns: CeilDrawing = { phase: "next", points: [pt], cursor: pt, lastPoint: pt, pos: s.pos };
|
||||
return [ns, { draft: ceilingDraft([pt], pt) }];
|
||||
}
|
||||
// Klick nahe Startpunkt → schließen (committet die Decke).
|
||||
if (s.points.length >= 3 && segLen(s.points[0], pt) < CLOSE_HIT) {
|
||||
const pts = s.points;
|
||||
return [
|
||||
{ phase: "start", lastPoint: null } as CeilIdle,
|
||||
{ draft: null, done: true, commit: appendCeiling(pts, ctx) },
|
||||
];
|
||||
}
|
||||
if (s.points.length >= 3 && segLen(s.points[0], pt) < CLOSE_HIT) return finish(s, ctx);
|
||||
// Null-Strecke (Klick auf denselben Punkt) ignorieren.
|
||||
const last = s.points[s.points.length - 1];
|
||||
if (segLen(last, pt) < EPS) {
|
||||
return [s, { draft: ceilingDraft(s.points, s.cursor) }];
|
||||
}
|
||||
const points = [...s.points, pt];
|
||||
const ns: CeilDrawing = { phase: "next", points, cursor: pt, lastPoint: pt };
|
||||
const ns: CeilDrawing = { phase: "next", points, cursor: pt, lastPoint: pt, pos: s.pos };
|
||||
return [ns, { draft: ceilingDraft(points, pt) }];
|
||||
},
|
||||
|
||||
onMove: (state, point): [CommandState, CommandResult] => {
|
||||
const s = state as CeilState;
|
||||
if (s.phase !== "next") return [s, { draft: null }];
|
||||
if (s.phase !== "next") return [s, { draft: s.phase === "z" ? ceilingDraft(s.points, null) : null }];
|
||||
const ns: CeilDrawing = { ...s, cursor: point };
|
||||
return [ns, { draft: ceilingDraft(s.points, point) }];
|
||||
},
|
||||
@@ -182,16 +221,12 @@ export const ceilingCommand: Command = {
|
||||
// Enter/Space/Rechtsklick: Umriss schließen + committen (≥3 Punkte).
|
||||
onConfirm: (state, ctx): [CommandState, CommandResult] => {
|
||||
const s = state as CeilState;
|
||||
if (s.phase === "next" && s.points.length >= 3) {
|
||||
const pts = s.points;
|
||||
return [
|
||||
{ phase: "start", lastPoint: null } as CeilIdle,
|
||||
{ draft: null, done: true, commit: appendCeiling(pts, ctx) },
|
||||
];
|
||||
}
|
||||
return idle();
|
||||
if (s.phase === "next" && s.points.length >= 3) return finish(s, ctx);
|
||||
// Lage „Frei": Enter = Oberkante 0 (Geschossboden).
|
||||
if (s.phase === "z") return [idleOf(s.pos), { draft: null, done: true, commit: appendCeiling(s.points, ctx, 0) }];
|
||||
return idle(s.pos);
|
||||
},
|
||||
onCancel: (): [CommandState, CommandResult] => idle(),
|
||||
onCancel: (state): [CommandState, CommandResult] => idle((state as CeilState).pos),
|
||||
|
||||
// Tab-Feld-Zyklus nur im „next"-Schritt: Länge + Winkel relativ zum letzten Punkt.
|
||||
fields: (state) => ((state as CeilState).phase === "next" ? CEIL_FIELDS : []),
|
||||
|
||||
@@ -40,8 +40,12 @@ function pickWall(ctx: CommandContext, p: Vec2): { id: string; start: Vec2; end:
|
||||
return { id, start: { x: start[0], y: start[1] }, end: { x: end[0], y: end[1] }, t, bulge };
|
||||
}
|
||||
|
||||
/** Tab-Felder im Positionsschritt: Breite/Höhe/Brüstung (+ Winkel bei Tür). */
|
||||
/**
|
||||
* Tab-Felder im Positionsschritt: Abstand entlang der Wand (erstes, aktives Feld — eine getippte Zahl ist der
|
||||
* Abstand, nicht die Breite, [285]), dann Breite/Höhe/Brüstung (+ Winkel bei Tür).
|
||||
*/
|
||||
const BASE_FIELDS: CommandField[] = [
|
||||
{ id: "pos", labelKey: "cmd.field.offset" },
|
||||
{ id: "width", labelKey: "cmd.field.width" },
|
||||
{ id: "height", labelKey: "cmd.field.height" },
|
||||
{ id: "sill", labelKey: "cmd.opening.sillField" },
|
||||
@@ -73,6 +77,8 @@ interface OpPos extends CommandState {
|
||||
bulge?: number;
|
||||
cursor: Vec2 | null;
|
||||
posAlong: number; // Abstand vom Wandanfang (Meter)
|
||||
/** [285] Getippter Abstand (Feld „Abstand“): hat Vorrang vor Maus und Klick. */
|
||||
posLock?: number;
|
||||
kind: "window" | "door";
|
||||
hinge: "start" | "end";
|
||||
side: "left" | "right";
|
||||
@@ -230,8 +236,8 @@ export const openingCommand: Command = {
|
||||
return [ns, { draft: posDraft(ns, ctx) }];
|
||||
}
|
||||
|
||||
// Positionsschritt: Klick projiziert auf die Achse → committen.
|
||||
const ns: OpPos = { ...s, posAlong: posDraftAt(s, ctx, null, pt).pos, cursor: pt };
|
||||
// Positionsschritt: Klick projiziert auf die Achse (ein getippter Abstand gilt vor dem Klick) → committen.
|
||||
const ns: OpPos = { ...s, posAlong: s.posLock ?? posDraftAt(s, ctx, null, pt).pos, cursor: pt };
|
||||
return [
|
||||
idle(s)[0],
|
||||
{ draft: null, done: true, commit: appendOpening(ns, ctx) },
|
||||
@@ -241,7 +247,7 @@ export const openingCommand: Command = {
|
||||
onMove: (state, point, _snap, ctx): [CommandState, CommandResult] => {
|
||||
const s = state as OpState;
|
||||
if (s.phase !== "pos") return [s, { draft: null }];
|
||||
const at = posDraftAt({ ...s, cursor: point }, ctx, null, point);
|
||||
const at = s.posLock !== undefined ? posDraftAt({ ...s, cursor: point }, ctx, s.posLock, null) : posDraftAt({ ...s, cursor: point }, ctx, null, point);
|
||||
const ns: OpPos = { ...s, posAlong: at.pos, cursor: point };
|
||||
return [ns, { draft: at.draft }];
|
||||
},
|
||||
@@ -249,7 +255,7 @@ export const openingCommand: Command = {
|
||||
onConfirm: (state, ctx): [CommandState, CommandResult] => {
|
||||
const s = state as OpState;
|
||||
if (s.phase === "pos") {
|
||||
const ns = s;
|
||||
const ns: OpPos = s.posLock !== undefined ? { ...s, posAlong: s.posLock } : s;
|
||||
return [
|
||||
idle(s)[0],
|
||||
{ draft: null, done: true, commit: appendOpening(ns, ctx) },
|
||||
@@ -267,6 +273,7 @@ export const openingCommand: Command = {
|
||||
// Getippte Tab-Felder sticky in den State übernehmen; kein Koordinatenpunkt.
|
||||
pointFromFields: (state, locks) => {
|
||||
const s = state as OpState;
|
||||
if (s.phase === "pos") s.posLock = "pos" in locks && Number.isFinite(locks.pos) ? locks.pos : undefined;
|
||||
if ("width" in locks && locks.width > 0) s.width = locks.width;
|
||||
if ("height" in locks && locks.height > 0) s.height = locks.height;
|
||||
if ("sill" in locks && locks.sill >= 0) s.sill = locks.sill;
|
||||
@@ -276,6 +283,7 @@ export const openingCommand: Command = {
|
||||
fieldValues: (state): Record<string, number> => {
|
||||
const s = state as OpState;
|
||||
const out: Record<string, number> = {
|
||||
...(s.phase === "pos" ? { pos: s.posLock ?? s.posAlong } : {}),
|
||||
width: s.width,
|
||||
height: s.height,
|
||||
sill: s.sill,
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
// [285] Fenster-Befehl: eine getippte Zahl beim Schritt „Position entlang der Wand (Abstand tippen)“ ist der
|
||||
// ABSTAND vom Wandanfang, nicht die Breite (vorher setzte sie still die Breite: „3“ = 3 m breites Fenster).
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { CommandEngine, type EngineHost } from "../engine";
|
||||
import type { CommandContext } from "../types";
|
||||
import type { ProjectMutation } from "../../core";
|
||||
import { sampleProject } from "../../model/sampleProject";
|
||||
|
||||
// Beispielhaus ohne die vorhandenen Öffnungen (sonst weicht das Fenster ihnen aus).
|
||||
const project = { ...sampleProject, openings: [] };
|
||||
const level = sampleProject.drawingLevels.find((l) => l.kind === "floor")!;
|
||||
const ctx: CommandContext = {
|
||||
project,
|
||||
level,
|
||||
defaultCategoryCode: "20",
|
||||
activeLineStyleId: "",
|
||||
activeWallTypeId: sampleProject.wallTypes[0]?.id ?? "",
|
||||
lastPoint: null,
|
||||
selection: { wallIds: [], drawingId: null, drawingIds: [] } as unknown as CommandContext["selection"],
|
||||
};
|
||||
|
||||
function run(type: (e: CommandEngine) => void) {
|
||||
const commits: ProjectMutation[] = [];
|
||||
const host: EngineHost = {
|
||||
context: (lastPoint) => ({ ...ctx, lastPoint }),
|
||||
snap: () => null,
|
||||
pxPerMeter: () => 50,
|
||||
setDraft: () => {},
|
||||
commit: (m) => void commits.push(m),
|
||||
isFloor: () => true,
|
||||
};
|
||||
const engine = new CommandEngine(host);
|
||||
engine.start("fenster");
|
||||
type(engine);
|
||||
return commits;
|
||||
}
|
||||
|
||||
describe("Fenster: getippter Abstand", () => {
|
||||
it("„3.5“ + Enter setzt das Fenster 3.5 m vom Wandanfang (Breite bleibt 1.2 m)", () => {
|
||||
// W1 läuft von (0,0) nach (5,0).
|
||||
const commits = run((e) => {
|
||||
e.pick({ x: 1, y: 0 });
|
||||
e.submitText("3.5");
|
||||
e.confirm();
|
||||
});
|
||||
expect(commits).toHaveLength(1);
|
||||
const q = commits[0](project);
|
||||
const o = (q.openings ?? []).find((x) => !(project.openings ?? []).some((y) => y.id === x.id))!;
|
||||
expect(o.hostWallId).toBe("W1");
|
||||
expect(o.position).toBeCloseTo(3.5, 6);
|
||||
expect(o.width).toBeCloseTo(1.2, 6);
|
||||
});
|
||||
});
|
||||
@@ -3,7 +3,7 @@
|
||||
* Geschossboden; Enter beim Gefälle übernimmt 6 %.
|
||||
*/
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { rampCommand, RAMP_DEFAULT_PERCENT } from "./ramp";
|
||||
import { rampCommand, rampNotice, RAMP_DEFAULT_PERCENT } from "./ramp";
|
||||
import type { CommandContext, CommandState, Project, Vec2 } from "../types";
|
||||
|
||||
function project(): Project {
|
||||
@@ -79,4 +79,26 @@ describe("rampCommand", () => {
|
||||
const q = run([...outline, { x: 0, y: 1.5 }, { x: 5, y: 1.5 }], 0);
|
||||
expect(q.ceilings ?? []).toHaveLength(0);
|
||||
});
|
||||
|
||||
it("[285] Hinweis, wenn die Rampe über die Geschosshöhe steigt oder tiefer als eine Geschosshöhe fällt", () => {
|
||||
const a = { x: 0, y: 0 };
|
||||
// 6 % auf 10 m = 0.6 m: in Ordnung.
|
||||
expect(rampNotice(a, { x: 10, y: 0 }, 6, 2.6)?.key).toBe("cmd.ramp.done");
|
||||
// 6 % auf 50 m = 3 m > 2.6 m: steigt über die Geschosshöhe.
|
||||
const hi = rampNotice(a, { x: 50, y: 0 }, 6, 2.6);
|
||||
expect(hi?.key).toBe("cmd.ramp.tooHigh");
|
||||
expect(hi?.kind).toBe("warning");
|
||||
// −6 % auf 50 m = −3 m: fällt unter den Boden.
|
||||
expect(rampNotice(a, { x: 50, y: 0 }, -6, 2.6)?.key).toBe("cmd.ramp.tooLow");
|
||||
// Ohne Geschosshöhe gilt die Vorgabe 2.6 m.
|
||||
expect(rampNotice(a, { x: 50, y: 0 }, 6, undefined)?.key).toBe("cmd.ramp.tooHigh");
|
||||
});
|
||||
it("[285] Der Befehl meldet den Hinweis beim Commit", () => {
|
||||
const p = project();
|
||||
const ctx = ctxOf(p);
|
||||
let state: CommandState = rampCommand.init();
|
||||
for (const point of [...outline, { x: 0, y: 1.5 }, { x: 10, y: 1.5 }]) state = rampCommand.onInput(state, { kind: "point", point }, ctx)[0];
|
||||
const [, res] = rampCommand.onInput(state, { kind: "number", value: 50 }, ctx);
|
||||
expect(res.notice?.key).toBe("cmd.ramp.tooHigh");
|
||||
});
|
||||
});
|
||||
@@ -44,9 +44,25 @@ function draft(s: RampState): ToolDraft {
|
||||
|
||||
const idle = (): RampState => ({ phase: "start", points: [], cursor: null, lastPoint: null });
|
||||
|
||||
/** Vorgabe-Geschosshöhe, wenn das Geschoss keine hat (wie der Kern, `cmd_create.rs`). */
|
||||
const DEF_FLOOR_HEIGHT = 2.6;
|
||||
|
||||
/**
|
||||
* [285] Hinweis nach dem Anlegen: steigt die Rampe über die Geschosshöhe bzw. fällt sie tiefer als eine Geschosshöhe unter den
|
||||
* Boden, stimmt meist die Richtung nicht (Anfang = Geschossboden, positives Gefälle = steigt zum Ende).
|
||||
*/
|
||||
export function rampNotice(from: Vec2, to: Vec2, percent: number, floorHeight: number | undefined): CommandResult["notice"] {
|
||||
const h = floorHeight && floorHeight > 0 ? floorHeight : DEF_FLOOR_HEIGHT;
|
||||
const rise = (percent / 100) * dist(from, to);
|
||||
if (rise > h + EPS) return { key: "cmd.ramp.tooHigh", params: { rise: rise.toFixed(2), height: h.toFixed(2) }, kind: "warning" };
|
||||
if (rise < -h - EPS) return { key: "cmd.ramp.tooLow", params: { drop: (-rise).toFixed(2), height: h.toFixed(2) }, kind: "warning" };
|
||||
return { key: "cmd.ramp.done", kind: "info" };
|
||||
}
|
||||
|
||||
function commit(s: RampState, percent: number, ctx: CommandContext): [CommandState, CommandResult] {
|
||||
const req = { cmd: "ramp", pts: s.points.map(xy), from: xy(s.from!), to: xy(s.to!), percent };
|
||||
return [idle(), { draft: null, done: true, commit: createMutation(ctx, req), notice: { key: "cmd.ramp.done", kind: "info" } }];
|
||||
const notice = rampNotice(s.from!, s.to!, percent, ctx.level.floorHeight);
|
||||
return [idle(), { draft: null, done: true, commit: createMutation(ctx, req), notice }];
|
||||
}
|
||||
|
||||
const closeOutline = (s: RampState): [CommandState, CommandResult] => {
|
||||
|
||||
+51
-12
@@ -32,6 +32,7 @@ import type {
|
||||
Vec2,
|
||||
} from "../types";
|
||||
import { createMutation, createPreview, xy } from "../createCore";
|
||||
import { t } from "../../i18n";
|
||||
|
||||
const EPS = 1e-6;
|
||||
const DEG = Math.PI / 180;
|
||||
@@ -74,6 +75,20 @@ interface ArcMode {
|
||||
arc: boolean;
|
||||
/** Im Bogen-Modus: tangential an den Vorgänger statt Drei-Punkt-Bogen. */
|
||||
tangent: boolean;
|
||||
/** [285] Wandtyp dieses Befehls (Option „Wandtyp“, bleibt erhalten); null = aktiver Wandtyp des Projekts. */
|
||||
typeId: string | null;
|
||||
/** [285] Name zum Wandtyp (nur für die Anzeige der Option). */
|
||||
typeName: string | null;
|
||||
/** [285] Aussenbauteil (IFC `IsExternal`): „auto“ = nach dem Wandtyp („Aussenwand“ ⇒ aussen), „yes“/„no“ ausdrücklich. */
|
||||
ext: "auto" | "yes" | "no";
|
||||
}
|
||||
const NO_MODE: ArcMode = { arc: false, tangent: false, typeId: null, typeName: null, ext: "auto" };
|
||||
const EXT_NEXT = { auto: "yes", yes: "no", no: "auto" } as const;
|
||||
|
||||
/** Kontext mit dem gewählten Wandtyp des Befehls (Option „Wandtyp“); ein inzwischen gelöschter Typ fällt auf den aktiven zurück. */
|
||||
function effCtx(ctx: CommandContext, s: ArcMode): CommandContext {
|
||||
if (!s.typeId || s.typeId === ctx.activeWallTypeId) return ctx;
|
||||
return ctx.project.wallTypes.some((w) => w.id === s.typeId) ? { ...ctx, activeWallTypeId: s.typeId } : ctx;
|
||||
}
|
||||
|
||||
interface WallIdle extends CommandState, ArcMode {
|
||||
@@ -101,6 +116,8 @@ type WallCmdState = WallIdle | WallDrawing;
|
||||
const UNDO: CmdOption = { id: "undo", labelKey: "cmd.polyline.undo" };
|
||||
const arcOption = (on: boolean): CmdOption => ({ id: "arc", labelKey: "cmd.polyline.arcOpt", value: on ? "on" : "off" });
|
||||
const tangentOption = (on: boolean): CmdOption => ({ id: "tangent", labelKey: "cmd.polyline.tangentOpt", value: on ? "on" : "off" });
|
||||
const typeOption = (s: ArcMode): CmdOption => ({ id: "wtype", labelKey: "cmd.wall.typeOpt", value: s.typeName ?? t("cmd.wall.typeActive"), key: "T" });
|
||||
const extOption = (s: ArcMode): CmdOption => ({ id: "ext", labelKey: "cmd.wall.extOpt", value: t(`cmd.wall.ext.${s.ext}`), key: "A" });
|
||||
|
||||
/**
|
||||
* Bänder der schon gesetzten Segmente: sie ändern sich je Mausschritt nicht und werden nur neu gerechnet,
|
||||
@@ -150,22 +167,26 @@ function wallDraft(
|
||||
* Commit: je Achssegment eine Wand des aktiven Typs (Höhe aus dem Geschoss); eine gelockte Dicke
|
||||
* (einschichtig) wählt/erzeugt den passenden Wandtyp — beides im Kern (`cmd_create.rs`).
|
||||
*/
|
||||
const appendWalls = (pts: Vec2[], ctx: CommandContext, thick: number | null, segs: Seg[] = []) =>
|
||||
createMutation(
|
||||
const appendWalls = (pts: Vec2[], ctx: CommandContext, thick: number | null, segs: Seg[] = [], ext: ArcMode["ext"] = "auto") => {
|
||||
const external = ext === "auto" ? null : ext === "yes";
|
||||
return createMutation(
|
||||
ctx,
|
||||
segs.some((g) => g !== 0) ? { cmd: "wall", pts: pts.map(xy), thick, segs } : { cmd: "wall", pts: pts.map(xy), thick },
|
||||
segs.some((g) => g !== 0)
|
||||
? { cmd: "wall", pts: pts.map(xy), thick, segs, external }
|
||||
: { cmd: "wall", pts: pts.map(xy), thick, external },
|
||||
);
|
||||
};
|
||||
|
||||
const idle = (
|
||||
thickOverride: number | null = null,
|
||||
single = false,
|
||||
mode: ArcMode = { arc: false, tangent: false },
|
||||
mode: ArcMode = NO_MODE,
|
||||
): [CommandState, CommandResult] => [
|
||||
{ phase: "start", lastPoint: null, thickOverride, single, arc: mode.arc, tangent: mode.tangent } as WallIdle,
|
||||
{ phase: "start", lastPoint: null, thickOverride, single, ...modeOf(mode) } as WallIdle,
|
||||
{ draft: null, done: true },
|
||||
];
|
||||
|
||||
const modeOf = (s: ArcMode): ArcMode => ({ arc: s.arc, tangent: s.tangent });
|
||||
const modeOf = (s: ArcMode): ArcMode => ({ arc: s.arc, tangent: s.tangent, typeId: s.typeId, typeName: s.typeName, ext: s.ext });
|
||||
const draftOf = (ctx: CommandContext, s: WallDrawing): ToolDraft => wallDraft(ctx, s.points, s.cursor, s.thickOverride, s);
|
||||
|
||||
export const wallCommand: Command = {
|
||||
@@ -181,14 +202,30 @@ export const wallCommand: Command = {
|
||||
accepts: () => ["point", "number", "option"],
|
||||
options: (s) => {
|
||||
const ps = s as WallCmdState;
|
||||
const arc = [arcOption(!!ps.arc), ...(ps.arc ? [tangentOption(!!ps.tangent)] : [])];
|
||||
const arc = [arcOption(!!ps.arc), ...(ps.arc ? [tangentOption(!!ps.tangent)] : []), typeOption(ps), extOption(ps)];
|
||||
return ps.phase === "next" ? [...arc, UNDO] : arc;
|
||||
},
|
||||
init: (): WallIdle => ({ phase: "start", lastPoint: null, thickOverride: null, single: false, arc: false, tangent: false }),
|
||||
init: (): WallIdle => ({ phase: "start", lastPoint: null, thickOverride: null, single: false, ...NO_MODE }),
|
||||
|
||||
onInput: (state, input, ctx): [CommandState, CommandResult] => {
|
||||
onInput: (state, input, ctx0): [CommandState, CommandResult] => {
|
||||
const s = state as WallCmdState;
|
||||
const to = s.thickOverride;
|
||||
|
||||
// [285] Wandtyp wählen (reihum durch die Typen des Projekts) bzw. Aussenbauteil umschalten.
|
||||
if (input.kind === "option" && (input.id === "wtype" || input.id === "ext")) {
|
||||
let flip: Partial<ArcMode>;
|
||||
if (input.id === "ext") flip = { ext: EXT_NEXT[s.ext] };
|
||||
else {
|
||||
const list = ctx0.project.wallTypes;
|
||||
if (list.length === 0) return [s, { draft: null }];
|
||||
const cur = list.findIndex((w) => w.id === (s.typeId ?? ctx0.activeWallTypeId));
|
||||
const next = list[(cur + 1) % list.length];
|
||||
flip = { typeId: next.id, typeName: next.name };
|
||||
}
|
||||
const ns = { ...s, ...flip } as WallCmdState;
|
||||
return [ns, { draft: ns.phase === "next" ? draftOf(effCtx(ctx0, ns), ns) : null }];
|
||||
}
|
||||
const ctx = effCtx(ctx0, s);
|
||||
const single = isSingleLayer(ctx);
|
||||
|
||||
if (input.kind === "option") {
|
||||
@@ -268,22 +305,24 @@ export const wallCommand: Command = {
|
||||
return [ns, { draft: draftOf(ctx, ns) }];
|
||||
},
|
||||
|
||||
onMove: (state, point, _snap, ctx): [CommandState, CommandResult] => {
|
||||
onMove: (state, point, _snap, ctx0): [CommandState, CommandResult] => {
|
||||
const s = state as WallCmdState;
|
||||
if (s.phase !== "next") return [s, { draft: null }];
|
||||
const ctx = effCtx(ctx0, s);
|
||||
const ns: WallDrawing = { ...s, cursor: point, single: isSingleLayer(ctx) };
|
||||
return [ns, { draft: draftOf(ctx, ns) }];
|
||||
},
|
||||
|
||||
// Enter/Space/Rechtsklick: offenen Zug beenden (≥2 Punkte) und committen.
|
||||
onConfirm: (state, ctx): [CommandState, CommandResult] => {
|
||||
onConfirm: (state, ctx0): [CommandState, CommandResult] => {
|
||||
const s = state as WallCmdState;
|
||||
const ctx = effCtx(ctx0, s);
|
||||
if (s.phase === "next" && s.points.length >= 2) {
|
||||
const pts = s.points;
|
||||
const to = s.thickOverride;
|
||||
return [
|
||||
{ phase: "start", lastPoint: null, thickOverride: to, single: s.single, ...modeOf(s) } as WallIdle,
|
||||
{ draft: null, done: true, commit: appendWalls(pts, ctx, to, s.segs) },
|
||||
{ draft: null, done: true, commit: appendWalls(pts, ctx, to, s.segs, s.ext) },
|
||||
];
|
||||
}
|
||||
return idle(s.thickOverride, s.single, modeOf(s));
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
/**
|
||||
* [285] `wallCommand` — Option „Wandtyp“ (reihum durch die Typen des Projekts) und „Aussenbauteil“ (IFC `IsExternal`):
|
||||
* Vorgabe nach dem Namen des Wandtyps („Aussenwand“ ⇒ aussen, „Innenwand“ ⇒ innen), ausdrücklich umschaltbar.
|
||||
*/
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { wallCommand } from "./wall";
|
||||
import type { CommandContext, CmdInput, CommandState, Project } from "../types";
|
||||
|
||||
function project(): Project {
|
||||
return {
|
||||
id: "t",
|
||||
name: "T",
|
||||
lineStyles: [],
|
||||
hatches: [],
|
||||
components: [{ id: "c", name: "C", color: "#ccc", hatchId: "none", joinPriority: 10 }],
|
||||
wallTypes: [
|
||||
{ id: "aw", name: "Aussenwand 36", layers: [{ componentId: "c", thickness: 0.36 }] },
|
||||
{ id: "iw", name: "Innenwand 12", layers: [{ componentId: "c", thickness: 0.12 }] },
|
||||
{ id: "bt", name: "Beton", layers: [{ componentId: "c", thickness: 0.2 }] },
|
||||
],
|
||||
drawingLevels: [{ id: "eg", name: "EG", kind: "floor", visible: true, locked: false, floorHeight: 2.6, cutHeight: 1.0, baseElevation: 0 }],
|
||||
layers: [{ code: "20", name: "Wände", color: "#0a0a0a", lw: 0.5, visible: true, locked: false }],
|
||||
walls: [],
|
||||
openings: [],
|
||||
ceilings: [],
|
||||
stairs: [],
|
||||
rooms: [],
|
||||
drawings2d: [],
|
||||
context: [],
|
||||
} as unknown as Project;
|
||||
}
|
||||
|
||||
const ctxOf = (p: Project): CommandContext => ({
|
||||
project: p,
|
||||
level: p.drawingLevels[0],
|
||||
defaultCategoryCode: "20",
|
||||
activeLineStyleId: "solid",
|
||||
activeWallTypeId: "aw",
|
||||
lastPoint: null,
|
||||
selection: { wallIds: [], drawingId: null },
|
||||
});
|
||||
|
||||
const A = { x: 0, y: 0 };
|
||||
const B = { x: 4, y: 0 };
|
||||
|
||||
function draw(options: string[]): Project["walls"][number] {
|
||||
const p = project();
|
||||
const ctx = ctxOf(p);
|
||||
let state: CommandState = wallCommand.init();
|
||||
for (const id of options) state = wallCommand.onInput(state, { kind: "option", id }, ctx)[0];
|
||||
for (const point of [A, B]) state = wallCommand.onInput(state, { kind: "point", point } as CmdInput, ctx)[0];
|
||||
const [, res] = wallCommand.onConfirm(state, ctx);
|
||||
return res.commit!(p).walls[0];
|
||||
}
|
||||
|
||||
describe("wallCommand Wandtyp und Aussenbauteil [285]", () => {
|
||||
it("Vorgabe: aktiver Wandtyp „Aussenwand“ ⇒ Aussenbauteil", () => {
|
||||
const w = draw([]);
|
||||
expect(w.wallTypeId).toBe("aw");
|
||||
expect(w.isExternal).toBe(true);
|
||||
});
|
||||
|
||||
it("Option Wandtyp wählt den nächsten Typ des Projekts; „Innenwand“ ⇒ innen", () => {
|
||||
const w = draw(["wtype"]);
|
||||
expect(w.wallTypeId).toBe("iw");
|
||||
expect(w.isExternal).toBe(false);
|
||||
});
|
||||
|
||||
it("Typ ohne Hinweis im Namen: keine Angabe; Option Aussenbauteil schaltet auto → ja → nein", () => {
|
||||
expect(draw(["wtype", "wtype"]).isExternal).toBeUndefined();
|
||||
expect(draw(["wtype", "wtype", "ext"]).isExternal).toBe(true);
|
||||
expect(draw(["ext", "ext"]).isExternal).toBe(false);
|
||||
});
|
||||
|
||||
it("Die Optionen zeigen den gewählten Typ", () => {
|
||||
const p = project();
|
||||
const ctx = ctxOf(p);
|
||||
const [s] = wallCommand.onInput(wallCommand.init(), { kind: "option", id: "wtype" }, ctx);
|
||||
const o = wallCommand.options(s).find((x) => x.id === "wtype");
|
||||
expect(o?.value).toBe("Innenwand 12");
|
||||
});
|
||||
});
|
||||
@@ -2057,9 +2057,20 @@ export const de = {
|
||||
"cmd.wall.label": "Wand",
|
||||
"cmd.wall.start": "Startpunkt der Wand:",
|
||||
"cmd.wall.next": "Nächster Punkt:",
|
||||
"cmd.wall.typeOpt": "Wandtyp",
|
||||
"cmd.wall.typeActive": "aktiv",
|
||||
"cmd.wall.extOpt": "Aussenbauteil",
|
||||
"cmd.wall.ext.auto": "nach Typ",
|
||||
"cmd.wall.ext.yes": "ja",
|
||||
"cmd.wall.ext.no": "nein",
|
||||
"cmd.ceiling.label": "Decke",
|
||||
"cmd.ceiling.start": "Erster Umrisspunkt der Decke:",
|
||||
"cmd.ceiling.next": "Nächster Punkt ( Schliessen ):",
|
||||
"cmd.ceiling.pos": "Lage",
|
||||
"cmd.ceiling.pos.top": "oben",
|
||||
"cmd.ceiling.pos.below": "unter dem Geschoss",
|
||||
"cmd.ceiling.pos.free": "frei",
|
||||
"cmd.ceiling.z": "Oberkante in m über dem Geschossboden <0>:",
|
||||
"cmd.ramp.label": "Rampe",
|
||||
"cmd.ramp.start": "Erster Umrisspunkt der Rampe:",
|
||||
"cmd.ramp.next": "Nächster Punkt ( Schliessen ):",
|
||||
@@ -2067,6 +2078,8 @@ export const de = {
|
||||
"cmd.ramp.to": "Ende der Gefällelinie:",
|
||||
"cmd.ramp.percent": "Gefälle in % (negativ = abwärts) <6>:",
|
||||
"cmd.ramp.done": "Rampe angelegt.",
|
||||
"cmd.ramp.tooHigh": "Rampe steigt {rise} m, mehr als die Geschosshöhe ({height} m): Anfang und Ende der Gefällelinie vertauscht?",
|
||||
"cmd.ramp.tooLow": "Rampe fällt {drop} m, tiefer als eine Geschosshöhe ({height} m) unter den Boden: Richtung prüfen.",
|
||||
"cmd.beam.done": "Träger angelegt.",
|
||||
"cmd.railing.done": "Geländer angelegt.",
|
||||
"cmd.solidbool.label": "Körper verschneiden",
|
||||
@@ -3320,6 +3333,7 @@ export const de = {
|
||||
"siteRules.areas": "Parzelle {parcel} m² · zulässig {allowed} m²",
|
||||
"siteRules.violation": "Gebäude {area} m² ausserhalb der zulässigen Fläche",
|
||||
"siteRules.inside": "Gebäude innerhalb der zulässigen Fläche",
|
||||
"siteRules.noBuilding": "Noch kein Gebäude gezeichnet",
|
||||
"siteRules.heightOk": "Höhe {top} m ≤ {max} m",
|
||||
"siteRules.heightOver": "Höhe {top} m über {max} m",
|
||||
"siteRules.terrainAtFacade": "Massgebendes Terrain an der Fassade: {z} m (Höhe darüber gemessen)",
|
||||
|
||||
@@ -2046,9 +2046,20 @@ export const en: Record<TranslationKey, string> = {
|
||||
"cmd.wall.label": "Wall",
|
||||
"cmd.wall.start": "Start of wall:",
|
||||
"cmd.wall.next": "Next point:",
|
||||
"cmd.wall.typeOpt": "Wall type",
|
||||
"cmd.wall.typeActive": "active",
|
||||
"cmd.wall.extOpt": "External",
|
||||
"cmd.wall.ext.auto": "by type",
|
||||
"cmd.wall.ext.yes": "yes",
|
||||
"cmd.wall.ext.no": "no",
|
||||
"cmd.ceiling.label": "Ceiling",
|
||||
"cmd.ceiling.start": "First outline point of ceiling:",
|
||||
"cmd.ceiling.next": "Next point ( Close ):",
|
||||
"cmd.ceiling.pos": "Position",
|
||||
"cmd.ceiling.pos.top": "top",
|
||||
"cmd.ceiling.pos.below": "below storey",
|
||||
"cmd.ceiling.pos.free": "free",
|
||||
"cmd.ceiling.z": "Top level in m above storey floor <0>:",
|
||||
"cmd.ramp.label": "Ramp",
|
||||
"cmd.ramp.start": "First outline point of the ramp:",
|
||||
"cmd.ramp.next": "Next point ( Close ):",
|
||||
@@ -2056,6 +2067,8 @@ export const en: Record<TranslationKey, string> = {
|
||||
"cmd.ramp.to": "End of the slope line:",
|
||||
"cmd.ramp.percent": "Gradient in % (negative = downward) <6>:",
|
||||
"cmd.ramp.done": "Ramp created.",
|
||||
"cmd.ramp.tooHigh": "Ramp rises {rise} m, more than the storey height ({height} m): start and end of the slope line swapped?",
|
||||
"cmd.ramp.tooLow": "Ramp drops {drop} m, more than one storey height ({height} m) below the floor: check the direction.",
|
||||
"cmd.beam.done": "Beam created.",
|
||||
"cmd.railing.done": "Railing created.",
|
||||
"cmd.solidbool.label": "Boolean solids",
|
||||
@@ -3268,6 +3281,7 @@ export const en: Record<TranslationKey, string> = {
|
||||
"siteRules.areas": "Parcel {parcel} m² · buildable {allowed} m²",
|
||||
"siteRules.violation": "Building {area} m² outside the buildable area",
|
||||
"siteRules.inside": "Building inside the buildable area",
|
||||
"siteRules.noBuilding": "No building drawn yet",
|
||||
"siteRules.heightOk": "Height {top} m ≤ {max} m",
|
||||
"siteRules.heightOver": "Height {top} m exceeds {max} m",
|
||||
"siteRules.terrainAtFacade": "Reference terrain at the façade: {z} m (height measured from it)",
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
// [285] Standardaufbauten neuer Projekte haben für jede Schicht eine Wärmeleitfähigkeit (sonst „U-Wert unvollständig“).
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { emptyProject } from "./sampleProject";
|
||||
|
||||
describe("Wärmeleitfähigkeit der Standard-Baustoffe [285]", () => {
|
||||
it("jede Schicht aller Wand-/Decken-/Dachtypen hat λ > 0", () => {
|
||||
const types = [...emptyProject.wallTypes, ...(emptyProject.ceilingTypes ?? []), ...(emptyProject.roofTypes ?? [])];
|
||||
for (const t of types) {
|
||||
for (const l of t.layers) {
|
||||
const c = emptyProject.components.find((x) => x.id === l.componentId);
|
||||
expect(c?.lambda, `${t.name}: ${l.componentId}`).toBeGreaterThan(0);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -117,10 +117,13 @@ export const sampleProject: Project = {
|
||||
],
|
||||
// Bauteil-Materialien: color = Poché-Füllung im Grundriss UND 3D-Diffusfarbe;
|
||||
// joinPriority höher = läuft am Stoß durch (für spätere T-Stöße).
|
||||
// [285] lambda = Bemessungswert der Wärmeleitfähigkeit W/(m·K), SIA-übliche Richtwerte (SIA 279/180, Merkblatt SIA 2001;
|
||||
// dieselben Werte wie die Standard-Bibliothek `core/standards.rs`) — sonst meldet der U-Wert „unvollständig“.
|
||||
components: [
|
||||
{
|
||||
id: "render-ext",
|
||||
name: "Aussenputz",
|
||||
lambda: 0.87,
|
||||
color: "#d8d2c7",
|
||||
hatchId: "none",
|
||||
joinPriority: 10,
|
||||
@@ -128,10 +131,11 @@ export const sampleProject: Project = {
|
||||
},
|
||||
// Weißer Grund unter den durchgezogenen Dämmungs-Haarlinien (quer zur Wand).
|
||||
// Kein passendes Bibliotheks-Asset (Dämmung) → bewusst ohne `material`.
|
||||
{ id: "insulation", name: "Wärmedämmung", color: "#ffffff", hatchId: "sia-insulation", joinPriority: 20 },
|
||||
{ id: "insulation", name: "Wärmedämmung", color: "#ffffff", hatchId: "sia-insulation", lambda: 0.035, joinPriority: 20 },
|
||||
{
|
||||
id: "brick",
|
||||
name: "Backstein",
|
||||
lambda: 0.44,
|
||||
color: "#8c5544",
|
||||
hatchId: "sia-brick",
|
||||
joinPriority: 50,
|
||||
@@ -140,6 +144,7 @@ export const sampleProject: Project = {
|
||||
{
|
||||
id: "render-int",
|
||||
name: "Innenputz",
|
||||
lambda: 0.7,
|
||||
color: "#efece6",
|
||||
hatchId: "none",
|
||||
joinPriority: 10,
|
||||
@@ -153,6 +158,7 @@ export const sampleProject: Project = {
|
||||
{
|
||||
id: "roof-tiles",
|
||||
name: "Dachziegel",
|
||||
lambda: 1.0,
|
||||
color: "#b8735c",
|
||||
hatchId: "sia-brick",
|
||||
joinPriority: 15,
|
||||
@@ -162,6 +168,7 @@ export const sampleProject: Project = {
|
||||
{
|
||||
id: "concrete",
|
||||
name: "Beton",
|
||||
lambda: 2.0,
|
||||
color: "#9aa0a6",
|
||||
hatchId: "sia-concrete",
|
||||
joinPriority: 100,
|
||||
@@ -169,7 +176,7 @@ export const sampleProject: Project = {
|
||||
},
|
||||
// Zementestrich — oberste Schicht des mehrschichtigen Deckenaufbaus (Decken-Stile).
|
||||
// Kein passendes Bibliotheks-Asset (Estrich) → bewusst ohne `material`.
|
||||
{ id: "screed", name: "Zementestrich", color: "#c9c2b3", hatchId: "diagonal", joinPriority: 30 },
|
||||
{ id: "screed", name: "Zementestrich", color: "#c9c2b3", hatchId: "diagonal", lambda: 1.4, joinPriority: 30 },
|
||||
],
|
||||
wallTypes: [
|
||||
{
|
||||
|
||||
@@ -96,7 +96,7 @@ export function SiteRulesSection() {
|
||||
|
||||
const check = checkSiteRules(project);
|
||||
const n = rules.parcel.length;
|
||||
const ok = check !== null && check.violationArea < 0.01 && !check.heightExceeded && !check.profileExceeded;
|
||||
const ok = check !== null && check.maxTop !== null && check.violationArea < 0.01 && !check.heightExceeded && !check.profileExceeded;
|
||||
|
||||
return (
|
||||
<div className="site-rules">
|
||||
@@ -121,12 +121,14 @@ export function SiteRulesSection() {
|
||||
</div>
|
||||
|
||||
{check && (
|
||||
<div className={"site-rules-result" + (ok ? " ok" : " bad")}>
|
||||
<div className={"site-rules-result" + (check.maxTop === null ? "" : ok ? " ok" : " bad")}>
|
||||
<div>{t("siteRules.areas", { parcel: fmt(check.parcelArea), allowed: fmt(check.allowedArea) })}</div>
|
||||
<div>
|
||||
{check.violationArea >= 0.01
|
||||
? t("siteRules.violation", { area: fmt(check.violationArea, 2) })
|
||||
: t("siteRules.inside")}
|
||||
: check.maxTop === null
|
||||
? t("siteRules.noBuilding")
|
||||
: t("siteRules.inside")}
|
||||
</div>
|
||||
{rules.maxHeight !== undefined && check.maxTop !== null && (
|
||||
<div>
|
||||
|
||||
Reference in new issue
Block a user