diff --git a/TODO.md b/TODO.md index 89877322..07e37a66 100644 --- a/TODO.md +++ b/TODO.md @@ -2607,6 +2607,24 @@ Reihenfolge = Abhängigkeiten. Neue Geometrie entsteht in Rust ([K]). „robust"/„Lösung"/„nicht nur" (Textprüfung des Pakets gilt bisher nur für die Startseite). Bilder der Fenster- und Türliste: das SVG von `schedule --openings --format svg` überlappt Spalten (Textbreiten), darum zeigt die Startseite dort einen Grundriss-Ausschnitt. Englisch: `[languages.en]`, `content.en/`. Mac-Screenshots (Metal, echtes 3D). · M +- ◐ **[143] Baugrube erstellen.** (5.11., Mac-Befund „Die Baugrube lässt sich gar nicht erstellen“) Nachgestellt im + Browser-Build (Musterhaus komplex, leeres Projekt). **Ursachen:** (1) der Befehl legte die Baugrube in Kategorie „02 + Gelände“ an — in den Grundriss-Ausschnitten/-Blättern (Vorlage blendet 02 aus) war sie unsichtbar; (2) die Sohle las + eine Liste `floors`, die es im Projekt nicht gibt (Geschosse = `drawingLevels`): Sohle immer −0.30, am Hang über dem + Gelände → nur Aufschüttung; (3) ohne Gelände, ausserhalb des Geländes oder in Schnitt/Ansicht/Blatt (floorOnly) + geschah still nichts; (4) Befehl `terrain` wartete auf eine Eingabe und schluckte die nächsten getippten Befehle; + (5) Gelände in m ü. M. ohne Höhenbezug: Sohle −0.30 gegen ≈ 500 m Gelände. **Neu** (Kern `cmd_solid.rs`): eigene + Kategorie „07 Baugrube“ (unter „05 Kontext“, wird bei Bedarf angelegt, `import_context.rs`/`contextCategories.ts`), + Sohle = tiefstes Geschoss − 0.30; Abfrage `excavationCheck` (Gelände da, Umriss über Gelände, Abtrag ja/nein, + neuer Bezug); liegt das Gelände in m ü. M. (Median > 100 m) und fehlt `referenceElevationMasl`, setzt derselbe + Undo-Schritt ±0.00 auf die Geländehöhe im Umriss. Befehls-Engine: `Command.precondition`, `CommandResult.notice` + (Toast mit Platzhaltern), Hinweis bei floorOnly ohne Geschoss; `terrain` läuft sofort (`autoRun`). Tests: Rust + (Sohle, Prüfung, Höhenbezug, Kategorie), vitest `commands/cmds/excavation.test.ts`, e2e `e2e/excavation.spec.ts` + (Musterhaus komplex im Ausschnitt EG 1:100: Panel-Knopf, Linien im Grundriss, Undo; leeres Projekt ohne Gelände: + Hinweise; leeres Projekt mit Höhenlinien in m ü. M.: Gelände erzeugen, Baugrube, ±0.00, Abtrag, Undo). Geprüft im + Linux-Container (Chromium, SVG-Plan), nicht in der Tauri-App/Metal; Schnitt/3D nur über die bestehenden Rust-Tests. + Offen: DXF-Höhenlinien landen als 2D-Zeichnung statt als `contourSet` (im leeren Projekt ohne Netz kein Weg zu + „Gelände erzeugen“ ausser Standort-Import); Option „Baugrube aus Gebäudegrundfläche“. - ◐ **[137] Alles Sichtbare anwählbar.** (5.11., Mac-Befund am Musterhaus komplex: „Schatten und gewachsenes Terrain lassen sich nicht anwählen und bearbeiten") **Bestand** (Klick im Plan / im 3D, Objekt-Info, Bearbeiten; vorher → jetzt): | Element | Grundriss | Schnitt/Ansicht | 3D | Objekt-Info / Bearbeiten | diff --git a/e2e/excavation.spec.ts b/e2e/excavation.spec.ts new file mode 100644 index 00000000..29d16bb1 --- /dev/null +++ b/e2e/excavation.spec.ts @@ -0,0 +1,100 @@ +// [143] Baugrube erstellen wie ein Nutzer (Mac-Befund 5.11.: „Die Baugrube lässt sich gar nicht erstellen"): +// Befehl/Panel-Knopf, Umriss tippen, Enter. Geprüft: Hinweis (Toast), Eintrag im Panel „Gelände", Linien der +// Baugrube im Grundriss (Farbe EXCAVATION_INK, `plan/context.rs`), Schnitt mit Gelände, Rückgängig entfernt sie. +// Ursachen vorher: Kategorie „02 Gelände" (in Grundrissen oft ausgeblendet → Baugrube unsichtbar), Sohle immer +// −0.30 (las eine Liste `floors`, die es nicht gibt), ohne Gelände stilles Nichts. +import type { Page } from "@playwright/test"; +import { blurFocus, commandInput, discardIfAsked, expect, fileMenu, openTab, showSnapshot, startNewProject, test, typeCommand } from "./app"; + +const ink = (page: Page) => page.locator('svg.plan-svg [stroke="#1f242c"]').count(); +const toast = (page: Page) => page.locator(".toast-message"); +const sitePanel = (page: Page) => page.locator(".site-panel"); + +async function drawExcavation(page: Page, pts: string[]): Promise { + await commandInput(page).focus(); + for (const p of pts) await typeCommand(page, p); + await commandInput(page).press("Enter"); + await expect(page.locator(".cmdline-prompt")).toHaveText("Befehl:"); +} + +test("Musterhaus komplex: Baugrube per Panel-Knopf im Ausschnitt EG 1:100, sichtbar im Grundriss, Rückgängig", async ({ page }) => { + test.setTimeout(120_000); + await startNewProject(page); + await fileMenu(page, /Musterhaus \(komplex\)/); + await discardIfAsked(page); + await expect(page.locator(".project-name")).toHaveText("Musterhaus komplex", { timeout: 30_000 }); + await expect(page.locator("svg.plan-svg").first()).toBeVisible({ timeout: 30_000 }); + // Ausschnitt „EG 1:100" (Grundriss-Vorlage: Gelände „02" ausgeblendet — dort war eine neue Baugrube unsichtbar). + await showSnapshot(page, "EG 1:100"); + await openTab(page, "Ebenen"); + await expect(page.getByRole("button", { name: /^Gelände sichtbar$/ })).toHaveAttribute("title", "Einblenden"); + // Ganzen Plan zeigen (das SVG enthält nur, was im Bild liegt). + await page.locator('[title="Auf Plan einpassen"]').first().click(); + await expect.poll(() => ink(page), { timeout: 30_000 }).toBeGreaterThan(0); + const before = await ink(page); + + await openTab(page, "Gelände"); + await page.getByRole("button", { name: "Baugrube zeichnen" }).click(); + await expect(page.locator(".cmdline-prompt")).toHaveText("Erster Punkt der Baugrubensohle:"); + await drawExcavation(page, ["-25,-10", "-12,-10", "-12,0", "-25,0"]); + + await expect(toast(page).filter({ hasText: /Baugrube angelegt: Sohle −3\.00 m/ })).toBeVisible(); + await expect(sitePanel(page)).toContainText("Baugrube 2"); + // Im Erdgeschoss-Grundriss sichtbar (Gelände „02" ist dort ausgeblendet, die Baugrube „07" nicht). + await expect.poll(() => ink(page)).toBeGreaterThan(before); + + // Rückgängig: weg aus Panel und Plan. + await blurFocus(page); + await page.keyboard.press("Control+z"); + await expect(sitePanel(page)).not.toContainText("Baugrube 2"); + await expect.poll(() => ink(page)).toBe(before); +}); + +test("Leeres Projekt ohne Gelände: klarer Hinweis statt stillem Nichts", async ({ page }) => { + await startNewProject(page); + await commandInput(page).focus(); + await typeCommand(page, "baugrube"); + await expect(toast(page).filter({ hasText: "Baugrube braucht ein Gelände" })).toBeVisible(); + await expect(page.locator(".cmdline-prompt")).toHaveText("Befehl:"); + await typeCommand(page, "terrain"); + await expect(toast(page).filter({ hasText: "Kein Gelände erzeugt" })).toBeVisible(); + await expect(page.locator(".cmdline-prompt")).toHaveText("Befehl:"); +}); + +test("Leeres Projekt mit Gelände in m ü. M.: Gelände erzeugen, Baugrube, ±0.00 angenommen, Rückgängig", async ({ page }) => { + test.setTimeout(90_000); + await startNewProject(page); + // Projekt mit Höhenlinien (Hang 500–512 m ü. M., kein Höhenbezug) speichern und wieder öffnen. + const pending = page.waitForEvent("download"); + await fileMenu(page, "Projekt speichern"); + const dl = await pending; + const { readFile } = await import("node:fs/promises"); + const json = JSON.parse((await readFile((await dl.path())!)).toString("utf8")); + const contours = []; + for (let i = 0; i <= 12; i++) { + const y = -30 + i * 5; + contours.push({ z: 500 + i, pts: [-40, -20, 0, 20, 40].map((x) => ({ x, y: y + x * 0.02 })), closed: false, layer: "HL" }); + } + json.context = [{ type: "contourSet", id: "hl", name: "Höhenlinien", layer: "Terrain", categoryCode: "14", contours }]; + json.name = "Hang"; + const chooser = page.waitForEvent("filechooser"); + await fileMenu(page, "Projekt öffnen"); + await (await chooser).setFiles({ name: "hang.obp", mimeType: "application/json", buffer: Buffer.from(JSON.stringify(json)) }); + await discardIfAsked(page); + await expect(page.locator(".project-name")).toHaveText("Hang", { timeout: 10_000 }); + + await openTab(page, "Gelände"); + await page.getByRole("button", { name: "Gelände erzeugen" }).click(); + await expect(page.getByRole("button", { name: "Baugrube zeichnen" })).toBeVisible(); + const before = await ink(page); + await page.getByRole("button", { name: "Baugrube zeichnen" }).click(); + await drawExcavation(page, ["-6,-5", "6,5"]); // 2 Punkte = Rechteck + await expect(toast(page).filter({ hasText: /±0\.00 = 50\d\.\d\d m ü\. M\. angenommen/ })).toBeVisible(); + await expect(sitePanel(page)).toContainText("Baugrube 1"); + await expect(sitePanel(page)).toContainText(/Abtrag [1-9]/); + await expect.poll(() => ink(page)).toBeGreaterThan(before); + + await blurFocus(page); + await page.keyboard.press("Control+z"); + await expect(sitePanel(page)).not.toContainText("Baugrube 1"); +}); diff --git a/src-tauri/core/src/cmd_create.rs b/src-tauri/core/src/cmd_create.rs index 0ea98048..12b0bc27 100644 --- a/src-tauri/core/src/cmd_create.rs +++ b/src-tauri/core/src/cmd_create.rs @@ -1096,7 +1096,7 @@ pub fn query(root: &Map, p: &Project, v: &Value) -> Option json!({ "hit": pick_profile(root, level, at).map_or(Value::Null, profile_json) }), "profile" => json!({ "hit": find(root, "drawings2d", s_of(v, "id")).map_or(Value::Null, profile_json) }), - _ => return crate::cmd_draw::query(root, p, v).or_else(|| crate::cmd_solid::query(root, v)).map(Ok), + _ => return crate::cmd_draw::query(root, p, v).or_else(|| crate::cmd_solid::query(root, p, v)).map(Ok), })) } diff --git a/src-tauri/core/src/cmd_solid.rs b/src-tauri/core/src/cmd_solid.rs index 7f9d96ce..56f6705c 100644 --- a/src-tauri/core/src/cmd_solid.rs +++ b/src-tauri/core/src/cmd_solid.rs @@ -489,9 +489,8 @@ pub fn terrain_from_contours_with(contours: &[Value], id: &str, o: crate::terrai ]) } -/// [68] Baugrube aus dem gezeichneten Umriss (≥ 3 Punkte; 2 Punkte = Rechteck). Sohle = Geschoss- -/// Unterkante − 0.30 m (Magerbeton + Bodenplatte), Böschung 45°. -fn excavation_ops(root: &Map, v: &Value, ctx: &Ctx, ids: &mut IdGen) -> Vec { +/// [143] Umriss der Baugrube aus den Klicks (≥ 3 Punkte; 2 Punkte = Rechteck); entartet → leer. +fn excavation_outline(v: &Value) -> Vec { let mut pts: Vec = pts_of(v, "pts").into_iter().filter(|p| p.0.is_finite() && p.1.is_finite()).collect(); if pts.len() == 2 { pts = rect_corners(pts[0], pts[1]).to_vec(); @@ -500,23 +499,131 @@ fn excavation_ops(root: &Map, v: &Value, ctx: &Ctx, ids: &mut IdG if pts.len() < 3 || area2.abs() < 0.02 { return Vec::new(); } - let base = arr(root.get("floors")).iter().find(|f| field(f, "id").and_then(Value::as_str) == Some(ctx.level)).map_or(0.0, |f| num_or(field(f, "baseElevation"), 0.0)); + pts +} + +/// [143] Rohhöhen des Geländes, ab denen es als „in m ü. M." gilt (ohne gesetzten Höhenbezug ±0.00). +const ABSOLUTE_TERRAIN_M: f64 = 100.0; + +/// [143] Prüfung vor dem Anlegen einer Baugrube (Befehl, Abfrage `excavationCheck`). +#[derive(Debug, PartialEq)] +pub struct ExCheck { + /// Sohle (Modellhöhe): Oberkante des tiefsten Geschosses − 0.30 m. + pub bottom: f64, + /// Es gibt ein Gelände-Netz. + pub terrain: bool, + /// Der Umriss liegt (wenigstens teilweise) über dem Gelände. + pub over: bool, + /// Das Gelände liegt irgendwo im Umriss über der Sohle (sonst nur Aufschüttung). + pub cut: bool, + /// Neuer Höhenbezug ±0.00 (m ü. M.), wenn das Gelände in m ü. M. vorliegt und keiner gesetzt ist: + /// Geländehöhe im Schwerpunkt des Umrisses (sonst lägen 500 m Höhe zwischen Gelände und Sohle). + pub datum: Option, +} + +fn excavation_check(p: &Project, pts: &[V], level: &str) -> ExCheck { + use crate::terrain::{datum, Tin, TinIndex}; + // Sohle unter dem TIEFSTEN Geschoss: im EG gezeichnet lag sie sonst auf −0.30 m, am Hang über dem + // Gelände → nur Aufschüttung statt Grube. (Vorher las der Befehl eine Liste `floors`, die es im + // Projekt nicht gibt — Geschosse sind `drawingLevels` —, die Sohle lag darum IMMER auf −0.30 m.) + use crate::model::DrawingLevelKind; + let base = p + .drawing_levels + .iter() + .filter(|l| l.kind == DrawingLevelKind::Floor || l.id == level) + .filter_map(|l| l.base_elevation.filter(|z| z.is_finite())) + .fold(f64::INFINITY, f64::min); + let base = if base.is_finite() { base } else { 0.0 }; + let bottom = base - 0.3; + let terrains = crate::excavation::terrains(p); + let mut out = ExCheck { bottom, terrain: !terrains.is_empty(), over: false, cut: false, datum: None }; + if pts.len() < 3 { + return out; + } + // Proben: Ecken, Schwerpunkt der Ecken, 6×6-Raster im Umriss. + let n = pts.len() as f64; + let c = (pts.iter().map(|p| p.0).sum::() / n, pts.iter().map(|p| p.1).sum::() / n); + let ring: Vec<[f64; 2]> = pts.iter().map(|p| [p.0, p.1]).collect(); + let (x0, x1) = pts.iter().fold((f64::INFINITY, f64::NEG_INFINITY), |(a, b), p| (a.min(p.0), b.max(p.0))); + let (y0, y1) = pts.iter().fold((f64::INFINITY, f64::NEG_INFINITY), |(a, b), p| (a.min(p.1), b.max(p.1))); + let mut samples: Vec = pts.to_vec(); + samples.push(c); + for i in 0..6 { + for j in 0..6 { + let q = (x0 + (x1 - x0) * (i as f64 + 0.5) / 6.0, y0 + (y1 - y0) * (j as f64 + 0.5) / 6.0); + if crate::excavation::point_in_ring([q.0, q.1], &ring) { + samples.push(q); + } + } + } + let reference = p.reference_elevation_masl.filter(|r| r.is_finite() && *r != 0.0); + for t in terrains { + let tin = Tin::from_flat(&t.positions, &t.indices); + if tin.tris.is_empty() { + continue; + } + let idx = TinIndex::new(&tin); + let raw: Vec = samples.iter().filter_map(|q| idx.z_at(q.0, q.1)).collect(); + if raw.is_empty() { + continue; + } + out.over = true; + let mut dz = datum(reference, &tin.z); + if reference.is_none() && out.datum.is_none() { + let mut zs: Vec = tin.z.iter().copied().filter(|z| z.is_finite()).collect(); + zs.sort_by(|a, b| a.total_cmp(b)); + if zs.get(zs.len() / 2).is_some_and(|m| m.abs() > ABSOLUTE_TERRAIN_M) { + let at = idx.z_at(c.0, c.1).unwrap_or(raw[0]); + let r = jsnum::round(at * 100.0) / 100.0; + out.datum = Some(r); + dz = r; + } + } + if raw.iter().any(|z| z - dz > bottom + 1e-6) { + out.cut = true; + } + } + out +} + +/// [68] Baugrube aus dem gezeichneten Umriss (≥ 3 Punkte; 2 Punkte = Rechteck). Sohle = Oberkante des +/// TIEFSTEN Geschosses − 0.30 m (Magerbeton + Bodenplatte), Böschung 45°. [143] Liegt das Gelände in +/// m ü. M. und ist kein Höhenbezug gesetzt, setzt derselbe Schritt ±0.00 auf die Geländehöhe im Umriss. +fn excavation_ops(root: &Map, p: &Project, v: &Value, ctx: &Ctx, ids: &mut IdGen) -> Vec { + let pts = excavation_outline(v); + if pts.is_empty() { + return Vec::new(); + } + let check = excavation_check(p, &pts, ctx.level); let n = arr(root.get("context")).iter().filter(|o| field(o, "type").and_then(Value::as_str) == Some("excavation")).count(); - add_op( + let mut out = Vec::new(); + if let Some(d) = check.datum { + out.push(Op::SetField { key: "referenceElevationMasl".into(), value: Some(js_num(d)), at: None }); + } + out.extend(add_op( "context", vec![obj(vec![ ("id", s(&ids.next("excavation"))), ("type", s("excavation")), ("name", s(&format!("Baugrube {}", n + 1))), ("layer", s("Terrain")), - ("categoryCode", s("02")), + ("categoryCode", s(EXCAVATION_CATEGORY)), ("outline", pvs(&pts)), - ("bottom", js_num(base - 0.3)), + ("bottom", js_num(check.bottom)), ("slope", js_num(crate::excavation::DEFAULT_SLOPE)), ])], - ) + )); + // [143] Kategorie „07 Baugrube" anlegen, falls sie fehlt (sonst wäre die Baugrube nirgends sichtbar). + let mut layers = arr(root.get("layers")).to_vec(); + if crate::import_context::ensure_context_categories(&mut layers, [EXCAVATION_CATEGORY]) { + out.push(Op::SetField { key: "layers".into(), value: Some(Value::Array(layers)), at: None }); + } + out } +/// [143] Kategorie neuer Baugruben (wie im Musterhaus komplex): nicht „02 Gelände", das Grundrisse oft ausblenden. +const EXCAVATION_CATEGORY: &str = "07"; + fn terrain_ops(root: &Map, ids: &mut IdGen) -> Vec { let Some(set) = arr(root.get("context")).iter().find(|o| field(o, "type").and_then(Value::as_str) == Some("contourSet")) else { return Vec::new(); @@ -780,7 +887,7 @@ pub fn ops(root: &Map, p: &Project, v: &Value, ctx: &Ctx, ids: &m "solidbool" => solidbool_ops(root, v, ids), "voidbox" => voidbox_ops(v, ctx, ids), "terrain" => terrain_ops(root, ids), - "excavation" => excavation_ops(root, v, ctx, ids), + "excavation" => excavation_ops(root, p, v, ctx, ids), "ceilingOpening" => ceiling_opening_ops(root, v, ctx), "roofHole" => roof_hole_ops(root, v, ctx), "roofWindow" => roof_window_ops(root, p, v, ctx, ids), @@ -816,9 +923,15 @@ pub fn preview(root: &Map, v: &Value, pts: &[V], p: &mut Preview) true } -pub fn query(root: &Map, v: &Value) -> Option { +pub fn query(root: &Map, p: &Project, v: &Value) -> Option { Some(match s_of(v, "q") { "pickSolid" => json!({ "hit": pick_solid(root, s_of(v, "level"), p_of(v, "pt")).and_then(id_of) }), + // [143] Baugrube vor dem Anlegen prüfen (Meldungen im Befehl). + "excavationCheck" => { + let pts = excavation_outline(v); + let c = excavation_check(p, &pts, s_of(v, "level")); + json!({ "valid": !pts.is_empty(), "bottom": js_num(c.bottom), "terrain": c.terrain, "over": c.over, "cut": c.cut, "datum": c.datum.map(js_num) }) + } _ => return None, }) } @@ -901,7 +1014,7 @@ mod tests { /// [68] Baugrube: Umriss (2 Punkte = Rechteck), Sohle = Geschoss − 0.30, als Kontext-Objekt. #[test] fn baugrube_befehl() { - let root = json!({"floors": [{"id": "ug", "baseElevation": -3.0}]}); + let root = json!({"drawingLevels": [{"id": "ug", "name": "UG", "kind": "floor", "visible": true, "locked": false, "baseElevation": -3.0}]}); let root = root.as_object().unwrap(); let run = |pts: Value| { let mut ids = IdGen::new("s"); @@ -916,6 +1029,75 @@ mod tests { assert!(run(json!([{"x": 0, "y": 0}, {"x": 1, "y": 0}, {"x": 2, "y": 0}])).is_empty()); } + /// [143] Im EG gezeichnet: Sohle unter dem tiefsten Geschoss (UG), nicht −0.30 unter dem EG. + #[test] + fn baugrube_sohle_unter_tiefstem_geschoss() { + let root = json!({"drawingLevels": json!([{"id": "eg", "name": "EG", "kind": "floor", "visible": true, "locked": false, "baseElevation": 0.0}, {"id": "ug", "name": "UG", "kind": "floor", "visible": true, "locked": false, "baseElevation": -2.7}, {"id": "og", "name": "OG", "kind": "floor", "visible": true, "locked": false, "baseElevation": 2.9}])}); + let root = root.as_object().unwrap(); + let run = |level: &str| { + let mut ids = IdGen::new("s"); + let ctx = Ctx { level, floor_height: None, cat: "", wall_type: "", text_height: 0.25, symbol: 1.0 }; + let o = ops(root, &crate::model::lenient::typed_for_test(root), &json!({"cmd": "excavation", "pts": [{"x": 0, "y": 0}, {"x": 10, "y": 8}]}), &ctx, &mut ids).unwrap(); + let Op::Add { items, .. } = &o[0] else { panic!() }; + items[0]["bottom"].as_f64().unwrap() + }; + for level in ["eg", "og", "ug"] { + assert!((run(level) - -3.0).abs() < 1e-9, "{level}"); + } + // Ohne Geschosse: ±0.00 − 0.30. + let empty = json!({}); + let mut ids = IdGen::new("s"); + let ctx = Ctx { level: "x", floor_height: None, cat: "", wall_type: "", text_height: 0.25, symbol: 1.0 }; + let o = ops(empty.as_object().unwrap(), &crate::model::lenient::typed_for_test(empty.as_object().unwrap()), &json!({"cmd": "excavation", "pts": [{"x": 0, "y": 0}, {"x": 10, "y": 8}]}), &ctx, &mut ids).unwrap(); + let Op::Add { items, .. } = &o[0] else { panic!() }; + assert_eq!(items[0]["bottom"].as_f64(), Some(-0.3)); + } + + /// [143] Prüfung: ohne Gelände, ausserhalb, nur Aufschüttung, Gelände in m ü. M. ohne Höhenbezug + /// (derselbe Schritt setzt ±0.00 auf die Geländehöhe im Umriss). + #[test] + fn baugrube_pruefung_und_hoehenbezug() { + let tri = |z: f64| json!({"type": "terrainMesh", "id": "t", "positions": [0, 0, z, 40, 0, z, 40, 40, z + 4.0, 0, 40, z + 4.0], "indices": [0, 1, 2, 0, 2, 3]}); + let rect = json!([{"x": 10, "y": 10}, {"x": 20, "y": 18}]); + let check = |root: &Value, pts: &Value| { + let r = root.as_object().unwrap(); + query(r, &crate::model::lenient::typed_for_test(r), &json!({"q": "excavationCheck", "pts": pts, "level": "eg"})).unwrap() + }; + let floors = json!([{"id": "eg", "name": "EG", "kind": "floor", "visible": true, "locked": false, "baseElevation": 0.0}, {"id": "ug", "name": "UG", "kind": "floor", "visible": true, "locked": false, "baseElevation": -2.7}, {"id": "og", "name": "OG", "kind": "floor", "visible": true, "locked": false, "baseElevation": 2.9}]); + // Kein Gelände. + let c = check(&json!({"drawingLevels": floors}), &rect); + assert_eq!((c["valid"].as_bool(), c["terrain"].as_bool(), c["over"].as_bool(), c["bottom"].as_f64()), (Some(true), Some(false), Some(false), Some(-3.0))); + // Gelände um ±0.00: Grube, kein neuer Bezug. + let c = check(&json!({"drawingLevels": floors, "context": [tri(0.0)]}), &rect); + assert_eq!((c["over"].as_bool(), c["cut"].as_bool(), c["datum"].is_null()), (Some(true), Some(true), true)); + // Ausserhalb des Geländes. + let c = check(&json!({"drawingLevels": floors, "context": [tri(0.0)]}), &json!([{"x": 100, "y": 100}, {"x": 110, "y": 108}])); + assert_eq!((c["terrain"].as_bool(), c["over"].as_bool()), (Some(true), Some(false))); + // Gelände tief unter der Sohle: nur Aufschüttung. + let c = check(&json!({"drawingLevels": floors, "context": [tri(-10.0)]}), &rect); + assert_eq!((c["over"].as_bool(), c["cut"].as_bool()), (Some(true), Some(false))); + // Gelände in m ü. M., kein Bezug: ±0.00 = Höhe im Schwerpunkt (512 + 4·14/40 = 513.40). + let root = json!({"drawingLevels": floors, "context": [tri(512.0)]}); + let c = check(&root, &rect); + assert_eq!((c["cut"].as_bool(), c["datum"].as_f64()), (Some(true), Some(513.4))); + let r = root.as_object().unwrap(); + let mut ids = IdGen::new("s"); + let ctx = Ctx { level: "eg", floor_height: None, cat: "", wall_type: "", text_height: 0.25, symbol: 1.0 }; + let o = ops(r, &crate::model::lenient::typed_for_test(r), &json!({"cmd": "excavation", "pts": rect}), &ctx, &mut ids).unwrap(); + assert!(matches!(&o[0], Op::SetField { key, value: Some(v), .. } if key == "referenceElevationMasl" && v.as_f64() == Some(513.4))); + assert!(matches!(&o[1], Op::Add { collection, items, .. } if collection == "context" && items[0]["categoryCode"] == "07")); + // Kategorie „07 Baugrube" unter „05 Kontext" ergänzt; vorhanden → keine Op. + assert!(matches!(&o[2], Op::SetField { key, value: Some(v), .. } if key == "layers" && v.to_string().contains("\"07\""))); + let r2 = json!({"layers": [{"code": "07", "name": "Grube", "color": "#000", "lw": 0.1, "visible": true, "locked": false}]}); + let r2 = r2.as_object().unwrap(); + let o2 = ops(r2, &crate::model::lenient::typed_for_test(r2), &json!({"cmd": "excavation", "pts": rect}), &ctx, &mut ids).unwrap(); + assert_eq!(o2.len(), 1); + // Mit gesetztem Bezug: kein neuer. + let c = check(&json!({"drawingLevels": floors, "referenceElevationMasl": 512.5, "context": [tri(512.0)]}), &rect); + assert!(c["datum"].is_null()); + assert_eq!(c["cut"].as_bool(), Some(true)); + } + #[test] fn gelaende_aus_hoehenlinien() { let c = json!([{"z": 1, "pts": [{"x": 0, "y": 0}, {"x": 4, "y": 0}]}, {"z": 2, "pts": [{"x": 0, "y": 3}, {"x": 4, "y": 3}]}]); diff --git a/src-tauri/core/src/import_context.rs b/src-tauri/core/src/import_context.rs index 454c85bf..49c684ed 100644 --- a/src-tauri/core/src/import_context.rs +++ b/src-tauri/core/src/import_context.rs @@ -30,7 +30,7 @@ const CONTEXT_PARENT: Def = Def { code: "05", name: "Kontext", color: "#707078", /// „31 Dächer" bleibt oberste Ebene. const IMPORTED_ROOF: Def = Def { code: "31", name: "Dächer", color: "#4a4a4a", lw: 0.18 }; /// Kinder von „05 Kontext", in dieser Reihenfolge (`NESTED_CONTEXT_CATEGORIES`). -const NESTED: [Def; 10] = [ +const NESTED: [Def; 11] = [ Def { code: "02", name: "Gelände", color: "#808080", lw: 0.13 }, Def { code: "03", name: "Luftbild", color: "#707078", lw: 0.13 }, Def { code: "10", name: "Situation", color: "#909090", lw: 0.18 }, @@ -41,6 +41,8 @@ const NESTED: [Def; 10] = [ Def { code: "16", name: "Bahn", color: "#606060", lw: 0.18 }, Def { code: "17", name: "Gewässer", color: "#909090", lw: 0.13 }, Def { code: "18", name: "Grünflächen", color: "#a0a0a0", lw: 0.13 }, + // [143] Baugruben eigene Kategorie: Grundrisse blenden „02 Gelände" oft aus, die Baugrube soll bleiben. + Def { code: "07", name: "Baugrube", color: "#4a4a4a", lw: 0.18 }, ]; fn category(d: &Def) -> Value { diff --git a/src/commands/cmds/excavation.test.ts b/src/commands/cmds/excavation.test.ts new file mode 100644 index 00000000..98ebd65d --- /dev/null +++ b/src/commands/cmds/excavation.test.ts @@ -0,0 +1,133 @@ +// [143] Baugrube erstellen: Voraussetzung Gelände, Anlegen im Musterhaus komplex (Sohle unter dem UG, Kategorie +// „07 Baugrube", sichtbar im Grundriss), Hinweise statt stillem Scheitern, Engine meldet blockierte Befehle. +import { describe, expect, it } from "vitest"; +import { buildComplexSampleProject } from "../../model/sampleProjectComplex"; +import { sampleProject } from "../../model/sampleProject"; +import type { Project } from "../../model/types"; +import { CommandEngine, type EngineHost } from "../engine"; +import type { Command, CommandContext, CommandResult, CmdInput } from "../types"; +import { excavationCommand } from "./excavation"; +import { terrainCommand } from "./terrain"; +import { flattenCategories } from "../../model/layers"; + +const complex = buildComplexSampleProject(); + +function ctxOf(p: Project, levelId?: string): CommandContext { + const level = p.drawingLevels.find((l) => (levelId ? l.id === levelId : l.kind === "floor"))!; + return { + project: p, + level, + defaultCategoryCode: p.layers[0].code, + activeLineStyleId: "solid", + activeWallTypeId: p.wallTypes[0]?.id ?? "", + lastPoint: null, + selection: { wallIds: [], drawingId: null, drawingIds: [] } as unknown as CommandContext["selection"], + }; +} + +/** Umriss klicken und mit Enter abschliessen; liefert das letzte Ergebnis. */ +function draw(cmd: Command, ctx: CommandContext, pts: [number, number][]): CommandResult { + let st = cmd.init(); + for (const [x, y] of pts) st = cmd.onInput(st, { kind: "point", point: { x, y } } as CmdInput, ctx)[0]; + return cmd.onConfirm(st, ctx)[1]; +} + +const excavations = (p: Project) => (p.context ?? []).filter((o) => o.type === "excavation"); + +describe("[143] Baugrube erstellen", () => { + it("ohne Gelände startet der Befehl nicht (Hinweis)", () => { + expect(excavationCommand.precondition?.(ctxOf(sampleProject))).toBe("cmd.excavation.noTerrain"); + expect(excavationCommand.precondition?.(ctxOf(complex, "eg"))).toBeNull(); + }); + + it("Musterhaus komplex, im EG gezeichnet: Sohle unter dem UG, Kategorie 07, Hinweis", () => { + const ctx = ctxOf(complex, "eg"); + const res = draw(excavationCommand, ctx, [ + [-25, -10], + [-12, -10], + [-12, 0], + [-25, 0], + ]); + expect(res.done).toBe(true); + expect(res.commit).toBeDefined(); + expect(res.notice?.key).toMatch(/^cmd\.excavation\.(created|fillOnly)$/); + const out = res.commit!(complex); + const added = excavations(out).filter((e) => !excavations(complex).some((o) => o.id === e.id)); + expect(added).toHaveLength(1); + const ug = complex.drawingLevels.find((l) => l.id === "ug")!; + expect(added[0]).toMatchObject({ categoryCode: "07", bottom: expect.closeTo((ug.baseElevation ?? 0) - 0.3, 6) }); + // Kategorie existiert (im Musterhaus schon vorhanden) und ist sichtbar. + expect(flattenCategories(out.layers).find((c) => c.code === "07")?.visible).toBe(true); + }); + + it("2 Punkte = Rechteck; ausserhalb des Geländes / entartet: nichts, mit Hinweis", () => { + const ctx = ctxOf(complex, "eg"); + const rect = draw(excavationCommand, ctx, [ + [-25, -10], + [-12, 0], + ]); + expect(rect.commit).toBeDefined(); + const far = draw(excavationCommand, ctx, [ + [5000, 5000], + [5010, 5010], + ]); + expect(far.commit).toBeUndefined(); + expect(far.notice?.key).toBe("cmd.excavation.outside"); + const flat = draw(excavationCommand, ctx, [ + [0, 0], + [5, 0], + [10, 0], + ]); + expect(flat.commit).toBeUndefined(); + expect(flat.notice?.key).toBe("cmd.excavation.degenerate"); + }); + + it("neues Projekt ohne Kategorie 07: der Befehl legt sie sichtbar an", () => { + const p: Project = { + ...complex, + layers: complex.layers.map((l) => ({ ...l, children: l.children?.filter((c) => c.code !== "07") })).filter((l) => l.code !== "07"), + }; + expect(flattenCategories(p.layers).some((c) => c.code === "07")).toBe(false); + const res = draw(excavationCommand, ctxOf(p, "eg"), [ + [-25, -10], + [-12, 0], + ]); + const out = res.commit!(p); + expect(flattenCategories(out.layers).find((c) => c.code === "07")).toMatchObject({ name: "Baugrube", visible: true }); + }); + + it("Gelände-Befehl: ohne Höhenlinien sofort fertig mit Hinweis (schluckt keine Eingaben)", () => { + const res = terrainCommand.autoRun!(ctxOf({ ...sampleProject, context: [] })); + expect(res.done).toBe(true); + expect(res.commit).toBeUndefined(); + expect(res.notice?.key).toBe("cmd.terrain.noContours"); + }); + + it("Engine: blockierte Befehle melden sich (Voraussetzung, kein Geschoss), Hinweise aus Ergebnissen", () => { + const notes: string[] = []; + let floor = true; + let project: Project = sampleProject; + const host: EngineHost = { + context: (lastPoint) => ({ ...ctxOf(project), lastPoint }), + snap: () => null, + pxPerMeter: () => 50, + setDraft: () => {}, + commit: () => {}, + isFloor: () => floor, + notify: (key) => void notes.push(key), + }; + const engine = new CommandEngine(host); + expect(engine.start("baugrube")).toBe(false); + expect(notes).toEqual(["cmd.excavation.noTerrain"]); + floor = false; + expect(engine.start("excavation")).toBe(false); + expect(notes.at(-1)).toBe("cmd.needsFloor"); + floor = true; + project = complex; + expect(engine.start("excavation")).toBe(true); + for (const pt of [{ x: 5000, y: 5000 }, { x: 5010, y: 5010 }]) engine.pick(pt); + engine.confirm(); + expect(engine.isActive()).toBe(false); + expect(notes.at(-1)).toBe("cmd.excavation.outside"); + }); +}); diff --git a/src/commands/cmds/excavation.ts b/src/commands/cmds/excavation.ts index 9460fbc1..13ddb017 100644 --- a/src/commands/cmds/excavation.ts +++ b/src/commands/cmds/excavation.ts @@ -7,8 +7,12 @@ // 2) „Nächster Punkt …" → Punkt … Schliessen per Klick auf den Startpunkt, Option „Schliessen" oder // Enter (≥ 3 Punkte; bei genau 2 Punkten: Rechteck aus den Ecken). +// +// [143] Meldungen statt stillem Scheitern: ohne Gelände startet der Befehl nicht; ausserhalb des Geländes +// oder entartet entsteht nichts (Hinweis); sonst Hinweis mit Sohle (und neuem Höhenbezug ±0.00, s. Kern). + import type { Command, CommandContext, CommandResult, CommandState, CmdOption, DraftShape, ToolDraft, Vec2 } from "../types"; -import { createMutation } from "../createCore"; +import { createMutation, createQuery } from "../createCore"; const EPS = 1e-6; const CLOSE_HIT = 0.08; // Modell-Meter: Klick nahe Startpunkt schliesst die Kontur @@ -46,9 +50,40 @@ const excavationOps = (points: Vec2[], ctx: CommandContext) => createMutation(ct const idle = (): [CommandState, CommandResult] => [{ phase: "start", lastPoint: null } as HoleIdle, { draft: null, done: true }]; +/** Prüfung des Kerns vor dem Anlegen (`cmd_solid.rs`, `excavationCheck`). */ +interface ExcavationCheck { + valid: boolean; + bottom: number; + terrain: boolean; + over: boolean; + cut: boolean; + datum: number | null; +} + +const hasTerrain = (ctx: CommandContext): boolean => (ctx.project.context ?? []).some((o) => o.type === "terrainMesh"); + +/** Sohle als Kote (−3.00). */ +const kote = (z: number): string => (z > 0 ? "+" : z < 0 ? "−" : "±") + Math.abs(z).toFixed(2); + +/** Baugrube anlegen oder sagen, warum nicht. */ +function finishResult(points: Vec2[], ctx: CommandContext): CommandResult { + const c = createQuery(ctx.project, { q: "excavationCheck", pts: points, level: ctx.level.id }); + if (!c.valid) return { draft: null, done: true, notice: { key: "cmd.excavation.degenerate", kind: "warning" } }; + if (!c.terrain) return { draft: null, done: true, notice: { key: "cmd.excavation.noTerrain", kind: "warning" } }; + if (!c.over) return { draft: null, done: true, notice: { key: "cmd.excavation.outside", kind: "warning" } }; + const bottom = kote(c.bottom); + const notice: CommandResult["notice"] = + c.datum != null + ? { key: "cmd.excavation.createdDatum", params: { bottom, datum: c.datum.toFixed(2) }, kind: "info" } + : c.cut + ? { key: "cmd.excavation.created", params: { bottom }, kind: "info" } + : { key: "cmd.excavation.fillOnly", params: { bottom }, kind: "warning" }; + return { draft: null, done: true, commit: excavationOps(points, ctx), notice }; +} + const finish = (points: Vec2[], ctx: CommandContext): [CommandState, CommandResult] => [ { phase: "start", lastPoint: null } as HoleIdle, - { draft: null, done: true, commit: excavationOps(points, ctx) }, + finishResult(points, ctx), ]; export const excavationCommand: Command = { @@ -62,6 +97,8 @@ export const excavationCommand: Command = { if (ps.phase !== "next") return []; return ps.points.length >= 3 ? [CLOSE, UNDO] : [UNDO]; }, + // [143] Ohne Gelände gibt es nichts auszuheben (das Panel zeigt den Knopf erst mit Gelände). + precondition: (ctx) => (hasTerrain(ctx) ? null : "cmd.excavation.noTerrain"), init: (): HoleIdle => ({ phase: "start", lastPoint: null }), onInput: (state, input, ctx): [CommandState, CommandResult] => { diff --git a/src/commands/cmds/terrain.ts b/src/commands/cmds/terrain.ts index d6deac39..44a62076 100644 --- a/src/commands/cmds/terrain.ts +++ b/src/commands/cmds/terrain.ts @@ -22,6 +22,15 @@ const commitDone = (ctx: CommandContext): CommandResult => ({ draft: null, done: const IDLE: CommandState = { phase: "idle", lastPoint: null }; +/** + * [143] Sofort ausführen (vorher wartete der Befehl auf eine Eingabe und schluckte die nächsten getippten + * Befehle); ohne Höhenlinien ein Hinweis statt stillem Nichts. + */ +const run = (ctx: CommandContext): CommandResult => + (ctx.project.context ?? []).some((o) => o.type === "contourSet") + ? commitDone(ctx) + : { draft: null, done: true, notice: { key: "cmd.terrain.noContours", kind: "warning" } }; + export const terrainCommand: Command = { name: "terrain", labelKey: "cmd.terrain.label", @@ -30,6 +39,7 @@ export const terrainCommand: Command = { accepts: () => [], options: () => [], init: () => ({ ...IDLE }), + autoRun: run, // Jeglicher Input beendet den Befehl mit dem Commit (es gibt keine Schritte). onInput: (_s, _i, ctx): [CommandState, CommandResult] => [{ ...IDLE }, commitDone(ctx)], diff --git a/src/commands/engine.ts b/src/commands/engine.ts index 22202d22..3d978c7c 100644 --- a/src/commands/engine.ts +++ b/src/commands/engine.ts @@ -67,7 +67,7 @@ export interface EngineHost { */ inputUnits?(): DisplayUnits; /** Optional: Hinweis zeigen (i18n-Key), z. B. „erst Objekte wählen" (`Command.needsSelection`). */ - notify?(key: string): void; + notify?(key: string, params?: Record, kind?: "info" | "warning" | "error"): void; } /** Öffentlicher Schnappschuss für die Command-Line-UI (rein lesend). */ @@ -323,7 +323,16 @@ export class CommandEngine { /** Startet einen konkreten Befehl (z. B. zur Wiederholung). */ startCommand(cmd: Command): boolean { - if (cmd.floorOnly && !this.host.isFloor()) return false; + if (cmd.floorOnly && !this.host.isFloor()) { + // [143] Nicht still scheitern (Schnitt/Ansicht/Blatt aktiv). + this.host.notify?.("cmd.needsFloor", undefined, "info"); + return false; + } + const blocked = cmd.precondition?.(this.host.context(null)); + if (blocked) { + this.host.notify?.(blocked, undefined, "warning"); + return false; + } if (cmd.needsSelection && !hasTransformSelection(this.host.context(null).selection)) { this.host.notify?.(cmd.needsSelection); return false; @@ -624,6 +633,7 @@ export class CommandEngine { private applyResult(res: CommandResult): void { if (res.commit) this.host.commit(res.commit); if (res.focusDrawingId) this.host.focusDrawing?.(res.focusDrawingId, res.focusMinHeightM); + if (res.notice) this.host.notify?.(res.notice.key, res.notice.params, res.notice.kind ?? "info"); if (res.draft) this.host.setDraft(res.draft); else this.host.setDraft(null); if (res.done) { diff --git a/src/commands/types.ts b/src/commands/types.ts index 979c5fb9..b3c0c360 100644 --- a/src/commands/types.ts +++ b/src/commands/types.ts @@ -137,6 +137,18 @@ export interface CommandResult { * sie, bestimmt allein der Inhalt die Höhe (Text-Werkzeug ohne Rahmen). */ focusMinHeightM?: number; + /** + * [143] Hinweis an den Nutzer (Toast über `EngineHost.notify`), z. B. warum nichts entstand oder was + * angenommen wurde. Ohne ihn scheitern Befehle still. + */ + notice?: CommandNotice; +} + +/** [143] Hinweis eines Befehls: i18n-Key, Platzhalter, Art. */ +export interface CommandNotice { + key: TranslationKey; + params?: Record; + kind?: "info" | "warning" | "error"; } // ── Befehls-Zustand ────────────────────────────────────────────────────────── @@ -193,6 +205,11 @@ export interface Command { * Befehl nicht, die Engine meldet diesen Hinweis über `EngineHost.notify`. */ needsSelection?: TranslationKey; + /** + * [143] Voraussetzung (optional): liefert einen Hinweis-Key, wenn der Befehl jetzt nicht sinnvoll ist + * (z. B. Baugrube ohne Gelände); die Engine startet ihn dann nicht und meldet den Hinweis. + */ + precondition?(ctx: CommandContext): TranslationKey | null; /** Initialer Schritt-Zustand. */ init(): CommandState; /** Eine Eingabe (Punkt/Zahl/Option/Auswahl) verarbeiten. */ diff --git a/src/i18n/de.ts b/src/i18n/de.ts index f44ad867..519996b6 100644 --- a/src/i18n/de.ts +++ b/src/i18n/de.ts @@ -1682,6 +1682,14 @@ export const de = { "cmd.ceilingOpening.start": "Erste Ecke der Aussparung (in einer Decke):", "cmd.ceilingOpening.corner": "Gegenecke:", "cmd.roofHole.label": "Dachhof", + "cmd.needsFloor": "Dieser Befehl zeichnet im Grundriss: zuerst ein Geschoss wählen", + "cmd.excavation.noTerrain": "Baugrube braucht ein Gelände: zuerst Höhenlinien importieren und „Gelände erzeugen“ (Panel Gelände) oder den Standort importieren", + "cmd.excavation.outside": "Keine Baugrube: der Umriss liegt ausserhalb des Geländes", + "cmd.excavation.degenerate": "Keine Baugrube: der Umriss hat keine Fläche", + "cmd.excavation.created": "Baugrube angelegt: Sohle {bottom} m (tiefstes Geschoss − 0.30), Böschung 45° — anpassen in der Objekt-Info", + "cmd.excavation.createdDatum": "Baugrube angelegt: Sohle {bottom} m; das Gelände liegt in m ü. M., ±0.00 = {datum} m ü. M. angenommen (Einstellungen)", + "cmd.excavation.fillOnly": "Baugrube angelegt, aber die Sohle {bottom} m liegt über dem Gelände: nur Aufschüttung — Sohle in der Objekt-Info tiefer setzen", + "cmd.terrain.noContours": "Kein Gelände erzeugt: es gibt keine Höhenlinien (DXF importieren oder Standort importieren)", "cmd.excavation.label": "Baugrube", "cmd.excavation.start": "Erster Punkt der Baugrubensohle:", "cmd.excavation.next": "Nächster Punkt (Enter bei 2 Punkten = Rechteck, ab 3 Punkten Polygon):", diff --git a/src/i18n/en.ts b/src/i18n/en.ts index 536b9f4a..c9cd4b2f 100644 --- a/src/i18n/en.ts +++ b/src/i18n/en.ts @@ -1671,6 +1671,14 @@ export const en: Record = { "cmd.ceilingOpening.start": "First corner of the opening (inside a slab):", "cmd.ceilingOpening.corner": "Opposite corner:", "cmd.roofHole.label": "Roof court", + "cmd.needsFloor": "This command draws in plan view: select a storey first", + "cmd.excavation.noTerrain": "An excavation needs terrain: import contour lines and “Generate terrain” (Terrain panel) or import the site first", + "cmd.excavation.outside": "No excavation: the outline lies outside the terrain", + "cmd.excavation.degenerate": "No excavation: the outline has no area", + "cmd.excavation.created": "Excavation created: bottom {bottom} m (lowest storey − 0.30), slope 45° — adjust in Object Info", + "cmd.excavation.createdDatum": "Excavation created: bottom {bottom} m; the terrain is in m a.s.l., ±0.00 = {datum} m a.s.l. assumed (Settings)", + "cmd.excavation.fillOnly": "Excavation created, but its bottom {bottom} m lies above the terrain: fill only — lower the bottom in Object Info", + "cmd.terrain.noContours": "No terrain generated: there are no contour lines (import a DXF or the site)", "cmd.excavation.label": "Excavation", "cmd.excavation.start": "First point of the excavation bottom:", "cmd.excavation.next": "Next point (Enter with 2 points = rectangle, 3 or more = polygon):", diff --git a/src/model/contextCategories.ts b/src/model/contextCategories.ts index b430686b..e3d2f4e7 100644 --- a/src/model/contextCategories.ts +++ b/src/model/contextCategories.ts @@ -57,6 +57,17 @@ export const TERRAIN_CATEGORY: ContextCategoryDef = { lw: 0.13, }; +/** + * [143] Baugrube (`excavation`): eigene Kategorie statt „02 Gelände" — Grundrisse blenden das Gelände oft aus, + * eine neu gezeichnete Baugrube war dort unsichtbar („lässt sich nicht erstellen"). + */ +export const EXCAVATION_CATEGORY: ContextCategoryDef = { + code: "07", + name: "Baugrube", + color: "#4a4a4a", + lw: 0.18, +}; + /** Georeferenziertes Luftbild (SWISSIMAGE/eingefügtes Bild). */ export const IMAGE_CATEGORY: ContextCategoryDef = { code: "03", diff --git a/src/state/useCommandEngineHost.ts b/src/state/useCommandEngineHost.ts index 2f967d7b..f1558e3b 100644 --- a/src/state/useCommandEngineHost.ts +++ b/src/state/useCommandEngineHost.ts @@ -169,7 +169,7 @@ export function useCommandEngineHost(opts: { }, isFloor: () => cmdLatest.current.activeLevel.kind === "floor", // Befehl braucht eine Auswahl (Bewegen/Drehen/Spiegeln), es ist keine da. - notify: (key) => notify(t(key as Parameters[0]), "info"), + notify: (key, params, kind) => notify(t(key as Parameters[0], params), kind ?? "info"), // Getippte Werte auf einem Layout-Blatt in Papier-mm, y nach unten ([93]). inputUnits: () => unitsForLevel(cmdLatest.current.activeLevel), // Frisch über `text`/`textbox` erzeugtes Element sofort inline editieren