Merge branch 'worktree-agent-a15a9b043f135b799' into claude/practical-noether-1hb2s1
This commit is contained in:
15 files changed
+1003
-59
No files matched your search
@@ -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");
|
||||
|
||||
@@ -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,
|
||||
});
|
||||
|
||||
@@ -0,0 +1,122 @@
|
||||
// Georeferenzierter DXF-/DWG-Export ([154]-Befund, 7.11.): ALLE Entitäten liegen im selben Rahmen (LV95).
|
||||
// Vorher blieben die Baugrube (Kontext `excavation`, Ebene CONTEXT) und Parzelle/Baulinien (`siteRules`,
|
||||
// Ebene SYMBOLS) in lokalen Koordinaten, weil die Projekt-Verschiebung sie nicht mitnahm — nach dem Import
|
||||
// lagen sie Hunderte Kilometer neben dem Gebäude. Geprüft am Musterhaus komplex (Kataster, Raster, Bemassung,
|
||||
// Blöcke/INSERT mit ATTRIB, Texte, Schraffur bei 1:50, Kontext), je Geschoss: DXF (Gruppen-Codes), DWG
|
||||
// (libredwg) und die Rundreise durch den eigenen Import.
|
||||
|
||||
import "../engine/fileioWasm.setup";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { buildPlanDwg, buildPlanDxf } from "./exportDxf";
|
||||
import { libreDwgReader, nums, readDxf } from "./cadReadBack.testutil";
|
||||
import { buildComplexSampleProject } from "../model/sampleProjectComplex";
|
||||
import { generatePlan } from "../plan/generatePlan";
|
||||
import { flattenCategories } from "../model/types";
|
||||
import type { Project } from "../model/types";
|
||||
import { projectGeoOrigin, projectToWorldCoords } from "../model/geoRebase";
|
||||
import { parseDxf } from "../io/dxfParser";
|
||||
import { ProjectDocument } from "../core/document";
|
||||
|
||||
const allCodes = (p: Project) => new Set(flattenCategories(p.layers).map((l) => l.code));
|
||||
|
||||
const project = buildComplexSampleProject();
|
||||
const origin = projectGeoOrigin(project)!;
|
||||
const world = projectToWorldCoords(project);
|
||||
const floors = project.drawingLevels.filter((l) => l.kind === "floor");
|
||||
/** Rahmen um das Grundstück (Kataster der Nachbarn reicht ≈ 55 m weit). */
|
||||
const R = 200;
|
||||
const inFrame = (x: number, y: number) => Math.abs(x - origin.e) < R && Math.abs(y - origin.n) < R;
|
||||
|
||||
describe("Georeferenzierter Export: alle Entitäten im LV95-Rahmen", () => {
|
||||
it("Baugrube und Baurecht wandern mit dem Projekt", () => {
|
||||
const ex = world.context?.find((c) => c.type === "excavation");
|
||||
expect(ex && "outline" in ex && ex.outline.every((p) => inFrame(p.x, p.y))).toBe(true);
|
||||
expect(ex && "positions" in ex).toBe(false);
|
||||
expect(world.siteRules!.parcel.every((p) => inFrame(p.x, p.y))).toBe(true);
|
||||
expect(world.siteRules!.buildingLines!.every((l) => inFrame(l.a.x, l.a.y) && inFrame(l.b.x, l.b.y))).toBe(true);
|
||||
});
|
||||
|
||||
for (const lvl of floors) {
|
||||
it(`${lvl.name}: DXF (alle Punkt-Codes) und DWG (libredwg)`, async () => {
|
||||
// 1:50: Wände mit Schraffur (HATCH) statt schwarzer Füllung.
|
||||
const plan = generatePlan(world, lvl.id, allCodes(world), undefined, "mittel", false, false, true, 50);
|
||||
const dxf = readDxf(buildPlanDxf(plan, world, { scaleDenominator: 50, levelId: lvl.id }));
|
||||
const bad: string[] = [];
|
||||
// Punkt-Codes der Modellbereichs-Entitäten (10/11/13/14 x, 20/21/23/24 y): Endpunkte, Ecken, Einfügepunkte,
|
||||
// Textlagen, Bemassungs-Definitionspunkte, Schraffur-Ränder.
|
||||
for (const e of dxf.entities) {
|
||||
for (const [cx, cy] of [[10, 20], [11, 21], [13, 23], [14, 24]]) {
|
||||
const xs = nums(e, cx);
|
||||
const ys = nums(e, cy);
|
||||
for (let i = 0; i < Math.min(xs.length, ys.length); i++) {
|
||||
// HATCH: Seed-/Musterbasispunkt (0, 0) ist kein Lagepunkt.
|
||||
if (e.type === "HATCH" && xs[i] === 0 && ys[i] === 0) continue;
|
||||
if (!inFrame(xs[i], ys[i])) bad.push(`${e.layer}/${e.type} ${cx}: ${xs[i]}, ${ys[i]}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
expect(bad.slice(0, 5)).toEqual([]);
|
||||
expect(dxf.entities.some((e) => e.type === "INSERT")).toBe(true);
|
||||
|
||||
const db = (await libreDwgReader())(buildPlanDwg(plan, world, { scaleDenominator: 50, levelId: lvl.id }));
|
||||
// TEXT links/Grundlinie: der Ausrichtungspunkt ist nicht gespeichert und lautet (0, 0) wie bei AutoCAD
|
||||
// (`(11 0 0 0)`); er gilt nur bei Mitte/rechts — dort steht er im Rahmen (endPoint geprüft).
|
||||
const unset = (e: { type: string }, p?: { x: number; y: number }) => e.type === "TEXT" && p?.x === 0 && p?.y === 0;
|
||||
const dwgBad = db.entities.flatMap((e) =>
|
||||
[e.startPoint, unset(e, e.endPoint) ? undefined : e.endPoint, e.center, ...(e.vertices ?? [])]
|
||||
.filter((p) => p && !inFrame(p.x, p.y))
|
||||
.map((p) => `${e.layer}/${e.type}: ${p!.x}, ${p!.y}`),
|
||||
);
|
||||
expect(dwgBad.slice(0, 5)).toEqual([]);
|
||||
});
|
||||
}
|
||||
|
||||
it("Rundreise Export → Import: alle importierten Zeichnungen im selben Rahmen", () => {
|
||||
const plan = generatePlan(world, "eg", allCodes(world));
|
||||
const parsed = parseDxf(buildPlanDxf(plan, world, { levelId: "eg" }));
|
||||
const base: Project = {
|
||||
...project,
|
||||
geoAnchor: undefined,
|
||||
siteRules: undefined,
|
||||
walls: [],
|
||||
openings: [],
|
||||
rooms: [],
|
||||
drawings2d: [],
|
||||
stairs: [],
|
||||
ceilings: [],
|
||||
roofs: [],
|
||||
columns: [],
|
||||
context: [],
|
||||
};
|
||||
const doc = new ProjectDocument(base);
|
||||
const r = doc.importDrawing(
|
||||
base,
|
||||
parsed.src,
|
||||
{
|
||||
target: { kind: "new", name: "Import" },
|
||||
categoryMode: "byLayer",
|
||||
activeCategoryCode: "20",
|
||||
importMeshes: false,
|
||||
levelNameTemplate: "Import {n}",
|
||||
parentName: "Import",
|
||||
dashStyleTemplate: "{pattern}",
|
||||
},
|
||||
0,
|
||||
);
|
||||
doc.close();
|
||||
if ("problems" in r) throw new Error(r.problems.join("; "));
|
||||
// Alle Punkte der importierten Zeichnungen (wie immer der Import sie verschiebt: gemeinsam).
|
||||
const xs: number[] = [];
|
||||
const ys: number[] = [];
|
||||
for (const d of r.project.drawings2d) {
|
||||
for (const m of JSON.stringify(d.geom).matchAll(/\{"x":(-?[\d.e+-]+),"y":(-?[\d.e+-]+)\}/g)) {
|
||||
xs.push(Number(m[1]));
|
||||
ys.push(Number(m[2]));
|
||||
}
|
||||
}
|
||||
expect(xs.length).toBeGreaterThan(1000);
|
||||
const span = (v: number[]) => v.reduce((a, b) => Math.max(a, b), -Infinity) - v.reduce((a, b) => Math.min(a, b), Infinity);
|
||||
expect(span(xs)).toBeLessThan(2 * R);
|
||||
expect(span(ys)).toBeLessThan(2 * R);
|
||||
});
|
||||
});
|
||||
+5
-3
@@ -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
@@ -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}",
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
@@ -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 ?? "" },
|
||||
};
|
||||
}
|
||||
|
||||
@@ -24,8 +24,9 @@ import type { Project } from "./types";
|
||||
/**
|
||||
* Verschiebt SÄMTLICHE Modell-Koordinaten eines Projekts um den festen Vektor
|
||||
* (dx,dy) — Wände, Decken, Dächer, Öffnungen-Host (folgt automatisch der Wand),
|
||||
* Treppen, Räume, Stützen, Extrusionen, freie 2D-Geometrie, Kontext-Schicht
|
||||
* (Import/Terrain/Konturen), Schnitt-/Ansichtslinien sowie den Geo-Anker
|
||||
* Treppen, Räume, Stützen, Bäume, Extrusionen, freie 2D-Geometrie, Kontext-Schicht
|
||||
* (Import/Terrain/Konturen/Baugrube), Schnitt-/Ansichtslinien, Baurecht (Parzelle,
|
||||
* Baulinien; bis 7.11. vergessen, [154]) sowie den Geo-Anker
|
||||
* (`geoAnchor.model`, damit der LV95-Bezug exakt erhalten bleibt). Richtungs-
|
||||
* Vektoren (z. B. `Stair.dir`) und Winkel-Felder bleiben unangetastet — eine
|
||||
* reine Translation ändert keine Orientierung. Unveränderte Teile behalten ihre Identität;
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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 (
|
||||
|
||||
Reference in new issue
Block a user