[K4] S4 Import: Aufrufer auf den Kern umgestellt, TS-Umwandlung gelöscht

DXF/DWG/PDF (Import-Dialog, CLI), IFC (Meshes/Bauteile) und Meshes laufen über ProjectDocument.importDrawing/
importIfc/importMesh (Store commitImport, ein Undo-Schritt). Dialoge halten nur Puffer + Zusammenfassung
(io/importSource.ts). Gelöscht: dxfToDrawings, pdfLineStyles, ifcElements, decodeImport/decodeIfc/decodeMesh,
ifcToImportedMeshes, meshObjectsToImportedMeshes, pdfPageToImport, buildDrawings, planImportLayers, Store
addDrawingLevel/importDrawings, Paritätstests. ensureContextCategories als Fassade über den Kern; CLI-PDF bekommt
wie die App Linienstile für Strichmuster. Tests über importView.testutil (Leseansicht des Kerns).
This commit is contained in:
Claude committed 2026-10-29 14:52:21 +00:00
1 parent 65e7f3a2ea
commit a5c3ea55f2
52 files changed
+880 -3010

No files matched your search

+3 -3
View File
@@ -11,7 +11,7 @@ import { tmpdir } from "node:os";
import { join } from "node:path";
import { buildPlanDwg, buildPlanDxf, buildPlanDxfBinary, collectPlanDrawing } from "./exportDxf";
import { countByType, libreDwgReader, readDxf } from "./cadReadBack.testutil";
import { parseDxf } from "../io/dxfParser";
import { inspectDxf } from "../io/importView.testutil";
import { sampleProject } from "../model/sampleProject";
import { generatePlan } from "../plan/generatePlan";
import { flattenCategories } from "../model/types";
@@ -232,7 +232,7 @@ describe("Fachplaner-Export: DWG (libredwg) und eigener Import", () => {
});
it("DXF-Import: Masszahlen, Möbelgeometrie und Türgeometrie kommen wieder an", () => {
const imp = parseDxf(buildPlanDxf(plan, project));
const imp = inspectDxf(buildPlanDxf(plan, project));
const texts = (imp.texts ?? []).map((t) => t.text);
expect(texts).toContain("2.00");
expect(texts).toContain("3.00");
@@ -246,6 +246,6 @@ describe("Fachplaner-Export: DWG (libredwg) und eigener Import", () => {
it("DXF-Import: Papierbereich wird als Layout erkannt", () => {
// Das Layout hat nur ein Ansichtsfenster (kein eigener Inhalt) und steht darum nicht in der Liste, ist aber lesbar.
const dxf = buildPlanDxf(plan, project, { paperLayout: true });
expect(() => parseDxf(dxf, "", "Plan_1-100")).not.toThrow();
expect(() => inspectDxf(dxf, "Plan_1-100")).not.toThrow();
});
});
+15 -11
View File
@@ -8,8 +8,7 @@ import { tmpdir } from "node:os";
import { join } from "node:path";
import "../engine/fileioWasm.setup";
import { exportIfcSpf } from "./exportIfc";
import { readIfcElements } from "../io/ifcElements";
import { classificationSuffix, ifcToImportedMeshes, readIfc } from "../io/ifcImport";
import { importIfcInto, inspectIfc } from "../io/importView.testutil";
import { sampleProject } from "../model/sampleProject";
import type { Project, Room } from "../model/types";
@@ -98,29 +97,34 @@ describe("Rundreise Export → Import", () => {
it("Klassifikation kommt an Bauteilen und am Mesh-Rest wieder an", async () => {
const ifc = exportIfcSpf(houseWithRooms(), { ebkph: true, layerCodes: true });
const bytes = new TextEncoder().encode(ifc);
const { products, elements } = await readIfcElements(bytes);
const wall = elements.walls[0];
const { products, raw } = await inspectIfc(bytes, true);
const wall = raw.filter((e) => e.kind === "wall")[0];
expect(wall.classifications?.map((c) => `${c.system}:${c.code}`).sort()).toEqual(["Dossier-Ebenen:20", "eBKP-H:C"]);
expect(wall.classifications?.find((c) => c.system === "eBKP-H")?.name).toBe("Konstruktion Gebäude");
const window = elements.openings.find((o) => o.kind === "window")!;
const window = raw.find((o) => o.kind === "opening" && o.openingKind === "window")!;
expect(window.classifications?.map((c) => `${c.system}:${c.code}`).sort()).toEqual(["Dossier-Ebenen:21", "eBKP-H:E"]);
const door = elements.openings.find((o) => o.kind === "door")!;
const door = raw.find((o) => o.kind === "opening" && o.openingKind === "door")!;
expect(door.classifications?.map((c) => c.system)).toEqual(["Dossier-Ebenen"]);
// Dach bleibt Mesh, trägt aber seine Klassifikation.
const roof = products.find((p) => p.ifcClass === "IfcRoof")!;
expect(roof.classifications?.map((c) => c.code).sort()).toEqual(["31", "F"]);
// Räume: Kategorie bleibt (auch über die Zone).
expect(elements.spaces.map((s) => s.sia).sort()).toEqual(["HNF", "HNF", "NNF", "VF"]);
expect(raw.filter((e) => e.kind === "space").map((s) => s.sia).sort()).toEqual(["HNF", "HNF", "NNF", "VF"]);
// Übernahme als Bauteile: Klassifikation gezählt (Wand/Decke/Raum haben kein Feld dafür).
const r = await importIfcInto(sampleProject, bytes, { elements: true });
expect(r.summary?.classified).toBeGreaterThan(0);
});
it("Mesh-Import: Klassifikation im Namen des Kontext-Objekts", async () => {
const ifc = exportIfcSpf(sampleProject, { ebkph: true });
const { products } = await readIfc(new TextEncoder().encode(ifc));
const bytes = new TextEncoder().encode(ifc);
const { products } = await inspectIfc(bytes);
expect(products.find((p) => p.ifcClass === "IfcRoof")?.classifications?.[0]).toMatchObject({ system: "eBKP-H", code: "F" });
const roof = ifcToImportedMeshes(products, "haus.ifc", { group: "product" }).find((m) => m.layer === "IfcRoof")!;
const r = await importIfcInto(sampleProject, bytes, { group: "product" });
const roof = r.meshes.find((m) => m.layer === "IfcRoof")!;
expect(roof.name).toMatch(/ \[eBKP-H F\]$/);
expect(classificationSuffix(undefined)).toBe("");
expect(classificationSuffix([{ system: "", code: "214", name: null }])).toBe(" [214]");
// Ohne Klassifikation kein Zusatz.
expect(r.meshes.find((m) => m.layer === "IfcStairFlight")?.name).not.toMatch(/\[/);
});
});
+12 -15
View File
@@ -1,7 +1,7 @@
// IFC2x3-Export (Coordination View 2.0, [B5] 28.10.): Schema-Option des IFC-Exports.
//
// - Text: Kopf, Entitäten des Schemas (keine IFC4-Entitäten), gleiche GlobalIds wie IFC4.
// - Eigener Import (`src/io/ifcImport.ts`, `ifcElements.ts`): liest die 2x3-Datei als Meshes und als
// - Eigener Import (`src/io/ifcImport.ts`, Kern `import_ifc.rs`): liest die 2x3-Datei als Meshes und als
// Bauteile mit demselben Ergebnis wie die IFC4-Datei.
// - ifcopenshell (nur mit Python/ifcopenshell): Schema-Prüfung der 2x3-Datei ohne Befunde, Volumen und
// Lage je Bauteil gleich der IFC4-Ausgabe.
@@ -13,8 +13,7 @@ import { tmpdir } from "node:os";
import { join } from "node:path";
import "../engine/fileioWasm.setup";
import { exportIfcSpf } from "./exportIfc";
import { ifcElementsToProject, readIfcElements } from "../io/ifcElements";
import { readIfc } from "../io/ifcImport";
import { importIfcInto, inspectIfc } from "../io/importView.testutil";
import { emptyProject, sampleProject } from "../model/sampleProject";
import type { Project } from "../model/types";
@@ -140,13 +139,13 @@ describe("IFC2x3-Export: eigener Import liest dasselbe wie bei IFC4", () => {
const b = v3(sampleProject);
it("Meshes: gleiche Körper (GlobalId, Volumen), Schema IFC2X3 erkannt", async () => {
const r4 = await readIfc(bytesOf(a));
const r3 = await readIfc(bytesOf(b));
expect(r4.report.schema).toBe("IFC4");
expect(r3.report.schema).toBe("IFC2X3");
expect(r3.report.parseErrors).toBe(0);
expect(r3.report.skippedItems).toEqual({});
expect(r3.report.productsWithoutGeometry).toBe(0);
const r4 = await inspectIfc(bytesOf(a));
const r3 = await inspectIfc(bytesOf(b));
expect(r4.meta.schema).toBe("IFC4");
expect(r3.meta.schema).toBe("IFC2X3");
expect(r3.meta.parseErrors).toBe(0);
expect(r3.meta.skippedItems).toEqual({});
expect(r3.meta.productsWithoutGeometry).toBe(0);
expect(r3.products.length).toBe(r4.products.length);
const vol = (p: { positions: ArrayLike<number>; indices: ArrayLike<number> }) => {
let v = 0;
@@ -169,11 +168,9 @@ describe("IFC2x3-Export: eigener Import liest dasselbe wie bei IFC4", () => {
});
it("Bauteile: gleiche Wände, Öffnungen, Decken, Räume", async () => {
const e4 = await readIfcElements(bytesOf(a));
const e3 = await readIfcElements(bytesOf(b));
expect(e3.report.parseErrors).toBe(0);
const p4 = ifcElementsToProject(emptyProject, e4.products, e4.elements, { fileName: "haus.ifc" });
const p3 = ifcElementsToProject(emptyProject, e3.products, e3.elements, { fileName: "haus.ifc" });
const p4 = await importIfcInto(emptyProject, bytesOf(a), { elements: true });
const p3 = await importIfcInto(emptyProject, bytesOf(b), { elements: true });
expect(p3.report.parseErrors).toBe(0);
expect(p3.summary).toEqual(p4.summary);
for (const key of ["walls", "openings", "ceilings", "rooms", "wallTypes"] as const) {
expect(normIds(p3.project[key]), key).toEqual(normIds(p4.project[key]));