[154] Bauteile erkennen: Schiebe-/Hebeschiebetüren, Türen mit Zarge/Futter, Türen in Bogenwänden, Stützen, Knopf in der Werkzeugleiste

Schiebetür: Pfeil (Spitze links und rechts) oder versetzte Flügel ab 1.4 m statt Fenster, Türtyp
schiebe/hebeschiebe aus dem Projekt oder neu. Türbogen kleiner als die Lücke (Zarge/Futter) -> Tür mit
Lückenbreite. Türbogen am Pfosten einer Bogenwand-Lücke -> Tür. Stützen: kleine gefüllte Rechtecke/Kreise
15-60 cm (oder Stützen-Layer), frei stehend. Rundreise Musterhaus komplex: Öffnungen 35/46 -> 40/46,
Stützen 1/1.
This commit is contained in:
Claude committed 2026-11-07 15:35:38 +00:00
1 parent 6b488dd0e9
commit 40982b4a1e
11 files changed
+790 -54

No files matched your search

+29 -1
View File
@@ -82,13 +82,41 @@ describe("recognizeCommand", () => {
it("Bericht-Text zählt unklare Stellen je Grund", () => {
const txt = reportText({
walls: 1, doors: 0, windows: 0, voids: 0, rooms: 0, arcWalls: 0, filledWalls: 0, unnamedRooms: 0, thicknesses: [0.3], layerFilter: true,
walls: 1, doors: 0, slidingDoors: 0, windows: 0, voids: 0, rooms: 0, columns: 0, arcWalls: 0, filledWalls: 0, unnamedRooms: 0, thicknesses: [0.3], layerFilter: true,
unclear: [{ code: "doorArc", x: 0, y: 0 }, { code: "doorArc", x: 1, y: 0 }, { code: "gapWide", x: 0, y: 0 }],
});
expect(txt).toContain("2×");
expect(txt).toContain("1×");
});
it("Schiebetür (Blatt vor der Wand + Pfeil statt Bogen) und Stütze: Türtyp mit Namen aus i18n, Stütze im Geschoss", () => {
const line = (id: string, a: [number, number], b: [number, number]): Drawing2D =>
({ id, type: "drawing2d", levelId: "imp", categoryCode: "102", geom: { shape: "line", a: { x: a[0], y: a[1] }, b: { x: b[0], y: b[1] } } }) as Drawing2D;
const base = project();
const p: Project = {
...base,
drawings2d: [
...base.drawings2d.filter((d) => d.id !== "arc"),
poly("blatt", "102", [[1, 0.17], [1.9, 0.17], [1.9, 0.21], [1, 0.21]]),
line("pfeil", [1.675, 0.3], [1.225, 0.3]),
line("spitze1", [1.225, 0.3], [1.34, 0.25]),
line("spitze2", [1.225, 0.3], [1.34, 0.35]),
{ ...poly("stuetze", "102", [[3.5, 1.85], [3.8, 1.85], [3.8, 2.15], [3.5, 2.15]]), fillColor: "#000000" } as Drawing2D,
],
};
const ctx = ctxOf(p);
const start = recognizeCommand.autoRun!(ctx);
expect(start.notice?.params).toMatchObject({ walls: 5, doors: 1, sliding: 1, columns: 1 });
const [, r] = recognizeCommand.onConfirm(recognizeCommand.init(), ctx);
const next = r.commit!(p);
const door = next.openings?.find((o) => o.kind === "door");
const type = next.doorTypes?.find((t) => t.id === door?.typeId);
expect(type?.kind).toBe("schiebe");
expect(type?.name).toBe("Schiebetür (erkannt)");
expect(next.columns?.length).toBe(1);
expect(next.columns?.[0]).toMatchObject({ floorId: "eg", position: { x: 3.65, y: 2 }, profile: { kind: "rect", width: 0.3, depth: 0.3 }, height: 2.8 });
});
it("ohne Zeichnung: Vorbedingung meldet, nichts erkannt → kein Commit", () => {
const p = { ...project(), drawings2d: [] };
expect(recognizeCommand.precondition!(ctxOf(p))).toBe("cmd.recognize.noDrawing");
+5 -1
View File
@@ -1,5 +1,5 @@
// [154] Bauteile aus Zeichnung erkennen: aus den 2D-Linien eines Grundrisses (DXF/DWG-Import aus ArchiCAD,
// Vectorworks, AutoCAD) Wände, Öffnungen und Räume. Quelle: die gewählten 2D-Elemente, sonst die Zeichnung des
// Vectorworks, AutoCAD) Wände, Öffnungen (Dreh-, Schiebe-, Hebeschiebetüren, Fenster, Durchbrüche), Stützen und Räume. Quelle: die gewählten 2D-Elemente, sonst die Zeichnung des
// aktiven Geschosses, sonst die erste Ebene mit Zeichnung (Option E schaltet durch). Beim Start zeigt die Vorschau
// alles Erkannte (Wandbänder, Türen/Fenster/Durchbrüche, Räume, unklare Stellen als Kreuz), die Meldung zählt;
// B zeigt den Bericht (unklar, mit Grund). Enter übernimmt als EIN Undo-Schritt ins aktive Geschoss (Höhe =
@@ -38,6 +38,8 @@ function optionsOf(s: RecognizeState, ctx: CommandContext): RecognizeOptions {
wallTypeId: ctx.activeWallTypeId,
typeName: t("cmd.recognize.typeName"),
roomName: t("cmd.recognize.roomName"),
slideTypeName: t("cmd.recognize.slideTypeName"),
liftSlideTypeName: t("cmd.recognize.liftSlideTypeName"),
};
}
@@ -65,6 +67,8 @@ const countParams = (r: RecognizeReport) => ({
doors: r.doors,
windows: r.windows,
voids: r.voids,
sliding: r.slidingDoors,
columns: r.columns,
rooms: r.rooms,
unclear: r.unclear.length,
});
+5 -3
View File
@@ -1969,9 +1969,11 @@ export const de = {
"cmd.recognize.report": "Bericht",
"cmd.recognize.typeName": "Wand {cm} cm (erkannt)",
"cmd.recognize.roomName": "Raum {n}",
"cmd.recognize.hud": "{walls} Wände · {doors} Türen · {windows} Fenster · {voids} Durchbrüche · {rooms} Räume · {unclear} unklar",
"cmd.recognize.summary": "Erkannt: {walls} Wände, {doors} Türen, {windows} Fenster, {voids} Durchbrüche, {rooms} Räume; unklar: {unclear}. Enter übernimmt, B zeigt den Bericht.",
"cmd.recognize.done": "Übernommen: {walls} Wände, {doors} Türen, {windows} Fenster, {voids} Durchbrüche, {rooms} Räume (ein Rückgängig-Schritt).",
"cmd.recognize.hud": "{walls} Wände · {doors} Türen · {windows} Fenster · {voids} Durchbrüche · {columns} Stützen · {rooms} Räume · {unclear} unklar",
"cmd.recognize.summary": "Erkannt: {walls} Wände, {doors} Türen ({sliding} Schiebetüren), {windows} Fenster, {voids} Durchbrüche, {columns} Stützen, {rooms} Räume; unklar: {unclear}. Enter übernimmt, B zeigt den Bericht.",
"cmd.recognize.done": "Übernommen: {walls} Wände, {doors} Türen, {windows} Fenster, {voids} Durchbrüche, {columns} Stützen, {rooms} Räume (ein Rückgängig-Schritt).",
"cmd.recognize.slideTypeName": "Schiebetür (erkannt)",
"cmd.recognize.liftSlideTypeName": "Hebeschiebetür (erkannt)",
"cmd.recognize.nothing": "Keine Wände erkannt (parallele Linien im Abstand 5–60 cm).",
"cmd.recognize.noDrawing": "Keine 2D-Zeichnung vorhanden – zuerst einen Grundriss (DXF/DWG) importieren.",
"cmd.recognize.reportNotice": "{text}",
+5 -3
View File
@@ -1958,9 +1958,11 @@ export const en: Record<TranslationKey, string> = {
"cmd.recognize.report": "Report",
"cmd.recognize.typeName": "Wall {cm} cm (recognized)",
"cmd.recognize.roomName": "Room {n}",
"cmd.recognize.hud": "{walls} walls · {doors} doors · {windows} windows · {voids} openings · {rooms} rooms · {unclear} unclear",
"cmd.recognize.summary": "Recognized: {walls} walls, {doors} doors, {windows} windows, {voids} wall openings, {rooms} rooms; unclear: {unclear}. Enter accepts, B shows the report.",
"cmd.recognize.done": "Added: {walls} walls, {doors} doors, {windows} windows, {voids} wall openings, {rooms} rooms (one undo step).",
"cmd.recognize.hud": "{walls} walls · {doors} doors · {windows} windows · {voids} openings · {columns} columns · {rooms} rooms · {unclear} unclear",
"cmd.recognize.summary": "Recognized: {walls} walls, {doors} doors ({sliding} sliding), {windows} windows, {voids} wall openings, {columns} columns, {rooms} rooms; unclear: {unclear}. Enter accepts, B shows the report.",
"cmd.recognize.done": "Added: {walls} walls, {doors} doors, {windows} windows, {voids} wall openings, {columns} columns, {rooms} rooms (one undo step).",
"cmd.recognize.slideTypeName": "Sliding door (recognized)",
"cmd.recognize.liftSlideTypeName": "Lift-and-slide door (recognized)",
"cmd.recognize.nothing": "No walls recognized (parallel lines 5–60 cm apart).",
"cmd.recognize.noDrawing": "No 2D drawing – import a floor plan (DXF/DWG) first.",
"cmd.recognize.reportNotice": "{text}",
+23 -10
View File
@@ -1,7 +1,7 @@
// [154] Rundreise: eigener DXF-Export eines Geschosses → DXF-Import (Layer als Kategorien, neue Zeichnungsebene)
// → „Bauteile aus Zeichnung erkennen“ → Wände/Öffnungen mit dem Original vergleichen (Quote auf der Konsole).
// Wände: Achse (beide Richtungen, ±1 cm) und Dicke (±1 mm); Öffnungen: Art und Pfosten (±2 cm), Türen zusätzlich
// Scharnierpunkt und Aufschlagseite. Mit `DOSSIER_RECOGNIZE_OUT=<ordner>` werden Import und Ergebnis als .obp
// Wände: Achse (beide Richtungen, ±1 cm) und Dicke (±1 mm); Öffnungen: Art (Schiebe-/Hebeschiebetür eigene Art) und
// Pfosten (±2 cm), Drehtüren zusätzlich Scharnierpunkt und Aufschlagseite; Stützen (15–60 cm): Mitte (±2 cm). Mit `DOSSIER_RECOGNIZE_OUT=<ordner>` werden Import und Ergebnis als .obp
// geschrieben (Bilder für den Bericht).
import { writeFileSync } from "node:fs";
@@ -27,7 +27,7 @@ const thickness = (p: Project, w: Wall) => (p.wallTypes.find((t) => t.id === w.w
const dist = (a: Vec2, b: Vec2) => Math.hypot(a.x - b.x, a.y - b.y);
interface Jambs {
kind: "door" | "window" | "void";
kind: "door" | "slide" | "window" | "void";
a: Vec2;
b: Vec2;
/** Tür: Scharnierpunkt und Aufschlagseite (Einheitsvektor quer zur Wand). */
@@ -46,8 +46,10 @@ function jambs(p: Project, o: Opening): Jambs | null {
arc
? { x: arc.center.x + arc.r * Math.cos(arc.a0 + Math.sign(arc.sweep) * (s / arc.r)), y: arc.center.y + arc.r * Math.sin(arc.a0 + Math.sign(arc.sweep) * (s / arc.r)) }
: { x: w.start.x + u.x * s, y: w.start.y + u.y * s };
const voidish = o.kind === "door" && (o.doorType === "wandoeffnung" || p.doorTypes?.find((t) => t.id === o.typeId)?.kind === "wandoeffnung");
const kind = voidish ? "void" : o.kind;
const typeKind = o.kind === "door" ? p.doorTypes?.find((t) => t.id === o.typeId)?.kind : undefined;
const voidish = o.kind === "door" && (o.doorType === "wandoeffnung" || typeKind === "wandoeffnung");
const slide = typeKind === "schiebe" || typeKind === "hebeschiebe";
const kind = voidish ? "void" : slide ? "slide" : o.kind;
const j: Jambs = { kind, a: at(o.position), b: at(o.position + o.width) };
if (kind === "door") {
j.hinge = at(o.position + (o.hinge === "end" ? o.width : 0));
@@ -63,6 +65,7 @@ interface Quote {
axis: number;
openings: [number, number];
doors: [number, number];
columns: [number, number];
report: RecognizeReport;
imported: Project;
result: Project;
@@ -135,15 +138,20 @@ function roundtrip(orig: Project, levelId: string): Quote {
const doorOk = od.filter((x) =>
no.some((y) => same(x, y) && dist(x.hinge!, y.hinge!) < 0.02 && dist(x.side!, y.side!) < 1e-6),
).length;
return { walls: [wallOk, ow.length], axis: axisAll ? axisOk / axisAll : 1, openings: [openOk, oo.length], doors: [doorOk, od.length], report, imported, result };
// Stützen mit Querschnitt 15–60 cm (kleinere, z. B. Carport-Pfosten 12 cm, sind keine Kandidaten).
const size = (x: number) => x >= 0.15 - 1e-9 && x <= 0.6 + 1e-9;
const oc = (orig.columns ?? []).filter((c) => c.floorId === levelId && (c.profile.kind === "round" ? size(2 * c.profile.radius) : size(c.profile.width) && size(c.profile.depth)));
const nc = (result.columns ?? []).filter((c) => c.floorId === levelId);
const colOk = oc.filter((c) => nc.some((n) => dist(c.position, n.position) < 0.02)).length;
return { walls: [wallOk, ow.length], axis: axisAll ? axisOk / axisAll : 1, openings: [openOk, oo.length], doors: [doorOk, od.length], columns: [colOk, oc.length], report, imported, result };
}
const pct = ([a, b]: [number, number]) => `${a}/${b} (${b ? Math.round((100 * a) / b) : 100} %)`;
function log(name: string, q: Quote) {
console.log(
`[154] ${name}: Wände ${pct(q.walls)} (Achsen ${Math.round(q.axis * 100)} %), Öffnungen ${pct(q.openings)}, Türen mit Anschlag/Aufschlag ${pct(q.doors)}; ` +
`erkannt ${q.report.walls} Wände, ${q.report.doors} Türen, ${q.report.windows} Fenster, ${q.report.voids} Durchbrüche, ${q.report.rooms} Räume, unklar ${q.report.unclear.length} (${[...new Set(q.report.unclear.map((u) => u.code))].join(", ")})`,
`[154] ${name}: Wände ${pct(q.walls)} (Achsen ${Math.round(q.axis * 100)} %), Öffnungen ${pct(q.openings)}, Türen mit Anschlag/Aufschlag ${pct(q.doors)}, Stützen ${pct(q.columns)}; ` +
`erkannt ${q.report.walls} Wände, ${q.report.doors} Türen (${q.report.slidingDoors} Schiebetüren), ${q.report.windows} Fenster, ${q.report.voids} Durchbrüche, ${q.report.columns} Stützen, ${q.report.rooms} Räume, unklar ${q.report.unclear.length} (${[...new Set(q.report.unclear.map((u) => u.code))].join(", ")})`,
);
if (OUT) {
writeFileSync(join(OUT, `${name}-import.obp`), serializeProject(q.imported));
@@ -177,7 +185,7 @@ describe("[154] Rundreise DXF-Export → Import → Bauteile erkennen", () => {
it("Musterhaus komplex: Quote je Geschoss", () => {
const p = buildComplexSampleProject();
const floors = p.drawingLevels.filter((l) => l.kind === "floor" && p.walls.some((w) => w.floorId === l.id));
let [w, wn, o, on, ax] = [0, 0, 0, 0, 0];
let [w, wn, o, on, ax, c, cn] = [0, 0, 0, 0, 0, 0, 0];
for (const l of floors) {
const q = roundtrip(p, l.id);
log(`komplex-${l.id}`, q);
@@ -186,9 +194,14 @@ describe("[154] Rundreise DXF-Export → Import → Bauteile erkennen", () => {
wn += q.walls[1];
o += q.openings[0];
on += q.openings[1];
c += q.columns[0];
cn += q.columns[1];
}
console.log(`[154] Musterhaus komplex gesamt: Wände ${pct([w, wn])} (Achsen ${Math.round(ax * 100)} %), Öffnungen ${pct([o, on])}`);
console.log(`[154] Musterhaus komplex gesamt: Wände ${pct([w, wn])} (Achsen ${Math.round(ax * 100)} %), Öffnungen ${pct([o, on])}, Stützen ${pct([c, cn])}`);
expect(wn).toBeGreaterThan(0);
expect(w / wn).toBeGreaterThan(0.6);
// 7.11.: Schiebe-/Hebeschiebetüren (5) und die Stütze im UG werden erkannt (vorher Fenster bzw. nichts).
expect(o / on).toBeGreaterThan(0.85);
expect(c).toBe(cn);
}, 120_000);
});
+11 -1
View File
@@ -1,5 +1,5 @@
// [154] Bauteile aus Zeichnung erkennen — dünne Fassade über den Kern (`src-tauri/core/src/drawing_recognize.rs`):
// aus den 2D-Linien eines Grundrisses (DXF/DWG-Import) Wände, Öffnungen und Räume. Erkennung, Vorschau, Bericht
// aus den 2D-Linien eines Grundrisses (DXF/DWG-Import) Wände, Öffnungen (auch Schiebetüren), Stützen und Räume. Erkennung, Vorschau, Bericht
// und Ops rechnet der Kern; hier nur die Anfrage (Quell-Ebene, Auswahl, Namensvorlagen, Ziel-Geschoss).
import type { Project } from "../model/types";
@@ -16,10 +16,15 @@ export interface RecognizeUnclear {
/** Bericht der Erkennung (Abfrage `recognize`). */
export interface RecognizeReport {
walls: number;
/** Türen einschliesslich Schiebe-/Hebeschiebetüren. */
doors: number;
/** Davon Schiebe- und Hebeschiebetüren (Pfeil oder versetzte Flügel, kein Bogen). */
slidingDoors: number;
windows: number;
voids: number;
rooms: number;
/** Stützen (kleine gefüllte Rechtecke/Kreise 15–60 cm oder auf einem Stützen-Layer, frei stehend). */
columns: number;
arcWalls: number;
/** Wände mit Füllung/Schraffur zwischen den Linien. */
filledWalls: number;
@@ -48,6 +53,9 @@ export interface RecognizeOptions {
typeName?: string;
/** Namensvorlage unbenannter Räume, `{n}` = laufende Nummer. */
roomName?: string;
/** Name eines neuen Schiebe- bzw. Hebeschiebetür-Typs (falls das Projekt keinen hat). */
slideTypeName?: string;
liftSlideTypeName?: string;
}
let seq = 0;
@@ -59,6 +67,8 @@ function request(o: RecognizeOptions): Record<string, unknown> {
ids: o.ids && o.ids.length > 0 ? [...o.ids] : [],
typeName: o.typeName ?? "",
roomName: o.roomName ?? "",
slideTypeName: o.slideTypeName ?? "",
liftSlideTypeName: o.liftSlideTypeName ?? "",
ctx: { level: o.levelId, floorHeight: o.floorHeight ?? null, cat: o.categoryCode ?? "20", wallType: o.wallTypeId ?? "" },
};
}
+1 -1
View File
@@ -380,7 +380,7 @@ const TOOLS_2D: ToolId[] = [
];
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", "sectionline", "viewline", "autodim", "excavation"];
const COMMANDS_EDIT = ["move", "copy", "array", "rotate", "mirror", "offset", "multiline", "trim", "break", "split", "extend", "fillet", "chamfer", "join", "defblock", "measure"];
const COMMANDS_EDIT = ["move", "copy", "array", "rotate", "mirror", "offset", "multiline", "trim", "break", "split", "extend", "fillet", "chamfer", "join", "defblock", "measure", "erkennen"];
type ToolsView = "list" | "icons";
const VIEW_STORAGE_KEY = "dossier.toolsPanel.view";
+11
View File
@@ -106,6 +106,17 @@ export const CommandIcon = memo(function CommandIcon({ name }: { name: string })
<line x1="2.5" y1="12" x2="13.5" y2="12" />
</svg>
);
case "erkennen":
// Bauteile aus Zeichnung erkennen ([154]): Linienpaar (Wand) mit Türbogen, Lupe.
return (
<svg {...common}>
<line x1="1.5" y1="4" x2="10" y2="4" />
<line x1="1.5" y1="7" x2="5" y2="7" />
<path d="M5 7 A4 4 0 0 1 9 3" strokeDasharray="1.4 1.2" />
<circle cx="10.5" cy="10.5" r="2.8" />
<line x1="12.5" y1="12.5" x2="14.5" y2="14.5" />
</svg>
);
case "trim":
// Schere (Stutzen).
return (