Merge branch 'worktree-agent-ae0df7110bf4298e3' into claude/practical-noether-1hb2s1

This commit is contained in:
Claude committed 2026-11-06 21:21:16 +00:00
commit 957f3d0d04
13 files changed
+1975 -110

No files matched your search

+9 -2
View File
@@ -48,8 +48,8 @@ import { RecoverAutosaveDialog } from "./ui/RecoverAutosaveDialog";
import { Toast } from "./ui/Toast";
import { isTauriRuntime, PROJECT_TEMPLATE_EXT } from "./native/projectFile";
import { readStepFlat } from "./engine/truckSolid";
import { formatIfcElementsSummary, formatIfcReport, readIfcFlat } from "./io/ifcImport";
import { IfcImportDialog, type IfcImportMode } from "./ui/IfcImportDialog";
import { formatIfcElementsSummary, formatIfcReport, readIfcFlat, type IfcElementsSummary } from "./io/ifcImport";
import { IfcImportDialog, IfcImportReportDialog, type IfcImportMode } from "./ui/IfcImportDialog";
import { MeshImportHost } from "./ui/MeshImportDialog";
import { openMeshFileDialog, requestMeshImport, splitMeshFiles } from "./state/meshImportStore";
import { formatMeshReport, isMeshFile, type MeshPlacement, type MeshRead } from "./io/meshImport";
@@ -1050,6 +1050,8 @@ export default function App() {
// IFC-Import: erst die Wahl Mesh/Bauteile (`IfcImportDialog`), dann liest das Format-Modul (Web-Worker) und der
// Kern übernimmt [B3] Kontext-Meshes oder [B4] echte Bauteile als EINEN Undo-Schritt ([K4] S4, `importIfc`).
const [pendingIfc, setPendingIfc] = useState<File | null>(null);
// Bericht nach dem Bauteil-Import ([B4]): erkannt je Bauteilart, als Mesh geblieben mit Grund.
const [ifcReport, setIfcReport] = useState<{ fileName: string; summary: IfcElementsSummary } | null>(null);
const importIfcFile = (f: File) => setPendingIfc(f);
const runIfcImport = (f: File, mode: IfcImportMode) => {
const elements = mode === "elements";
@@ -1066,6 +1068,7 @@ export default function App() {
const s = r.summary;
const empty = s.walls + s.ceilings + s.columns + s.rooms + s.meshes === 0;
notify(formatIfcElementsSummary(s, report, t), empty || report.truncated ? "warning" : "info");
setIfcReport({ fileName: f.name, summary: s });
return;
}
fitToContextObjects(addedItems(r.ops, "context") as ContextObject[]);
@@ -2804,6 +2807,10 @@ export default function App() {
/>
)}
{ifcReport && (
<IfcImportReportDialog fileName={ifcReport.fileName} summary={ifcReport.summary} onClose={() => setIfcReport(null)} />
)}
{pendingDiscard && (
<UnsavedChangesDialog
onCancel={() => setPendingDiscard(null)}
+3 -2
View File
@@ -105,8 +105,9 @@ describe("Rundreise Export → Import", () => {
expect(window.classifications?.map((c) => `${c.system}:${c.code}`).sort()).toEqual(["Dossier-Ebenen:21", "eBKP-H:E"]);
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")!;
// Dach wird Bauteil ([B4], 6.11.) und trägt seine Klassifikation.
expect(products.find((p) => p.ifcClass === "IfcRoof")).toBeUndefined();
const roof = raw.find((e) => e.kind === "roof")!;
expect(roof.classifications?.map((c) => c.code).sort()).toEqual(["31", "F"]);
// Räume: Kategorie bleibt (auch über die Zone).
expect(raw.filter((e) => e.kind === "space").map((s) => s.sia).sort()).toEqual(["HNF", "HNF", "NNF", "VF"]);
+30 -3
View File
@@ -2455,15 +2455,42 @@ export const de = {
"ifc.import.voids": "{n} Öffnungen nicht abgezogen",
"ifc.import.booleans": "{n} Boolesche Körper vereinfacht (nur erster Operand)",
"ifc.import.truncated": "abgebrochen: zu viele Dreiecke",
"ifc.import.elements": "{schema} importiert: {walls} Wände, {openings} Türen/Fenster, {ceilings} Decken, {columns} Stützen, {rooms} Räume, {floors} neue Geschosse; {meshes} Bauteile als Kontext-Meshes",
"ifc.import.kept": "{n} Wände/Decken/Stützen/Räume nicht sicher abbildbar, als Mesh übernommen",
"ifc.import.elements": "{schema} importiert: {walls} Wände, {openings} Türen/Fenster, {ceilings} Decken, {columns} Stützen, {rooms} Räume, {roofs} Dächer, {stairs} Treppen, {floors} neue Geschosse; {meshes} Bauteile als Kontext-Meshes",
"ifc.import.kept": "{n} Kandidaten (Wände, Decken, Dächer, Treppen …) nicht sicher abbildbar, als Mesh übernommen",
"ifc.import.classified": "{n} Bauteile mit Klassifikation (eBKP-H …); bei Kontext-Meshes im Namen vermerkt",
"ifc.importDialog.title": "IFC importieren",
"ifc.importDialog.asMesh": "Als Kontext-Meshes (Standard)",
"ifc.importDialog.asMeshHint": "Jedes Bauteil als nicht bearbeitbares Mesh der Kontext-Schicht, wie in der Datei.",
"ifc.importDialog.asElements": "Als Bauteile",
"ifc.importDialog.asElementsHint": "Wände, Decken, Stützen, Türen/Fenster, Räume und Geschosse werden bearbeitbare Dossier-Bauteile; was nicht sicher abbildbar ist, bleibt Mesh.",
"ifc.importDialog.asElementsHint": "Wände (auch Bogen- und Giebelwände), Decken, Dächer, gerade Treppen, Stützen, Türen/Fenster, Räume und Geschosse werden bearbeitbare Dossier-Bauteile; was nicht sicher abbildbar ist, bleibt Mesh.",
"ifc.importDialog.import": "Importieren",
"ifc.importReport.title": "IFC-Import: Bericht",
"ifc.importReport.recognized": "Als Bauteile übernommen",
"ifc.importReport.kept": "Als Mesh geblieben (Grund)",
"ifc.importReport.keptNone": "Alle Kandidaten wurden Bauteile.",
"ifc.importReport.walls": "Wände",
"ifc.importReport.openings": "Türen, Fenster, Öffnungen",
"ifc.importReport.ceilings": "Decken",
"ifc.importReport.columns": "Stützen",
"ifc.importReport.rooms": "Räume",
"ifc.importReport.roofs": "Dächer",
"ifc.importReport.stairs": "Treppen",
"ifc.importReport.floors": "Neue Geschosse",
"ifc.importReport.types": "Neue Typen (Wand, Decke, Dach, Tür, Fenster)",
"ifc.importReport.meshes": "Übrige Bauteile als Kontext-Mesh",
"ifc.importReport.close": "Schliessen",
"ifc.reason.noBody": "kein lesbarer Körper",
"ifc.reason.shape": "Körper unbrauchbar",
"ifc.reason.dimensions": "Masse ausserhalb des Abbildbaren",
"ifc.reason.notRectangular": "Grundriss weder Rechteck noch Kreisring",
"ifc.reason.slopedTop": "schräge Krone ohne erkanntes Dach darüber",
"ifc.reason.notPrism": "kein senkrechtes Prisma",
"ifc.reason.opening": "Öffnung nicht abbildbar",
"ifc.reason.profile": "Querschnitt weder Rechteck noch Kreis",
"ifc.reason.holes": "Raum mit Loch",
"ifc.reason.part": "Teil eines anderen Bauteils",
"ifc.reason.roofForm": "Dachform nicht Flach/Pult/Sattel/Walm (achsparallel)",
"ifc.reason.stairForm": "keine gerade, gleichmässige Treppe",
"menu.native.importMesh": "3D-Modell importieren …",
"mesh.import.title": "3D-Modell importieren",
"mesh.import.failed": "3D-Modell-Import fehlgeschlagen",
+30 -3
View File
@@ -2405,15 +2405,42 @@ export const en: Record<TranslationKey, string> = {
"ifc.import.voids": "{n} openings not subtracted",
"ifc.import.booleans": "{n} boolean solids simplified (first operand only)",
"ifc.import.truncated": "aborted: too many triangles",
"ifc.import.elements": "{schema} imported: {walls} walls, {openings} doors/windows, {ceilings} slabs, {columns} columns, {rooms} rooms, {floors} new storeys; {meshes} elements as context meshes",
"ifc.import.kept": "{n} walls/slabs/columns/rooms not safely mappable, kept as mesh",
"ifc.import.elements": "{schema} imported: {walls} walls, {openings} doors/windows, {ceilings} slabs, {columns} columns, {rooms} rooms, {roofs} roofs, {stairs} stairs, {floors} new storeys; {meshes} elements as context meshes",
"ifc.import.kept": "{n} candidates (walls, slabs, roofs, stairs …) not safely mappable, kept as mesh",
"ifc.import.classified": "{n} elements with a classification (eBKP-H …); noted in the name of context meshes",
"ifc.importDialog.title": "Import IFC",
"ifc.importDialog.asMesh": "As context meshes (default)",
"ifc.importDialog.asMeshHint": "Every element as a non-editable mesh on the context layer, as in the file.",
"ifc.importDialog.asElements": "As building elements",
"ifc.importDialog.asElementsHint": "Walls, slabs, columns, doors/windows, rooms and storeys become editable Dossier elements; anything not safely mappable stays a mesh.",
"ifc.importDialog.asElementsHint": "Walls (including curved and gable walls), slabs, roofs, straight stairs, columns, doors/windows, rooms and storeys become editable Dossier elements; anything not safely mappable stays a mesh.",
"ifc.importDialog.import": "Import",
"ifc.importReport.title": "IFC import: report",
"ifc.importReport.recognized": "Imported as building elements",
"ifc.importReport.kept": "Kept as mesh (reason)",
"ifc.importReport.keptNone": "All candidates became building elements.",
"ifc.importReport.walls": "Walls",
"ifc.importReport.openings": "Doors, windows, openings",
"ifc.importReport.ceilings": "Slabs",
"ifc.importReport.columns": "Columns",
"ifc.importReport.rooms": "Rooms",
"ifc.importReport.roofs": "Roofs",
"ifc.importReport.stairs": "Stairs",
"ifc.importReport.floors": "New storeys",
"ifc.importReport.types": "New types (wall, slab, roof, door, window)",
"ifc.importReport.meshes": "Other elements as context mesh",
"ifc.importReport.close": "Close",
"ifc.reason.noBody": "no readable body",
"ifc.reason.shape": "body unusable",
"ifc.reason.dimensions": "dimensions out of range",
"ifc.reason.notRectangular": "plan neither rectangle nor ring segment",
"ifc.reason.slopedTop": "sloped top without a recognised roof above",
"ifc.reason.notPrism": "not a vertical prism",
"ifc.reason.opening": "opening not mappable",
"ifc.reason.profile": "cross-section neither rectangle nor circle",
"ifc.reason.holes": "room with a hole",
"ifc.reason.part": "part of another element",
"ifc.reason.roofForm": "roof shape not flat/mono-pitch/gable/hip (axis-aligned)",
"ifc.reason.stairForm": "not a straight, regular stair",
"menu.native.importMesh": "Import 3D model …",
"mesh.import.title": "Import 3D model",
"mesh.import.failed": "3D model import failed",
+18 -2
View File
@@ -33,9 +33,25 @@ describe("IFC-Import als Bauteile: Rundreise Demo-Haus", () => {
const { project: p, summary, report } = await importInto(emptyProject, sampleProject);
expect(report.parseErrors).toBe(0);
expect(summary).toMatchObject({ walls: 9, openings: 3, ceilings: 1, columns: 0, rooms: 1, floors: 0, wallTypes: 0, ceilingTypes: 0, components: 0, kept: 0 });
// Dach und Treppenlauf (die IfcStair selbst hat keine Darstellung) bleiben Kontext-Mesh.
expect((p.context ?? []).map((c) => (c as { layer?: string }).layer).sort()).toEqual(["IfcRoof", "IfcStairFlight"]);
// (6.11.) Dach und Treppe kommen als Bauteile zurück, kein Kontext-Mesh mehr.
expect(summary).toMatchObject({ roofs: 1, stairs: 1, roofTypes: 0, doorTypes: 0, windowTypes: 0 });
expect(p.context ?? []).toEqual([]);
expect(validateProject(p)).toEqual([]);
// Satteldach: Umriss = Traufe samt Überstand (0.4), Überstand 0, Traufhöhe = OK OG (5.2), 30°, First x.
const roof = p.roofs![0];
expect([roof.shape, roof.ridgeAxis, roof.overhang]).toEqual(["sattel", "x", 0]);
expect(roof.pitchDeg).toBeCloseTo(30, 4);
expect(roof.baseElevation!).toBeCloseTo(5.2, 6);
expect(roof.thickness).toBeCloseTo(0.2, 6);
for (const q of [{ x: -0.4, y: -0.4 }, { x: 5.4, y: 4.4 }]) expect(roof.outline.some((g) => near(g, q, 1e-6)), JSON.stringify(roof.outline)).toBe(true);
// Gerade Treppe: gleicher Antritt, Richtung, Breite, Stufen, Steighöhe und Lauflänge.
const st0 = sampleProject.stairs![0];
const st = p.stairs![0];
expect([st.shape, st.floorId, st.stepCount]).toEqual(["straight", st0.floorId, st0.stepCount]);
expect(near(st.start, st0.start, 1e-6) && near(st.dir, st0.dir, 1e-9), JSON.stringify(st)).toBe(true);
expect(st.width).toBeCloseTo(st0.width, 6);
expect(st.runLength).toBeCloseTo(st0.runLength, 6);
expect(st.totalRise!).toBeCloseTo(st0.totalRise!, 5);
const byOrig = new Map<string, Wall>();
for (const w of sampleProject.walls) {
+11
View File
@@ -119,10 +119,17 @@ export interface IfcElementsSummary {
ceilings: number;
columns: number;
rooms: number;
/** Dächer (Flach/Pult/Sattel/Walm) und gerade Treppen ([B4]). */
roofs: number;
stairs: number;
/** Neu angelegte Geschosse. */
floors: number;
wallTypes: number;
ceilingTypes: number;
roofTypes: number;
/** Neue Tür-/Fenstertypen nach dem Typnamen der Datei (IfcDoorType/IfcWindowType). */
doorTypes: number;
windowTypes: number;
components: number;
/** Bauteile als Kontext-Mesh. */
meshes: number;
@@ -130,6 +137,8 @@ export interface IfcElementsSummary {
classified: number;
/** Davon Kandidaten, die nicht sicher abbildbar waren. */
kept: number;
/** Je IFC-Klasse die Gründe (Kennwort → Anzahl), weshalb Kandidaten Mesh blieben; Text `ifc.reason.<kennwort>`. */
keptReasons: Record<string, Record<string, number>>;
}
/** IFC-Import als Ops im Kern ([K4] S4): Antwort von `ProjectDocument.importIfc`. */
@@ -171,6 +180,8 @@ export function formatIfcElementsSummary(
ceilings: s.ceilings,
columns: s.columns,
rooms: s.rooms,
roofs: s.roofs ?? 0,
stairs: s.stairs ?? 0,
floors: s.floors,
meshes: s.meshes,
}),
+98
View File
@@ -3,6 +3,7 @@
import { useEffect, useState } from "react";
import { t } from "../i18n";
import type { IfcElementsSummary } from "../io/ifcImport";
export type IfcImportMode = "mesh" | "elements";
@@ -67,3 +68,100 @@ export function IfcImportDialog({ fileName, onImport, onCancel }: IfcImportDialo
</div>
);
}
/** Zeilen „erkannt" des Berichts: Zähler aus der Zusammenfassung des Kerns. */
const RECOGNIZED: ReadonlyArray<[string, (s: IfcElementsSummary) => number]> = [
["ifc.importReport.walls", (s) => s.walls],
["ifc.importReport.openings", (s) => s.openings],
["ifc.importReport.ceilings", (s) => s.ceilings],
["ifc.importReport.roofs", (s) => s.roofs ?? 0],
["ifc.importReport.stairs", (s) => s.stairs ?? 0],
["ifc.importReport.columns", (s) => s.columns],
["ifc.importReport.rooms", (s) => s.rooms],
["ifc.importReport.floors", (s) => s.floors],
[
"ifc.importReport.types",
(s) => s.wallTypes + s.ceilingTypes + (s.roofTypes ?? 0) + (s.doorTypes ?? 0) + (s.windowTypes ?? 0),
],
["ifc.importReport.meshes", (s) => s.meshes],
];
/** Bericht nach dem Bauteil-Import ([B4]): was erkannt wurde und was mit welchem Grund Mesh blieb. */
export function IfcImportReportDialog({
fileName,
summary,
onClose,
}: {
fileName: string;
summary: IfcElementsSummary;
onClose: () => void;
}) {
useEffect(() => {
const onKey = (e: KeyboardEvent) => {
if (e.key === "Escape" || e.key === "Enter") onClose();
};
window.addEventListener("keydown", onKey);
return () => window.removeEventListener("keydown", onKey);
}, [onClose]);
const kept = Object.entries(summary.keptReasons ?? {}).flatMap(([cls, reasons]) =>
Object.entries(reasons).map(([why, n]) => ({ cls, why, n })),
);
return (
<div className="imp-overlay" onClick={onClose}>
<div
className="imp-dialog"
role="dialog"
aria-modal="true"
aria-label={t("ifc.importReport.title")}
onClick={(e) => e.stopPropagation()}
>
<header className="imp-head">
<span className="imp-head-title">{t("ifc.importReport.title")}</span>
<button className="imp-close" onClick={onClose} aria-label={t("export.close")}>
×
</button>
</header>
<div className="imp-body">
<section className="imp-section">
<div className="imp-section-title">
{fileName} · {t("ifc.importReport.recognized")}
</div>
<table className="imp-table">
<tbody>
{RECOGNIZED.map(([key, n]) => (
<tr key={key}>
<td>{t(key)}</td>
<td style={{ textAlign: "right" }}>{n(summary)}</td>
</tr>
))}
</tbody>
</table>
</section>
<section className="imp-section">
<div className="imp-section-title">{t("ifc.importReport.kept")}</div>
{kept.length === 0 ? (
<div className="imp-note">{t("ifc.importReport.keptNone")}</div>
) : (
<table className="imp-table">
<tbody>
{kept.map(({ cls, why, n }) => (
<tr key={`${cls}/${why}`}>
<td>{cls}</td>
<td>{t(`ifc.reason.${why}`)}</td>
<td style={{ textAlign: "right" }}>{n}</td>
</tr>
))}
</tbody>
</table>
)}
</section>
</div>
<footer className="imp-foot">
<button className="imp-btn primary" onClick={onClose}>
{t("ifc.importReport.close")}
</button>
</footer>
</div>
</div>
);
}