[187] [143] [T6] Höhenlinien-Sätze im Schnitt (Geländelinie, Erdreich, Höhen-Griff je Linie); Treppen-Antritt (baseOffset, Griff, Objekt-Info)

This commit is contained in:
Claude committed 2026-11-12 03:04:07 +00:00
1 parent f356b91eed
commit 3ce43f3844
24 files changed
+304 -42

No files matched your search

+1 -1
View File
@@ -128,7 +128,7 @@ Wer zu einer ID mehr wissen will (Entscheide, Tests, Bilder), sucht dort nach `*
Bogenwände im 3D weiter 7.5°-Sehnen (Plattenrand feiner); keine Kante gerade → Bogen per Objekt-Info; nicht in der
Tauri-App/auf dem Mac geprüft. · L
- ○ **[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
- ◐ **[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 **Update 12.11. (Teil 3):** Höhenlinien-Sätze (`contourSet` ohne daraus erzeugtes Netz) erscheinen im Schnitt: Geländelinie aus den Schnittpunkten der Linien mit der Schnittebene (`terrain::contour_crossings`, nach Lage sortiert, linear verbunden, Bezugshöhe wie das Netz-Gelände) samt Erdreich-Schraffur, Klasse = die des Satzes, Pick = Satz; Griff je Schnittpunkt (`contourLine`, `sheet_height::contour_marks`, Blatt-Höhe + Bezug → Höhe der Linie). Treppen-Antritt: Modellfeld `baseOffset` (Antritt über der Geschoss-Basis, Austritt bleibt auf `totalRise`; Kern `stair_vertical_extent`, damit 3D/Schnitt/Plan/IFC), Griff `stairBottom` im Schnitt, Objekt-Info-Feld. Geprüft: cargo test (Kern), vitest, tsc, Schnittbild per CLI; e2e `sectionGrips.spec.ts` (Antritt) erweitert. **Offen:** Höhenlinien-Griffe ohne Obergrenze (viele Schnittpunkte = viele Griffe); Gelände-Profilpunkte von Netzen.
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
+20 -5
View File
@@ -211,18 +211,33 @@ test("Schnitt A-A: Dach-Traufe und First ziehen, Zug = ein Undo-Schritt", async
await expect.poll(async () => (await roofOf(page, "dach-haupt")).pitchDeg).toBe(r0.pitchDeg);
});
test("Schnitt B-B: Treppen-Austritt ziehen", async ({ page }) => {
test("Schnitt B-B: Treppen-Austritt und -Antritt 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 expect(page.locator(".plan-grip")).toHaveCount(2);
const [bottom, top] = await gripCentres(page);
expect(bottom.x).toBeLessThan(top.x);
// Austritt nach oben: die Steighöhe wächst, der Antritt bleibt.
await dragGrip(page, top, -30);
const s1 = await stair();
expect(s1.totalRise).toBeGreaterThan(s0.totalRise + 0.02);
expect(s1.baseOffset).toBe(s0.baseOffset);
await undo(page);
await expect.poll(async () => (await stair()).totalRise).toBe(s0.totalRise);
// Antritt nach oben: Versatz über der Geschoss-Basis, der Austritt bleibt stehen.
await select(page, { stairs: ["tr-kern"] });
await expect(page.locator(".plan-grip")).toHaveCount(2);
const [bottom2] = await gripCentres(page);
await dragGrip(page, bottom2, -30);
const s2 = await stair();
expect(s2.baseOffset).toBeGreaterThan(s0.baseOffset + 0.02);
expect(s2.totalRise).toBe(s0.totalRise);
await undo(page);
await expect.poll(async () => (await stair()).baseOffset).toBe(s0.baseOffset);
});
test("Schnitt A-A: Sohle der Baugrube ziehen", async ({ page }) => {
+5
View File
@@ -3994,6 +3994,11 @@ pub struct Stair {
#[serde(rename = "totalRise", default, skip_serializing_if = "Option::is_none")]
#[ts(optional)]
pub total_rise: Option<f64>,
/// [187] Antrittsversatz in Metern: Höhe des Antritts über der Basis des Geschosses (negativ = darunter). Der
/// Austritt bleibt auf `totalRise` ab Geschoss-Basis, die Steigung ist `totalRise - baseOffset`. Fehlt es: 0.
#[serde(rename = "baseOffset", default, skip_serializing_if = "Option::is_none")]
#[ts(optional)]
pub base_offset: Option<f64>,
/// Anzahl der Steigungen (Setzstufen). Die Trittanzahl = stepCount (letzte =
/// Austritt aufs obere Geschoss). Steigungshöhe = totalRise / stepCount.
#[serde(rename = "stepCount")]
+3 -1
View File
@@ -170,7 +170,9 @@ impl Project {
_ if floor_height > 0.0 => floor_height,
_ => 2.6,
};
(base, base + rise)
// [187] Antritt über/unter der Geschoss-Basis; der Austritt bleibt bei `base + rise` (Mindeststeigung 5 cm).
let off = s.base_offset.filter(|o| o.is_finite()).unwrap_or(0.0).min(rise - 0.05);
(base + off, base + rise)
}
pub fn column_vertical_extent(&self, c: &Column) -> (f64, f64) {
+31 -2
View File
@@ -201,8 +201,16 @@ pub(super) fn clip_line_to_u(pts: &[[f64; 2]], lo: f64, hi: f64) -> Vec<Vec<[f64
/// `appendTerrainProfiles`.
/// [152]/[181] Geschlossene Gelände-Netze (z. B. IFC-Gelände als Platte): von ihren Schnittringen nur die Oberkante.
pub(super) fn append_terrain_profiles(out: &mut Output, p: &Project, base: (f64, f64), u: (f64, f64)) {
let terrains: Vec<&TerrainMesh> = p.context.as_deref().unwrap_or(&[]).iter().filter_map(|c| if let ContextObject::TerrainMesh(t) = c { Some(t) } else { None }).collect();
if terrains.is_empty() {
let ctx = p.context.as_deref().unwrap_or(&[]);
let terrains: Vec<&TerrainMesh> = ctx.iter().filter_map(|c| if let ContextObject::TerrainMesh(t) = c { Some(t) } else { None }).collect();
// [187]/[143] Höhenlinien-Sätze ohne daraus erzeugtes Gelände-Netz (`sourceId`): ihre Schnittpunkte mit der Ebene
// ergeben die Geländelinie.
let sets: Vec<&ContourSet> = ctx
.iter()
.filter_map(|c| if let ContextObject::ContourSet(s) = c { Some(s) } else { None })
.filter(|s| !terrains.iter().any(|t| t.source_id.as_deref() == Some(s.id.as_str())))
.collect();
if terrains.is_empty() && sets.is_empty() {
return;
}
let (mut lo, mut hi) = (f64::INFINITY, f64::NEG_INFINITY);
@@ -249,10 +257,31 @@ pub(super) fn append_terrain_profiles(out: &mut Output, p: &Project, base: (f64,
}
}
}
for set in sets {
let cs = contours_in(set);
let datum = crate::terrain::datum(p.reference_elevation_masl, &cs.iter().map(|c| c.z).collect::<Vec<_>>());
let pts: Vec<[f64; 2]> = crate::terrain::contour_crossings(&cs, [base.0, base.1], [u.0, u.1]).into_iter().map(|(s, z, _)| [s, z - datum]).collect();
if pts.len() < 2 {
continue;
}
out.terrain_id.get_or_insert_with(|| set.id.clone());
let parts = match range {
Some((lo, hi)) => clip_line_to_u(&pts, lo - TERRAIN_MARGIN, hi + TERRAIN_MARGIN),
None => vec![pts],
};
for pts in parts {
out.profiles.push(Profile { category: Some(set.category_code.clone()), pts, natural: false });
}
}
append_shoring(out, p, base, u, range);
append_earth(out, p, base, u);
}
/// Höhenlinien eines Satzes als Eingabe für `terrain.rs`.
pub(crate) fn contours_in(set: &ContourSet) -> Vec<crate::terrain::ContourIn> {
set.contours.iter().map(|c| crate::terrain::ContourIn { z: c.z, pts: c.pts.iter().map(|q| [q.x, q.y]).collect(), closed: c.closed }).collect()
}
/// [68] Verbauwände der Baugruben im Schnitt: das Wandband jeder verbauten Sohlkante (Dicke nach aussen) wird mit
/// der Schnittebene geschnitten; oben das gewachsene Gelände, unten Sohle minus Einbindetiefe. Bänder ausserhalb
/// der Schnittweite fallen weg.
+19
View File
@@ -1211,3 +1211,22 @@ fn schnitt_cache_kennt_ausgeblendete_klassen() {
assert_eq!(run(&[]), all);
assert_eq!(run(&["31"]), off);
}
/// [187]/[143] Höhenlinien-Satz (ohne Gelände-Netz): die Schnittpunkte mit der Ebene ergeben die Geländelinie, darunter
/// das Erdreich-Band mit Pick-Id des Satzes (Klasse = die des Satzes, `Profile::category`).
#[test]
fn hoehenlinien_ergeben_gelaendelinie_und_erdreich() {
let mut p = sample();
let ring = |x0: f64, x1: f64, z: f64| Contour { z, pts: vec![Vec2 { x: x0, y: -50.0 }, Vec2 { x: x1, y: -50.0 }, Vec2 { x: x1, y: 50.0 }, Vec2 { x: x0, y: 50.0 }], closed: true, ..Default::default() };
p.context = Some(vec![ContextObject::ContourSet(ContourSet { id: "hl".into(), name: "HL".into(), category_code: "02".into(), contours: vec![ring(-4.0, 8.0, -1.0), ring(-2.0, 7.0, -0.5), ring(-1.5, 6.5, 0.0)], ..Default::default() })]);
let l = p.drawing_levels.iter().find(|l| l.id == "schnitt-a").unwrap();
let text = serde_json::json!({ "level": serde_json::to_value(l).unwrap(), "scale": 50 }).to_string();
let run = |p: &Project| -> Vec<Primitive> {
let (prims, groups, _) = crate::plan::buf::decode(&section_plan_buf(p, &[0.0, 1.0, 7.0, 0.0], &text).unwrap()).unwrap();
prims[groups[0].0..groups[0].1].to_vec()
};
let g = run(&p);
let lines = g.iter().filter(|q| matches!(q, Primitive::Line { cls, .. } if cls == "section-terrain")).count();
assert_eq!(lines, 5, "6 Schnittpunkte = 5 Segmente");
assert!(g.iter().any(|q| matches!(q, Primitive::Polygon { context_object_id: Some(id), .. } if id == "hl")), "Erdreich mit Pick-Id");
}
+6 -2
View File
@@ -925,7 +925,10 @@ fn stair_selection(root: &Map<String, Value>, s: &Value) -> Result<J, String> {
} else {
2.6
};
let (zb, zt) = (base, base + rise);
// [187] Antrittsversatz: der Antritt liegt über/unter der Basis, der Austritt bleibt auf `base + rise`.
let offset = num_of(field(s, "baseOffset"));
let offset = if offset.is_finite() { offset.min(rise - 0.05) } else { 0.0 };
let (zb, zt) = (base + offset, base + rise);
let total_rise = zt - zb;
let typed: crate::model::Stair = serde_json::from_value(s.clone()).map_err(|e| format!("Treppe passt nicht zum Kern-Modell: {e}"))?;
// Wie die TS-Fassade: Geometrie flach, leer (Unsinn-Eingabe) = leere Geometrie, daraus die bbox.
@@ -954,7 +957,8 @@ fn stair_selection(root: &Map<String, Value>, s: &Value) -> Result<J, String> {
.raw("shape", s, "shape")
.raw("width", s, "width")
.raw("stepCount", s, "stepCount")
.n("totalRise", total_rise)
.n("totalRise", rise)
.n("baseOffset", offset)
.n("riserHeight", geo[0])
.n("treadDepth", geo[1])
.v("up", Value::Bool(field(s, "up") != Some(&Value::Bool(false))))
+98 -8
View File
@@ -12,9 +12,10 @@
//! | `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) |
//! | `stairTop` | Austrittshöhe (`totalRise`, ab Geschoss-Basis; Mindeststeigung 0.30 m über dem Antritt) |
//! | `stairBottom` | Antritt (`baseOffset` über der Geschoss-Basis); der Austritt bleibt stehen |
//! | `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 |
//! | `contourLine` | Höhe der Höhenlinie `index` eines Höhenlinien-Satzes (Blatt-Höhe + Bezugshöhe `datum` → Höhe der Linie) |
//!
//! 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
@@ -53,12 +54,14 @@ pub enum Kind {
ParapetTop,
/// Treppen-Austritt: `bottom` = Basis, `top` mindestens 0.30 m darüber.
StairTop,
/// Treppen-Antritt: `top` = Austritt bleibt, `bottom` höchstens 0.30 m darunter.
StairBottom,
}
impl Kind {
pub fn from_index(i: u32) -> Option<Kind> {
use Kind::*;
[WallTop, OpeningTop, OpeningBottom, WallBottom, CeilingTop, CeilingTopFixed, CeilingBottom, RoofEave, RoofTop, ParapetTop, StairTop].get(i as usize).copied()
[WallTop, OpeningTop, OpeningBottom, WallBottom, CeilingTop, CeilingTopFixed, CeilingBottom, RoofEave, RoofTop, ParapetTop, StairTop, StairBottom].get(i as usize).copied()
}
}
@@ -79,6 +82,7 @@ pub fn drag(kind: Kind, base: f64, top: f64, bottom: f64, y: f64, free: bool) ->
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),
Kind::StairBottom => (top, jsnum::min(top - MIN_STAIR, v)),
}
}
@@ -220,7 +224,7 @@ pub fn ops(lk: &Lookup, kind: &str, id: &str, y: f64, free: bool, new_id: &str,
};
if new == *r { vec![] } else { vec![replace("roofs", new)] }
}
"stairTop" => {
"stairTop" | "stairBottom" => {
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);
@@ -230,9 +234,16 @@ pub fn ops(lk: &Lookup, kind: &str, id: &str, y: f64, free: bool, new_id: &str,
_ 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)));
let off = Some(num_of(field(st, "baseOffset"))).filter(|o| o.is_finite()).unwrap_or(0.0);
let new = if kind == "stairTop" {
let z = target(y, free, b, base + cur);
let top = drag(Kind::StairTop, base, base + cur, base + off, z, true).0;
with(st, "totalRise", js_num(mm(top - base)))
} else {
let z = target(y, free, b, base + off);
let bottom = drag(Kind::StairBottom, base, base + cur, base + off, z, true).1;
with(st, "baseOffset", js_num(mm(bottom - base)))
};
if new == *st { vec![] } else { vec![replace("stairs", new)] }
}
"contextTop" | "contextBottom" | "contourLine" => {
@@ -241,7 +252,8 @@ pub fn ops(lk: &Lookup, kind: &str, id: &str, y: f64, free: bool, new_id: &str,
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)
// Der Schnitt zeichnet die Höhen abzüglich der Bezugshöhe (`datum`, wie das Gelände): zurückrechnen.
crate::cmd_context::contour_height(e, index as usize, v + contour_datum(root, e))
} else {
None
};
@@ -251,6 +263,35 @@ pub fn ops(lk: &Lookup, kind: &str, id: &str, y: f64, free: bool, new_id: &str,
}
}
/// Bezugshöhe, die der Schnitt von den Höhen eines Höhenlinien-Satzes abzieht (`terrain::datum` über alle Höhenlinien).
pub(crate) fn contour_datum(root: &Map<String, Value>, set: &Value) -> f64 {
let zs: Vec<f64> = arr(field(set, "contours")).iter().map(|c| num_of(field(c, "z"))).collect();
crate::terrain::datum(root.get("referenceElevationMasl").and_then(Value::as_f64), &zs)
}
/// [187] Griffe einer Höhenlinie im Schnitt: Schnittpunkte der Linien des Satzes mit der Schnittebene als
/// `[u, Blatt-Höhe, Index]` (je Punkt). Eingabe flach: `[Basis x, y, u-Richtung x, y, Bezug m ü. M. (NaN = keiner)]`, dann je
/// Linie `[z, geschlossen (0/1), Anzahl Punkte, x, y, …]`. Gleiche Bezugshöhe wie die Geländelinie des Schnitts; Unsinn → leer.
pub fn contour_marks(flat: &[f64]) -> Vec<f64> {
if flat.len() < 5 || flat[..4].iter().any(|v| !v.is_finite()) {
return vec![];
}
let (base, u, reference) = ([flat[0], flat[1]], [flat[2], flat[3]], Some(flat[4]).filter(|r| !r.is_nan()));
let mut cs = Vec::new();
let mut i = 5;
while i + 3 <= flat.len() {
let (z, closed, n) = (flat[i], flat[i + 1] != 0.0, flat[i + 2]);
if !(n >= 0.0 && n.fract() == 0.0) || i + 3 + 2 * (n as usize) > flat.len() {
return vec![];
}
let pts = flat[i + 3..i + 3 + 2 * (n as usize)].chunks_exact(2).map(|c| [c[0], c[1]]).collect();
cs.push(crate::terrain::ContourIn { z, pts, closed });
i += 3 + 2 * (n as usize);
}
let datum = crate::terrain::datum(reference, &cs.iter().map(|c| c.z).collect::<Vec<_>>());
crate::terrain::contour_crossings(&cs, base, u).into_iter().flat_map(|(s, z, k)| [s, z - datum, k as f64]).collect()
}
/// 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.
@@ -498,6 +539,55 @@ mod tests {
assert!(run_roof("contextTop", "tm", 502.0, 502.0, f64::NAN).is_empty());
}
#[test]
fn treppe_antritt_setzt_den_versatz() {
// Antritt auf 0.5 über der Basis; der Austritt (totalRise) bleibt.
let e = entity(&run_roof("stairBottom", "s1", 0.5, f64::NAN, f64::NAN));
assert_eq!(e["baseOffset"], json!(0.5));
assert!(e.get("totalRise").is_none());
// Unter die Basis ist erlaubt (Antritt im Keller); über dem Austritt: Mindeststeigung 0.30 (Geschosshöhe 2.6).
assert_eq!(entity(&run_roof("stairBottom", "s1", -0.4, f64::NAN, f64::NAN))["baseOffset"], json!(-0.4));
assert_eq!(entity(&run_roof("stairBottom", "s1", 9.0, f64::NAN, f64::NAN))["baseOffset"], json!(2.3));
// Relativ: Griff stand auf 0.2, Zug auf 0.6 → +0.4.
assert_eq!(entity(&run_roof("stairBottom", "s1", 0.6, 0.2, f64::NAN))["baseOffset"], json!(0.4));
assert_eq!(entity(&run_roof("stairBottom", "s1", 0.0, f64::NAN, f64::NAN))["baseOffset"], json!(0));
assert!(run_roof("stairBottom", "s2", 0.5, f64::NAN, f64::NAN).is_empty(), "gesperrt");
// Der Austritt hält den Abstand zum Antritt: totalRise nie unter Antritt + 0.30.
let r = {
let mut r = roof_root();
r["stairs"][0]["baseOffset"] = json!(1.0);
r
};
let ops = ops(&Lookup::plain(&r), "stairTop", "s1", 0.5, false, "", &Value::Null, f64::NAN, f64::NAN);
assert_eq!(entity(&ops)["totalRise"], json!(1.3));
}
#[test]
fn hoehenlinien_griffe_im_schnitt() {
// Schnitt entlang x durch y = 5: zwei Linien (z 500 offen, z 501 geschlossen) kreuzen ihn.
let mut f = vec![0.0, 5.0, 1.0, 0.0, f64::NAN];
f.extend([500.0, 0.0, 2.0, 2.0, 0.0, 2.0, 10.0]); // senkrecht bei x = 2
f.extend([501.0, 1.0, 4.0, 6.0, 0.0, 9.0, 0.0, 9.0, 10.0, 6.0, 10.0]); // Rechteck x 6..9: Kreuzungen bei 6 und 9
let m = contour_marks(&f);
assert_eq!(m, vec![2.0, 500.0, 0.0, 6.0, 501.0, 1.0, 9.0, 501.0, 1.0]);
// Bezug 500: Blatt-Höhen 0 und 1.
f[4] = 500.0;
let m = contour_marks(&f);
assert_eq!(m.chunks(3).map(|c| c[1]).collect::<Vec<_>>(), vec![0.0, 1.0, 1.0]);
assert!(contour_marks(&[1.0]).is_empty());
assert!(contour_marks(&[0.0, 0.0, 1.0, 0.0, f64::NAN, 5.0, 0.0, 99.0]).is_empty(), "Punktzahl über das Ende");
assert!(contour_marks(&[f64::NAN, 0.0, 1.0, 0.0, f64::NAN]).is_empty());
}
#[test]
fn hoehenlinie_mit_bezugshoehe() {
// Bezug 500 m ü. M.: der Schnitt zeigt 501 als 1.0 — Zug auf Blatt-Höhe 3.0 setzt die Linie auf 503.
let mut r = roof_root();
r.insert("referenceElevationMasl".into(), json!(500));
let ops = ops(&Lookup::plain(&r), "contourLine", "hl", 3.0, false, "", &Value::Null, f64::NAN, 1.0);
assert_eq!(entity(&ops)["contours"][1]["z"], json!(503));
}
#[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.
+33
View File
@@ -735,6 +735,39 @@ pub struct ContourIn {
pub closed: bool,
}
/// [187] Schnittpunkte der Höhenlinien mit der senkrechten Ebene durch `base` in Richtung `u` (Einheitsvektor):
/// `(u, Höhe der Linie, Index der Linie)`, nach `u` sortiert (Lage entlang der Schnittlinie, wie die Schnittblätter
/// sie führen). Eine Ecke genau auf der Ebene zählt einmal; Linien in der Ebene schneiden nicht.
pub fn contour_crossings(contours: &[ContourIn], base: P2, u: P2) -> Vec<(f64, f64, usize)> {
let mut out = Vec::new();
if ![base[0], base[1], u[0], u[1]].iter().all(|v| v.is_finite()) {
return out;
}
let side = |p: P2| (p[0] - base[0]) * u[1] - (p[1] - base[1]) * u[0];
let along = |p: P2| (p[0] - base[0]) * u[0] + (p[1] - base[1]) * u[1];
for (i, c) in contours.iter().enumerate() {
if !c.z.is_finite() {
continue;
}
let n = c.pts.len();
let segs = if c.closed && n > 2 { n } else { n.saturating_sub(1) };
for k in 0..segs {
let (a, b) = (c.pts[k], c.pts[(k + 1) % n]);
if !(a[0].is_finite() && a[1].is_finite() && b[0].is_finite() && b[1].is_finite()) {
continue;
}
let (da, db) = (side(a), side(b));
if (da < 0.0) == (db < 0.0) {
continue;
}
let t = da / (da - db);
out.push((along(a) + (along(b) - along(a)) * t, c.z, i));
}
}
out.sort_by(|a, b| a.0.total_cmp(&b.0));
out
}
/// Optionen: `smooth` = Glättungsstufen (0 = reines TIN mit Bruchkanten), `max_edge` = Verdichtung und
/// grösste Kante (≤ 0 → automatisch), `breaklines` = Konturen erzwingen.
#[derive(Clone, Copy, Debug)]
+9 -2
View File
@@ -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, 7 Traufe, 8 First, 9 Attika, 10 Treppen-Austritt): 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, 11 Treppen-Antritt): 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> {
@@ -121,6 +121,13 @@ pub fn grip_sheet_height(kind: u32, base: f64, top: f64, bottom: f64, y: f64, fr
vec![t, b]
}
/// Griffe der Höhenlinien im Schnitt ([187], `sheet_height::contour_marks`): `[u, Blatt-Höhe, Linien-Index]` je
/// Schnittpunkt; `[]` bei Unsinn.
#[wasm_bindgen]
pub fn grip_contour_marks(flat: &[f64]) -> Vec<f64> {
crate::sheet_height::contour_marks(flat)
}
/// Fang einer Blatt-Höhe `y` auf die nächste Kote aus `levels` innerhalb `tol` (Meter): die Kote, sonst `y`.
#[wasm_bindgen]
pub fn grip_snap_height(y: f64, levels: &[f64], tol: f64) -> f64 {
@@ -210,7 +217,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(11, 0.0, 1.0, 0.0, 1.0, false).is_empty());
assert!(grip_sheet_height(12, 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]);
}
+1 -1
View File
@@ -74,7 +74,7 @@ export { arcApex, drawingVertices, gripPt, openEdges, polylineEdgeGrips, ringEdg
export { verticalExtents } from "../geometry/grips";
export type { VerticalExtent } from "../geometry/grips";
export type { GripRequest, RingKind } from "../geometry/grips";
export { clampInside, coincidentGripPoints, excavationGripPoints, gripArcWallRadius, gripArcWallResize, gripArcWallTarget, gripAxisLock, gripEdgeTarget, gripPolar, gripPolarPoint, openingGripPoint, openingSheetSlide, openingTypedPosition, sheetHeightDrag, snapSheetHeight, stairMoveHandle, stairParamPoints, wallGripPoints } from "../geometry/gripDrag";
export { clampInside, coincidentGripPoints, excavationGripPoints, gripArcWallRadius, gripArcWallResize, gripArcWallTarget, gripAxisLock, gripEdgeTarget, gripPolar, gripPolarPoint, openingGripPoint, openingSheetSlide, openingTypedPosition, contourMarks, sheetHeightDrag, snapSheetHeight, stairMoveHandle, stairParamPoints, wallGripPoints } from "../geometry/gripDrag";
export type { EdgeDrive, GripLocks, SheetHeightKind } from "../geometry/gripDrag";
export { openingPreviewProject, openingPreviewSvgs } from "../plan/openingPreview";
export type { OpeningPreviewSvgs } from "../plan/openingPreview";
+24 -2
View File
@@ -112,10 +112,10 @@ export function gripEdgeTarget(edge: EdgeGrip, raw: Vec2, d: EdgeDrive = {}): Ve
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";
| "roofEave" | "roofTop" | "parapetTop" | "stairTop" | "stairBottom" | "contextTop" | "contextBottom" | "contourLine";
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;
roofEave: 7, roofTop: 8, parapetTop: 9, stairTop: 10, stairBottom: 11, contextTop: 4, contextBottom: 7, contourLine: 4 } 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
@@ -134,6 +134,28 @@ export function sheetHeightDrag(
return f.length ? { top: f[0], bottom: f[1] } : { top: g.top, bottom: g.bottom };
}
/**
* [187] Griffe der Höhenlinien eines Satzes im Schnitt: Schnittpunkte der Linien mit der Schnittebene (Punkt `base` im
* Grundriss, Richtung `uAxis`) als Blatt-Koordinate `{ u, z }` samt Index der Linie im Satz. Gleiche Rechnung und Bezugshöhe
* wie die Geländelinie des Schnitts (Kern `sheet_height::contour_marks`).
*/
export function contourMarks(
contours: readonly { z: number; closed: boolean; pts: readonly Vec2[] }[],
base: Vec2,
uAxis: Vec2,
referenceMasl: number | undefined,
): { u: number; z: number; index: number }[] {
const flat: number[] = [base.x, base.y, uAxis.x, uAxis.y, referenceMasl ?? NaN];
for (const c of contours) {
flat.push(c.z, c.closed ? 1 : 0, c.pts.length);
for (const q of c.pts) flat.push(q.x, q.y);
}
const f = core().grip_contour_marks(Float64Array.from(flat));
const out: { u: number; z: number; index: number }[] = [];
for (let i = 0; i + 2 < f.length; i += 3) out.push({ u: f[i], z: f[i + 1], index: f[i + 2] });
return out;
}
/** Fang einer Blatt-Höhe auf die nächste Kote aus `levels` innerhalb `tol` Metern. */
export function snapSheetHeight(y: number, levels: readonly number[], tol: number): number {
return core().grip_snap_height(y, Float64Array.from(levels), tol);
+1 -1
View File
@@ -57,7 +57,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; b?: number; free?: boolean; newId: string; newName: string }
| { op: "sheetHeight"; kind: SheetHeightKind; id: string; a: number; b?: number; index?: 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 }
+1
View File
@@ -901,6 +901,7 @@ export const de = {
"objinfo.stair.profile.flach": "Flachstahl",
"objinfo.stair.steps": "Stufenanzahl",
"objinfo.stair.rise": "Steighöhe (gesamt)",
"objinfo.stair.baseOffset": "Antritt über Geschoss-Basis",
"objinfo.stair.riser": "Steigungshöhe",
"objinfo.stair.tread": "Auftrittstiefe",
"objinfo.stair.concreteVolume": "Betonvolumen Lauf",
+1
View File
@@ -885,6 +885,7 @@ export const en: Record<TranslationKey, string> = {
"objinfo.stair.profile.flach": "Flat bar",
"objinfo.stair.steps": "Step count",
"objinfo.stair.rise": "Total rise",
"objinfo.stair.baseOffset": "Start above floor base",
"objinfo.stair.riser": "Riser height",
"objinfo.stair.tread": "Tread depth",
"objinfo.stair.concreteVolume": "Concrete volume (flight)",
+5
View File
@@ -3512,6 +3512,11 @@ export type Stair = {
* beim Auflösen die Geschosshöhe des zugehörigen Geschosses.
*/
totalRise?: number;
/**
* [187] Antrittsversatz in Metern: Höhe des Antritts über der Basis des Geschosses (negativ = darunter). Der
* Austritt bleibt auf `totalRise` ab Geschoss-Basis, die Steigung ist `totalRise - baseOffset`. Fehlt es: 0.
*/
baseOffset?: number;
/**
* Anzahl der Steigungen (Setzstufen). Die Trittanzahl = stepCount (letzte =
* Austritt aufs obere Geschoss). Steigungshöhe = totalRise / stepCount.
+2
View File
@@ -551,6 +551,8 @@ export interface PanelHostValue {
onSetStairSteps: (stepCount: number) => void;
/** Setzt die Gesamt-Steighöhe (Meter, OKFF → OKFF). */
onSetStairRise: (totalRise: number) => void;
/** [187] Antritt über/unter der Geschoss-Basis (Meter). */
onSetStairBaseOffset: (baseOffset: number) => void;
/** Setzt die Laufrichtung (aufwärts/abwärts). */
onSetStairUp: (up: boolean) => void;
/** Setzt die Pfeil-Darstellung (offener Winkel- vs. gefüllter Vollpfeil). */
+5
View File
@@ -259,6 +259,11 @@ export function StairSection({
value={stair.totalRise}
onCommit={(v) => host.onSetStairRise(v)}
/>
<DimensionField
label={t("objinfo.stair.baseOffset")}
value={stair.baseOffset ?? 0}
onCommit={(v) => host.onSetStairBaseOffset(v)}
/>
{/* Abgeleitete Werte (read-only). */}
<div className="objinfo-field">
@@ -212,6 +212,9 @@ export function buildElementAttributesHost(c: FlatHostOpts) {
if (selection?.kind === "stair" && totalRise > 0)
updateStair(selection.id, { totalRise });
},
onSetStairBaseOffset: (baseOffset) => {
if (selection?.kind === "stair" && Number.isFinite(baseOffset)) updateStair(selection.id, { baseOffset });
},
onSetStairUp: (up) => {
if (selection?.kind === "stair") updateStair(selection.id, { up });
},
+3 -3
View File
@@ -423,7 +423,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, from?: number) => void;
sheetHeightGrip: (kind: SheetHeightKind, id: string, y: number, free?: boolean, from?: number, index?: number) => void;
// ── Öffnungs-Editieren (Object-Info-Panel) ────────────────────────────────
/** Generischer immutabler Patch auf eine Öffnung (per ID). */
@@ -1323,14 +1323,14 @@ export function createProjectSlice(
newName: t("default.ceilingTypeSingle", { thickness: thickness.toFixed(2) }),
}),
sheetHeightGrip: (kind, id, y, free, from) =>
sheetHeightGrip: (kind, id, y, free, from, index) =>
applyGrip({
op: "sheetHeight",
kind,
id,
a: y,
b: from, // Griffhöhe vor dem Zug: Dach, Treppe, Gelände zählen den Zug relativ
index, // Höhenlinie `contourLine`
free: !!free,
newId: `ct-${Date.now()}`,
newName: t("default.ceilingTypeSingle", { thickness: "{t}" }), // {t} setzt der Kern ein
+3 -1
View File
@@ -268,8 +268,10 @@ export interface StairInfo {
width: number;
/** Stufenanzahl (Setzstufen). */
stepCount: number;
/** Gesamt-Steighöhe (Meter, OKFF → OKFF). */
/** Austrittshöhe ab Geschoss-Basis (Meter; ohne Antrittsversatz die Gesamt-Steighöhe OKFF → OKFF). */
totalRise: number;
/** [187] Antritt über (negativ: unter) der Geschoss-Basis (Meter); die Steigung ist totalRise − baseOffset. */
baseOffset: number;
/** Abgeleitete Steigungshöhe (Meter) = totalRise / stepCount. */
riserHeight: number;
/** Abgeleitete Auftrittstiefe (Meter). */
+5 -2
View File
@@ -38,7 +38,9 @@ declare global {
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 }[];
stairs: { id: string; totalRise: number; baseOffset: number }[];
/** [187] Höhe je Höhenlinie der Höhenlinien-Sätze. */
contours: { id: string; zs: number[] }[];
excavations: { id: string; bottom: number }[];
};
/** [144] Auswahl setzen (wie ein Klick), z. B. `{ openings: ["D1"] }`. */
@@ -108,7 +110,8 @@ export function installTestHooks(): void {
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 })),
stairs: (p.stairs ?? []).map((st) => ({ id: st.id, totalRise: st.totalRise ?? NaN, baseOffset: st.baseOffset ?? 0 })),
contours: (p.context ?? []).flatMap((c) => (c.type === "contourSet" ? [{ id: c.id, zs: c.contours.map((k) => k.z) }] : [])),
excavations: (p.context ?? []).flatMap((c) => (c.type === "excavation" ? [{ id: c.id, bottom: c.bottom }] : [])),
};
},
+24 -10
View File
@@ -29,6 +29,7 @@ import {
openingSheetSlide,
openingTypedPosition,
sheetHeightDrag,
contourMarks,
snapSheetHeight,
stairMoveHandle,
stairParamPoints,
@@ -96,7 +97,7 @@ export function useGripEditing(opts: {
* Schnitt-u-Achse `uAxis` (Grundriss, Einheit) aufs Bauteil übertragen, die
* Vorschau zeigt die verschobenen Schnittflächen im Blatt.
*/
sheet?: { levelId: string; uAxis: Vec2 } | null;
sheet?: { levelId: string; uAxis: Vec2; /** Punkt der Schnittlinie im Grundriss (u = 0). */ base?: Vec2 } | null;
visibleCodes: Set<string>;
/** Papier-Massstab (1:N) — die Bemassungs-Griffe hängen daran (Papier-mm). */
scaleDenominator: number;
@@ -109,7 +110,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, from?: number) => void;
sheetHeightGrip: (kind: SheetHeightKind, id: string, y: number, free?: boolean, from?: number, index?: 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;
@@ -294,6 +295,8 @@ export function useGripEditing(opts: {
bottom: number;
/** Decke mit gebundener Unterkante: die Oberkante ändert dann die Dicke statt die Platte zu verschieben. */
bottomFixed?: boolean;
/** Höhenlinie (`contourLine`): Index im Satz. */
index?: number;
};
// [187] Höhen-Griffe im Schnitt/in der Ansicht: Wand (Ober-/Unterkante), Öffnung (Brüstung, Sturz), Decke (Ober-/
// Unterkante). Breite (u, entlang der Schnittlinie) aus den gezeichneten Umrissen, Höhen (v) aus dem Modell; die
@@ -357,18 +360,29 @@ export function useGripEditing(opts: {
}
return out;
}
// Treppe: Austrittshöhe (Steighöhe ab Geschoss-Basis; der Antritt liegt im Modell fest auf der Basis).
// Treppe: Austritt (Steighöhe ab Geschoss-Basis) oben rechts, Antritt (`baseOffset`) unten links. Der Kern zählt beide
// Züge relativ zur gezeichneten Kante.
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 }];
const common = { id: st.id, u0: bb.u0, u1: bb.u1, base: bb.v0, top: bb.v1, bottom: bb.v0 };
return [
{ kind: "stairTop", pt: { x: bb.u1, y: bb.v1 }, ...common },
{ kind: "stairBottom", pt: { x: bb.u0, y: bb.v0 }, ...common },
];
}
// 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.
// Gelände: Netz (Oberkante des Profils) bzw. Baugrube (Sohle) um die Differenz versetzen; Höhenlinien-Satz: ein Griff
// je Schnittpunkt einer Linie mit der Schnittebene (Höhe der Linie ändern).
if (selection.contextObjects.length === 1) {
const o = (project.context ?? []).find((c) => c.id === selection.contextObjects[0]);
if (!o) return [];
if (o.type === "contourSet") {
if (!sheet.base) return [];
return contourMarks(o.contours, sheet.base, sheet.uAxis, project.referenceElevationMasl).map((m) => ({
kind: "contourLine" as const, pt: { x: m.u, y: m.z }, id: o.id, u0: m.u, u1: m.u, base: m.z, top: m.z, bottom: m.z, index: m.index,
}));
}
if (o.type === "terrainMesh" || o.type === "importedMesh") {
const bb = bbox("context", o.id);
if (!bb) return [];
@@ -812,7 +826,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; from: number } | null>(null);
const pendingSheetHeightRef = useRef<{ kind: SheetHeightKind; id: string; y: number; free: boolean; from: number; index?: 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). */
@@ -1151,7 +1165,7 @@ export function useGripEditing(opts: {
}
const ins = gripOwners[index];
// [191] Scheitel-Griff einer Bogenkante: Bulge live, ein Undo-Schritt je Zug.
if (modelEditable && ins?.arcSeg != null && ins.ring && ins.ring.kind !== "excavation" && ins.ring.kind !== "polyline") {
if (modelEditable && ins?.arcSeg != null && ins.ring && ins.ring.kind !== "excavation" && ins.ring.kind !== "polyline" && ins.ring.kind !== "contours") {
storeState().setRingArc(ins.ring.kind, ins.ring.id, ins.arcSeg, pt);
return;
}
@@ -1343,7 +1357,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, ph.from);
if (ph) sheetHeightGrip(ph.kind, ph.id, ph.y, ph.free, ph.from, ph.index);
const pc = pendingContourRef.current;
pendingContourRef.current = null;
if (pc) {
@@ -1625,7 +1639,7 @@ export function useGripEditing(opts: {
const z = g.kind.endsWith("Top") ? top : bottom;
// 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 };
pendingSheetHeightRef.current = { kind: g.kind, id: g.id, y, free, from: g.pt.y, index: g.index };
sheetDragRef.current = { z };
setDraft({
preview: [{
+1 -1
View File
@@ -73,7 +73,7 @@ export function useGripInputs(opts: {
if (!plane) return null;
const u = sectionUAxisModel(plane);
const len = Math.hypot(u.x, u.y) || 1;
return { levelId: activeLevel.id, uAxis: { x: u.x / len, y: u.y / len } };
return { levelId: activeLevel.id, uAxis: { x: u.x / len, y: u.y / len }, base: { x: plane.point[0], y: plane.point[2] } };
}, [activeLevel]);
// Snap ohne Entwurfspunkte (Griff-Ziehen, s. useGripEditing).