[187] Griffe im Schnitt/in der Ansicht, Teil 2: Dach (Traufe, First/Neigung, Attika), Treppe (Austritt), Gelände (Netz, Baugrube-Sohle)
This commit is contained in:
14 files changed
+403
-27
No files matched your search
@@ -109,7 +109,8 @@ Wer zu einer ID mehr wissen will (Entscheide, Tests, Bilder), sucht dort nach `*
|
||||
nicht in der Tauri-App geprüft. · S
|
||||
- ○ **[189]** Panels neu ordnen + Einstellungsdialog (12.11., Maintainer): Attribute-Panel unten links nur Gestaltung (Stift, Füllung, Linienstil, Schraffur); BIM-/Bauteil-Infos (Typ, Schichten, Masse, Kennwerte, IFC/Psets, Material …) in die Objekt-Info. Taste T bei Auswahl öffnet direkt den Einstellungsdialog des Objekts (wie Archicad Cmd+T), v. a. für Fenster/Türen, deren Einstellungen heute nur über das Attribute-Panel erreichbar sind. · M
|
||||
- ◐ **[187]** Griffe im Schnitt/in der Ansicht (12.11., Maintainer): angewählte Elemente haben dort kaum Fasspunkte (Decken, Gelände, Dächer …). Wie Archicad: Decke OK/UK (Höhe/Dicke), Wand OK (Höhe), Öffnung Brüstung/Sturz, Dach Traufe/First bzw. Neigung, Treppe An-/Austritt, Gelände-Profilpunkte (falls Modell es erlaubt); ein Undo-Schritt je Zug, Fang + Tab-Eingabe wie im Grundriss. · L
|
||||
Teil 1 (12.11.): Höhen-Griffe im Schnitt/in der Ansicht für Decke (OK = Höhenlage über die `top`-Bindung, bei gebundener UK ändert sie die Dicke; UK = Dicke über den Deckentyp wie in der Objekt-Info bzw. UK-Bindung), Wand (OK, neu UK mit festgehaltener OK) und Öffnung (Brüstung, Sturz). Rechnung im Kern (`sheet_height.rs`, Griff-Anfrage `sheetHeight`, ein Undo-Schritt je Zug, Mindestmasse, gesperrte Bauteile ohne Griffe), Fang auf Geschoss-Koten (8 px) und Geometrie des Schnitts, Tab tippt die Kote (absolutes Z), Zug-Anzeige „Kote · Höhe". Offen (Teil 2): Dach (Traufe/First bzw. Neigung), Treppe (An-/Austritt), Gelände-Profilpunkte; Wand-UK-Griff ändert nur die Bindung `bottom` (Verbund mit Nachbarwänden/Geschosswechsel nicht bedacht); nicht in der Tauri-App geprüft. · L
|
||||
Teil 1 (12.11.): Höhen-Griffe im Schnitt/in der Ansicht für Decke (OK = Höhenlage über die `top`-Bindung, bei gebundener UK ändert sie die Dicke; UK = Dicke über den Deckentyp wie in der Objekt-Info bzw. UK-Bindung), Wand (OK, neu UK mit festgehaltener OK) und Öffnung (Brüstung, Sturz). Rechnung im Kern (`sheet_height.rs`, Griff-Anfrage `sheetHeight`, ein Undo-Schritt je Zug, Mindestmasse, gesperrte Bauteile ohne Griffe), Fang auf Geschoss-Koten (8 px) und Geometrie des Schnitts, Tab tippt die Kote (absolutes Z), Zug-Anzeige „Kote · Höhe". Wand-UK-Griff ändert nur die Bindung `bottom` (Verbund mit Nachbarwänden nicht bedacht). · L
|
||||
Teil 2 (12.11.): Griffe für Dach (Traufe = `baseElevation`, das ganze Dach wandert; First = Neigung wird aus Firsthöhe und Spannweite gerechnet, Sekantenverfahren auf `roof_ridge_height`; Flachdach: Attika-Höhe `parapetHeight`), Treppe (Austritt = `totalRise`) und Gelände (Netz/importiertes Netz: alle z um die Differenz; Baugrube: Sohle) im Schnitt/in der Ansicht — Kern `sheet_height.rs` (`roofEave`, `roofTop`, `parapetTop`, `stairTop`, `contextTop`/`contextBottom`, `contourLine`), Griff sitzt an der sichtbaren Kante des Schnitts, der Kern zählt den Zug relativ zur Griffhöhe (`b`); Wand-UK unter der Geschoss-Basis (Kellerwand) war schon erlaubt, über der OK hält die Mindesthöhe 0.30 m und das HUD weist darauf hin. Offen: Treppen-Antritt (Modell hat keinen Versatz, Antritt = Geschoss-Basis); Höhenlinien-Sätze zeichnet der Schnitt nicht, daher kein Griff (der Kern kann `contourLine` Höhe je Linie, aber ohne UI); bei Dächern mit `edgePitchDeg` ändert der First-Griff nur die Hauptneigung; nicht in der Tauri-App geprüft. · L
|
||||
(Navigator, Kürzel, Ebenen-Panel) behält Zoom und Ausschnitt exakt — Geschosse teilen sich den Einpass-Schlüssel
|
||||
(`viewTabs.ts::planFitKey`, `PlanView` `fitKey`; Schnitt/Ansicht/Zeichnung/neues Projekt passen weiter ein).
|
||||
Cmd/Ctrl+5 Geschoss tiefer, Cmd/Ctrl+6 höher im Grundriss- und 3D-Reiter (`stepFloor`/`adjacentFloorId`, nach
|
||||
|
||||
@@ -54,7 +54,7 @@ async function undo(page: Page) {
|
||||
async function select(page: Page, patch: Record<string, string[]>) {
|
||||
await blurFocus(page);
|
||||
// setSelection mischt: die anderen Arten leeren, sonst bleibt z. B. das Fenster gewählt
|
||||
await page.evaluate((p) => window.__dossierTest!.select({ walls: [], openings: [], ceilings: [], ...p }), patch);
|
||||
await page.evaluate((p) => window.__dossierTest!.select({ walls: [], openings: [], ceilings: [], roofs: [], stairs: [], contextObjects: [], ...p }), patch);
|
||||
}
|
||||
|
||||
test("Schnitt A-A: Decke, Fenster und Wand haben Höhen-Griffe, Zug = ein Undo-Schritt", async ({ page }) => {
|
||||
@@ -167,3 +167,74 @@ test("Schnitt A-A: Tab tippt die Kote der Decken-Oberkante", async ({ page }) =>
|
||||
await undo(page);
|
||||
await expect.poll(async () => (await ceiling(page, "c-eg")).zTop).toBe(c0.zTop);
|
||||
});
|
||||
|
||||
// [187] Teil 2: Dach (Traufe, First), Treppe (Austritt) und Gelände (Sohle der Baugrube) im Schnitt.
|
||||
async function openSheet(page: Page, name: string) {
|
||||
await page.goto("/?dossierTest");
|
||||
await page.getByRole("button", { name: /Neues Projekt/ }).first().click();
|
||||
await expect(page.getByRole("group", { name: "Befehlszeile" })).toBeVisible();
|
||||
await fileMenu(page, /Musterhaus \(komplex\)/);
|
||||
await discardIfAsked(page);
|
||||
await expect(page.locator(".project-name")).toHaveText("Musterhaus komplex", { timeout: 30_000 });
|
||||
await showSnapshot(page, name);
|
||||
await expect(page.locator("svg.plan-svg").first()).toBeVisible({ timeout: 30_000 });
|
||||
await page.waitForTimeout(1000);
|
||||
}
|
||||
const roofOf = async (page: Page, id: string) => (await heights(page)).roofs.find((r) => r.id === id)!;
|
||||
|
||||
test("Schnitt A-A: Dach-Traufe und First ziehen, Zug = ein Undo-Schritt", async ({ page }) => {
|
||||
test.setTimeout(180_000);
|
||||
await openSheet(page, "Schnitt A-A");
|
||||
const r0 = await roofOf(page, "dach-haupt");
|
||||
await select(page, { roofs: ["dach-haupt"] });
|
||||
await expect(page.locator(".plan-grip")).toHaveCount(2);
|
||||
const [eave, ridge] = await gripCentres(page);
|
||||
expect(eave.x).toBeLessThan(ridge.x);
|
||||
|
||||
// Traufe nach oben: das ganze Dach wandert, die Neigung bleibt.
|
||||
await dragGrip(page, eave, -30);
|
||||
const r1 = await roofOf(page, "dach-haupt");
|
||||
expect(r1.eave).toBeGreaterThan(r0.eave + 0.05);
|
||||
expect(r1.pitchDeg).toBe(r0.pitchDeg);
|
||||
await undo(page);
|
||||
await expect.poll(async () => (await roofOf(page, "dach-haupt")).eave).toBe(r0.eave);
|
||||
|
||||
// First nach oben: die Neigung wächst, die Traufe bleibt.
|
||||
await select(page, { roofs: ["dach-haupt"] });
|
||||
await expect(page.locator(".plan-grip")).toHaveCount(2);
|
||||
const [, ridge2] = await gripCentres(page);
|
||||
await dragGrip(page, ridge2, -30);
|
||||
const r2 = await roofOf(page, "dach-haupt");
|
||||
expect(r2.pitchDeg).toBeGreaterThan(r0.pitchDeg + 0.5);
|
||||
expect(r2.eave).toBe(r0.eave);
|
||||
await undo(page);
|
||||
await expect.poll(async () => (await roofOf(page, "dach-haupt")).pitchDeg).toBe(r0.pitchDeg);
|
||||
});
|
||||
|
||||
test("Schnitt B-B: Treppen-Austritt ziehen", async ({ page }) => {
|
||||
test.setTimeout(180_000);
|
||||
await openSheet(page, "Schnitt B-B");
|
||||
const stair = async () => (await heights(page)).stairs.find((s) => s.id === "tr-kern")!;
|
||||
const s0 = await stair();
|
||||
await select(page, { stairs: ["tr-kern"] });
|
||||
await expect(page.locator(".plan-grip")).toHaveCount(1);
|
||||
const [g] = await gripCentres(page);
|
||||
await dragGrip(page, g, -30);
|
||||
expect((await stair()).totalRise).toBeGreaterThan(s0.totalRise + 0.02);
|
||||
await undo(page);
|
||||
await expect.poll(async () => (await stair()).totalRise).toBe(s0.totalRise);
|
||||
});
|
||||
|
||||
test("Schnitt A-A: Sohle der Baugrube ziehen", async ({ page }) => {
|
||||
test.setTimeout(180_000);
|
||||
await openSheet(page, "Schnitt A-A");
|
||||
const pit = async () => (await heights(page)).excavations.find((e) => e.id === "baugrube")!;
|
||||
const b0 = await pit();
|
||||
await select(page, { contextObjects: ["baugrube"] });
|
||||
await expect(page.locator(".plan-grip")).toHaveCount(1);
|
||||
const [g] = await gripCentres(page);
|
||||
await dragGrip(page, g, 30);
|
||||
expect((await pit()).bottom).toBeLessThan(b0.bottom - 0.05);
|
||||
await undo(page);
|
||||
await expect.poll(async () => (await pit()).bottom).toBe(b0.bottom);
|
||||
});
|
||||
@@ -473,8 +473,8 @@ pub fn run(lk: &Lookup, req: &Request) -> Result<GripResult, String> {
|
||||
vec![replace("drawings2d", with_geom(d, with_all(g, fields)))].into()
|
||||
}
|
||||
// [187] Höhen-Griff im Schnitt/in der Ansicht: `kind` = wallTop | wallBottom | openingTop | openingBottom |
|
||||
// ceilingTop | ceilingBottom, `a` = Blatt-Höhe (absolutes Z), `free` ohne 1-cm-Raster (`sheet_height.rs`).
|
||||
"sheetHeight" => crate::sheet_height::ops(lk, r.s("kind").unwrap_or(""), r.s("id").unwrap_or(""), r.n("a"), r.free, r.s("newId").unwrap_or(""), &req.new_name).into(),
|
||||
// ceilingTop | ceilingBottom | roofEave | roofTop | parapetTop | stairTop | contextTop | contourLine, `a` = Blatt-Höhe (absolutes Z), `free` ohne 1-cm-Raster (`sheet_height.rs`).
|
||||
"sheetHeight" => crate::sheet_height::ops(lk, r.s("kind").unwrap_or(""), r.s("id").unwrap_or(""), r.n("a"), r.free, r.s("newId").unwrap_or(""), &req.new_name, r.n("b"), r.n("index")).into(),
|
||||
"wallThickness" => wall_thickness(root, r.s("id").unwrap_or(""), r.n("thickness"), r.s("newId").unwrap_or(""), req.new_name.clone()).into(),
|
||||
"ceilingThickness" => ceiling_thickness(root, r.s("id").unwrap_or(""), r.n("thickness"), r.s("newId").unwrap_or(""), req.new_name.clone()).into(),
|
||||
// [144] Wandöffnung gleiten lassen: Griff-Zug nach `pt` bzw. Objekt-Info-Position `a` (ab
|
||||
|
||||
@@ -735,7 +735,7 @@ fn value_hash(v: &Value, h: &mut u64) {
|
||||
}
|
||||
|
||||
/// Firsthöhe über der Traufe (Dach-Geometrie des Kerns, `roof.rs`), nach Inhalt gemerkt.
|
||||
fn roof_ridge_height(r: &Value, eaves: f64) -> Result<f64, String> {
|
||||
pub(crate) fn roof_ridge_height(r: &Value, eaves: f64) -> Result<f64, String> {
|
||||
let mut key = 0xcbf2_9ce4_8422_2325u64 ^ eaves.to_bits();
|
||||
value_hash(r, &mut key);
|
||||
let hit = RIDGE_CACHE.with(|c| c.borrow().get(&key).and_then(|l| l.iter().find(|(v, z, _)| *z == eaves.to_bits() && v == r).map(|e| e.2)));
|
||||
|
||||
@@ -9,13 +9,19 @@
|
||||
//! | `openingBottom` | Brüstung (`sillHeight`) bei gleicher Oberkante (Fenster) |
|
||||
//! | `ceilingTop` | Höhenlage: Oberkante-Bindung (`top`); ohne UK-Bindung zieht die Dicke die Unterkante mit |
|
||||
//! | `ceilingBottom` | Dicke (über den Deckentyp, wie die Objekt-Info) bzw. die UK-Bindung, falls es eine gibt |
|
||||
//! | `roofEave` | Traufhöhe (`baseElevation`); das ganze Dach wandert, die Firsthöhe über der Traufe bleibt |
|
||||
//! | `roofTop` | Firsthöhe: die Neigung (`pitchDeg`) wird so gerechnet, dass der First auf der Kote liegt |
|
||||
//! | `parapetTop` | Attika-Höhe (`parapetHeight`, Flachdach): Oberkante über der Traufe |
|
||||
//! | `stairTop` | Austrittshöhe (`totalRise`, ab Geschoss-Basis; der Antritt liegt im Modell fest auf der Basis) |
|
||||
//! | `contextTop`, `contextBottom` | Gelände (Netz, Baugrube, Höhenlinien): alle Höhen um die Differenz zur Griffhöhe `b` versetzen |
|
||||
//! | `contourLine` | Höhe der Höhenlinie `index` eines Höhenlinien-Satzes |
|
||||
//!
|
||||
//! Raster 1 cm (`free` = ohne), Mindestmasse: Wand 0.30 m, Öffnung 0.20 m, Decke 0.05 m. Bindungen bleiben in ihrer
|
||||
//! Art (Geschoss + Versatz bleibt Geschoss + Versatz, absolut bleibt absolut); ohne Bindung entsteht eine
|
||||
//! Geschoss-Bindung des eigenen Geschosses. Gesperrte Bauteile ändern sich nicht.
|
||||
|
||||
use crate::document::Lookup;
|
||||
use crate::json_util::{field, js_num, num_of, truthy, with, with_all};
|
||||
use crate::json_util::{arr, field, js_num, num_of, truthy, with, with_all};
|
||||
use crate::jsnum;
|
||||
use crate::ops::Op;
|
||||
use crate::selection_info::{anchor, ceiling_extent, ceiling_thickness as ceiling_thickness_of, vertical_extent};
|
||||
@@ -24,6 +30,8 @@ use serde_json::{json, Map, Value};
|
||||
const MIN_WALL: f64 = 0.3;
|
||||
const MIN_OPENING: f64 = 0.2;
|
||||
const MIN_CEILING: f64 = 0.05;
|
||||
const MIN_RIDGE: f64 = 0.1;
|
||||
const MIN_STAIR: f64 = 0.3;
|
||||
|
||||
/// Art eines Höhen-Griffs (Reihenfolge = Index der Bindung `grip_sheet_height`).
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
@@ -37,12 +45,20 @@ pub enum Kind {
|
||||
/// Decke OK bei gebundener UK: die Dicke ändert sich.
|
||||
CeilingTopFixed,
|
||||
CeilingBottom,
|
||||
/// Traufe: das Dach wandert (Firsthöhe über der Traufe bleibt); `bottom` = Traufe, `top` = First.
|
||||
RoofEave,
|
||||
/// First: `bottom` = Traufe bleibt, `top` mindestens 0.10 m darüber.
|
||||
RoofTop,
|
||||
/// Attika-Oberkante: `bottom` = Dachhaut, `top` darüber (mindestens gleich).
|
||||
ParapetTop,
|
||||
/// Treppen-Austritt: `bottom` = Basis, `top` mindestens 0.30 m darüber.
|
||||
StairTop,
|
||||
}
|
||||
|
||||
impl Kind {
|
||||
pub fn from_index(i: u32) -> Option<Kind> {
|
||||
use Kind::*;
|
||||
[WallTop, OpeningTop, OpeningBottom, WallBottom, CeilingTop, CeilingTopFixed, CeilingBottom].get(i as usize).copied()
|
||||
[WallTop, OpeningTop, OpeningBottom, WallBottom, CeilingTop, CeilingTopFixed, CeilingBottom, RoofEave, RoofTop, ParapetTop, StairTop].get(i as usize).copied()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,6 +75,10 @@ pub fn drag(kind: Kind, base: f64, top: f64, bottom: f64, y: f64, free: bool) ->
|
||||
Kind::CeilingTop => (v, bottom + (v - top)),
|
||||
Kind::CeilingTopFixed => (jsnum::max(bottom + MIN_CEILING, v), bottom),
|
||||
Kind::CeilingBottom => (top, jsnum::min(top - MIN_CEILING, v)),
|
||||
Kind::RoofEave => (top + (v - bottom), v),
|
||||
Kind::RoofTop => (jsnum::max(bottom + MIN_RIDGE, v), bottom),
|
||||
Kind::ParapetTop => (jsnum::max(bottom, v), bottom),
|
||||
Kind::StairTop => (jsnum::max(bottom + MIN_STAIR, v), bottom),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,7 +119,9 @@ pub fn snap_level(y: f64, levels: &[f64], tol: f64) -> f64 {
|
||||
/// Die Ops für den Zug von `kind` an Bauteil `id` auf die Blatt-Höhe `y`. `new_id`/`new_name`: Deckentyp, falls die
|
||||
/// Dicke einen eigenen braucht (`ceilingThickness`). Leer bei unbekanntem Bauteil/Art, Sperre, Unsinn oder wenn sich
|
||||
/// nichts ändert.
|
||||
pub fn ops(lk: &Lookup, kind: &str, id: &str, y: f64, free: bool, new_id: &str, new_name: &Value) -> Vec<Op> {
|
||||
/// `b` = Höhe, auf der der Griff vor dem Zug stand (Dach, Treppe, `contextTop`: der Zug zählt dann relativ), `index` = Höhenlinie (nur `contourLine`).
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn ops(lk: &Lookup, kind: &str, id: &str, y: f64, free: bool, new_id: &str, new_name: &Value, b: f64, index: f64) -> Vec<Op> {
|
||||
if !y.is_finite() {
|
||||
return vec![];
|
||||
}
|
||||
@@ -169,10 +191,102 @@ pub fn ops(lk: &Lookup, kind: &str, id: &str, y: f64, free: bool, new_id: &str,
|
||||
let name = new_name.as_str().map_or_else(|| new_name.clone(), |n| Value::from(n.replace("{t}", &format!("{t:.2}"))));
|
||||
crate::grips::ceiling_thickness(root, id, t, new_id, name)
|
||||
}
|
||||
"roofEave" | "roofTop" | "parapetTop" => {
|
||||
let Some(r) = lk.find("roofs", id).filter(|r| !locked(r)) else { return vec![] };
|
||||
let eave = roof_eave(root, r);
|
||||
let new = match kind {
|
||||
"roofEave" => {
|
||||
let z = target(y, free, b, eave);
|
||||
with(r, "baseElevation", js_num(mm(drag(Kind::RoofEave, 0.0, eave, eave, z, true).1)))
|
||||
}
|
||||
"parapetTop" => {
|
||||
if field(r, "shape").and_then(Value::as_str) != Some("flach") {
|
||||
return vec![];
|
||||
}
|
||||
let h = jsnum::max(0.0, num_of(field(r, "parapetHeight")));
|
||||
let h = if h.is_finite() { h } else { 0.0 };
|
||||
let z = target(y, free, b, eave + h);
|
||||
with(r, "parapetHeight", js_num(mm(drag(Kind::ParapetTop, 0.0, eave, eave, z, true).0 - eave)))
|
||||
}
|
||||
_ => {
|
||||
// Ist der Zug relativ (`b`), zählt die heutige Firsthöhe als Ausgang.
|
||||
let h0 = crate::selection_info::roof_ridge_height(r, eave).unwrap_or(0.0);
|
||||
let z = target(y, free, b, eave + h0);
|
||||
match ridge_pitch(r, eave, drag(Kind::RoofTop, 0.0, eave, eave, z, true).0 - eave) {
|
||||
Some(p) => with(r, "pitchDeg", js_num(p)),
|
||||
None => return vec![],
|
||||
}
|
||||
}
|
||||
};
|
||||
if new == *r { vec![] } else { vec![replace("roofs", new)] }
|
||||
}
|
||||
"stairTop" => {
|
||||
let Some(st) = lk.find("stairs", id).filter(|s| !locked(s)) else { return vec![] };
|
||||
let f = field(st, "floorId").and_then(Value::as_str).and_then(|i| lk.find("drawingLevels", i));
|
||||
let base = Some(f.map_or(0.0, |f| num_of(field(f, "baseElevation")))).filter(|b| b.is_finite()).unwrap_or(0.0);
|
||||
let floor_h = f.map_or(0.0, |f| num_of(field(f, "floorHeight")));
|
||||
let cur = match num_of(field(st, "totalRise")) {
|
||||
r if r > 0.0 => r,
|
||||
_ if floor_h > 0.0 => floor_h,
|
||||
_ => 2.6,
|
||||
};
|
||||
let z = target(y, free, b, base + cur);
|
||||
let top = drag(Kind::StairTop, base, base + cur, base, z, true).0;
|
||||
let new = with(st, "totalRise", js_num(mm(top - base)));
|
||||
if new == *st { vec![] } else { vec![replace("stairs", new)] }
|
||||
}
|
||||
"contextTop" | "contextBottom" | "contourLine" => {
|
||||
let Some(e) = lk.find("context", id).filter(|e| !locked(e)) else { return vec![] };
|
||||
let v = if free { y } else { jsnum::round(y * 100.0) / 100.0 };
|
||||
let new = if kind != "contourLine" {
|
||||
crate::cmd_context::height_offset(e, v - b)
|
||||
} else if index.is_finite() && index >= 0.0 {
|
||||
crate::cmd_context::contour_height(e, index as usize, v)
|
||||
} else {
|
||||
None
|
||||
};
|
||||
new.map(|entity| vec![replace("context", entity)]).unwrap_or_default()
|
||||
}
|
||||
_ => vec![],
|
||||
}
|
||||
}
|
||||
|
||||
/// Zielhöhe des Zugs: mit bekannter Ausgangshöhe des Griffs `b` relativ (heutige Kante `cur` + Zug, 1-cm-Raster auf
|
||||
/// dem Zug), sonst absolut `y`. Die Hülle zieht die sichtbare Kante des Schnitts (inkl. Überstand, Dicke), nicht
|
||||
/// die Modell-Kante — darum der Zug als Differenz.
|
||||
fn target(y: f64, free: bool, b: f64, cur: f64) -> f64 {
|
||||
let v = if free { y } else { jsnum::round(y * 100.0) / 100.0 };
|
||||
if b.is_finite() { cur + (v - b) } else { v }
|
||||
}
|
||||
|
||||
/// Traufhöhe (absolutes Z) eines Dachs: `baseElevation`, sonst Oberkante des Geschosses.
|
||||
fn roof_eave(root: &Map<String, Value>, r: &Value) -> f64 {
|
||||
if let Some(b) = field(r, "baseElevation").filter(|b| !b.is_null()) {
|
||||
return num_of(Some(b));
|
||||
}
|
||||
let id = field(r, "floorId").and_then(Value::as_str);
|
||||
arr(root.get("drawingLevels")).iter().find(|l| field(l, "id").and_then(Value::as_str) == id).map_or(0.0, |f| num_of(field(f, "baseElevation")) + num_of(field(f, "floorHeight")))
|
||||
}
|
||||
|
||||
/// Neigung (Grad, 0.01°), bei der der First `rise` Meter über der Traufe liegt; `None` bei Flachdach, Fehler oder
|
||||
/// unveränderter Neigung. Die Firsthöhe wächst mit tan(Neigung): Sekantenverfahren auf dem Kern, höchstens 8 Schritte.
|
||||
fn ridge_pitch(r: &Value, eave: f64, rise: f64) -> Option<f64> {
|
||||
if field(r, "shape").and_then(Value::as_str) == Some("flach") || !rise.is_finite() {
|
||||
return None;
|
||||
}
|
||||
let p0 = num_of(field(r, "pitchDeg"));
|
||||
let mut p = if p0.is_finite() && p0 > 0.0 { p0 } else { 10.0 };
|
||||
for _ in 0..8 {
|
||||
let h = crate::selection_info::roof_ridge_height(&with(r, "pitchDeg", js_num(p)), eave).ok()?;
|
||||
if !(h > 1e-9) || (h - rise).abs() < 1e-4 {
|
||||
break;
|
||||
}
|
||||
p = ((p.to_radians().tan() * rise / h).atan().to_degrees()).clamp(0.5, 85.0);
|
||||
}
|
||||
let p = jsnum::round(p * 100.0) / 100.0;
|
||||
if p == p0 { None } else { Some(p) }
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
@@ -207,7 +321,7 @@ mod tests {
|
||||
|
||||
fn run(kind: &str, id: &str, y: f64) -> Vec<Op> {
|
||||
let r = root();
|
||||
ops(&Lookup::plain(&r), kind, id, y, false, "ct-neu", &json!("Neu"))
|
||||
ops(&Lookup::plain(&r), kind, id, y, false, "ct-neu", &json!("Neu"), f64::NAN, f64::NAN)
|
||||
}
|
||||
|
||||
fn entity(ops: &[Op]) -> Value {
|
||||
@@ -301,4 +415,118 @@ mod tests {
|
||||
assert_eq!(e["bottom"], json!({"mode": "custom", "z": 2.1}));
|
||||
}
|
||||
|
||||
fn roof_root() -> Map<String, Value> {
|
||||
json!({
|
||||
"drawingLevels": [{"id": "eg", "kind": "floor", "baseElevation": 0.0, "floorHeight": 2.6}],
|
||||
"roofs": [
|
||||
{"id": "r1", "type": "roof", "floorId": "eg", "categoryCode": "35", "shape": "sattel", "pitchDeg": 30, "ridgeAxis": "x",
|
||||
"outline": [{"x": 0, "y": 0}, {"x": 10, "y": 0}, {"x": 10, "y": 8}, {"x": 0, "y": 8}], "overhang": 0, "thickness": 0.2},
|
||||
{"id": "r2", "type": "roof", "floorId": "eg", "categoryCode": "35", "shape": "flach", "pitchDeg": 0, "baseElevation": 3.5,
|
||||
"outline": [{"x": 0, "y": 0}, {"x": 10, "y": 0}, {"x": 10, "y": 8}, {"x": 0, "y": 8}], "overhang": 0, "thickness": 0.2},
|
||||
{"id": "r3", "type": "roof", "floorId": "eg", "shape": "sattel", "pitchDeg": 30, "locked": true, "outline": []}
|
||||
],
|
||||
"stairs": [{"id": "s1", "floorId": "eg", "stepCount": 14}, {"id": "s2", "floorId": "eg", "stepCount": 14, "totalRise": 2.8, "locked": true}],
|
||||
"context": [
|
||||
{"id": "tm", "type": "terrainMesh", "positions": [0, 0, 500, 1, 0, 501, 0, 1, 502]},
|
||||
{"id": "hl", "type": "contourSet", "contours": [{"z": 500, "pts": [], "closed": false}, {"z": 501, "pts": [], "closed": false}]},
|
||||
{"id": "im", "type": "image"}
|
||||
]
|
||||
})
|
||||
.as_object()
|
||||
.unwrap()
|
||||
.clone()
|
||||
}
|
||||
|
||||
fn run_roof(kind: &str, id: &str, y: f64, b: f64, index: f64) -> Vec<Op> {
|
||||
let r = roof_root();
|
||||
ops(&Lookup::plain(&r), kind, id, y, false, "", &Value::Null, b, index)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn dach_traufe_verschiebt_das_dach() {
|
||||
let e = entity(&run_roof("roofEave", "r1", 2.7449, f64::NAN, f64::NAN));
|
||||
assert_eq!(e["baseElevation"], json!(2.74));
|
||||
assert_eq!(e["pitchDeg"], json!(30));
|
||||
assert!(run_roof("roofEave", "r2", 3.5, f64::NAN, f64::NAN).is_empty(), "gleiche Traufe: keine Änderung");
|
||||
assert!(run_roof("roofEave", "r3", 3.0, f64::NAN, f64::NAN).is_empty(), "gesperrt");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn dach_first_rechnet_die_neigung() {
|
||||
// Spannweite 8 m: First bei 30° = 4 * tan 30° = 2.309 m über der Traufe (2.6).
|
||||
let r = roof_root();
|
||||
let r1 = r["roofs"][0].clone();
|
||||
let h0 = crate::selection_info::roof_ridge_height(&r1, 2.6).unwrap();
|
||||
assert!((h0 - 4.0 * 30f64.to_radians().tan()).abs() < 1e-6, "{h0}");
|
||||
let e = entity(&run_roof("roofTop", "r1", 2.6 + 3.0, f64::NAN, f64::NAN));
|
||||
let p = e["pitchDeg"].as_f64().unwrap();
|
||||
assert!(p > 30.0);
|
||||
let h = crate::selection_info::roof_ridge_height(&e, 2.6).unwrap();
|
||||
assert!((h - 3.0).abs() < 0.01, "First liegt auf der Kote: {h}");
|
||||
// Mindesthöhe: nie flacher als 0.10 m über der Traufe; Flachdach hat keinen First.
|
||||
let p_min = entity(&run_roof("roofTop", "r1", 0.0, f64::NAN, f64::NAN))["pitchDeg"].as_f64().unwrap();
|
||||
assert!(p_min < 2.0 && p_min >= 0.5);
|
||||
assert!(run_roof("roofTop", "r2", 6.0, f64::NAN, f64::NAN).is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn dach_attika_nur_beim_flachdach() {
|
||||
let e = entity(&run_roof("parapetTop", "r2", 3.95, f64::NAN, f64::NAN));
|
||||
assert_eq!(e["parapetHeight"], json!(0.45));
|
||||
assert_eq!(entity(&run_roof("parapetTop", "r2", 1.0, f64::NAN, f64::NAN))["parapetHeight"], json!(0));
|
||||
assert!(run_roof("parapetTop", "r1", 4.0, f64::NAN, f64::NAN).is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn treppe_austritt_setzt_die_steighoehe() {
|
||||
assert_eq!(entity(&run_roof("stairTop", "s1", 2.9, f64::NAN, f64::NAN))["totalRise"], json!(2.9));
|
||||
assert_eq!(entity(&run_roof("stairTop", "s1", -4.0, f64::NAN, f64::NAN))["totalRise"], json!(0.3));
|
||||
assert!(run_roof("stairTop", "s2", 3.0, f64::NAN, f64::NAN).is_empty(), "gesperrt");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn gelaende_versatz_und_hoehenlinie() {
|
||||
// Netz: höchster Punkt stand auf 502, Zug auf 503.5 → alle z um 1.5 höher.
|
||||
let e = entity(&run_roof("contextTop", "tm", 503.5, 502.0, f64::NAN));
|
||||
assert_eq!(e["positions"], json!([0, 0, 501.5, 1, 0, 502.5, 0, 1, 503.5]));
|
||||
// Höhenlinie 1 auf 510.
|
||||
let e = entity(&run_roof("contourLine", "hl", 510.0, f64::NAN, 1.0));
|
||||
assert_eq!(e["contours"][1]["z"], json!(510));
|
||||
assert_eq!(e["contours"][0]["z"], json!(500));
|
||||
assert!(run_roof("contourLine", "hl", 510.0, f64::NAN, 7.0).is_empty());
|
||||
assert!(run_roof("contextTop", "im", 5.0, 4.0, f64::NAN).is_empty(), "Luftbild hat keine Höhe");
|
||||
assert!(run_roof("contextTop", "tm", 502.0, 502.0, f64::NAN).is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn dach_und_treppe_relativ_zur_griffhoehe() {
|
||||
// Sichtbare Kante stand auf 5.0 (Überstand/Dicke), Zug auf 5.5 → Traufe 2.6 + 0.5.
|
||||
let e = entity(&run_roof("roofEave", "r1", 5.5, 5.0, f64::NAN));
|
||||
assert_eq!(e["baseElevation"], json!(3.1));
|
||||
// Treppe ohne totalRise: Geschosshöhe 2.6; Griff stand auf 2.7, Zug auf 2.9 → 2.8.
|
||||
assert_eq!(entity(&run_roof("stairTop", "s1", 2.9, 2.7, f64::NAN))["totalRise"], json!(2.8));
|
||||
// First: Zug um +1 m über den heutigen First hebt die Neigung.
|
||||
let r = roof_root();
|
||||
let h0 = crate::selection_info::roof_ridge_height(&r["roofs"][0], 2.6).unwrap();
|
||||
let e = entity(&run_roof("roofTop", "r1", 6.0, 5.0, f64::NAN));
|
||||
let h = crate::selection_info::roof_ridge_height(&e, 2.6).unwrap();
|
||||
assert!((h - (h0 + 1.0)).abs() < 0.01, "{h} vs {h0}+1");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn vorschau_dach_und_treppe() {
|
||||
assert_eq!(drag(Kind::RoofEave, 0.0, 5.0, 2.6, 3.0, false), (5.4, 3.0));
|
||||
assert_eq!(drag(Kind::RoofTop, 0.0, 5.0, 2.6, 2.0, false), (2.7, 2.6));
|
||||
assert_eq!(drag(Kind::ParapetTop, 0.0, 3.0, 3.0, 2.0, false), (3.0, 3.0));
|
||||
assert_eq!(drag(Kind::StairTop, 0.0, 2.6, 0.0, 0.1, false), (0.3, 0.0));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn wand_unterkante_unter_geschoss_erlaubt() {
|
||||
// Kellerwand: UK unter der Geschoss-Basis (0.0) ist erlaubt; über OK bleibt die Mindesthöhe.
|
||||
let e = entity(&run("wallBottom", "w1", -1.2));
|
||||
assert_eq!(e["bottom"], json!({"mode": "floor", "floorId": "eg", "offset": -1.2}));
|
||||
assert_eq!(e["height"], json!(3.8));
|
||||
assert_eq!(entity(&run("wallBottom", "w1", 4.0))["height"], json!(0.3));
|
||||
}
|
||||
}
|
||||
@@ -109,7 +109,7 @@ pub fn grip_edge_target(
|
||||
}
|
||||
|
||||
/// Höhen-Griff im Schnitt ([187], `sheet_height::Kind`: 0 Wand OK, 1 Öffnung oben, 2 Öffnung unten, 3 Wand UK, 4 Decke OK
|
||||
/// (Platte wandert), 5 Decke OK bei gebundener UK, 6 Decke UK): neue `[oben, unten]` im Blatt; `[]` bei unbekannter Art
|
||||
/// (Platte wandert), 5 Decke OK bei gebundener UK, 6 Decke UK, 7 Traufe, 8 First, 9 Attika, 10 Treppen-Austritt): neue `[oben, unten]` im Blatt; `[]` bei unbekannter Art
|
||||
/// oder Unsinn (NaN).
|
||||
#[wasm_bindgen]
|
||||
pub fn grip_sheet_height(kind: u32, base: f64, top: f64, bottom: f64, y: f64, free: bool) -> Vec<f64> {
|
||||
@@ -210,7 +210,7 @@ mod tests {
|
||||
assert!(grip_coincident(&[0.0, 0.0], &[3.0, 1.0]).is_empty());
|
||||
assert!(grip_coincident(&[0.0, 0.0], &[f64::NAN]).is_empty());
|
||||
assert_eq!(grip_coincident(&[0.0, 0.0], &[1.0, 0.01, 0.0, 0.0]), vec![0.0, 0.0]);
|
||||
assert!(grip_sheet_height(7, 0.0, 1.0, 0.0, 1.0, false).is_empty());
|
||||
assert!(grip_sheet_height(11, 0.0, 1.0, 0.0, 1.0, false).is_empty());
|
||||
// Unsinniger Index: keine Polygon-Nachbarn, nur Welt-H/V.
|
||||
assert_eq!(grip_axis_lock(3.0, 0.4, 0.0, 0.0, 1.0, 1.0, &[0.0, 0.0, 1.0, 1.0], f64::NAN, true), vec![3.0, 0.0]);
|
||||
}
|
||||
|
||||
@@ -109,9 +109,13 @@ export function gripEdgeTarget(edge: EdgeGrip, raw: Vec2, d: EdgeDrive = {}): Ve
|
||||
}
|
||||
|
||||
/** Art eines Höhen-Griffs im Schnitt/in der Ansicht ([187]; Index = `sheet_height::Kind` im Kern). */
|
||||
export type SheetHeightKind = "wallTop" | "openingTop" | "openingBottom" | "wallBottom" | "ceilingTop" | "ceilingBottom";
|
||||
export type SheetHeightKind =
|
||||
| "wallTop" | "openingTop" | "openingBottom" | "wallBottom" | "ceilingTop" | "ceilingBottom"
|
||||
// Dach: Traufe, First (bzw. Neigung), Attika; Treppe: Austritt; Gelände: Oberkante (Netz) bzw. Sohle (Baugrube).
|
||||
| "roofEave" | "roofTop" | "parapetTop" | "stairTop" | "contextTop" | "contextBottom";
|
||||
|
||||
const SHEET_KIND = { wallTop: 0, openingTop: 1, openingBottom: 2, wallBottom: 3, ceilingTop: 4, ceilingBottom: 6 } as const;
|
||||
const SHEET_KIND = { wallTop: 0, openingTop: 1, openingBottom: 2, wallBottom: 3, ceilingTop: 4, ceilingBottom: 6,
|
||||
roofEave: 7, roofTop: 8, parapetTop: 9, stairTop: 10, contextTop: 4, contextBottom: 7 } as const;
|
||||
|
||||
/**
|
||||
* Höhen-Griff auf die Blatt-Höhe `y` ziehen (1-cm-Raster, `free` = ohne): neue Ober-/Unterkante im Blatt für die
|
||||
|
||||
@@ -55,7 +55,7 @@ export type GripRequest =
|
||||
| { op: "deletePoint"; id: string; index: number }
|
||||
| { op: "vertexType"; id: string; index: number; vertexType: "corner" | "arc" | "spline" }
|
||||
// [187] Höhen-Griff im Schnitt/in der Ansicht: Kante `kind` auf die Blatt-Höhe `a` (absolutes Z) ziehen (Kern `sheet_height.rs`).
|
||||
| { op: "sheetHeight"; kind: SheetHeightKind; id: string; a: number; free?: boolean; newId: string; newName: string }
|
||||
| { op: "sheetHeight"; kind: SheetHeightKind; id: string; a: number; b?: number; free?: boolean; newId: string; newName: string }
|
||||
| { op: "wallThickness" | "ceilingThickness"; id: string; thickness: number; newId: string; newName: string }
|
||||
// [144] Wandöffnung gleiten lassen (Kern `opening_slide`): Griff-Zug nach `pt` bzw. Position `a` ab Wandanfang.
|
||||
| { op: "openingSlide"; id: string; pt: P }
|
||||
|
||||
@@ -2330,6 +2330,7 @@ export const de = {
|
||||
"cmd.field.length": "Länge",
|
||||
"cmd.field.level": "Kote",
|
||||
"grip.sheetHeight": "Kote {z} m · Höhe {d} m",
|
||||
"grip.sheetWallBottomClamped": "Unterkante über Oberkante: Mindesthöhe 0.30 m",
|
||||
"cmd.field.angle": "Winkel",
|
||||
"cmd.field.width": "Breite",
|
||||
"cmd.field.height": "Höhe",
|
||||
|
||||
@@ -2318,6 +2318,7 @@ export const en: Record<TranslationKey, string> = {
|
||||
"cmd.field.length": "Length",
|
||||
"cmd.field.level": "Level",
|
||||
"grip.sheetHeight": "Level {z} m · height {d} m",
|
||||
"grip.sheetWallBottomClamped": "Bottom above top: minimum height 0.30 m",
|
||||
"cmd.field.angle": "Angle",
|
||||
"cmd.field.width": "Width",
|
||||
"cmd.field.height": "Height",
|
||||
|
||||
@@ -421,7 +421,7 @@ export interface ProjectSlice {
|
||||
/** Setzt die Gesamtdicke einer Decke (thickness-Übersteuerung, Meter). */
|
||||
setCeilingThickness: (ceilingId: string, thickness: number) => void;
|
||||
/** [187] Höhen-Griff im Schnitt/in der Ansicht: Kante `kind` des Bauteils `id` auf die Blatt-Höhe `y` (absolutes Z) ziehen. */
|
||||
sheetHeightGrip: (kind: SheetHeightKind, id: string, y: number, free?: boolean) => void;
|
||||
sheetHeightGrip: (kind: SheetHeightKind, id: string, y: number, free?: boolean, from?: number) => void;
|
||||
|
||||
// ── Öffnungs-Editieren (Object-Info-Panel) ────────────────────────────────
|
||||
/** Generischer immutabler Patch auf eine Öffnung (per ID). */
|
||||
@@ -1313,12 +1313,14 @@ export function createProjectSlice(
|
||||
newName: t("default.ceilingTypeSingle", { thickness: thickness.toFixed(2) }),
|
||||
}),
|
||||
|
||||
sheetHeightGrip: (kind, id, y, free) =>
|
||||
sheetHeightGrip: (kind, id, y, free, from) =>
|
||||
applyGrip({
|
||||
op: "sheetHeight",
|
||||
kind,
|
||||
id,
|
||||
a: y,
|
||||
b: from, // Griffhöhe vor dem Zug: Dach, Treppe, Gelände zählen den Zug relativ
|
||||
|
||||
free: !!free,
|
||||
newId: `ct-${Date.now()}`,
|
||||
newName: t("default.ceilingTypeSingle", { thickness: "{t}" }), // {t} setzt der Kern ein
|
||||
|
||||
@@ -33,6 +33,10 @@ declare global {
|
||||
ceilings: { id: string; zBottom: number; zTop: number; thickness: number }[];
|
||||
walls: { id: string; zBottom: number; zTop: number }[];
|
||||
openings: { id: string; sillHeight: number; height: number }[];
|
||||
/** [187] Teil 2: Traufe (absolutes Z), Neigung, Attika-Höhe; Steighöhe der Treppen; Sohle der Baugruben. */
|
||||
roofs: { id: string; eave: number; pitchDeg: number; parapetHeight: number }[];
|
||||
stairs: { id: string; totalRise: number }[];
|
||||
excavations: { id: string; bottom: number }[];
|
||||
};
|
||||
/** [144] Auswahl setzen (wie ein Klick), z. B. `{ openings: ["D1"] }`. */
|
||||
select: (patch: Record<string, string[]>) => void;
|
||||
@@ -93,6 +97,12 @@ export function installTestHooks(): void {
|
||||
ceilings: ceilings.map((c, i) => ({ id: c.id, zBottom: ext.ceilings[i].zBottom, zTop: ext.ceilings[i].zTop, thickness: ceilingThickness(p, c) })),
|
||||
walls: p.walls.map((w, i) => ({ id: w.id, zBottom: ext.walls[i].zBottom, zTop: ext.walls[i].zTop })),
|
||||
openings: (p.openings ?? []).map((o) => ({ id: o.id, sillHeight: o.sillHeight, height: o.height })),
|
||||
roofs: (p.roofs ?? []).map((r) => {
|
||||
const f = p.drawingLevels.find((l) => l.id === r.floorId);
|
||||
return { id: r.id, eave: r.baseElevation ?? (f ? (f.baseElevation ?? 0) + (f.floorHeight ?? 0) : 0), pitchDeg: r.pitchDeg, parapetHeight: r.parapetHeight ?? 0 };
|
||||
}),
|
||||
stairs: (p.stairs ?? []).map((st) => ({ id: st.id, totalRise: st.totalRise ?? NaN })),
|
||||
excavations: (p.context ?? []).flatMap((c) => (c.type === "excavation" ? [{ id: c.id, bottom: c.bottom }] : [])),
|
||||
};
|
||||
},
|
||||
wallWeights: () => Object.fromEntries(getState().project.walls.flatMap((w) => (w.strokeWeight === undefined ? [] : [[w.id, w.strokeWeight]]))),
|
||||
|
||||
+66
-10
@@ -40,7 +40,7 @@ import { contextAnchor } from "./contextDrag";
|
||||
import type { DraftShape, SnapResult, SnapSettings, ToolDraft, ToolMods } from "../tools/types";
|
||||
import { computeSnap } from "../tools/snapping";
|
||||
import { useCommandTabShortcut } from "./useKeyboardShortcuts";
|
||||
import { sheetOutlinesVersion, sheetOwnerOutlines, subscribeSheetOutlines } from "../tools/sheetSnapGeometry";
|
||||
import { sheetOutlinesVersion, sheetOwnerOutlines, sheetSnapSegments, subscribeSheetOutlines } from "../tools/sheetSnapGeometry";
|
||||
import type { BodyTarget } from "../views/plan/PlanView";
|
||||
import type { CommandLineHandle } from "../ui/CommandLine";
|
||||
import type { CommandEngine } from "../commands/engine";
|
||||
@@ -109,7 +109,7 @@ export function useGripEditing(opts: {
|
||||
/** [144] Wandöffnung gleiten lassen (Kern: Wand, Bogenwand, Nachbaröffnungen). */
|
||||
slideOpening: (id: string, to: { position: number } | { pt: Vec2 }, coalesceKey?: string) => void;
|
||||
/** [187] Höhen-Griff im Schnitt/in der Ansicht anwenden (Kern `sheet_height.rs`); EIN Aufruf je Zug. */
|
||||
sheetHeightGrip: (kind: SheetHeightKind, id: string, y: number, free?: boolean) => void;
|
||||
sheetHeightGrip: (kind: SheetHeightKind, id: string, y: number, free?: boolean, from?: number) => void;
|
||||
moveStairBy: (id: string, delta: Vec2) => void;
|
||||
/** [151] Parameter-Griff einer Podesttreppe ziehen (Index ohne den Bewegpunkt). */
|
||||
dragStairParam?: (id: string, index: number, pt: Vec2) => void;
|
||||
@@ -297,15 +297,16 @@ export function useGripEditing(opts: {
|
||||
// Änderung am Bauteil rechnet der Kern beim Loslassen (`sheetHeight`). Gesperrte Bauteile haben keine.
|
||||
const sheetHeightGrips: SheetHeightGrip[] = (() => {
|
||||
if (modelEditable || !sheet) return [];
|
||||
const bbox = (kind: "wall" | "opening" | "ceiling", id: string) => {
|
||||
const bbox = (kind: "wall" | "opening" | "ceiling" | "roof" | "stair" | "context", id: string) => {
|
||||
const polys = sheetOwnerOutlines(sheet.levelId, kind, id);
|
||||
if (polys.length === 0) return null;
|
||||
let u0 = Infinity, u1 = -Infinity, v0 = Infinity, v1 = -Infinity;
|
||||
let u0 = Infinity, u1 = -Infinity, v0 = Infinity, v1 = -Infinity, uHigh = 0;
|
||||
for (const poly of polys) for (const q of poly) {
|
||||
u0 = Math.min(u0, q.x); u1 = Math.max(u1, q.x);
|
||||
v0 = Math.min(v0, q.y); v1 = Math.max(v1, q.y);
|
||||
v0 = Math.min(v0, q.y);
|
||||
if (q.y > v1) { v1 = q.y; uHigh = q.x; } // uHigh: wo das Bauteil am höchsten ist (Geländeprofil)
|
||||
}
|
||||
return { u0, u1, v0, v1 };
|
||||
return { u0, u1, v0, v1, uHigh };
|
||||
};
|
||||
// Höhen aus dem Modell (nicht aus den gezeichneten Umrissen: ein von Fenstern oder Decken zerschnittener Rest
|
||||
// reicht nicht von UK bis OK), nur die Breite (u) kommt aus dem Blatt.
|
||||
@@ -335,6 +336,56 @@ export function useGripEditing(opts: {
|
||||
{ kind: "wallBottom", pt: { x: mid, y: zBottom }, ...common },
|
||||
];
|
||||
}
|
||||
// [187] Teil 2 — Dach: Traufe (links unten, ganzes Dach wandert), First (Neigung folgt), Flachdach: Attika.
|
||||
// Die Griffe sitzen an der sichtbaren Kante des Schnitts (mit Überstand/Dicke); der Kern zählt den Zug relativ.
|
||||
const selectedRoofId = single(selection, "roofs");
|
||||
if (selectedRoofId) {
|
||||
const r = (project.roofs ?? []).find((x) => x.id === selectedRoofId);
|
||||
const bb = r && bbox("roof", r.id);
|
||||
if (!r || !bb || r.locked) return [];
|
||||
const common = { id: r.id, u0: bb.u0, u1: bb.u1, base: bb.v0, top: bb.v1, bottom: bb.v0 };
|
||||
const out: SheetHeightGrip[] = [{ kind: "roofEave", pt: { x: bb.u0, y: bb.v0 }, ...common }];
|
||||
if (r.shape === "flach") {
|
||||
if (r.parapetHeight && r.parapetHeight > 0) {
|
||||
out.push({ kind: "parapetTop", pt: { x: bb.u1, y: bb.v1 }, ...common, bottom: bb.v1 - r.parapetHeight });
|
||||
}
|
||||
} else {
|
||||
out.push({ kind: "roofTop", pt: { x: (bb.u0 + bb.u1) / 2, y: bb.v1 }, ...common });
|
||||
}
|
||||
return out;
|
||||
}
|
||||
// Treppe: Austrittshöhe (Steighöhe ab Geschoss-Basis; der Antritt liegt im Modell fest auf der Basis).
|
||||
if (selectedStairId) {
|
||||
const st = (project.stairs ?? []).find((x) => x.id === selectedStairId);
|
||||
const bb = st && bbox("stair", st.id);
|
||||
if (!st || !bb || st.locked) return [];
|
||||
return [{ kind: "stairTop", pt: { x: bb.u1, y: bb.v1 }, id: st.id, u0: bb.u0, u1: bb.u1, base: bb.v0, top: bb.v1, bottom: bb.v0 }];
|
||||
}
|
||||
// Gelände: Netz (Oberkante des Profils) bzw. Baugrube (Sohle) um die Differenz versetzen. Höhenlinien-Sätze
|
||||
// zeichnet der Schnitt nicht — dafür gibt es keinen Griff.
|
||||
if (selection.contextObjects.length === 1) {
|
||||
const o = (project.context ?? []).find((c) => c.id === selection.contextObjects[0]);
|
||||
if (!o) return [];
|
||||
if (o.type === "terrainMesh" || o.type === "importedMesh") {
|
||||
const bb = bbox("context", o.id);
|
||||
if (!bb) return [];
|
||||
return [{ kind: "contextTop", pt: { x: bb.uHigh, y: bb.v1 }, id: o.id, u0: bb.u0, u1: bb.u1, base: bb.v0, top: bb.v1, bottom: bb.v0 }];
|
||||
}
|
||||
if (o.type === "excavation") {
|
||||
// Die Sohle ist im Schnitt eine waagrechte Linie auf der Höhe `bottom` (die Fläche mit der Id sind nur Böschung/Verbau):
|
||||
// der Griff sitzt in der Mitte der längsten solchen Linie.
|
||||
let best: [Vec2, Vec2] | null = null;
|
||||
for (const sg of sheetSnapSegments(sheet.levelId)) {
|
||||
if (Math.abs(sg[0].y - o.bottom) > 0.005 || Math.abs(sg[1].y - o.bottom) > 0.005) continue;
|
||||
if (!best || Math.abs(sg[1].x - sg[0].x) > Math.abs(best[1].x - best[0].x)) best = sg;
|
||||
}
|
||||
if (!best) return [];
|
||||
const u = (best[0].x + best[1].x) / 2;
|
||||
const [ua, ub] = [Math.min(best[0].x, best[1].x), Math.max(best[0].x, best[1].x)];
|
||||
return [{ kind: "contextBottom", pt: { x: u, y: o.bottom }, id: o.id, u0: ua, u1: ub, base: o.bottom, top: o.bottom, bottom: o.bottom }];
|
||||
}
|
||||
return [];
|
||||
}
|
||||
if (selectedCeilingId) {
|
||||
const c = (project.ceilings ?? []).find((x) => x.id === selectedCeilingId);
|
||||
const bb = c && bbox("ceiling", c.id);
|
||||
@@ -734,7 +785,7 @@ export function useGripEditing(opts: {
|
||||
/** Aufgeschobene Öffnungs-Verschiebung im Schnitt/in der Ansicht (neue `position`). */
|
||||
const pendingOpeningMoveRef = useRef<{ id: string; position: number } | null>(null);
|
||||
/** Aufgeschobene Höhen-Änderung im Schnitt (Kante `kind` auf die Höhe `y`, Kern `sheetHeight`). */
|
||||
const pendingSheetHeightRef = useRef<{ kind: SheetHeightKind; id: string; y: number; free: boolean } | null>(null);
|
||||
const pendingSheetHeightRef = useRef<{ kind: SheetHeightKind; id: string; y: number; free: boolean; from: number } | null>(null);
|
||||
/** [187] Kote der gezogenen Kante im laufenden Höhen-Zug (Tab-Feld „Kote“). */
|
||||
const sheetDragRef = useRef<{ z: number } | null>(null);
|
||||
/** Laufendes Blatt-Delta (u, Meter) eines Zugs im Schnitt (s. moveInSheet). */
|
||||
@@ -1261,7 +1312,7 @@ export function useGripEditing(opts: {
|
||||
const commitPendingGripChanges = () => {
|
||||
const ph = pendingSheetHeightRef.current;
|
||||
pendingSheetHeightRef.current = null;
|
||||
if (ph) sheetHeightGrip(ph.kind, ph.id, ph.y, ph.free);
|
||||
if (ph) sheetHeightGrip(ph.kind, ph.id, ph.y, ph.free, ph.from);
|
||||
const pc = pendingContourRef.current;
|
||||
pendingContourRef.current = null;
|
||||
if (pc) {
|
||||
@@ -1541,7 +1592,9 @@ export function useGripEditing(opts: {
|
||||
if (!g) return;
|
||||
const { top, bottom } = sheetHeightDrag(g.kind, g, y, free);
|
||||
const z = g.kind.endsWith("Top") ? top : bottom;
|
||||
pendingSheetHeightRef.current = { kind: g.kind, id: g.id, y, free };
|
||||
// Wand-UK über der Oberkante: die Mindesthöhe (0.30 m) hält sie fest; unter der Geschoss-Basis ist sie erlaubt (Kellerwand).
|
||||
const clamped = g.kind === "wallBottom" && y > g.top - 0.3;
|
||||
pendingSheetHeightRef.current = { kind: g.kind, id: g.id, y, free, from: g.pt.y };
|
||||
sheetDragRef.current = { z };
|
||||
setDraft({
|
||||
preview: [{
|
||||
@@ -1551,7 +1604,10 @@ export function useGripEditing(opts: {
|
||||
}],
|
||||
vertices: [],
|
||||
snap: snapResult,
|
||||
hud: { at: { x: g.pt.x, y: z }, text: t("grip.sheetHeight", { z: z.toFixed(2), d: (top - bottom).toFixed(2) }) },
|
||||
hud: {
|
||||
at: { x: g.pt.x, y: z },
|
||||
text: t("grip.sheetHeight", { z: z.toFixed(2), d: (top - bottom).toFixed(2) }) + (clamped ? ` · ${t("grip.sheetWallBottomClamped")}` : ""),
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ export function snapSegmentsFromPrimitives(prims: readonly Primitive[]): SnapSeg
|
||||
}
|
||||
|
||||
/** Bauteil-Art, deren Schnittflächen im Blatt gezogen werden können. */
|
||||
export type SheetOwnerKind = "wall" | "ceiling" | "opening" | "stair";
|
||||
export type SheetOwnerKind = "wall" | "ceiling" | "opening" | "stair" | "roof" | "context";
|
||||
|
||||
/**
|
||||
* Schnittflächen der Ebene `levelId` je Quell-Bauteil ablegen (aus den Plan-
|
||||
@@ -97,6 +97,8 @@ export function setSheetOwnerOutlines(levelId: string, prims: readonly Primitive
|
||||
else if (p.stairId) add(`stair:${p.stairId}`, p.pts);
|
||||
else if (p.wallId) add(`wall:${p.wallId}`, p.pts);
|
||||
else if (p.ceilingId) add(`ceiling:${p.ceilingId}`, p.pts);
|
||||
else if (p.roofId) add(`roof:${p.roofId}`, p.pts);
|
||||
else if (p.contextObjectId) add(`context:${p.contextObjectId}`, p.pts);
|
||||
}
|
||||
outlinesByLevel.set(levelId, map);
|
||||
bumpOutlines();
|
||||
|
||||
Reference in new issue
Block a user