From c70438dba0fd04b0102f7bb3c5542282ff560246 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 27 Oct 2026 20:48:23 +0000 Subject: [PATCH] [81] Automatische Aussenbemassung: Befehl autodim (Kuerzel ab) erzeugt je Gebaeudeseite Oeffnungs-, Vor-/Ruecksprung- und Gesamtkette - geometry/autoDimensions.ts: vereinigte Wand-Grundflaeche (verbundene Enden um halbe Dicke verlaengert), nach aussen schauende achsparallele Kanten je Seite, Leibungen der Oeffnungen in diesen Waenden; Ketten im Abstand 10/17/24 mm Papier (1:100); schiefe Waende werden noch nicht bemasst - Befehl ersetzt beim erneuten Aufruf die automatisch erzeugten Ketten des Geschosses; Werkzeugpalette mit Symbol - Planbegrenzung umfasst die versetzte Masslinie samt Masszahl (vorher schnitten Druck/Einpassen Bemassungen ab) - Tests Claude-Session: https://claude.ai/code/session_01NTYBZBvLYCtugMJoKXaB67 --- src/commands/cmds/autodim.test.ts | 30 +++++ src/commands/cmds/autodim.ts | 44 +++++++ src/commands/registry.ts | 4 + src/core/index.ts | 2 + src/geometry/autoDimensions.test.ts | 74 +++++++++++ src/geometry/autoDimensions.ts | 192 ++++++++++++++++++++++++++++ src/i18n/de.ts | 1 + src/i18n/en.ts | 1 + src/panels/ToolsPanel.tsx | 2 +- src/plan/generatePlan.ts | 11 ++ src/ui/ribbon/CommandIcon.tsx | 13 ++ 11 files changed, 373 insertions(+), 1 deletion(-) create mode 100644 src/commands/cmds/autodim.test.ts create mode 100644 src/commands/cmds/autodim.ts create mode 100644 src/geometry/autoDimensions.test.ts create mode 100644 src/geometry/autoDimensions.ts diff --git a/src/commands/cmds/autodim.test.ts b/src/commands/cmds/autodim.test.ts new file mode 100644 index 00000000..3354bad7 --- /dev/null +++ b/src/commands/cmds/autodim.test.ts @@ -0,0 +1,30 @@ +import { describe, expect, it } from "vitest"; +import { autodimCommand } from "./autodim"; +import { sampleProject } from "../../model/sampleProject"; +import type { CommandContext } from "../types"; + +const ctx = (p = sampleProject, levelId = "eg"): CommandContext => ({ + project: p, + level: p.drawingLevels.find((l) => l.id === levelId)!, + defaultCategoryCode: "80", + activeLineStyleId: "solid", + activeWallTypeId: "aw", + lastPoint: null, + selection: { wallIds: [], drawingId: null }, +}); + +describe("Befehl Aussenbemassung", () => { + it("fügt Massketten hinzu; erneut ausgeführt ersetzt er sie statt zu verdoppeln", () => { + const r1 = autodimCommand.autoRun!(ctx()); + const p1 = r1.commit!(sampleProject); + const added = p1.drawings2d.length - sampleProject.drawings2d.length; + expect(added).toBeGreaterThanOrEqual(4); + const p2 = autodimCommand.autoRun!(ctx(p1)).commit!(p1); + expect(p2.drawings2d.length).toBe(p1.drawings2d.length); + expect(p2.drawings2d.filter((d) => d.geom.shape === "dimension" && d.levelId === "eg").length).toBeGreaterThanOrEqual(4); + }); + it("nicht in Schnitt-/Zeichnungsebenen", () => { + const sec = sampleProject.drawingLevels.find((l) => l.kind !== "floor")!; + expect(autodimCommand.autoRun!(ctx(sampleProject, sec.id)).commit).toBeUndefined(); + }); +}); diff --git a/src/commands/cmds/autodim.ts b/src/commands/cmds/autodim.ts new file mode 100644 index 00000000..f12cc21b --- /dev/null +++ b/src/commands/cmds/autodim.ts @@ -0,0 +1,44 @@ +// Aussenbemassung ([81]) — Sofort-Befehl ohne Punkt-Eingabe: erzeugt für das aktive Geschoss +// die Massketten (Öffnungen, Vor-/Rücksprünge, Gesamtmass) je Gebäudeseite +// (`geometry/autoDimensions.ts`). Ein erneuter Aufruf ersetzt die zuvor automatisch erzeugten +// Ketten DIESES Geschosses (feste IDs), von Hand gezeichnete Bemassungen bleiben. + +import { autoExteriorDimensions } from "../../core"; +import type { Command, CommandContext, CommandResult, CommandState } from "../types"; + +const PREFIX = "autodim"; + +const done = (): [CommandState, CommandResult] => [ + { phase: "idle", lastPoint: null }, + { draft: null, done: true }, +]; + +export const autodimCommand: Command = { + name: "autodim", + labelKey: "cmd.autodim.label", + prompt: () => "cmd.autodim.label", + accepts: () => [], + options: () => [], + init: (): CommandState => ({ phase: "idle", lastPoint: null }), + + autoRun: (ctx: CommandContext): CommandResult => { + if (ctx.level.kind !== "floor") return { draft: null, done: true }; + const floorId = ctx.level.id; + const dims = autoExteriorDimensions(ctx.project, floorId, ctx.defaultCategoryCode, 100, PREFIX); + if (dims.length === 0) return { draft: null, done: true }; + const own = `${PREFIX}-${floorId}-`; + return { + draft: null, + done: true, + commit: (p) => ({ + ...p, + drawings2d: [...p.drawings2d.filter((d) => !d.id.startsWith(own)), ...dims.map((d) => d.drawing)], + }), + }; + }, + + onInput: (): [CommandState, CommandResult] => done(), + onMove: (state): [CommandState, CommandResult] => [state, { draft: null }], + onConfirm: (): [CommandState, CommandResult] => done(), + onCancel: (): [CommandState, CommandResult] => done(), +}; diff --git a/src/commands/registry.ts b/src/commands/registry.ts index 065f05f2..ebaaf27b 100644 --- a/src/commands/registry.ts +++ b/src/commands/registry.ts @@ -42,6 +42,7 @@ import { mirrorCommand } from "./cmds/mirror"; import { rotateCommand } from "./cmds/rotate"; import { scaleCommand } from "./cmds/scale"; import { explodeCommand } from "./cmds/explode"; +import { autodimCommand } from "./cmds/autodim"; import { alignCommand } from "./cmds/align"; import { joinCommand } from "./cmds/join"; import { copyCommand } from "./cmds/copy"; @@ -104,6 +105,7 @@ export const COMMANDS: Record = { rotate: rotateCommand, scale: scaleCommand, explode: explodeCommand, + autodim: autodimCommand, align: alignCommand, join: joinCommand, copy: copyCommand, @@ -215,6 +217,8 @@ export const ALIASES: Record = { skalieren: "scale", x: "explode", aufloesen: "explode", + ab: "autodim", + aussenbemassung: "autodim", al: "align", ausrichten: "align", j: "join", diff --git a/src/core/index.ts b/src/core/index.ts index 12529d4d..05214bf3 100644 --- a/src/core/index.ts +++ b/src/core/index.ts @@ -92,6 +92,8 @@ export { openingGapQuad, openingVerticalExtent, } from "../geometry/opening"; +export { autoExteriorDimensions } from "../geometry/autoDimensions"; +export type { AutoDimension } from "../geometry/autoDimensions"; export { nearestPolylineTarget, diff --git a/src/geometry/autoDimensions.test.ts b/src/geometry/autoDimensions.test.ts new file mode 100644 index 00000000..c2cdedef --- /dev/null +++ b/src/geometry/autoDimensions.test.ts @@ -0,0 +1,74 @@ +import { describe, expect, it } from "vitest"; +import { autoExteriorDimensions } from "./autoDimensions"; +import type { Opening, Project, Wall } from "../model/types"; + +// L-förmiger Grundriss aus 0.3-m-Wänden (Achsen): (0,0)→(10,0)→(10,6)→(4,6)→(4,9)→(0,9)→(0,0). +const axis: [number, number][] = [[0, 0], [10, 0], [10, 6], [4, 6], [4, 9], [0, 9]]; +function project(openings: Opening[] = []): Project { + const walls: Wall[] = axis.map(([x, y], i) => { + const [x2, y2] = axis[(i + 1) % axis.length]; + return { id: `W${i}`, type: "wall", floorId: "eg", categoryCode: "20", start: { x, y }, end: { x: x2, y: y2 }, wallTypeId: "aw" } as Wall; + }); + return { + id: "t", name: "T", lineStyles: [], hatches: [], components: [{ id: "c", name: "C", color: "#ccc", hatchId: "none", joinPriority: 1 }], + wallTypes: [{ id: "aw", name: "AW", layers: [{ componentId: "c", thickness: 0.3 }] }], + drawingLevels: [{ id: "eg", name: "EG", kind: "floor", visible: true, locked: false, floorHeight: 2.6, cutHeight: 1, baseElevation: 0 }], + layers: [], walls, openings, ceilings: [], stairs: [], rooms: [], drawings2d: [], context: [], + } as unknown as Project; +} +const lengths = (pts: { x: number; y: number }[]) => pts.slice(1).map((p, i) => Math.hypot(p.x - pts[i].x, p.y - pts[i].y)); +const sum = (a: number[]) => a.reduce((s, v) => s + v, 0); + +describe("automatische Aussenbemassung", () => { + it("vier Seiten, Gesamtmass = Aussenmass", () => { + const dims = autoExteriorDimensions(project(), "eg", "80"); + const totals = dims.filter((d) => d.chain === "total"); + expect(totals).toHaveLength(4); + const byside = Object.fromEntries(totals.map((d) => [d.side, sum(lengths(d.drawing.geom.shape === "dimension" ? d.drawing.geom.pts : []))])); + expect(byside.south).toBeCloseTo(10.3, 6); + expect(byside.north).toBeCloseTo(10.3, 6); + expect(byside.west).toBeCloseTo(9.3, 6); + expect(byside.east).toBeCloseTo(9.3, 6); + }); + it("Vor-/Rücksprung-Kette nur, wo die Seite gestuft ist (L: Nord und Ost)", () => { + const dims = autoExteriorDimensions(project(), "eg", "80"); + const steps = dims.filter((d) => d.chain === "steps"); + expect(steps.map((d) => d.side).sort()).toEqual(["east", "north"]); + const north = steps.find((d) => d.side === "north")!; + const g = north.drawing.geom; + expect(g.shape === "dimension" && lengths(g.pts).map((v) => +v.toFixed(3)).sort((a, b) => a - b)).toEqual([4.3, 6]); + }); + it("Öffnungskette mit Leibungen, Abstand nach aussen positiv", () => { + const o = { id: "F1", type: "opening", categoryCode: "21", kind: "window", hostWallId: "W0", position: 2, width: 1.5, height: 1.4, sillHeight: 0.9 } as Opening; + const dims = autoExteriorDimensions(project([o]), "eg", "80"); + const south = dims.find((d) => d.side === "south" && d.chain === "openings")!; + const g = south.drawing.geom; + expect(g.shape).toBe("dimension"); + if (g.shape !== "dimension") return; + expect(lengths(g.pts).length).toBe(3); + expect(sum(lengths(g.pts))).toBeCloseTo(10.3, 6); + expect(g.offset).toBeGreaterThan(0); + // Masslinie liegt ausserhalb (südlich) des Gebäudes. + const nx = -(g.pts[1].y - g.pts[0].y), ny = g.pts[1].x - g.pts[0].x; + const len = Math.hypot(nx, ny); + expect(g.pts[0].y + (ny / len) * g.offset).toBeLessThan(-0.15); + expect(south.drawing.levelId).toBe("eg"); + expect(south.drawing.categoryCode).toBe("80"); + }); + it("ohne Wände nichts", () => { + expect(autoExteriorDimensions({ ...project(), walls: [] }, "eg", "80")).toEqual([]); + }); +}); + +describe("Planbegrenzung mit Bemassung", () => { + it("umfasst die versetzte Masslinie samt Masszahl", async () => { + const { generatePlan } = await import("../plan/generatePlan"); + const p = project(); + const dims = autoExteriorDimensions(p, "eg", "80"); + const withDims = { ...p, layers: [{ code: "80", name: "Mass", color: "#000", lw: 0.18, visible: true, locked: false }], drawings2d: dims.map((d) => d.drawing) } as Project; + const b = generatePlan(withDims, "eg", new Set(["80"])).bounds; + // Gesamtmass Süd liegt 2.4 m ausserhalb von y = -0.15. + expect(b.minY).toBeLessThan(-0.15 - 2.4); + expect(b.maxX).toBeGreaterThan(10.15 + 2.4); + }); +}); diff --git a/src/geometry/autoDimensions.ts b/src/geometry/autoDimensions.ts new file mode 100644 index 00000000..d79b49dd --- /dev/null +++ b/src/geometry/autoDimensions.ts @@ -0,0 +1,192 @@ +// Automatische Aussenbemassung ([81]): je Gebäudeseite (Süd, Ost, Nord, West) bis zu drei +// Massketten ausserhalb des Grundrisses, von innen nach aussen: +// 1. Öffnungen — Gebäudeecken der Seite plus Leibungen der Fenster/Türen in Wänden dieser Seite, +// 2. Vor-/Rücksprünge — die Ecken der nach dieser Seite schauenden Aussenkanten (nur bei Stufung), +// 3. Gesamtmass. +// Grundlage ist die vereinigte Grundfläche der Wände des Geschosses (an verbundenen Enden um die +// halbe Dicke verlängert, damit Aussenecken voll sind). Nur achsparallele Kanten werden bemasst; +// schiefe Wände fehlen in den Ketten. Ergebnis sind gewöhnliche Bemassungen (Drawing2D), danach +// frei bearbeitbar. + +import polygonClipping from "polygon-clipping"; +import type { Pair, Polygon as PcPolygon } from "polygon-clipping"; +import type { Drawing2D, Project, Vec2, Wall } from "../model/types"; +import { getWallType, wallTypeThickness } from "../model/types"; +import { openingJambs } from "./opening"; + +export type DimSide = "south" | "east" | "north" | "west"; +export type DimChain = "openings" | "steps" | "total"; + +export interface AutoDimension { + side: DimSide; + chain: DimChain; + drawing: Drawing2D; +} + +/** Aussennormalen der Seiten (Modell: x = Ost, y = Nord). */ +const SIDES: { side: DimSide; n: Vec2 }[] = [ + { side: "south", n: { x: 0, y: -1 } }, + { side: "east", n: { x: 1, y: 0 } }, + { side: "north", n: { x: 0, y: 1 } }, + { side: "west", n: { x: -1, y: 0 } }, +]; + +const EPS = 1e-6; +const dot = (a: Vec2, b: Vec2) => a.x * b.x + a.y * b.y; + +/** Abstand der Ketten von der äussersten Kante in Papier-mm (1:100 → 1.0 / 1.7 / 2.4 m). */ +const CHAIN_MM = { openings: 10, steps: 17, total: 24 } as const; + +function wallRect(w: Wall, t: number, extStart: number, extEnd: number): Vec2[] { + const dx = w.end.x - w.start.x, dy = w.end.y - w.start.y; + const len = Math.hypot(dx, dy); + const ux = dx / len, uy = dy / len; + const nx = -uy * (t / 2), ny = ux * (t / 2); + const a = { x: w.start.x - ux * extStart, y: w.start.y - uy * extStart }; + const b = { x: w.end.x + ux * extEnd, y: w.end.y + uy * extEnd }; + return [ + { x: a.x + nx, y: a.y + ny }, { x: b.x + nx, y: b.y + ny }, + { x: b.x - nx, y: b.y - ny }, { x: a.x - nx, y: a.y - ny }, + ]; +} + +/** Liegt `p` auf einer anderen Wandachse (Ende oder dazwischen)? Dann ist das Wandende verbunden. */ +function connected(p: Vec2, self: Wall, walls: Wall[]): boolean { + for (const o of walls) { + if (o === self) continue; + const dx = o.end.x - o.start.x, dy = o.end.y - o.start.y; + const l2 = dx * dx + dy * dy; + if (l2 < EPS) continue; + const t = Math.max(0, Math.min(1, ((p.x - o.start.x) * dx + (p.y - o.start.y) * dy) / l2)); + if (Math.hypot(o.start.x + t * dx - p.x, o.start.y + t * dy - p.y) < 1e-3) return true; + } + return false; +} + +/** Aussenringe der vereinigten Wand-Grundfläche (gegen den Uhrzeigersinn). */ +function outerRings(project: Project, walls: Wall[]): Vec2[][] { + const parts: PcPolygon[] = []; + for (const w of walls) { + if (Math.hypot(w.end.x - w.start.x, w.end.y - w.start.y) < EPS) continue; + let t = 0.3; + try { + t = wallTypeThickness(getWallType(project, w)); + } catch { + /* verwaister Wandtyp */ + } + const r = wallRect(w, t, connected(w.start, w, walls) ? t / 2 : 0, connected(w.end, w, walls) ? t / 2 : 0); + parts.push([[...r.map((p): Pair => [p.x, p.y]), [r[0].x, r[0].y]]]); + } + if (parts.length === 0) return []; + const rings: Vec2[][] = []; + for (const poly of polygonClipping.union(parts[0], ...parts.slice(1))) { + const ring = poly[0].slice(0, -1).map(([x, y]) => ({ x, y })); + let a = 0; + for (let i = 0; i < ring.length; i++) { + const p = ring[i], q = ring[(i + 1) % ring.length]; + a += p.x * q.y - q.x * p.y; + } + rings.push(a < 0 ? ring.reverse() : ring); + } + return rings; +} + +/** Werte zusammenfassen, die näher als 1 mm beieinander liegen (sortiert). */ +function uniqueSorted(vals: number[]): number[] { + const s = vals.slice().sort((a, b) => a - b); + const out: number[] = []; + for (const v of s) if (out.length === 0 || v - out[out.length - 1] > 1e-3) out.push(v); + return out; +} + +/** + * Erzeugt die Aussenbemassung eines Geschosses. `scaleDenominator` bestimmt den Abstand der + * Ketten (Papier-mm → Modell-Meter), `categoryCode` die Ebene der neuen Bemassungen. + */ +export function autoExteriorDimensions( + project: Project, + floorId: string, + categoryCode: string, + scaleDenominator = 100, + idPrefix = "autodim", +): AutoDimension[] { + const walls = project.walls.filter((w) => w.floorId === floorId); + const rings = outerRings(project, walls); + if (rings.length === 0) return []; + const toM = (mm: number) => (mm / 1000) * scaleDenominator; + const out: AutoDimension[] = []; + + for (const { side, n } of SIDES) { + // Laufrichtung so, dass die linke Normale = Aussennormale ist (positiver Abstand = aussen). + const u: Vec2 = { x: n.y, y: -n.x }; + let sMax = -Infinity, tMin = Infinity, tMax = -Infinity; + const corners: number[] = []; + // Kanten, die nach `n` schauen: Aussennormale (rechte Normale eines CCW-Rings) ≈ n. + const faces: { s: number; t0: number; t1: number }[] = []; + for (const ring of rings) { + for (const p of ring) { + sMax = Math.max(sMax, dot(p, n)); + tMin = Math.min(tMin, dot(p, u)); + tMax = Math.max(tMax, dot(p, u)); + } + for (let i = 0; i < ring.length; i++) { + const a = ring[i], b = ring[(i + 1) % ring.length]; + const dx = b.x - a.x, dy = b.y - a.y; + const len = Math.hypot(dx, dy); + if (len < EPS) continue; + const outward = { x: dy / len, y: -dx / len }; + if (dot(outward, n) < 1 - 1e-6) continue; // nur achsparallele, nach n schauende Kanten + const ta = dot(a, u), tb = dot(b, u); + faces.push({ s: dot(a, n), t0: Math.min(ta, tb), t1: Math.max(ta, tb) }); + corners.push(ta, tb); + } + } + if (faces.length === 0) continue; + + // Öffnungen in Wänden, deren Aussenseite auf einer dieser Kanten liegt. + const jambs: number[] = []; + for (const o of project.openings ?? []) { + const w = walls.find((x) => x.id === o.hostWallId); + if (!w) continue; + const dx = w.end.x - w.start.x, dy = w.end.y - w.start.y; + const len = Math.hypot(dx, dy); + if (len < EPS || Math.abs(dot({ x: dx / len, y: dy / len }, n)) > 1e-6) continue; // Wand quer zu n + let t = 0.3; + try { + t = wallTypeThickness(getWallType(project, w)); + } catch { + /* verwaister Wandtyp */ + } + const outerS = dot(w.start, n) + t / 2; + const j = openingJambs(w, o); + if (!j) continue; + const ja = dot(j.jambStart, u), jb = dot(j.jambEnd, u); + const onFace = faces.some((f) => Math.abs(f.s - outerS) < 1e-3 && Math.min(ja, jb) >= f.t0 - 1e-3 && Math.max(ja, jb) <= f.t1 + 1e-3); + if (onFace) jambs.push(ja, jb); + } + + const chains: { chain: DimChain; ts: number[] }[] = []; + const total = [tMin, tMax]; + const steps = uniqueSorted(corners); + if (jambs.length > 0) chains.push({ chain: "openings", ts: uniqueSorted([...steps, ...jambs]) }); + if (steps.length > 2) chains.push({ chain: "steps", ts: steps }); + chains.push({ chain: "total", ts: total }); + + for (const { chain, ts } of chains) { + if (ts.length < 2) continue; + const pts = ts.map((t) => ({ x: u.x * t + n.x * sMax, y: u.y * t + n.y * sMax })); + out.push({ + side, + chain, + drawing: { + id: `${idPrefix}-${floorId}-${side}-${chain}`, + type: "drawing2d", + levelId: floorId, + categoryCode, + geom: { shape: "dimension", pts, offset: toM(CHAIN_MM[chain]) }, + } as Drawing2D, + }); + } + } + return out; +} diff --git a/src/i18n/de.ts b/src/i18n/de.ts index dce0a216..7f8ba810 100644 --- a/src/i18n/de.ts +++ b/src/i18n/de.ts @@ -1500,6 +1500,7 @@ export const de = { "cmd.align.distX": "waagrecht verteilen", "cmd.align.distY": "senkrecht verteilen", "cmd.explode.label": "Auflösen", + "cmd.autodim.label": "Aussenbemassung", "cmd.scale.label": "Skalieren", "cmd.scale.base": "Basispunkt:", "cmd.scale.factor": "Faktor oder Referenzlänge (Punkt):", diff --git a/src/i18n/en.ts b/src/i18n/en.ts index be729aab..fd65fd10 100644 --- a/src/i18n/en.ts +++ b/src/i18n/en.ts @@ -1488,6 +1488,7 @@ export const en: Record = { "cmd.align.distX": "Distribute horizontally", "cmd.align.distY": "Distribute vertically", "cmd.explode.label": "Explode", + "cmd.autodim.label": "Exterior dimensions", "cmd.scale.label": "Scale", "cmd.scale.base": "Base point:", "cmd.scale.factor": "Factor or reference length (point):", diff --git a/src/panels/ToolsPanel.tsx b/src/panels/ToolsPanel.tsx index a7d0616c..6fc3f2ff 100644 --- a/src/panels/ToolsPanel.tsx +++ b/src/panels/ToolsPanel.tsx @@ -355,7 +355,7 @@ const TOOLS_2D: ToolId[] = [ "image", ]; const TOOLS_3D: ToolId[] = ["wall", "ceiling", "window", "door", "stair", "room"]; -const COMMANDS_3D = ["column", "ceilingopening", "roof", "extrude", "solid", "solidbool", "sectionline", "viewline"]; +const COMMANDS_3D = ["column", "ceilingopening", "roof", "extrude", "solid", "solidbool", "sectionline", "viewline", "autodim"]; const COMMANDS_EDIT = ["move", "copy", "array", "rotate", "mirror", "offset", "multiline", "trim", "break", "extend", "fillet", "chamfer", "join", "defblock", "measure"]; type ToolsView = "list" | "icons"; diff --git a/src/plan/generatePlan.ts b/src/plan/generatePlan.ts index 91fbe570..ecf9056c 100644 --- a/src/plan/generatePlan.ts +++ b/src/plan/generatePlan.ts @@ -1126,6 +1126,17 @@ function computeBounds( g.pts.forEach(acc); } else if (g.shape === "dimension") { g.pts.forEach(acc); + // Masslinie liegt um `offset` versetzt (linke Normale je Segment), die Masszahl noch etwas + // weiter aussen — beides mit einrahmen, sonst schneiden Druck/Einpassen die Kette ab. + const reach = g.offset * 1.4; + for (let i = 0; i + 1 < g.pts.length; i++) { + const a = g.pts[i], b = g.pts[i + 1]; + const len = Math.hypot(b.x - a.x, b.y - a.y); + if (len < 1e-9) continue; + const nx = (-(b.y - a.y) / len) * reach, ny = ((b.x - a.x) / len) * reach; + acc({ x: a.x + nx, y: a.y + ny }); + acc({ x: b.x + nx, y: b.y + ny }); + } } else if (g.shape === "kote") acc(g.at); else if (g.shape === "detailref") acc(g.at); else if (g.shape === "scalebar") { diff --git a/src/ui/ribbon/CommandIcon.tsx b/src/ui/ribbon/CommandIcon.tsx index eab75b33..d72d529e 100644 --- a/src/ui/ribbon/CommandIcon.tsx +++ b/src/ui/ribbon/CommandIcon.tsx @@ -45,6 +45,19 @@ export function CommandIcon({ name }: { name: string }) { ); + case "autodim": + // Grundriss-Rechteck mit zwei Massketten (unten und rechts). + return ( + + + + + + + + + + ); case "measure": // Lineal/Massband: Strecke mit Endmarken + kleiner Skala. return (