[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:
Claude committed 2026-11-18 00:54:36 +00:00
1 parent 369df24be0
commit 5bc0370211
97 files changed
+1479 -81

No files matched your search

+1 -1
View File
@@ -58,7 +58,7 @@ function keysOfSnapshot(project: Project, snap: ViewSnapshot, out: Set<string>):
if (r.floorId !== level || !cat(r.categoryCode)) continue;
comps((project.roofTypes ?? []).find((t) => t.id === r.roofTypeId)?.layers);
}
for (const c of project.columns ?? []) {
for (const c of [...(project.columns ?? []), ...(project.beams ?? [])]) {
if (c.floorId !== level || !cat(c.categoryCode)) continue;
if (c.hatchId) out.add(`hatch:${c.hatchId}`);
if (c.componentId) out.add(`component:${c.componentId}`);
+1 -1
View File
@@ -28,7 +28,7 @@ Ribbon-Befehle sie erreichen: `src/state/useToolInput.ts`.
| Gruppe | Module |
|---|---|
| Bauteile | `wall.ts`, `opening.ts`, `ceiling.ts`, `ceilingOpening.ts`, `roof.ts`, `roofHole.ts`, `roofWindow.ts`, `dormer.ts`, `stair.ts`, `column.ts`, `room.ts`, `grid.ts`, `tree.ts`, `terrain.ts`, `excavation.ts` |
| Bauteile | `wall.ts`, `opening.ts`, `ceiling.ts`, `ceilingOpening.ts`, `roof.ts`, `roofHole.ts`, `roofWindow.ts`, `dormer.ts`, `stair.ts`, `column.ts`, `traeger.ts` ([280]), `room.ts`, `grid.ts`, `tree.ts`, `terrain.ts`, `excavation.ts` |
| Körper | `solid.ts`, `solidbool.ts`, `solidToParts.ts` (Körper → Bauteile, [222]), `voidbox.ts`, `extrude.ts`, `revolve.ts`, `loft.ts` |
| 2D zeichnen | `line.ts`, `xline.ts`, `ray.ts`, `polyline.ts`, `polygon.ts`, `rect.ts`, `circle.ts`, `arc.ts`, `ellipse.ts`, `bezier.ts`, `spline.ts`, `multiline.ts`, `revcloud.ts`, `wipeout.ts`, `block.ts`, `defblock.ts`, `libobj.ts` (Objekt aus der Bibliothek setzen, [253]) |
| Beschriften | `text.ts`, `textbox.ts`, `textpath.ts`, `leader.ts`, `dimension.ts`, `dimround.ts`, `dimdetach.ts`, `autodim.ts`, `kote.ts`, `detailref.ts`, `pointmarker.ts`, `scalebar.ts`, `sectionline.ts` |
+101
View File
@@ -0,0 +1,101 @@
// [280] Träger/Unterzug als Engine-Befehl. Ablauf:
// 1) „Anfang des Trägers:" → Punkt
// 2) „Ende des Trägers:" → Punkt → commit (ein Träger, Befehl endet)
//
// Der Träger sitzt auf dem aktiven Geschoss, Klasse „25“ (Stützen), sonst „50“ (Tragwerk), die Oberkante bündig an der Deckenunterkante
// (Unterzug); der Kern (`cmd_create.rs`, Befehl `beam`) legt ihn an. Optionen (IMMER sichtbar): Profil = Vorgabe aus
// einer kurzen Liste (Rechteck-Unterzug 25/40 … oder Stahlprofil als Text mit Aussenmassen). Eine getippte Zahl setzt
// die Querschnittshöhe (Meter) PERSISTENT über Aufrufe, die Breite bleibt die des Profils.
//
// Bezeichner englisch, sichtbarer Text via t().
import { segmentHud } from "../../tools/types";
import type { Command, CommandContext, CommandResult, CommandState, CmdOption, ToolDraft, Vec2 } from "../types";
import { createMutation, createPreview } from "../createCore";
const EPS = 1e-6;
/** Profil-Vorgaben: Breite × Höhe (Meter, Aussenmasse), Name nur als Text. */
const PRESETS: { id: string; width: number; height: number; name: string }[] = [
{ id: "rect2540", width: 0.25, height: 0.4, name: "" },
{ id: "rect3050", width: 0.3, height: 0.5, name: "" },
{ id: "rect2030", width: 0.2, height: 0.3, name: "" },
{ id: "heb200", width: 0.2, height: 0.2, name: "HEB 200" },
{ id: "heb300", width: 0.3, height: 0.3, name: "HEB 300" },
{ id: "ipe200", width: 0.1, height: 0.2, name: "IPE 200" },
];
// ── Persistente Vorgaben (modulweit, leben über Befehls-Instanzen hinweg) ─────
const defaults: { preset: number; height: number | null } = { preset: 0, height: null };
const current = () => {
const p = PRESETS[defaults.preset] ?? PRESETS[0];
return { width: p.width, height: defaults.height ?? p.height, profileName: p.name };
};
const label = () => {
const c = current();
const size = `${(c.width * 100).toFixed(0)}/${(c.height * 100).toFixed(0)}`;
return c.profileName ? `${c.profileName} (${size})` : size;
};
interface BeamState extends CommandState {
phase: "start" | "end" | "done";
a?: Vec2;
}
const finish = (): [CommandState, CommandResult] => [{ phase: "done", lastPoint: null } as BeamState, { draft: null, done: true }];
/** Anfrage an den Kern: Achse a→b, Querschnitt und Profilname der Vorgabe. */
const request = (a: Vec2, b: Vec2) => ({ cmd: "beam", pts: [[a.x, a.y], [b.x, b.y]], ...current() });
function draftTo(a: Vec2, b: Vec2, ctx: CommandContext): ToolDraft {
const far = Math.hypot(b.x - a.x, b.y - a.y) >= EPS;
return {
preview: far ? createPreview(ctx, { cmd: "beam", ...current() }, [a, b]).shapes : [],
vertices: [a],
hud: far ? { at: b, text: `${segmentHud(a, b).length.toFixed(2)} m · ${label()}` } : undefined,
};
}
export const traegerCommand: Command = {
name: "traeger",
labelKey: "cmd.traeger.label",
prompt: (s) => ((s as BeamState).phase === "end" ? "cmd.traeger.end" : "cmd.traeger.start"),
accepts: () => ["point", "number", "option"],
options: (): CmdOption[] => [{ id: "profile", labelKey: "cmd.traeger.profile", value: label() }],
floorOnly: true,
init: (): BeamState => ({ phase: "start", lastPoint: null }),
onInput: (state, input, ctx): [CommandState, CommandResult] => {
const s = state as BeamState;
if (s.phase === "done") return finish();
if (input.kind === "number") {
const v = Math.abs(input.value);
if (v > 1e-4) defaults.height = v;
return [s, { draft: s.a ? draftTo(s.a, s.a, ctx) : null }];
}
if (input.kind === "option" && input.id === "profile") {
defaults.preset = (defaults.preset + 1) % PRESETS.length;
defaults.height = null;
return [s, { draft: null }];
}
if (input.kind !== "point") return [s, { draft: null }];
if (s.phase === "start") {
return [{ phase: "end", a: input.point, lastPoint: input.point } as BeamState, { draft: draftTo(input.point, input.point, ctx) }];
}
const a = s.a as Vec2;
if (Math.hypot(input.point.x - a.x, input.point.y - a.y) < EPS) return [s, { draft: draftTo(a, a, ctx) }];
return [{ phase: "done", lastPoint: null } as BeamState, { draft: null, done: true, commit: createMutation(ctx, request(a, input.point)) }];
},
onMove: (state, point, _snap, ctx): [CommandState, CommandResult] => {
const s = state as BeamState;
if (s.phase !== "end" || !s.a) return [s, { draft: null }];
return [s, { draft: draftTo(s.a, point, ctx) }];
},
onConfirm: (): [CommandState, CommandResult] => finish(),
onCancel: (): [CommandState, CommandResult] => finish(),
};
+5
View File
@@ -13,6 +13,7 @@ import { ceilingCommand } from "./cmds/ceiling";
import { openingCommand, fensterCommand, tuerCommand } from "./cmds/opening";
import { stairCommand } from "./cmds/stair";
import { columnCommand } from "./cmds/column";
import { traegerCommand } from "./cmds/traeger";
import { circlesToTreesCommand, treeCommand } from "./cmds/tree";
import { roofCommand } from "./cmds/roof";
import { solidCommand } from "./cmds/solid";
@@ -93,6 +94,7 @@ export const COMMANDS: Record<string, Command> = {
tuer: tuerCommand,
stair: stairCommand,
column: columnCommand,
traeger: traegerCommand,
tree: treeCommand,
circlestotrees: circlesToTreesCommand,
roof: roofCommand,
@@ -194,6 +196,9 @@ export const ALIASES: Record<string, string> = {
treppe: "stair",
tp: "stair",
stuetze: "column",
träger: "traeger",
unterzug: "traeger",
beam: "traeger",
stütze: "column",
baum: "tree",
kreiseinbaeume: "circlestotrees",
+1 -1
View File
@@ -45,7 +45,7 @@ export const AI_TOOLS: AiToolDef[] = [
name: "run_command",
description:
"Führt einen Kern-Befehl mit JSON-Parametern aus (dieselben wie die Befehle der Oberfläche): z. B. " +
'{cmd:"wall", pts:[[0,0],[5,0]]}, {cmd:"room"|"ceiling"|"roof", pts:[…]}, {cmd:"column", at:[x,y]}, ' +
'{cmd:"wall", pts:[[0,0],[5,0]]}, {cmd:"room"|"ceiling"|"roof", pts:[…]}, {cmd:"column", at:[x,y]}, {cmd:"beam", pts:[[x0,y0],[x1,y1]], width?, height?, profileName?}, ' +
'{cmd:"opening", wall:<id>, start, end (Wandachse), pos, width, height, sill, kind:"door"|"window"}, {cmd:"rect"|"polyline"|"circle", …}, {cmd:"transform", ids, …}, ' +
'{cmd:"align"|"distribute", ids, mode|axis}, {cmd:"split", ids}. `level` = Geschoss-id (Standard: aktives bzw. erstes).',
inputSchema: obj({ cmd: { type: "string" }, params: { type: "object" }, level: { type: "string" } }, ["cmd"]),
+1 -1
View File
@@ -86,7 +86,7 @@ export { EMPTY_MEMBERSHIP, containingGroupId, expandToGroups, isInsideActiveGrou
export type { GroupMembership, MemberKind } from "../model/groups";
export { arcApex, drawingVertices, gripPt, openEdges, polylineEdgeGrips, ringEdges } from "../geometry/grips";
export { verticalExtents } from "../geometry/grips";
export { cameraGripPoints } from "../geometry/grips";
export { cameraGripPoints, beamGripPoints } from "../geometry/grips";
export type { VerticalExtent } from "../geometry/grips";
export type { GripRequest, RingKind } from "../geometry/grips";
export { edgeArcToggle, type ArcRingKind } from "../geometry/grips";
+7
View File
@@ -21,6 +21,7 @@
import type {
Camera,
Ceiling,
Beam,
Column,
Drawing2D,
ExtrudedSolid,
@@ -64,6 +65,8 @@ export interface ElementClipboard {
rooms: Room[];
extrudedSolids: ExtrudedSolid[];
columns: Column[];
/** [280] Träger (liegen im Auswahlkanal der Stützen; optional wie Bäume). */
beams?: Beam[];
/** [149] Bäume (optional: Zwischenablagen älterer Fenster haben sie nicht). */
trees?: Tree[];
/** [213] Kameras (optional: ältere Zwischenablagen haben sie nicht). */
@@ -94,6 +97,7 @@ export function isClipboardEmpty(c: ElementClipboard): boolean {
c.rooms.length === 0 &&
c.extrudedSolids.length === 0 &&
c.columns.length === 0 &&
(c.beams?.length ?? 0) === 0 &&
(c.trees?.length ?? 0) === 0 &&
(c.cameras?.length ?? 0) === 0
);
@@ -134,6 +138,7 @@ export function collectElementClipboard(
const extrudedSolids = (project.extrudedSolids ?? []).filter((s) => extrudedSolidIds.has(s.id));
const columnIds = new Set(sel.columnIds);
const columns = (project.columns ?? []).filter((c) => columnIds.has(c.id));
const beams = (project.beams ?? []).filter((b) => columnIds.has(b.id));
const treeIds = new Set(sel.treeIds ?? []);
const trees = (project.trees ?? []).filter((t) => treeIds.has(t.id));
const cameraIds = new Set(sel.cameraIds ?? []);
@@ -149,6 +154,7 @@ export function collectElementClipboard(
rooms: rooms.map((r) => structuredClone(r)),
extrudedSolids: extrudedSolids.map((s) => structuredClone(s)),
columns: columns.map((c) => structuredClone(c)),
beams: beams.map((b) => structuredClone(b)),
trees: trees.map((t) => structuredClone(t)),
cameras: cameras.map((c) => structuredClone(c)),
};
@@ -181,6 +187,7 @@ const PASTED_KEY: Record<string, keyof PastedIds> = {
rooms: "roomIds",
extrudedSolids: "extrudedSolidIds",
columns: "columnIds",
beams: "columnIds",
trees: "treeIds",
cameras: "cameraIds",
};
+2 -1
View File
@@ -18,7 +18,8 @@ export type ScheduleKind =
| "Treppe"
| "Extrusion"
| "Dach"
| "Stütze";
| "Stütze"
| "Träger";
/** Eine ausgewertete Zeile der Bauteilliste (je Bauteil-Vorkommen ein Datensatz). */
export interface ScheduleRow {
+6
View File
@@ -48,6 +48,7 @@ export type GripRequest =
| { op: "sectionBendInsert"; id: string; seg: number; pt: P }
// [213] Kamera: 0 = Standpunkt, 1 = Ziel, 2 = Bildwinkel bzw. Sichtbreite (Kern `camera::grip_edit`); `cameraBy` verschiebt Standpunkt und Ziel.
| { op: "cameraGrip"; id: string; index: number; pt: P }
| { op: "beamGrip"; id: string; index: number; pt: P }
| { op: "cameraBy"; id: string; delta: P }
| { op: "sectionBendDelete"; id: string; index: number }
| { op: "sectionLineTidy"; id: string; tol?: number }
@@ -111,6 +112,11 @@ export function cameraGripPoints(c: Camera, scaleDenominator: number = DEFAULT_S
return out;
}
/** [280] Griffe eines Trägers im Grundriss: Anfang, Ende, Mitte (verschiebt den ganzen Träger). */
export function beamGripPoints(b: { start: Vec2; end: Vec2 }): Vec2[] {
return [b.start, b.end, { x: (b.start.x + b.end.x) / 2, y: (b.start.y + b.end.y) / 2 }];
}
type Owner = { drawingId?: string; wallId?: string };
function flat(verts: readonly Vec2[]): Float64Array {
+16
View File
@@ -617,6 +617,15 @@ export const de = {
"objinfo.column.height": "Höhe",
"objinfo.column.rotation": "Drehung (°)",
"objinfo.column.floor": "Geschoss",
"objinfo.beam.section": "Träger",
"objinfo.beam.profileName": "Profil",
"objinfo.beam.profileName.placeholder": "z. B. HEB 200",
"objinfo.beam.width": "Breite",
"objinfo.beam.height": "Höhe",
"objinfo.beam.topOffset": "OK-Versatz zur Decke",
"objinfo.beam.length": "Länge",
"objinfo.beam.level": "UK – OK",
"objinfo.beam.floor": "Geschoss",
// ── Wand-Attribute (Object-Info-Panel) ──────────────────────────────────
"objinfo.wall.section": "Wand",
"objinfo.wall.refLine": "Referenzlinie",
@@ -2278,6 +2287,10 @@ export const de = {
"cmd.column.label": "Stütze",
"cmd.column.place": "Stütze setzen:",
"cmd.column.profile": "Profil",
"cmd.traeger.label": "Träger",
"cmd.traeger.start": "Anfang des Trägers:",
"cmd.traeger.end": "Ende des Trägers (Zahl = Höhe):",
"cmd.traeger.profile": "Profil",
"cmd.stair.label": "Treppe",
"cmd.stair.start": "Startpunkt der Treppe:",
"cmd.stair.run": "Laufrichtung / Ende ( Grundform · Auf/Ab ):",
@@ -3598,6 +3611,7 @@ export const de = {
"elements.kind.extrusion": "Extrusion",
"elements.kind.roof": "Dach",
"elements.kind.column": "Stütze",
"elements.kind.beam": "Träger",
// Ausschnitte / View-Snapshots (DOSSIER A2).
"viewsnap.title": "Ausschnitte",
@@ -3929,6 +3943,7 @@ export const de = {
"history.cmd.chamfer": "Fase",
"history.cmd.circle": "Kreis zeichnen",
"history.cmd.column": "Stütze zeichnen",
"history.cmd.traeger": "Träger zeichnen",
"history.cmd.defblock": "Block definieren",
"history.cmd.detailref": "Detailverweis",
"history.cmd.dimension": "Bemassung",
@@ -3986,6 +4001,7 @@ export const de = {
"history.coll.rooms": "Raum",
"history.coll.drawings2d": "2D-Element",
"history.coll.columns": "Stütze",
"history.coll.beams": "Träger",
"history.coll.extrudedSolids": "Körper",
"history.coll.groups": "Gruppe",
"history.coll.layers": "Ebene",
+16
View File
@@ -615,6 +615,15 @@ export const en: Record<TranslationKey, string> = {
"objinfo.column.height": "Height",
"objinfo.column.rotation": "Rotation (°)",
"objinfo.column.floor": "Floor",
"objinfo.beam.section": "Beam",
"objinfo.beam.profileName": "Profile",
"objinfo.beam.profileName.placeholder": "e.g. HEB 200",
"objinfo.beam.width": "Width",
"objinfo.beam.height": "Height",
"objinfo.beam.topOffset": "Top offset to slab",
"objinfo.beam.length": "Length",
"objinfo.beam.level": "Bottom – top",
"objinfo.beam.floor": "Storey",
// ── Wall attributes (object info panel) ──────────────────────────────────
"objinfo.wall.section": "Wall",
"objinfo.wall.refLine": "Reference line",
@@ -2267,6 +2276,10 @@ export const en: Record<TranslationKey, string> = {
"cmd.column.label": "Column",
"cmd.column.place": "Place column:",
"cmd.column.profile": "Profile",
"cmd.traeger.label": "Beam",
"cmd.traeger.start": "Start of beam:",
"cmd.traeger.end": "End of beam (number = height):",
"cmd.traeger.profile": "Profile",
"cmd.stair.label": "Stair",
"cmd.stair.start": "Start point of the stair:",
"cmd.stair.run": "Run direction / end ( Shape · Up/Down ):",
@@ -3585,6 +3598,7 @@ export const en: Record<TranslationKey, string> = {
"elements.kind.extrusion": "Extrusion",
"elements.kind.roof": "Roof",
"elements.kind.column": "Column",
"elements.kind.beam": "Beam",
// Views / view snapshots (DOSSIER A2).
"viewsnap.title": "Views",
@@ -3915,6 +3929,7 @@ export const en: Record<TranslationKey, string> = {
"history.cmd.chamfer": "Chamfer",
"history.cmd.circle": "Draw circle",
"history.cmd.column": "Draw column",
"history.cmd.traeger": "Draw beam",
"history.cmd.defblock": "Define block",
"history.cmd.detailref": "Detail reference",
"history.cmd.dimension": "Dimension",
@@ -3972,6 +3987,7 @@ export const en: Record<TranslationKey, string> = {
"history.coll.rooms": "room",
"history.coll.drawings2d": "2D element",
"history.coll.columns": "column",
"history.coll.beams": "beam",
"history.coll.extrudedSolids": "solid",
"history.coll.groups": "group",
"history.coll.layers": "layer",
+4 -1
View File
@@ -59,6 +59,7 @@ export function buildGuidIndex(project: Project): Map<string, Target> {
for (const c of project.ceilings ?? []) add("slab", "ceilingIds", c.id, c.ifcGlobalId);
for (const r of project.roofs ?? []) add("roof", "roofIds", r.id, r.ifcGlobalId);
for (const c of project.columns ?? []) add("column", "columnIds", c.id, c.ifcGlobalId);
for (const b of project.beams ?? []) add("beam", "columnIds", b.id, b.ifcGlobalId);
for (const s of project.stairs ?? []) add("stair", "stairIds", s.id, s.ifcGlobalId);
for (const e of project.extrudedSolids ?? []) add("extrusion", "extrudedSolidIds", e.id, e.ifcGlobalId);
for (const r of project.rooms ?? []) add("space", "roomIds", r.id, r.ifcGlobalId);
@@ -106,7 +107,9 @@ export function selectionToGuids(project: Project, sel: BcfSelection): string[]
g("wall", sel.wallIds, project.walls);
g("slab", sel.ceilingIds, project.ceilings);
g("roof", sel.roofIds, project.roofs);
g("column", sel.columnIds, project.columns);
const isBeam = (id: string) => (project.beams ?? []).some((b) => b.id === id);
g("column", sel.columnIds.filter((id) => !isBeam(id)), project.columns);
g("beam", sel.columnIds.filter(isBeam), project.beams); // [280]
g("stair", sel.stairIds, project.stairs);
g("extrusion", sel.extrudedSolidIds, project.extrudedSolids);
g("space", sel.roomIds, project.rooms);
+5 -2
View File
@@ -8,7 +8,7 @@ import { patchItem, setField } from "../core/opsBuild";
import type { DesignOption, DesignOptionCombination, DesignOptionRef, DesignOptionSet, DrawingLevel, Project } from "./types";
/** Listen, deren Elemente einer Variante angehören können (gleich wie `design_options::COLLECTIONS`). */
export const DESIGN_OPTION_COLLECTIONS = ["walls", "openings", "ceilings", "roofs", "stairs", "columns", "extrudedSolids", "rooms", "drawings2d"] as const;
export const DESIGN_OPTION_COLLECTIONS = ["walls", "openings", "ceilings", "roofs", "stairs", "columns", "beams", "extrudedSolids", "rooms", "drawings2d"] as const;
export type DesignOptionCollection = (typeof DESIGN_OPTION_COLLECTIONS)[number];
/** Kombination: Satz-Id → Varianten-Id. */
@@ -523,7 +523,10 @@ export function designOptionLocked(project: Project, edit: DesignOptionTarget |
if (OUTSIDE_KINDS.has(kind)) return true;
const coll = KIND_COLLECTION[kind];
if (!coll) return false;
const e = ((project[coll] ?? []) as { id: string; designOption?: DesignOptionRef; hostWallId?: string }[]).find((x) => x.id === id);
type El = { id: string; designOption?: DesignOptionRef; hostWallId?: string };
// [280] Träger liegen im Auswahlkanal der Stützen.
const pool = ((project[coll] ?? []) as El[]).concat(coll === "columns" ? ((project.beams ?? []) as El[]) : []);
const e = pool.find((x) => x.id === id);
if (!e) return false;
const r = e.designOption ?? (coll === "openings" ? project.walls.find((w) => w.id === e.hostWallId)?.designOption : undefined);
return !(r && r.set === edit.set && r.option === edit.option);
+3 -2
View File
@@ -16,7 +16,7 @@ export const RENOVATION_STATUSES: readonly RenovationStatus[] = ["existing", "de
* Listen mit Umbau-Status (Räume nur Sichtbarkeit/Flächen, keine Farbe). `drawings2d`: Möbel und Symbole der Bibliothek
* (ohne Angabe = Bestand) sowie 2D-Elemente mit ausdrücklichem Status (Linienwerk, Masse …; Kern `drawing_takes_part`).
*/
export const RENOVATION_COLLECTIONS = ["walls", "openings", "ceilings", "roofs", "stairs", "columns", "extrudedSolids", "rooms", "drawings2d"] as const;
export const RENOVATION_COLLECTIONS = ["walls", "openings", "ceilings", "roofs", "stairs", "columns", "beams", "extrudedSolids", "rooms", "drawings2d"] as const;
export type RenovationCollection = (typeof RENOVATION_COLLECTIONS)[number];
/**
@@ -270,6 +270,7 @@ const SELECTION_KEY: Record<RenovationCollection, string> = {
roofs: "roofs",
stairs: "stairs",
columns: "columns",
beams: "columns", // [280] Träger liegen im Auswahlkanal der Stützen
extrudedSolids: "solids",
rooms: "rooms",
drawings2d: "drawings",
@@ -299,7 +300,7 @@ export function idsByRenovationStatus(
if (opts.phase !== undefined && (r?.phase ?? "") !== opts.phase) continue;
ids.push(e.id);
}
if (ids.length) out[SELECTION_KEY[c]] = ids;
if (ids.length) out[SELECTION_KEY[c]] = [...(out[SELECTION_KEY[c]] ?? []), ...ids];
}
const trees = (project.trees ?? []).filter((t) => treeRenovationStatus(t) === status && (!opts.floorId || t.floorId === opts.floorId) && (opts.phase === undefined || opts.phase === "")).map((t) => t.id);
if (trees.length) out.trees = trees;
+7
View File
@@ -504,6 +504,12 @@ const columns: NonNullable<Project["columns"]> = [
{ id: "st-ug-1", type: "column", floorId: "ug", categoryCode: "25", position: P(10.0, 2.6), profile: { kind: "round", radius: 0.15 }, rotation: 0, height: H.ug, componentId: "std-c-stahlbeton" },
];
// [280] Unterzug im EG-Wohnraum (Spannweite 6 m, Wand x = 0 bis Wand x = 6): 30 × 45 cm, Oberkante bündig an der
// Deckenunterkante des EG, Stahlbeton; im Schnitt A-A quer geschnitten, im Grundriss über der Schnitthöhe gestrichelt.
const beams: NonNullable<Project["beams"]> = [
{ id: "tg-eg-1", type: "beam", floorId: "eg", categoryCode: "25", start: P(HA, 2.5), end: P(6 - 0.075, 2.5), width: 0.3, height: 0.45, profileName: "Unterzug 30/45", componentId: "std-c-stahlbeton" },
];
/** [269] Klasse der Umgebungs-Körper (Brunnen, Pflanzgefäss, Sitzrolle): Objektbibliothek-Klasse „Fahrzeuge & Freiflächen". */
const GARDEN_CLASS = "24";
@@ -870,6 +876,7 @@ export function buildComplexSampleProject(): Project {
stairs,
rooms: [],
columns,
beams,
extrudedSolids,
drawings2d: [...cadastre(), ...annotations()],
context: [
+93
View File
@@ -27,6 +27,97 @@ export type Align = "left" | "center" | "right" | "justify";
*/
export type AttributeSource = "layer" | "object";
/**
* [280] Ein Träger/Unterzug (Beam) — geschossgebundenes Tragwerk-Bauteil (Kategorie „50"): Achse
* `start` → `end` im Grundriss, rechteckiger Querschnitt `width` × `height` (Aussenmasse; `profileName`
* ist nur ein Text wie „HEB 200", gezeichnet wird das Rechteck). Oberkante = Unterkante der Decke darüber
* (höchstens die Geschoss-Oberkante) plus `topOffset`; bündig (0) ⇒ Unterzug. Wird wie eine Stütze
* ausgewertet (`Beam::as_column`), liegt aber in `Project.beams`; im Auswahlkanal der Stützen.
*/
export type Beam = {
id: string;
type: "beam";
/** Zugehörige Zeichnungsebene (Geschoss). */
floorId: string;
/** Grafik-Kategorie (Ebene), z. B. "50" für Tragwerk. */
categoryCode: string;
/**
* [201] IFC-GlobalId des Quell-Bauteils (IFC-Import); der IFC-Export schreibt sie zurück, damit
* die Rundreise dieselben GUIDs behält. Kopien (Einfügen, Kopieren, Reihe, Wand teilen) tragen sie NICHT.
*/
ifcGlobalId?: string;
/** Objekt-Sperre, analog `Wall.locked`. */
locked?: boolean;
/** Achse: Anfangspunkt im Grundriss (Meter). */
start: Vec2;
/** Achse: Endpunkt im Grundriss (Meter). */
end: Vec2;
/** Querschnittsbreite (quer zur Achse, Meter, > 0). */
width: number;
/** Querschnittshöhe (Meter, > 0), nach unten ab der Oberkante. */
height: number;
/**
* Profilname als Text (z. B. „HEB 200", „BSH 20/40"); ohne Wirkung auf die Geometrie, geht in Liste und IFC.
*/
profileName?: string;
/**
* Versatz der Oberkante gegenüber der Unterkante der Decke darüber (Meter, + nach oben in die Decke).
* Fehlt ⇒ 0: bündig, Unterzug.
*/
topOffset?: number;
/** Optionales tragendes Bauteil (Component) für Poché/3D-Farbe/Schraffur. */
componentId?: string;
/**
* Optionale Übersteuerung der Strich-/Umrandungsfarbe; sonst gilt die
* Kategorie-Farbe.
*/
color?: string;
/** Stift-Kopplung von `color` (s. `Component.colorPenId`-Doku). */
colorPenId?: string;
/**
* Attribut-Override der Muster-/Schraffurfarbe (Vordergrund) DIESER Stütze.
* `undefined` = „Nach System" (erben → Component.foreground), analog `Wall.
* foreground`.
*/
foreground?: string;
/**
* Attribut-Override der Füllfarbe (Hintergrund/Poché) DIESER Stütze.
* `undefined` = „Nach System" (neutrale SIA-Poché HATCH_INK/HATCH_PAPER je
* nach Schraffur-Muster), analog `Wall.background`.
*/
background?: string;
/** Stift-Kopplung von `foreground` (s. `Component.foregroundPenId`-Doku). */
foregroundPenId?: string;
/** Stift-Kopplung von `background`, analog {@link Wall.foregroundPenId}. */
backgroundPenId?: string;
/**
* Attribut-Override der Strichstärke (mm Papier) DIESER Stütze. `undefined`
* = „Nach System" (erben → `strokeWeightSource`), analog `Wall.strokeWeight`.
*/
strokeWeight?: number;
/**
* Attribut-Override der Schnitt-Schraffur (Hatch Manager) DIESER Stütze.
* `undefined` = „Nach System" (erben → `hatchSource`), analog `Wall.hatchId`.
*/
hatchId?: string;
/**
* Quelle des Vordergrunds, wenn kein explizites `foreground` gesetzt ist — analog `Wall.foregroundSource`.
*/
foregroundSource?: AttributeSource;
/** Quelle des Hintergrunds, analog {@link Beam.foregroundSource}. */
backgroundSource?: AttributeSource;
/** Quelle der Strichstärke, analog {@link Beam.foregroundSource}. */
strokeWeightSource?: AttributeSource;
/** Quelle der Schraffur, analog {@link Beam.foregroundSource}. */
hatchSource?: AttributeSource;
/** [271] Umbau: Status (Bestand, Abbruch, Neu) und Etappe. Fehlt ⇒ Bestand. */
renovation?: Renovation;
/**
* [272] Variante, zu der das Element gehört (`Project.designOptionSets`). Fehlt ⇒ Hauptmodell (immer sichtbar).
*/
designOption?: DesignOptionRef;
};
/**
* Wiederverwendbares 2D-Symbol (Möbelblock, Sanitär-/Normsymbol, Nordpfeil
* u. Ä.) — s. `Project.blockDefs` + `Drawing2DGeom["block"]`. `geom2d` ist
@@ -3247,6 +3338,8 @@ export type Project = {
* Projekte/Tests ohne `columns` gültig bleiben (Default: leer behandeln).
*/
columns?: Array<Column>;
/** [280] Träger/Unterzüge, siehe {@link Beam}. Optional wie `columns`. */
beams?: Array<Beam>;
/**
* Bäume ([149]) — eigene Objekte mit Stamm, Krone und Höhe, siehe {@link Tree}. Optional, damit
* bestehende Projekte ohne `trees` gültig bleiben (Default: leer behandeln).
+2
View File
@@ -34,6 +34,7 @@ const CLASS_ORDER: Exclude<ScheduleKind, "Tür">[] = [
"Decke",
"Dach",
"Stütze",
"Träger",
"Fenster",
"Öffnung",
"Treppe",
@@ -46,6 +47,7 @@ const CLASS_LABEL_KEY: Record<Exclude<ScheduleKind, "Tür">, string> = {
Decke: "elements.kind.ceiling",
Dach: "elements.kind.roof",
Stütze: "elements.kind.column",
Träger: "elements.kind.beam",
Fenster: "elements.kind.window",
Öffnung: "elements.kind.opening",
Treppe: "elements.kind.stair",
+1 -1
View File
@@ -41,7 +41,7 @@ function parseNum(text: string): number | null {
/** [271] Trägt ein Bauteil oder Raum einen Umbau-Status (sonst bleibt die Wahl „Zustand“ verborgen)? */
function hasRenovation(p: Project): boolean {
const lists = [p.walls, p.openings, p.ceilings, p.roofs, p.stairs, p.columns, p.extrudedSolids, p.rooms] as Array<readonly { renovation?: unknown }[] | undefined>;
const lists = [p.walls, p.openings, p.ceilings, p.roofs, p.stairs, p.columns, p.beams, p.extrudedSolids, p.rooms] as Array<readonly { renovation?: unknown }[] | undefined>;
return lists.some((l) => (l ?? []).some((e) => e.renovation !== undefined));
}
+1 -1
View File
@@ -379,7 +379,7 @@ const TOOLS_2D: ToolId[] = [
"image",
];
const TOOLS_3D: ToolId[] = ["wall", "ceiling", "window", "door", "stair", "room"];
const COMMANDS_3D = ["column", "tree", "circlestotrees", "ceilingopening", "roof", "roofhole", "roofwindow", "dormer", "extrude", "revolve", "loft", "solid", "solidbool", "solidtoparts", "sectionline", "viewline", "ansichten", "autodim", "excavation"];
const COMMANDS_3D = ["column", "traeger", "tree", "circlestotrees", "ceilingopening", "roof", "roofhole", "roofwindow", "dormer", "extrude", "revolve", "loft", "solid", "solidbool", "solidtoparts", "sectionline", "viewline", "ansichten", "autodim", "excavation"];
const COMMANDS_EDIT = ["move", "copy", "array", "rotate", "mirror", "offset", "multiline", "trim", "break", "split", "extend", "fillet", "chamfer", "join", "defblock", "measure", "erkennen"];
type ToolsView = "list" | "icons";
+5
View File
@@ -607,6 +607,11 @@ export interface PanelHostValue {
onSetColumnRadius: (radius: number) => void;
/** Setzt die Höhe der Stütze (Meter, > 0). */
onSetColumnHeight: (height: number) => void;
/** [280] Träger: Querschnitt, Profilname und Oberkanten-Versatz (nur bei selektiertem Träger). */
onSetBeamWidth: (width: number) => void;
onSetBeamHeight: (height: number) => void;
onSetBeamTopOffset: (offset: number) => void;
onSetBeamProfileName: (name: string) => void;
/** Setzt die Drehung der Stütze (Grad; intern in Radiant gespeichert). */
onSetColumnRotation: (deg: number) => void;
+53
View File
@@ -0,0 +1,53 @@
// [280] Träger-Abschnitt der Objekt-Info: Querschnitt (Breite × Höhe), Profilname (nur Text), Versatz der Oberkante
// gegenüber der Deckenunterkante (0 = bündig, Unterzug); Länge, Geschoss und aufgelöste UK/OK nur zur Auskunft.
import { t } from "../../i18n";
import type { BeamInfo } from "../../state/selectionInfo";
import { usePanelHost } from "../host";
import { DimensionField } from "./fields";
export function BeamSection({ beam, host }: { beam: BeamInfo; host: ReturnType<typeof usePanelHost> }) {
return (
<>
<div className="objinfo-sep" />
<div className="objinfo-section-label">{t("objinfo.beam.section")}</div>
<label className="objinfo-field">
<span className="objinfo-flabel">{t("objinfo.beam.profileName")}</span>
<input
key={beam.profileName ?? ""}
type="text"
className="objinfo-text"
defaultValue={beam.profileName ?? ""}
placeholder={t("objinfo.beam.profileName.placeholder")}
onBlur={(e) => {
if (e.target.value.trim() !== (beam.profileName ?? "")) host.onSetBeamProfileName(e.target.value);
}}
onKeyDown={(e) => {
if (e.key === "Enter") (e.target as HTMLInputElement).blur();
}}
title={t("objinfo.beam.profileName")}
/>
</label>
<DimensionField label={t("objinfo.beam.width")} value={beam.width} onCommit={(v) => host.onSetBeamWidth(v)} />
<DimensionField label={t("objinfo.beam.height")} value={beam.height} onCommit={(v) => host.onSetBeamHeight(v)} />
<DimensionField label={t("objinfo.beam.topOffset")} value={beam.topOffset} onCommit={(v) => host.onSetBeamTopOffset(v)} />
<div className="objinfo-field">
<span className="objinfo-flabel">{t("objinfo.beam.length")}</span>
<span className="objinfo-fval">{beam.length.toFixed(2)} m</span>
</div>
<div className="objinfo-field">
<span className="objinfo-flabel">{t("objinfo.beam.level")}</span>
<span className="objinfo-fval">
{beam.zBottom.toFixed(2)} – {beam.zTop.toFixed(2)} m
</span>
</div>
<div className="objinfo-field">
<span className="objinfo-flabel">{t("objinfo.beam.floor")}</span>
<span className="objinfo-fval">{beam.floorName}</span>
</div>
</>
);
}
+2
View File
@@ -18,6 +18,7 @@ import { RoomSection } from "./RoomSection";
import { RoomStampSection } from "./RoomStampSection";
import { SectionLineSection } from "./SectionLineSection";
import { ColumnSection, ExtrudedSolidSection } from "./SolidSections";
import { BeamSection } from "./BeamSection";
import { StairSection } from "./StairSection";
import { WallSection } from "./WallSection";
import { infoGroups, type InfoGroupId } from "./groups";
@@ -54,6 +55,7 @@ export function InfoGroups({ sel, drawing, host }: { sel: SelectionInfo | null;
case "roomStamp": return sel?.room ? <RoomStampSection roomId={sel.id} /> : null;
case "extrudedSolid": return sel?.extrudedSolid ? <ExtrudedSolidSection solid={sel.extrudedSolid} host={host} /> : null;
case "column": return sel?.column ? <ColumnSection column={sel.column} host={host} /> : null;
case "beam": return sel?.beam ? <BeamSection beam={sel.beam} host={host} /> : null;
case "detailRef": return sel?.detailRef ? <DetailRefSection detailRef={sel.detailRef} drawingId={sel.id} host={host} /> : null;
case "dimRefs": return sel?.dimRefs ? <DimRefsSection refs={sel.dimRefs} drawingId={sel.id} host={host} /> : null;
case "dimText": return sel ? <DimTextSection drawingId={sel.id} host={host} /> : null;
+3
View File
@@ -21,6 +21,7 @@ export type InfoGroupId =
| "roomStamp"
| "extrudedSolid"
| "column"
| "beam"
| "detailRef"
| "dimRefs"
| "dimText"
@@ -45,6 +46,7 @@ export const INFO_GROUP_TITLE: Record<InfoGroupId, TranslationKey> = {
roomStamp: "roomStamp.title",
extrudedSolid: "objinfo.extrudedSolid.section",
column: "objinfo.column.section",
beam: "objinfo.beam.section",
detailRef: "objinfo.detailRef.section",
dimRefs: "objinfo.dimRefs.section",
dimText: "objinfo.dimText.section",
@@ -89,6 +91,7 @@ export function infoGroups(c: InfoGroupContext): InfoGroupId[] {
if (sel.room) out.push("room", "roomStamp");
if (sel.extrudedSolid) out.push("extrudedSolid");
if (sel.column) out.push("column");
if (sel.beam) out.push("beam");
if (sel.detailRef) out.push("detailRef");
if (sel.dimRefs) out.push("dimRefs");
if (sel.dimTextMoved) out.push("dimText");
@@ -1,12 +1,12 @@
viewBox -31.5 0 93 18.478
bytes 179206
bytes 179502
circle 4
g 1
line 259
line 261
path 4
polygon 982
polygon 983
polyline 123
rect 1
svg 1
text 4
hash 336574edc432bcfb
hash 61214d28614f8dcb
+5 -5
View File
@@ -1,5 +1,5 @@
meshes [1175]
meshes[].color [3] x1175
meshes [1176]
meshes[].color [3] x1176
meshes[].indices [1056]
meshes[].indices [108] x6
meshes[].indices [1140]
@@ -35,7 +35,7 @@ meshes[].indices [300] x3
meshes[].indices [31104]
meshes[].indices [312]
meshes[].indices [348] x6
meshes[].indices [36] x1012
meshes[].indices [36] x1013
meshes[].indices [396]
meshes[].indices [4092]
meshes[].indices [4812] x2
@@ -83,7 +83,7 @@ meshes[].positions [234]
meshes[].positions [2412] x2
meshes[].positions [2430] x3
meshes[].positions [2436]
meshes[].positions [24] x980
meshes[].positions [24] x981
meshes[].positions [252] x2
meshes[].positions [2580]
meshes[].positions [2583]
@@ -150,4 +150,4 @@ walls[].start [2] x439
walls[].startCut [4] x270
walls[].topDrop [2] x22
walls[].topPlane [3] x22
hash 91dcb660a771029a
hash 51132759a706b1b1
+120
View File
@@ -0,0 +1,120 @@
/**
* [280] Träger/Unterzug: Befehl `traeger` (zwei Punkte → ein Träger), Grundriss (gestrichelt, Achse), 3D (Prisma),
* Objekt-Info, Griff, Löschen über den Auswahlkanal der Stützen, Beispielprojekt „Musterhaus komplex“.
* (Höhenlage, Schnitt längs/quer: Rust-Tests `beam_tests.rs`.)
*/
import { describe, it, expect } from "vitest";
import { generatePlan } from "./generatePlan";
import { projectToModel3d } from "./toWalls3d";
import { traegerCommand } from "../commands/cmds/traeger";
import type { CommandContext } from "../commands/types";
import { deriveSelection } from "../state/selectionInfo";
import { buildComplexSampleProject } from "../model/sampleProjectComplex";
import { applyOps } from "../core";
import { lockOps } from "../state/objectLock";
import { beamGripPoints } from "../core";
import type { Beam, Project } from "../model/types";
const beam: Beam = { id: "B1", type: "beam", floorId: "eg", categoryCode: "50", start: { x: 1, y: 2 }, end: { x: 5, y: 2 }, width: 0.25, height: 0.4 };
function project(beams: Beam[]): Project {
return {
id: "t",
name: "T",
lineStyles: [{ id: "thin", name: "d", weight: 0.13, color: "#111", dash: null }],
hatches: [{ id: "none", name: "Ohne", pattern: "none", scale: 1, angle: 0, color: "#111" }],
components: [{ id: "a", name: "A", color: "#c8c8cc", hatchId: "none", joinPriority: 10 }],
wallTypes: [{ id: "aw", name: "AW", layers: [{ componentId: "a", thickness: 0.3 }] }],
drawingLevels: [{ id: "eg", name: "EG", kind: "floor", visible: true, locked: false, floorHeight: 2.6, cutHeight: 1.0, baseElevation: 0 }],
layers: [{ code: "50", name: "Tragwerk", color: "#0a0a0a", lw: 0.5, visible: true, locked: false }],
walls: [],
openings: [],
ceilings: [],
stairs: [],
rooms: [],
beams,
drawings2d: [],
context: [],
};
}
describe("Träger — Grundriss, 3D, Objekt-Info", () => {
it("Grundriss: über der Schnitthöhe, Kanten gestrichelt und Achse als Linie", () => {
const plan = generatePlan(project([beam]), "eg", new Set(["50"]));
const prims = plan.primitives;
expect(prims.some((p) => p.kind === "polygon" && p.columnId === "B1")).toBe(true);
const dashed = prims.filter((p) => p.kind === "line" && p.dash && p.cls !== "beam-axis");
expect(dashed.length).toBe(4);
expect(prims.filter((p) => p.kind === "line" && p.cls === "beam-axis").length).toBe(1);
// Klasse aus: nichts.
expect(generatePlan(project([beam]), "eg", new Set()).primitives.filter((p) => p.kind === "polygon" && p.columnId === "B1").length).toBe(0);
});
it("3D: ein Prisma 4 m × 25 cm, Oberkante an der Geschoss-Oberkante (keine Decke darüber)", () => {
const m = projectToModel3d(project([beam]));
const meshes = m.meshes.filter((x) => x.kind === "extrusion");
expect(meshes.length).toBe(1);
const pos = Array.from(meshes[0].positions);
const z = pos.filter((_, i) => i % 3 === 2);
expect(Math.max(...z)).toBeCloseTo(2.6, 6);
expect(Math.min(...z)).toBeCloseTo(2.2, 6);
const x = pos.filter((_, i) => i % 3 === 0);
expect(Math.max(...x) - Math.min(...x)).toBeCloseTo(4, 6);
});
it("Objekt-Info: kind beam mit Querschnitt, Länge und UK/OK; Griffe Anfang, Ende, Mitte", () => {
const p = project([{ ...beam, profileName: "HEB 200", topOffset: 0.1 }]);
const info = deriveSelection(p, { columns: ["B1"] });
expect(info?.kind).toBe("beam");
expect(info?.beam).toMatchObject({ width: 0.25, height: 0.4, profileName: "HEB 200", topOffset: 0.1, length: 4 });
expect(info?.beam?.zTop).toBeCloseTo(2.7, 6);
expect(beamGripPoints(beam)).toEqual([{ x: 1, y: 2 }, { x: 5, y: 2 }, { x: 3, y: 2 }]);
});
it("Sperre über den Auswahlkanal der Stützen", () => {
const p = project([beam]);
const ops = lockOps(p, "columnIds", "B1", true);
expect(ops.length).toBe(1);
const q = applyOps(p, ops);
expect(q.beams?.[0].locked).toBe(true);
});
});
describe("Befehl traeger", () => {
const ctxOf = (p: Project): CommandContext => ({ project: p, level: p.drawingLevels[0], defaultCategoryCode: "50", activeLineStyleId: "thin", activeWallTypeId: "aw", lastPoint: null, selection: { wallIds: [], drawingId: null } });
it("zwei Punkte legen einen Träger an und beenden den Befehl", () => {
const p = project([]);
const ctx = ctxOf(p);
const [s1, r1] = traegerCommand.onInput(traegerCommand.init(), { kind: "point", point: { x: 0, y: 0 } }, ctx);
expect(r1.done).toBeFalsy();
const [, mv] = traegerCommand.onMove!(s1, { x: 3, y: 0 }, null, ctx);
expect(mv.draft?.preview.length).toBeGreaterThan(0);
const [, r2] = traegerCommand.onInput(s1, { kind: "point", point: { x: 3, y: 0 } }, ctx);
expect(r2.done).toBe(true);
const next = r2.commit!(p);
expect(next.beams?.length).toBe(1);
const item = next.beams![0];
expect(item).toMatchObject({ type: "beam", floorId: "eg", categoryCode: "50", width: 0.25, height: 0.4, end: { x: 3, y: 0 } });
});
it("Nulllänge wird ignoriert", () => {
const p = project([]);
const ctx = ctxOf(p);
const [s1] = traegerCommand.onInput(traegerCommand.init(), { kind: "point", point: { x: 1, y: 1 } }, ctx);
const [s2, r] = traegerCommand.onInput(s1, { kind: "point", point: { x: 1, y: 1 } }, ctx);
expect(r.done).toBeFalsy();
expect(s2).toBe(s1);
});
});
describe("Beispielprojekt Musterhaus komplex", () => {
it("enthält den Unterzug im EG; Schnitt A-A schneidet ihn quer", () => {
const p = buildComplexSampleProject();
const b = p.beams?.find((x) => x.id === "tg-eg-1");
expect(b).toBeTruthy();
const plan = generatePlan(p, "eg", new Set(["25", "30", "20"]));
expect(plan.primitives.some((q) => q.kind === "polygon" && q.columnId === "tg-eg-1")).toBe(true);
});
});
+1 -1
View File
@@ -22,7 +22,7 @@ function collection(project: Project, kind: PickKind): readonly WithCategory[] {
case "stair": return p.stairs ?? [];
case "room": return p.rooms ?? [];
case "roof": return p.roofs ?? [];
case "column": return p.columns ?? [];
case "column": return [...(p.columns ?? []), ...(p.beams ?? [])];
case "context": return p.context ?? [];
case "solid": return p.extrudedSolids ?? [];
case "tree": return p.trees ?? [];
+1 -1
View File
@@ -46,7 +46,7 @@ function candidateCodes(project: Project): Set<string> {
const codes = new Set<string>();
for (const c of flattenCategories(project.layers)) codes.add(c.code);
// [115] Freie Körper und Stützen tragen ihre Klasse wie jedes Bauteil.
for (const list of [project.walls, project.ceilings, project.roofs, project.stairs, project.openings, project.extrudedSolids, project.columns]) {
for (const list of [project.walls, project.ceilings, project.roofs, project.stairs, project.openings, project.extrudedSolids, project.columns, project.beams]) {
for (const e of list ?? []) codes.add(e.categoryCode);
}
for (const c of project.context ?? []) if (c.type === "terrainMesh" && c.categoryCode !== undefined) codes.add(c.categoryCode);
+1
View File
@@ -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"],
];
+1
View File
@@ -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
);
+2 -2
View File
@@ -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 });
+7 -1
View File
@@ -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
}
},
+1
View File
@@ -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] } : {}) });
+3
View File
@@ -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) => {
+2 -1
View File
@@ -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).
+25
View File
@@ -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;
/**
+2 -2
View File
@@ -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 }] : [])),
+14 -1
View File
@@ -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);
+2 -2
View File
@@ -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;
+1
View File
@@ -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),
+1 -1
View File
@@ -40,7 +40,7 @@ export interface DesignOptionHandlers {
/** Zahl der Elemente je Variante (Satz-Id → Varianten-Id → Anzahl). */
function counts(project: Project): Map<string, number> {
const out = new Map<string, number>();
const lists = [project.walls, project.openings, project.ceilings, project.roofs, project.stairs, project.columns, project.extrudedSolids, project.rooms, project.drawings2d];
const lists = [project.walls, project.openings, project.ceilings, project.roofs, project.stairs, project.columns, project.beams, project.extrudedSolids, project.rooms, project.drawings2d];
for (const list of lists) {
for (const e of (list ?? []) as { designOption?: { set: string; option: string } }[]) {
if (!e.designOption) continue;
+8
View File
@@ -204,6 +204,14 @@ export const CommandIcon = memo(function CommandIcon({ name }: { name: string })
<line x1="12" y1="9" x2="12" y2="13" />
</svg>
);
case "traeger":
// [280] Träger: Seitenansicht eines Balkens (Rechteck, Achsstrich).
return (
<svg {...common}>
<rect x="1.5" y="5.5" width="13" height="5" />
<line x1="1.5" y1="8" x2="14.5" y2="8" strokeDasharray="3 1.5 0.6 1.5" />
</svg>
);
case "column":
// Stütze: Quadrat-Querschnitt mit vertikalen Kanten (Pfeiler).
return (