[293] Wand-Oberkante als eine Auswahl (Geschosshöhe/Frei, Bis Decke, Bis Dach, tiefere von beiden): Objekt-Info und Befehl wand

This commit is contained in:
Claude committed 2026-11-19 10:49:42 +00:00
1 parent c7f7f66b33
commit c1b4dcf67a
14 files changed
+184 -71

No files matched your search

+14 -13
View File
@@ -33,6 +33,7 @@ import type {
} from "../types";
import { createMutation, createPreview, xy } from "../createCore";
import { t } from "../../i18n";
import { wallTopNext, wallTopPatch, type WallTopMode } from "../../model/wallTop";
const EPS = 1e-6;
const DEG = Math.PI / 180;
@@ -81,10 +82,10 @@ interface ArcMode {
typeName: string | null;
/** [285] Aussenbauteil (IFC `IsExternal`): „auto“ = nach dem Wandtyp („Aussenwand“ ⇒ aussen), „yes“/„no“ ausdrücklich. */
ext: "auto" | "yes" | "no";
/** [292] OK bis Decke: neue Wände enden an der Unterkante der Decke ihres Geschosses (Vorgabe aus). */
ceil: boolean;
/** [292]/[293] Oberkante neuer Wände (Geschosshöhe, bis Decke, bis Dach, tiefere von beiden; Vorgabe Geschosshöhe). */
top: WallTopMode;
}
const NO_MODE: ArcMode = { arc: false, tangent: false, typeId: null, typeName: null, ext: "auto", ceil: false };
const NO_MODE: ArcMode = { arc: false, tangent: false, typeId: null, typeName: null, ext: "auto", top: "storey" };
const EXT_NEXT = { auto: "yes", yes: "no", no: "auto" } as const;
/** Kontext mit dem gewählten Wandtyp des Befehls (Option „Wandtyp“); ein inzwischen gelöschter Typ fällt auf den aktiven zurück. */
@@ -120,7 +121,7 @@ const arcOption = (on: boolean): CmdOption => ({ id: "arc", labelKey: "cmd.polyl
const tangentOption = (on: boolean): CmdOption => ({ id: "tangent", labelKey: "cmd.polyline.tangentOpt", value: on ? "on" : "off" });
const typeOption = (s: ArcMode): CmdOption => ({ id: "wtype", labelKey: "cmd.wall.typeOpt", value: s.typeName ?? t("cmd.wall.typeActive"), key: "W" });
const extOption = (s: ArcMode): CmdOption => ({ id: "ext", labelKey: "cmd.wall.extOpt", value: t(`cmd.wall.ext.${s.ext}`), key: t("cmd.wall.extKey") });
const ceilOption = (s: ArcMode): CmdOption => ({ id: "ceil", labelKey: "cmd.wall.ceilOpt", value: t(s.ceil ? "cmd.wall.ext.yes" : "cmd.wall.ext.no"), key: t("cmd.wall.ceilKey") });
const topOption = (s: ArcMode): CmdOption => ({ id: "top", labelKey: "cmd.wall.topOpt", value: t(`objinfo.wall.topMode.${s.top}`), key: t("cmd.wall.topKey") });
/**
* Bänder der schon gesetzten Segmente: sie ändern sich je Mausschritt nicht und werden nur neu gerechnet,
@@ -170,13 +171,13 @@ function wallDraft(
* Commit: je Achssegment eine Wand des aktiven Typs (Höhe aus dem Geschoss); eine gelockte Dicke
* (einschichtig) wählt/erzeugt den passenden Wandtyp — beides im Kern (`cmd_create.rs`).
*/
const appendWalls = (pts: Vec2[], ctx: CommandContext, thick: number | null, segs: Seg[] = [], ext: ArcMode["ext"] = "auto", ceil = false) => {
const appendWalls = (pts: Vec2[], ctx: CommandContext, thick: number | null, segs: Seg[] = [], ext: ArcMode["ext"] = "auto", top: WallTopMode = "storey") => {
const external = ext === "auto" ? null : ext === "yes";
return createMutation(
ctx,
segs.some((g) => g !== 0)
? { cmd: "wall", pts: pts.map(xy), thick, segs, external, ceilingAttach: ceil }
: { cmd: "wall", pts: pts.map(xy), thick, external, ceilingAttach: ceil },
? { cmd: "wall", pts: pts.map(xy), thick, segs, external, ...wallTopPatch(top) }
: { cmd: "wall", pts: pts.map(xy), thick, external, ...wallTopPatch(top) },
);
};
@@ -189,7 +190,7 @@ const idle = (
{ draft: null, done: true },
];
const modeOf = (s: ArcMode): ArcMode => ({ arc: s.arc, tangent: s.tangent, typeId: s.typeId, typeName: s.typeName, ext: s.ext, ceil: s.ceil });
const modeOf = (s: ArcMode): ArcMode => ({ arc: s.arc, tangent: s.tangent, typeId: s.typeId, typeName: s.typeName, ext: s.ext, top: s.top });
const draftOf = (ctx: CommandContext, s: WallDrawing): ToolDraft => wallDraft(ctx, s.points, s.cursor, s.thickOverride, s);
export const wallCommand: Command = {
@@ -205,7 +206,7 @@ export const wallCommand: Command = {
accepts: () => ["point", "number", "option"],
options: (s) => {
const ps = s as WallCmdState;
const arc = [arcOption(!!ps.arc), ...(ps.arc ? [tangentOption(!!ps.tangent)] : []), typeOption(ps), extOption(ps), ceilOption(ps)];
const arc = [arcOption(!!ps.arc), ...(ps.arc ? [tangentOption(!!ps.tangent)] : []), typeOption(ps), extOption(ps), topOption(ps)];
return ps.phase === "next" ? [...arc, UNDO] : arc;
},
init: (): WallIdle => ({ phase: "start", lastPoint: null, thickOverride: null, single: false, ...NO_MODE }),
@@ -215,10 +216,10 @@ export const wallCommand: Command = {
const to = s.thickOverride;
// [285] Wandtyp wählen (reihum durch die Typen des Projekts) bzw. Aussenbauteil umschalten.
if (input.kind === "option" && (input.id === "wtype" || input.id === "ext" || input.id === "ceil")) {
if (input.kind === "option" && (input.id === "wtype" || input.id === "ext" || input.id === "top")) {
let flip: Partial<ArcMode>;
if (input.id === "ext") flip = { ext: EXT_NEXT[s.ext] };
else if (input.id === "ceil") flip = { ceil: !s.ceil };
else if (input.id === "top") flip = { top: wallTopNext(s.top) };
else {
const list = ctx0.project.wallTypes;
if (list.length === 0) return [s, { draft: null }];
@@ -301,7 +302,7 @@ export const wallCommand: Command = {
if (s.points.length >= 3 && segLen(s.points[0], pt) < EPS) {
return [
{ phase: "start", lastPoint: null, thickOverride: to, single, ...modeOf(s) } as WallIdle,
{ draft: null, done: true, commit: appendWalls([...s.points, s.points[0]], ctx, to, [...s.segs, seg], s.ext, s.ceil) },
{ draft: null, done: true, commit: appendWalls([...s.points, s.points[0]], ctx, to, [...s.segs, seg], s.ext, s.top) },
];
}
const ns: WallDrawing = {
@@ -334,7 +335,7 @@ export const wallCommand: Command = {
const to = s.thickOverride;
return [
{ phase: "start", lastPoint: null, thickOverride: to, single: s.single, ...modeOf(s) } as WallIdle,
{ draft: null, done: true, commit: appendWalls(pts, ctx, to, s.segs, s.ext, s.ceil) },
{ draft: null, done: true, commit: appendWalls(pts, ctx, to, s.segs, s.ext, s.top) },
];
}
return idle(s.thickOverride, s.single, modeOf(s));
+12
View File
@@ -79,4 +79,16 @@ describe("wallCommand Wandtyp und Aussenbauteil [285]", () => {
const o = wallCommand.options(s).find((x) => x.id === "wtype");
expect(o?.value).toBe("Innenwand 12");
});
it("Option Oberkante [293]: reihum Geschosshöhe, Decke, Dach, tiefere von beiden", () => {
const w0 = draw([]);
expect(w0.ceilingAttach).toBeUndefined();
expect(w0.roofAttach).toBeUndefined();
const w1 = draw(["top"]);
expect([w1.ceilingAttach, w1.roofAttach]).toEqual([true, false]);
const w2 = draw(["top", "top"]);
expect([w2.ceilingAttach, w2.roofAttach]).toEqual([undefined, true]);
const w3 = draw(["top", "top", "top"]);
expect([w3.ceilingAttach, w3.roofAttach]).toEqual([true, undefined]);
});
});
+8 -11
View File
@@ -647,20 +647,17 @@ export const de = {
"objinfo.wall.refLine.right": "Innen (rechts)",
"objinfo.wall.refLine.joint": "Fuge",
"objinfo.wall.sliceTermination": "An Decke enden",
"objinfo.wall.roofAttach": "An Dach anschliessen",
"objinfo.isExternal": "Aussenbauteil",
"objinfo.loadBearing": "Tragend",
"objinfo.wall.roofAttach.auto": "Automatisch",
"objinfo.wall.roofAttach.on": "Ja, bis unters Dach",
"objinfo.wall.roofAttach.off": "Nein",
"objinfo.wall.ceilingAttach": "Oberkante",
"objinfo.wall.ceilingAttach.off": "Geschosshöhe",
"objinfo.wall.ceilingAttach.on": "Bis Decke",
"objinfo.wall.ceilingAttach.tip": "Geschosshöhe: Die Wand endet an ihrer Oberkante (Geschoss bzw. frei gesetzt). Bis Decke: Sie endet an der Unterkante der Decke ihres Geschosses, auch bei geneigter Decke; im Deckenloch bleibt die Krone.",
"objinfo.wall.roofAttach.tip": "Automatisch: Die Wand endet je Schicht an der Dach-Unterkante, wo ihre Krone darüber liegt. Ja: zusätzlich bis unter das Dach verlängert. Nein: Dächer schneiden die Wand nicht.",
"objinfo.wall.sliceTermination.both": "Aus",
"objinfo.wall.sliceTermination.below": "Unten",
"objinfo.wall.sliceTermination.above": "Oben",
"objinfo.wall.topMode": "Oberkante",
"objinfo.wall.topMode.storey": "Geschosshöhe / Frei (Höhe)",
"objinfo.wall.topMode.ceiling": "Bis Decke",
"objinfo.wall.topMode.roof": "Bis Dach",
"objinfo.wall.topMode.lower": "Bis Decke/Dach (tiefere)",
"objinfo.wall.topMode.tip": "Geschosshöhe / Frei: Die Wand endet an ihrer Oberkante (Geschoss bzw. frei gesetzt, Höhe unten); Dächer schneiden sie automatisch. Bis Decke: Unterkante der Decke ihres Geschosses, auch geneigt; Dächer schneiden nicht. Bis Dach: bis unter das Dach verlängert. Bis Decke/Dach: je Punkt die tiefere der beiden Kanten.",
"objinfo.wall.buildup": "Aufbau",
"objinfo.wall.single": "Solid",
"objinfo.wall.multi": "Mehrschichtig",
@@ -2080,8 +2077,8 @@ export const de = {
"cmd.wall.typeActive": "aktiv",
"cmd.wall.extOpt": "Aussenbauteil",
"cmd.wall.extKey": "A",
"cmd.wall.ceilOpt": "OK bis Decke",
"cmd.wall.ceilKey": "D",
"cmd.wall.topOpt": "Oberkante",
"cmd.wall.topKey": "D",
"cmd.wall.ext.auto": "nach Typ",
"cmd.wall.ext.yes": "ja",
"cmd.wall.ext.no": "nein",
+8 -11
View File
@@ -645,20 +645,17 @@ export const en: Record<TranslationKey, string> = {
"objinfo.wall.refLine.right": "Interior (right)",
"objinfo.wall.refLine.joint": "Joint",
"objinfo.wall.sliceTermination": "End at ceiling",
"objinfo.wall.roofAttach": "Attach to roof",
"objinfo.isExternal": "External",
"objinfo.loadBearing": "Load-bearing",
"objinfo.wall.roofAttach.auto": "Automatic",
"objinfo.wall.roofAttach.on": "Yes, up to the roof",
"objinfo.wall.roofAttach.off": "No",
"objinfo.wall.ceilingAttach": "Top",
"objinfo.wall.ceilingAttach.off": "Storey height",
"objinfo.wall.ceilingAttach.on": "Up to ceiling",
"objinfo.wall.ceilingAttach.tip": "Storey height: the wall ends at its top (storey or freely set). Up to ceiling: it ends at the underside of its storey's ceiling, also for a sloped ceiling; the crown stays in a ceiling opening.",
"objinfo.wall.roofAttach.tip": "Automatic: each wall layer ends at the roof underside where its top lies above it. Yes: also extended up to the roof. No: roofs do not cut the wall.",
"objinfo.wall.sliceTermination.both": "Off",
"objinfo.wall.sliceTermination.below": "Below",
"objinfo.wall.sliceTermination.above": "Above",
"objinfo.wall.topMode": "Top",
"objinfo.wall.topMode.storey": "Storey height / free (height)",
"objinfo.wall.topMode.ceiling": "Up to ceiling",
"objinfo.wall.topMode.roof": "Up to roof",
"objinfo.wall.topMode.lower": "Ceiling/roof (lower one)",
"objinfo.wall.topMode.tip": "Storey height / free: the wall ends at its top (storey or freely set, height below); roofs cut it automatically. Up to ceiling: underside of its storey's ceiling, also sloped; roofs do not cut. Up to roof: extended up to the roof. Ceiling/roof: the lower of both edges at each point.",
"objinfo.wall.buildup": "Build-up",
"objinfo.wall.single": "Solid",
"objinfo.wall.multi": "Multi layer",
@@ -2069,8 +2066,8 @@ export const en: Record<TranslationKey, string> = {
"cmd.wall.typeActive": "active",
"cmd.wall.extOpt": "External",
"cmd.wall.extKey": "E",
"cmd.wall.ceilOpt": "Top to ceiling",
"cmd.wall.ceilKey": "C",
"cmd.wall.topOpt": "Top",
"cmd.wall.topKey": "T",
"cmd.wall.ext.auto": "by type",
"cmd.wall.ext.yes": "yes",
"cmd.wall.ext.no": "no",
+24
View File
@@ -0,0 +1,24 @@
import { describe, expect, it } from "vitest";
import { WALL_TOP_MODES, wallTopFromFields, wallTopPatch, wallTopNext } from "./wallTop";
describe("Wand-Oberkante [293]", () => {
it("Felder und Auswahl sind umkehrbar", () => {
for (const m of WALL_TOP_MODES) {
const p = wallTopPatch(m);
expect(wallTopFromFields(p.roofAttach, p.ceilingAttach)).toBe(m);
}
});
it("Standard (nichts gesetzt) = Geschosshöhe", () => {
expect(wallTopFromFields(undefined, undefined)).toBe("storey");
expect(wallTopPatch("storey")).toEqual({ roofAttach: undefined, ceilingAttach: undefined });
});
it("Decke allein schaltet das Dach ab, tiefere lässt es automatisch", () => {
expect(wallTopPatch("ceiling")).toEqual({ roofAttach: false, ceilingAttach: true });
expect(wallTopPatch("lower")).toEqual({ roofAttach: undefined, ceilingAttach: true });
expect(wallTopPatch("roof")).toEqual({ roofAttach: true, ceilingAttach: undefined });
});
it("reihum", () => {
expect(wallTopNext("storey")).toBe("ceiling");
expect(wallTopNext("lower")).toBe("storey");
});
});
+32
View File
@@ -0,0 +1,32 @@
/**
* [293] Wand-Oberkante als EINE Auswahl über die Felder `Wall.roofAttach` ([G2]) und `Wall.ceilingAttach` ([292]).
* Die Höhe selbst (`height`/`top`) bleibt getrennt (Geschosshöhe bzw. frei, s. Objekt-Info „Höhe“).
* storey — Geschosshöhe/frei: Dächer schneiden automatisch, keine Decke
* roof — bis unters Dach verlängert
* ceiling — bis Unterkante der Decke, Dächer schneiden nicht
* lower — Decke und Dach, je Punkt die tiefere Kante (so rechnet `wall_bands.rs` bei beiden Feldern)
*/
export type WallTopMode = "storey" | "ceiling" | "roof" | "lower";
export const WALL_TOP_MODES: readonly WallTopMode[] = ["storey", "ceiling", "roof", "lower"];
export interface WallTopFields {
roofAttach: boolean | undefined;
ceilingAttach: boolean | undefined;
}
export function wallTopFromFields(roofAttach: boolean | undefined, ceilingAttach: boolean | undefined): WallTopMode {
if (ceilingAttach) return roofAttach === false ? "ceiling" : "lower";
return roofAttach === true ? "roof" : "storey";
}
/** Felder für eine Auswahl; `undefined` entfernt das Feld (Vorgabe). */
export function wallTopPatch(mode: WallTopMode): WallTopFields {
switch (mode) {
case "storey": return { roofAttach: undefined, ceilingAttach: undefined };
case "roof": return { roofAttach: true, ceilingAttach: undefined };
case "ceiling": return { roofAttach: false, ceilingAttach: true };
case "lower": return { roofAttach: undefined, ceilingAttach: true };
}
}
export const wallTopNext = (m: WallTopMode): WallTopMode => WALL_TOP_MODES[(WALL_TOP_MODES.indexOf(m) + 1) % WALL_TOP_MODES.length];
+3 -2
View File
@@ -46,6 +46,7 @@ import type { TerrainOptions } from "../model/terrain";
import type { TextStylePreset } from "../text/richText";
import type { ScheduleKind } from "../export/exportSchedule";
import type { DetailLevel } from "../model/viewTypes";
import type { WallTopMode } from "../model/wallTop";
import type { TabId as ResourceTabId } from "../ui/ResourceManager";
// ── Darstellungsmodus-Steuerung je Dock-Inhalt ────────────────────────────
@@ -421,8 +422,8 @@ export interface PanelHostValue {
*/
onSetWallSliceTermination: (termination: SliceTermination) => void;
/** An Dach anschliessen ([G2]): "auto" = Default (Wand endet an der Dach-Unterkante). */
onSetWallRoofAttach: (attach: "auto" | "on" | "off") => void;
onSetWallCeilingAttach: (attach: boolean) => void;
/** [293] Oberkante der Wand: setzt `roofAttach` und `ceilingAttach` zusammen (ein Undo-Schritt). */
onSetWallTopMode: (mode: WallTopMode) => void;
/** Aussenbauteil/tragend der gewählten Wand bzw. Decke ([97]/[98]); `false` = Feld weg. */
onSetBuildingFlags: (flags: { isExternal?: boolean; loadBearing?: boolean }) => void;
/** [178] Deckenrand der gewählten Decke: `true` = bis an den Umriss, `false` = Auflager bis Kern (Standard). */
+11 -24
View File
@@ -8,6 +8,7 @@ import { usePanelHost } from "../host";
import { t } from "../../i18n";
import { Dropdown } from "../../ui/Dropdown";
import type { WallReferenceLine, SliceTermination } from "../../model/types";
import { wallTopFromFields, type WallTopMode } from "../../model/wallTop";
import { UValueRow } from "../UValueRow";
import { formatM } from "../../model/types";
import { BuildingFlags, DimensionField, MixedMark, VerticalAnchorRow } from "./fields";
@@ -99,34 +100,20 @@ export function WallSection({
/>
</div>
{/* An Dach anschliessen ([G2]): automatisch endet die Wand an der Dach-Unterkante, "Ja"
verlängert sie bis unter das Dach, "Nein" lässt die Dächer die Wand nicht schneiden. */}
{/* Oberkante ([293], [G2], [292]): EINE Auswahl über roofAttach + ceilingAttach (eine Op). */}
<div className="objinfo-field">
<span className="objinfo-flabel">{t("objinfo.wall.roofAttach")}</span>
<span className="objinfo-flabel">{t("objinfo.wall.topMode")}</span>
<Dropdown
value={wall.roofAttach}
onChange={(v) => host.onSetWallRoofAttach(v as "auto" | "on" | "off")}
value={wallTopFromFields(wall.roofAttach === "auto" ? undefined : wall.roofAttach === "on", wall.ceilingAttach)}
onChange={(v) => host.onSetWallTopMode(v as WallTopMode)}
options={[
{ value: "auto", label: t("objinfo.wall.roofAttach.auto") },
{ value: "on", label: t("objinfo.wall.roofAttach.on") },
{ value: "off", label: t("objinfo.wall.roofAttach.off") },
{ value: "storey", label: t("objinfo.wall.topMode.storey") },
{ value: "ceiling", label: t("objinfo.wall.topMode.ceiling") },
{ value: "roof", label: t("objinfo.wall.topMode.roof") },
{ value: "lower", label: t("objinfo.wall.topMode.lower") },
]}
title={t("objinfo.wall.roofAttach.tip")}
width={120}
/>
</div>
{/* OK bis Decke ([292]): Oberkante an der Unterkante der Decke des Geschosses, auch geneigt. */}
<div className="objinfo-field">
<span className="objinfo-flabel">{t("objinfo.wall.ceilingAttach")}</span>
<Dropdown
value={wall.ceilingAttach ? "on" : "off"}
onChange={(v) => host.onSetWallCeilingAttach(v === "on")}
options={[
{ value: "off", label: t("objinfo.wall.ceilingAttach.off") },
{ value: "on", label: t("objinfo.wall.ceilingAttach.on") },
]}
title={t("objinfo.wall.ceilingAttach.tip")}
width={120}
title={t("objinfo.wall.topMode.tip")}
width={150}
/>
</div>
<BuildingFlags isExternal={wall.isExternal} loadBearing={wall.loadBearing} host={host} />
+4 -7
View File
@@ -6,6 +6,7 @@
import { patchItems, removeRoofHole, setRoofEdge } from "../../core";
import type { EntityOf } from "../../core";
import { getState } from "../appStore";
import { wallTopPatch } from "../../model/wallTop";
import type { FlatHostOpts, HostPart } from "./types";
/** Auswahl-Arten mit Mehrfach-Setzen (Schlüssel in `Selection`). */
@@ -88,13 +89,9 @@ export function buildElementAttributesHost(c: FlatHostOpts) {
// "both" ist der Default ⇒ als undefined speichern (Alt-Projekt-Parität).
patchAll("walls", selection.id, { sliceTermination: termination === "both" ? undefined : termination });
},
onSetWallRoofAttach: (attach) => {
if (selection?.kind === "wall")
// "auto" ist der Default ⇒ als undefined speichern.
patchAll("walls", selection.id, { roofAttach: attach === "auto" ? undefined : attach === "on" });
},
onSetWallCeilingAttach: (attach) => {
if (selection?.kind === "wall") patchAll("walls", selection.id, { ceilingAttach: attach ? true : undefined });
onSetWallTopMode: (mode) => {
// [293] roofAttach + ceilingAttach in EINER Op (undefined = Vorgabe).
if (selection?.kind === "wall") patchAll("walls", selection.id, { ...wallTopPatch(mode) });
},
onSetBuildingFlags: (flags) => {
const patch: { isExternal?: boolean; loadBearing?: boolean } = {};
+3
View File
@@ -91,6 +91,8 @@ declare global {
layerView: () => { wallId: string; visible: string[]; prims: number; wallPrims: number };
/** [195] Strichstärke-Override der Wände (id → mm), nur gesetzte. */
wallWeights: () => Record<string, number>;
/** [293] Oberkante der Wände: `roofAttach`/`ceilingAttach`, nur Wände mit gesetztem Feld. */
wallTops: () => Record<string, { roofAttach?: boolean; ceilingAttach?: boolean }>;
/** [190] Auswahl-Aktion wie das native Menü (Bearbeiten > Verbinden usw.), ohne Tastendruck: `runSelectionAction`. */
selectionAction: (id: SelectionActionId) => void;
/** [190] Wände (id, Start, Ende) des Projekts. */
@@ -151,6 +153,7 @@ export function installTestHooks(): void {
excavations: (p.context ?? []).flatMap((c) => (c.type === "excavation" ? [{ id: c.id, bottom: c.bottom }] : [])),
};
},
wallTops: () => Object.fromEntries(getState().project.walls.flatMap((w) => (w.roofAttach === undefined && w.ceilingAttach === undefined ? [] : [[w.id, { roofAttach: w.roofAttach, ceilingAttach: w.ceilingAttach }]]))),
wallWeights: () => Object.fromEntries(getState().project.walls.flatMap((w) => (w.strokeWeight === undefined ? [] : [[w.id, w.strokeWeight]]))),
selectionAction: (id) => runSelectionAction(id),
walls: () => getState().project.walls.map((w) => ({ id: w.id, start: { ...w.start }, end: { ...w.end } })),