[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
This commit is contained in:
Claude committed 2026-10-27 20:48:23 +00:00
1 parent 3693378439
commit c70438dba0
11 files changed
+373 -1

No files matched your search

+30
View File
@@ -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();
});
});
+44
View File
@@ -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(),
};