[280] Träger/Unterzug als eigenes Bauteil: Project.beams, Plan (gestrichelt mit Achse), Schnitt, Ansicht, 3D, IFC IfcBeam, DXF, Befehl traeger, Objekt-Info, Griffe, Beispiel Musterhaus komplex
This commit is contained in:
97 files changed
+1479
-81
No files matched your search
@@ -115,6 +115,7 @@ const CHANNELS: [keyof Project, SelectionKind][] = [
|
||||
["rooms", "rooms"],
|
||||
["extrudedSolids", "solids"],
|
||||
["columns", "columns"],
|
||||
["beams", "columns"], // [280] Träger liegen im Auswahlkanal der Stützen
|
||||
["roofs", "roofs"],
|
||||
["context", "contextObjects"],
|
||||
];
|
||||
|
||||
@@ -125,6 +125,7 @@ export function hasContent(p: Project): boolean {
|
||||
(p.stairs?.length ?? 0) > 0 ||
|
||||
(p.rooms?.length ?? 0) > 0 ||
|
||||
(p.columns?.length ?? 0) > 0 ||
|
||||
(p.beams?.length ?? 0) > 0 ||
|
||||
(p.extrudedSolids?.length ?? 0) > 0 ||
|
||||
(p.context?.length ?? 0) > 0
|
||||
);
|
||||
|
||||
@@ -29,7 +29,7 @@ export function isLocked(project: Project, kind: MemberKind, id: string): boolea
|
||||
case "stairIds":
|
||||
return !!(project.stairs ?? []).find((s) => s.id === id)?.locked;
|
||||
case "columnIds":
|
||||
return !!(project.columns ?? []).find((c) => c.id === id)?.locked;
|
||||
return !!((project.columns ?? []).find((c) => c.id === id)?.locked || (project.beams ?? []).find((c) => c.id === id)?.locked);
|
||||
case "roofIds":
|
||||
return !!(project.roofs ?? []).find((r) => r.id === id)?.locked;
|
||||
case "openingIds":
|
||||
@@ -55,7 +55,7 @@ export function lockOps(project: Project, kind: MemberKind, id: string, locked:
|
||||
case "stairIds":
|
||||
return patchItem(project, "stairs", id, { locked });
|
||||
case "columnIds":
|
||||
return patchItem(project, "columns", id, { locked });
|
||||
return [...patchItem(project, "columns", id, { locked }), ...patchItem(project, "beams", id, { locked })];
|
||||
case "roofIds":
|
||||
return patchItem(project, "roofs", id, { locked });
|
||||
case "openingIds":
|
||||
|
||||
@@ -63,6 +63,12 @@ export function buildElementAttributesHost(c: FlatHostOpts) {
|
||||
else if (collection === "rooms") updateRoom(id, patch);
|
||||
else mapAll(collection, id, (e) => ({ ...(e as object), ...patch }) as typeof e, coalesceKey);
|
||||
}
|
||||
/** [280] Patch auf alle gewählten Träger (Träger liegen im Auswahlkanal `columns`); ein Undo-Schritt. */
|
||||
function patchBeams(id: string, patch: Record<string, unknown>): void {
|
||||
const sel = getState().selection.columns;
|
||||
const ids = sel.length > 1 && sel.includes(id) ? sel : [id];
|
||||
applyChange((p) => patchItems(p, "beams", ids, (e) => ({ ...e, ...patch }) as typeof e));
|
||||
}
|
||||
return {
|
||||
// ── Wand-Attribute (nur bei selektierter Wand) ─────────────────────────
|
||||
onSetWallReferenceLine: (ref) => {
|
||||
@@ -400,6 +406,23 @@ export function buildElementAttributesHost(c: FlatHostOpts) {
|
||||
if (selection?.kind !== "column" || !(height > 0)) return;
|
||||
patchAll("columns", selection.id, { height });
|
||||
},
|
||||
// ── [280] Träger-Attribute (nur bei selektiertem Träger; Auswahlkanal der Stützen) ──────────────
|
||||
onSetBeamWidth: (width) => {
|
||||
if (selection?.kind !== "beam" || !(width > 0)) return;
|
||||
patchBeams(selection.id, { width });
|
||||
},
|
||||
onSetBeamHeight: (height) => {
|
||||
if (selection?.kind !== "beam" || !(height > 0)) return;
|
||||
patchBeams(selection.id, { height });
|
||||
},
|
||||
onSetBeamTopOffset: (offset) => {
|
||||
if (selection?.kind !== "beam" || !Number.isFinite(offset)) return;
|
||||
patchBeams(selection.id, { topOffset: Math.abs(offset) > 1e-9 ? offset : undefined });
|
||||
},
|
||||
onSetBeamProfileName: (name) => {
|
||||
if (selection?.kind !== "beam") return;
|
||||
patchBeams(selection.id, { profileName: name.trim() || undefined });
|
||||
},
|
||||
onSetColumnRotation: (deg) => {
|
||||
if (selection?.kind !== "column" || !Number.isFinite(deg)) return;
|
||||
patchAll("columns", selection.id, { rotation: (deg * Math.PI) / 180 });
|
||||
|
||||
@@ -23,7 +23,7 @@ function singleTransformSel(kind: string, id: string): TransformSelection | null
|
||||
if (kind === "wall") return { wallIds: [id], drawingId: null };
|
||||
if (kind === "drawing2d") return { wallIds: [], drawingId: id };
|
||||
if (kind === "extrudedSolid") return { wallIds: [], drawingId: null, extrudedSolidId: id };
|
||||
if (kind === "column") return { wallIds: [], drawingId: null, columnId: id };
|
||||
if (kind === "column" || kind === "beam") return { wallIds: [], drawingId: null, columnId: id };
|
||||
if (kind === "ceiling") return { wallIds: [], drawingId: null, ceilingIds: [id] };
|
||||
// Dach: Move geht (Umriss verschiebt sich), Rotate no-opt bewusst (s.
|
||||
// TransformSelection.roofIds) — der Host-Aufruf degradiert dafür von
|
||||
@@ -367,6 +367,9 @@ export function buildSelectionStyleHost(c: FlatHostOpts) {
|
||||
case "column":
|
||||
applyChange((p) => patchItem(p, "columns", id, { categoryCode: code }));
|
||||
break;
|
||||
case "beam": // [280]
|
||||
applyChange((p) => patchItem(p, "beams", id, { categoryCode: code }));
|
||||
break;
|
||||
// [181] Gelände-/Umgebungs-Elemente (Netzkörper, Gelände, Höhenlinien, Luftbild, Baugrube) wie jedes Element.
|
||||
case "contextObject":
|
||||
applyChange((p) => patchItem(p, "context", id, { categoryCode: code }));
|
||||
@@ -394,6 +397,9 @@ export function buildSelectionStyleHost(c: FlatHostOpts) {
|
||||
case "column":
|
||||
applyChange((p) => patchItem(p, "columns", id, { floorId: levelId }));
|
||||
break;
|
||||
case "beam": // [280]
|
||||
applyChange((p) => patchItem(p, "beams", id, { floorId: levelId }));
|
||||
break;
|
||||
default: break; // opening: Ebene kommt aus der Wirts-Wand
|
||||
}
|
||||
},
|
||||
|
||||
@@ -41,6 +41,7 @@ export function buildSiteHost(c: FlatHostOpts) {
|
||||
Extrusion: "solids",
|
||||
Dach: "roofs",
|
||||
Stütze: "columns",
|
||||
Träger: "columns", // [280] Träger liegen im Auswahlkanal der Stützen
|
||||
};
|
||||
const k = kindOf[kind];
|
||||
setSelection({ ...clearKinds(), ...(k ? { [k]: [id] } : {}) });
|
||||
|
||||
@@ -392,6 +392,8 @@ export interface ProjectSlice {
|
||||
moveSectionLineGrip: (id: string, index: number, pt: Vec2, coalesceKey?: string) => void;
|
||||
/** [213] Griff einer Kamera: 0 = Standpunkt, 1 = Ziel, 2 = Bildwinkel/Sichtbreite. */
|
||||
moveCameraGrip: (id: string, index: number, pt: Vec2) => void;
|
||||
/** [280] Träger: Griff 0 Anfang, 1 Ende, 2 Mitte (verschiebt den Träger), Kern `grips.rs`. */
|
||||
moveBeamGrip: (id: string, index: number, pt: Vec2) => void;
|
||||
/** [176] Knick in Segment `seg` (Mittel-Griff) einfügen; `coalesceKey` fasst den anschliessenden Zug zusammen. */
|
||||
insertSectionBend: (id: string, seg: number, pt: Vec2, coalesceKey?: string) => void;
|
||||
/** [176] Knick löschen (`index` wie bei {@link moveSectionLineGrip}; Anfang/Ende lassen sich nicht löschen). */
|
||||
@@ -1307,6 +1309,7 @@ export function createProjectSlice(
|
||||
moveSectionLineGrip: (id, index, pt, coalesceKey) =>
|
||||
applyGrip({ op: "sectionLineGrip", id, index, pt: gripPt(pt) }, coalesceKey ?? `moveSectionLineGrip:${id}:${index}`),
|
||||
moveCameraGrip: (id, index, pt) => applyGrip({ op: "cameraGrip", id, index, pt: gripPt(pt) }, `moveCameraGrip:${id}:${index}`),
|
||||
moveBeamGrip: (id, index, pt) => applyGrip({ op: "beamGrip", id, index, pt: gripPt(pt) }, `moveBeamGrip:${id}:${index}`),
|
||||
insertSectionBend: (id, seg, pt, coalesceKey) => applyGrip({ op: "sectionBendInsert", id, seg, pt: gripPt(pt) }, coalesceKey),
|
||||
deleteSectionBend: (id, index) => applyGrip({ op: "sectionBendDelete", id, index }),
|
||||
moveRingVertex: (kind, id, index, pt, coalesceKey) => {
|
||||
|
||||
@@ -23,7 +23,8 @@ export function selectAllIds(project: Project, levelId: string): Partial<Selecti
|
||||
const stairIds = (project.stairs ?? []).filter((s) => s.floorId === levelId).map((s) => s.id);
|
||||
const roomIds = (project.rooms ?? []).filter((r) => r.floorId === levelId).map((r) => r.id);
|
||||
const solids = (project.extrudedSolids ?? []).filter((s) => s.levelId === levelId).map((s) => s.id);
|
||||
const columnIds = (project.columns ?? []).filter((c) => c.floorId === levelId).map((c) => c.id);
|
||||
// [280] Träger liegen im Auswahlkanal der Stützen.
|
||||
const columnIds = [...(project.columns ?? []), ...(project.beams ?? [])].filter((c) => c.floorId === levelId).map((c) => c.id);
|
||||
// [213] Kameras des Geschosses (Symbol im Grundriss), gesperrte bleiben.
|
||||
const cameras = (project.cameras ?? []).filter((c) => c.floorId === levelId && !c.locked).map((c) => c.id);
|
||||
// Schnittführungs-Symbole sind projektweit (kein floorId; plan/context.rs, plan_section_lines).
|
||||
|
||||
@@ -402,6 +402,28 @@ export interface ColumnInfo {
|
||||
zTop: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* [280] Träger-Attribute für die Objekt-Info (nur bei Auswahl genau eines Trägers): Querschnitt, Profilname, Versatz der
|
||||
* Oberkante gegenüber der Deckenunterkante, Länge der Achse und aufgelöste UK/OK.
|
||||
*/
|
||||
export interface BeamInfo {
|
||||
/** Querschnittsbreite (Meter, editierbar). */
|
||||
width: number;
|
||||
/** Querschnittshöhe (Meter, editierbar). */
|
||||
height: number;
|
||||
/** Profilname als Text (z. B. „HEB 200"), `null` = keiner. */
|
||||
profileName: string | null;
|
||||
/** Versatz der Oberkante gegenüber der Deckenunterkante (Meter, + nach oben, editierbar). */
|
||||
topOffset: number;
|
||||
/** Länge der Achse (Meter). */
|
||||
length: number;
|
||||
floorId: string;
|
||||
floorName: string;
|
||||
/** Aufgelöste absolute UK/OK (Meter). */
|
||||
zBottom: number;
|
||||
zTop: number;
|
||||
}
|
||||
|
||||
/** Achsparallele Bounding-Box eines Elements in Modell-Metern. */
|
||||
export interface SelectionBBox {
|
||||
minX: number;
|
||||
@@ -426,6 +448,7 @@ export interface SelectionInfo {
|
||||
| "door"
|
||||
| "extrudedSolid"
|
||||
| "column"
|
||||
| "beam"
|
||||
| "roof"
|
||||
| "contextObject";
|
||||
id: string;
|
||||
@@ -549,6 +572,8 @@ export interface SelectionInfo {
|
||||
extrudedSolid?: ExtrudedSolidInfo;
|
||||
/** Stützen-Attribute (nur bei `kind === "column"`). */
|
||||
column?: ColumnInfo;
|
||||
/** [280] Träger-Attribute (nur bei `kind === "beam"`). */
|
||||
beam?: BeamInfo;
|
||||
/** Kontext-Objekt-Attribute (nur bei `kind === "contextObject"`). */
|
||||
contextObject?: ContextObjectInfo;
|
||||
/**
|
||||
|
||||
@@ -28,7 +28,7 @@ declare global {
|
||||
coreReady: () => Promise<void>;
|
||||
coreEpoch: () => number;
|
||||
/** Zahl der Elemente je Liste des Projekts (Wände, Öffnungen, Zeichnungsebenen) und das Projekt im Kern als JSON-Länge. */
|
||||
counts: () => { walls: number; openings: number; drawingLevels: number; coreJson: number };
|
||||
counts: () => { walls: number; openings: number; drawingLevels: number; coreJson: number; /** [280] Träger. */ beams: number };
|
||||
/** Endpunkte aller 2D-Linien des Projekts ([123] Transformations-Test). */
|
||||
lines: () => { a: { x: number; y: number }; b: { x: number; y: number } }[];
|
||||
/** [137] Polylinien-Punkte der 2D-Elemente mit Id-Präfix (Präsentations-Massstabsbalken). */
|
||||
@@ -123,7 +123,7 @@ export function installTestHooks(): void {
|
||||
coreEpoch,
|
||||
counts: () => {
|
||||
const p = getState().project;
|
||||
return { walls: p.walls.length, openings: p.openings?.length ?? 0, drawingLevels: p.drawingLevels.length, coreJson: storeDocument(p).json().length };
|
||||
return { walls: p.walls.length, openings: p.openings?.length ?? 0, drawingLevels: p.drawingLevels.length, beams: p.beams?.length ?? 0, coreJson: storeDocument(p).json().length };
|
||||
},
|
||||
lines: () =>
|
||||
getState().project.drawings2d.flatMap((d) => (d.geom.shape === "line" ? [{ a: d.geom.a, b: d.geom.b }] : [])),
|
||||
|
||||
@@ -51,7 +51,7 @@ import { getPlanViewport, subscribePlanViewport } from "./planViewport";
|
||||
import { growRect, meshGripIndices } from "../core";
|
||||
import { patchItem, verticalExtents } from "../core";
|
||||
import { treeGripPatch, treeGripPoints } from "./treeGrips";
|
||||
import { cameraGripPoints } from "../core";
|
||||
import { beamGripPoints, cameraGripPoints } from "../core";
|
||||
import type { Selection } from "./selection";
|
||||
|
||||
export interface GripEditFieldsState {
|
||||
@@ -215,6 +215,9 @@ export function useGripEditing(opts: {
|
||||
const selectedTree = selectedTreeId ? (project.trees ?? []).find((x) => x.id === selectedTreeId) : undefined;
|
||||
// [213] Kamera: Griffe an Standpunkt, Ziel und Sichtkegel-Rand (Bildwinkel); nur auf dem Geschoss der Kamera.
|
||||
const selectedCameraId = single(selection, "cameras");
|
||||
// [280] Träger liegen im Auswahlkanal der Stützen: ein gewählter einzelner Träger zeigt Anfang-, Ende- und Mitte-Griff.
|
||||
const selectedColumnId = single(selection, "columns");
|
||||
const selectedBeam = selectedColumnId ? (project.beams ?? []).find((x) => x.id === selectedColumnId && x.floorId === levelId) : undefined;
|
||||
const selectedCamera = selectedCameraId ? (project.cameras ?? []).find((x) => x.id === selectedCameraId && x.floorId === levelId) : undefined;
|
||||
// [176] Schnitt-/Ansichtslinie im Grundriss: Griffe an Anfang, Knickpunkten (`bendPoints`) und Ende.
|
||||
const selectedSectionLineId = single(selection, "sectionLines");
|
||||
@@ -517,6 +520,11 @@ export function useGripEditing(opts: {
|
||||
pts.forEach((_, i) => { gripOwners.push({ localIndex: i }); gripOwnerRange.push([0, pts.length - 1]); });
|
||||
return pts;
|
||||
}
|
||||
if (selectedBeam && modelEditable && !selectedBeam.locked) {
|
||||
const pts = beamGripPoints(selectedBeam);
|
||||
pts.forEach((_, i) => { gripOwners.push({ localIndex: i }); gripOwnerRange.push([0, pts.length - 1]); });
|
||||
return pts;
|
||||
}
|
||||
if (selectedCamera && modelEditable && !selectedCamera.locked) {
|
||||
const pts = cameraGripPoints(selectedCamera, scaleDenominator);
|
||||
pts.forEach((_, i) => { gripOwners.push({ localIndex: i }); gripOwnerRange.push([0, pts.length - 1]); });
|
||||
@@ -1256,6 +1264,11 @@ export function useGripEditing(opts: {
|
||||
else if (st) moveStairBy(st.id, sub(pt, stairMoveHandle(st)));
|
||||
return;
|
||||
}
|
||||
// [280] Träger: Anfang, Ende bzw. Mitte live (Kern `grips.rs`), ein Undo-Schritt je Zug.
|
||||
if (selectedBeam) {
|
||||
if (!selectedBeam.locked) storeState().moveBeamGrip(selectedBeam.id, index, pt);
|
||||
return;
|
||||
}
|
||||
// [213] Kamera: Standpunkt, Ziel bzw. Sichtkegel-Rand live (Kern `camera::grip_edit`), ein Undo-Schritt je Zug.
|
||||
if (selectedCamera) {
|
||||
if (!selectedCamera.locked) storeState().moveCameraGrip(selectedCamera.id, index, pt);
|
||||
|
||||
@@ -145,7 +145,7 @@ export function useMouseSelectionHandlers(opts: {
|
||||
return (project.stairs ?? []).find((s) => s.id === sel.stairId)?.categoryCode;
|
||||
if (sel.roomId) return (project.rooms ?? []).find((r) => r.id === sel.roomId)?.categoryCode;
|
||||
if (sel.columnId)
|
||||
return (project.columns ?? []).find((c) => c.id === sel.columnId)?.categoryCode;
|
||||
return [...(project.columns ?? []), ...(project.beams ?? [])].find((c) => c.id === sel.columnId)?.categoryCode;
|
||||
if (sel.roofId) return (project.roofs ?? []).find((r) => r.id === sel.roofId)?.categoryCode;
|
||||
if (sel.drawingId)
|
||||
return project.drawings2d.find((d) => d.id === sel.drawingId)?.categoryCode;
|
||||
@@ -162,7 +162,7 @@ export function useMouseSelectionHandlers(opts: {
|
||||
if (sel.ceilingId) return (project.ceilings ?? []).find((c) => c.id === sel.ceilingId)?.floorId;
|
||||
if (sel.stairId) return (project.stairs ?? []).find((s) => s.id === sel.stairId)?.floorId;
|
||||
if (sel.roomId) return (project.rooms ?? []).find((r) => r.id === sel.roomId)?.floorId;
|
||||
if (sel.columnId) return (project.columns ?? []).find((c) => c.id === sel.columnId)?.floorId;
|
||||
if (sel.columnId) return [...(project.columns ?? []), ...(project.beams ?? [])].find((c) => c.id === sel.columnId)?.floorId;
|
||||
if (sel.roofId) return (project.roofs ?? []).find((r) => r.id === sel.roofId)?.floorId;
|
||||
if (sel.drawingId) return project.drawings2d.find((d) => d.id === sel.drawingId)?.levelId;
|
||||
return undefined;
|
||||
|
||||
@@ -173,6 +173,7 @@ export function useSelectionCommands(opts: {
|
||||
...removeItems(p, "rooms", rmids),
|
||||
...removeItems(p, "extrudedSolids", exids),
|
||||
...removeItems(p, "columns", colids),
|
||||
...removeItems(p, "beams", colids), // [280] Träger liegen im Auswahlkanal der Stützen
|
||||
// Öffnungen: eigene Auswahl löschen UND alle, deren Wirt (Wand, Dach, Decke [103]) entfällt.
|
||||
...removeItems(p, "openings", (o) => oids.has(o.id) || wids.has(o.hostWallId) || (!!o.hostRoofId && rfids.has(o.hostRoofId)) || (!!o.hostCeilingId && cids.has(o.hostCeilingId))),
|
||||
...removeItems(p, "context", ctxids),
|
||||
|
||||
Reference in new issue
Block a user