Merge branch 'worktree-agent-adb08c89c338dbe82' into claude/practical-noether-1hb2s1
This commit is contained in:
26 files changed
+675
-37
No files matched your search
+1
-1
@@ -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";
|
||||
|
||||
@@ -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" | "stairBottom" | "contextTop" | "contextBottom" | "contourLine";
|
||||
|
||||
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, 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
|
||||
@@ -130,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);
|
||||
|
||||
@@ -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; 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 }
|
||||
|
||||
@@ -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",
|
||||
@@ -2338,6 +2339,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",
|
||||
|
||||
@@ -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)",
|
||||
@@ -2326,6 +2327,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",
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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). */
|
||||
|
||||
@@ -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 });
|
||||
},
|
||||
|
||||
@@ -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) => 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,12 +1323,14 @@ export function createProjectSlice(
|
||||
newName: t("default.ceilingTypeSingle", { thickness: thickness.toFixed(2) }),
|
||||
}),
|
||||
|
||||
sheetHeightGrip: (kind, id, y, free) =>
|
||||
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
|
||||
|
||||
@@ -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). */
|
||||
|
||||
@@ -36,6 +36,12 @@ 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; 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"] }`. */
|
||||
select: (patch: Record<string, string[]>) => void;
|
||||
@@ -100,6 +106,13 @@ 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, 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 }] : [])),
|
||||
};
|
||||
},
|
||||
wallWeights: () => Object.fromEntries(getState().project.walls.flatMap((w) => (w.strokeWeight === undefined ? [] : [[w.id, w.strokeWeight]]))),
|
||||
|
||||
+81
-11
@@ -29,6 +29,7 @@ import {
|
||||
openingSheetSlide,
|
||||
openingTypedPosition,
|
||||
sheetHeightDrag,
|
||||
contourMarks,
|
||||
snapSheetHeight,
|
||||
stairMoveHandle,
|
||||
stairParamPoints,
|
||||
@@ -40,7 +41,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";
|
||||
@@ -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) => 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,21 +295,24 @@ 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
|
||||
// Ä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.
|
||||
@@ -338,6 +342,67 @@ 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: 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 [];
|
||||
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-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 [];
|
||||
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);
|
||||
@@ -761,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 } | 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). */
|
||||
@@ -1292,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);
|
||||
if (ph) sheetHeightGrip(ph.kind, ph.id, ph.y, ph.free, ph.from, ph.index);
|
||||
const pc = pendingContourRef.current;
|
||||
pendingContourRef.current = null;
|
||||
if (pc) {
|
||||
@@ -1572,7 +1637,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, index: g.index };
|
||||
sheetDragRef.current = { z };
|
||||
setDraft({
|
||||
preview: [{
|
||||
@@ -1582,7 +1649,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")}` : ""),
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -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).
|
||||
|
||||
@@ -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