[B5] IFC-Export: Schema-Option IFC4 | IFC2x3 (Coordination View 2.0)

Rust-Schreiber mit Schema im META (FLAT_VERSION 4): FILE_SCHEMA IFC2X3 und ViewDefinition,
Netze als IfcFacetedBrep/IfcShellBasedSurfaceModel, IfcWallStandardCase mit LayerSetUsage,
IfcDoorStyle/IfcWindowStyle, Dachschichten direkt am Dach, Georeferenz über IfcSite und
ePSet_MapConversion/ePSet_ProjectedCRS, Attributlisten nach IFC2X3_TC1. Export-Dialog mit
Schema-Wahl, CLI ifc --schema 2x3. Geprüft: ifcopenshell (IFC2X3, 0 Befunde, Volumen gleich
IFC4), eigener Import liest beide gleich.

Claude-Session: https://claude.ai/code/session_01NTYBZBvLYCtugMJoKXaB67
This commit is contained in:
Claude committed 2026-10-28 17:06:36 +00:00
1 parent a72ac89795
commit ea23d2a69e
11 files changed
+933 -78

No files matched your search

+33 -2
View File
@@ -1,7 +1,7 @@
// dossier-cli (Phase C): importiert nur src/core, und die Befehle laufen headless gegen das
// Beispielprojekt (inkl. der echten WASM-Pakete aus src/engine/pkg*).
import { describe, expect, it, beforeAll } from "vitest";
import { mkdtempSync, readFileSync, writeFileSync, readdirSync, statSync } from "node:fs";
import { describe, expect, it, beforeAll, vi } from "vitest";
import { existsSync, mkdtempSync, readFileSync, writeFileSync, readdirSync, statSync } from "node:fs";
import { tmpdir } from "node:os";
import { join } from "node:path";
import { run } from "./main";
@@ -71,6 +71,37 @@ describe("dossier-cli", () => {
}
});
it("IFC mit --schema: 4 (Standard) und 2x3 (Coordination View 2.0), anderes ist ein Fehler", async () => {
const out = join(dir, "schema.ifc");
expect(await call("ifc", "--out", out)).toBe(0);
expect(readFileSync(out, "utf8")).toContain("FILE_SCHEMA(('IFC4'));");
expect(await call("ifc", "--schema", "4", "--out", out)).toBe(0);
expect(readFileSync(out, "utf8")).toContain("FILE_SCHEMA(('IFC4'));");
for (const v of ["2x3", "IFC2X3", "ifc2x3"]) {
expect(await call("ifc", "--schema", v, "--out", out)).toBe(0);
const text = readFileSync(out, "utf8");
expect(text).toContain("FILE_SCHEMA(('IFC2X3'));");
expect(text).toContain("ViewDefinition [CoordinationView_V2.0]");
expect(text).not.toContain("IFCTRIANGULATEDFACESET");
}
// convert reicht die Option durch.
const conv = join(dir, "convert.ifc");
expect(await run(["convert", file, conv, "--schema", "2x3"])).toBe(0);
expect(readFileSync(conv, "utf8")).toContain("FILE_SCHEMA(('IFC2X3'));");
// Unbekanntes Schema: `fail` beendet den Prozess (hier abgefangen) und schreibt keine Datei.
const exit = vi.spyOn(process, "exit").mockImplementation((code) => {
throw new Error(`exit ${code}`);
});
const err = vi.spyOn(process.stderr, "write").mockImplementation(() => true);
try {
await expect(call("ifc", "--schema", "2x4", "--out", join(dir, "nope.ifc"))).rejects.toThrow("exit 1");
} finally {
exit.mockRestore();
err.mockRestore();
}
expect(existsSync(join(dir, "nope.ifc"))).toBe(false);
});
it("DWG über das Format-WASM (acadrust, R2018)", async () => {
const out = join(dir, "eg.dwg");
expect(await call("dwg", "--level", "eg", "--out", out)).toBe(0);