[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);
+12 -1
View File
@@ -10,6 +10,7 @@
// dossier-cli <projekt.obp> section <Name> [--out schnitt.svg] (braucht render3d-WASM)
// dossier-cli <projekt.obp> elevation <Name> [--out ansicht.svg]
// dossier-cli <projekt.obp> ifc [--ebkph] [--ebenen] (IFC mit eBKP-H-Hauptgruppen bzw. Modell-Ebenen als Klassifikation)
// --schema 4|2x3: IFC4 (Standard) oder IFC2x3 (Coordination View 2.0)
// dossier-cli <projekt.obp> dxf [--binary] [--scale 100] [--dim-unit cm] [--layout]|dwg|ifc|step|obj|stl|glb|gltf|schedule|kennzahlen|sun [--level EG] [--out datei]
// glb/gltf = glTF 2.0 (Y-up, Meter, Geschoss als Eltern; --flat ohne Geschoss-Knoten)
// dossier-cli convert <eingabe> <ausgabe> [--cmd "befehl"]… Format nach Endung: dxf/dwg/ifc/obp → obp-Import,
@@ -98,6 +99,16 @@ import { serveStdio } from "./mcp";
type Args = { positional: string[]; flags: Map<string, string>; cmds: string[] };
/** `--schema 4|ifc4|2x3|ifc2x3` → IFC-Schema des Exports (ohne Angabe IFC4). */
function ifcSchemaFlag(args: Args): "IFC4" | "IFC2X3" {
const v = args.flags.get("schema");
if (v === undefined) return "IFC4";
const k = v.toLowerCase().replace(/^ifc/, "");
if (k === "4") return "IFC4";
if (k === "2x3") return "IFC2X3";
return fail(`--schema: "${v}" unbekannt (4 oder 2x3)`);
}
function parseArgs(argv: string[]): Args {
const positional: string[] = [];
const flags = new Map<string, string>();
@@ -590,7 +601,7 @@ async function execute(project: Project, file: string, command: string, rest: st
case "ifc":
await loadFileio();
// --ebkph: eBKP-H-Hauptgruppen je Bauteilart; --ebenen: Ebene (categoryCode) des Modells als Klassifikation.
out(args, exportIfcSpf(project, { ebkph: args.flags.has("ebkph"), layerCodes: args.flags.has("ebenen") }), `${project.name || "projekt"}.ifc`);
out(args, exportIfcSpf(project, { ebkph: args.flags.has("ebkph"), layerCodes: args.flags.has("ebenen"), schema: ifcSchemaFlag(args) }), `${project.name || "projekt"}.ifc`);
return 0;
case "obj":
await loadFileio();