[T5] Mesh-Import repariert: Ecken verschweissen, Entartete entfernen, kleine Löcher schliessen [T4] Stand
This commit is contained in:
8 files changed
+285
-6
No files matched your search
@@ -2250,6 +2250,7 @@ export const de = {
|
||||
"mesh.import.upUncertain": "Achse unsicher, angenommen: {axis} oben (im Import-Dialog wählbar)",
|
||||
"mesh.import.dropped": "{n} ungültige oder entartete Flächen verworfen",
|
||||
"mesh.import.truncated": "abgebrochen: zu viele Dreiecke",
|
||||
"mesh.import.repaired": "repariert: {welded} Ecken verschweisst, {tris} entartete Dreiecke entfernt, {holes} Löcher geschlossen",
|
||||
"mesh.import.noFaces": "Die PLY-Datei enthält keine Flächen (Punktwolke): sie wird als Punktwolke geöffnet.",
|
||||
"mesh.import.missingExternal": "Zusätzliche Dateien fehlen: {list}. Wählen Sie sie zusammen mit dem Modell aus (oder ziehen Sie alle Dateien gemeinsam ins Fenster).",
|
||||
"mesh.importDialog.files": "Begleitdateien: {list}",
|
||||
|
||||
@@ -2200,6 +2200,7 @@ export const en: Record<TranslationKey, string> = {
|
||||
"mesh.import.upUncertain": "Axis uncertain, assumed: {axis} up (selectable in the import dialog)",
|
||||
"mesh.import.dropped": "{n} invalid or degenerate faces dropped",
|
||||
"mesh.import.truncated": "aborted: too many triangles",
|
||||
"mesh.import.repaired": "repaired: {welded} vertices welded, {tris} degenerate triangles removed, {holes} holes closed",
|
||||
"mesh.import.noFaces": "The PLY file has no faces (point cloud): opening it as a point cloud.",
|
||||
"mesh.import.missingExternal": "Additional files are missing: {list}. Select them together with the model (or drop all files into the window together).",
|
||||
"mesh.importDialog.files": "Companion files: {list}",
|
||||
|
||||
@@ -192,6 +192,13 @@ describe("Mesh-Import: Abbildung auf Kontext-Meshes", () => {
|
||||
expect(text).toContain("mesh.import.done");
|
||||
expect(text).toContain("mesh.import.up");
|
||||
});
|
||||
|
||||
it("Bericht nennt die Reparatur ([T5]) nur, wenn etwas repariert wurde", () => {
|
||||
const base = { format: "stl", up: "z", upAuto: false, upCertain: true, unitScale: 1, triangles: 12, degenerate: 0, badFaces: 0, truncated: false, warnings: [], objects: 1 } as const;
|
||||
const tr = (k: string, v?: Record<string, string | number>) => `${k}${v ? JSON.stringify(v) : ""}`;
|
||||
expect(formatMeshReport({ ...base, repaired: { welded: 0, degenerate: 0, holes: 0 } }, tr)).not.toContain("repaired");
|
||||
expect(formatMeshReport({ ...base, repaired: { welded: 28, degenerate: 1, holes: 2 } }, tr)).toContain('mesh.import.repaired{"welded":28,"tris":1,"holes":2}');
|
||||
});
|
||||
});
|
||||
|
||||
describe("Mesh-Import: Fehler", () => {
|
||||
|
||||
@@ -64,6 +64,8 @@ export interface MeshImportReport {
|
||||
truncated: boolean;
|
||||
warnings: string[];
|
||||
objects: number;
|
||||
/** Reparatur beim Import ([T5]): zusammengelegte Ecken, entfernte entartete Dreiecke, geschlossene Löcher. */
|
||||
repaired?: { welded: number; degenerate: number; holes: number };
|
||||
}
|
||||
|
||||
/** Rohergebnis aus Rust: Zahlenpuffer + Zeichenketten. */
|
||||
@@ -198,7 +200,7 @@ export async function readMesh(bytes: Uint8Array, name: string, opts?: MeshReadO
|
||||
export function formatMeshReport(
|
||||
r: MeshImportReport,
|
||||
tr: (
|
||||
key: "mesh.import.done" | "mesh.import.up" | "mesh.import.upUncertain" | "mesh.import.dropped" | "mesh.import.truncated",
|
||||
key: "mesh.import.done" | "mesh.import.up" | "mesh.import.upUncertain" | "mesh.import.dropped" | "mesh.import.truncated" | "mesh.import.repaired",
|
||||
vars?: Record<string, string | number>,
|
||||
) => string,
|
||||
): string {
|
||||
@@ -206,6 +208,8 @@ export function formatMeshReport(
|
||||
if (r.upAuto) parts.push(tr(r.upCertain ? "mesh.import.up" : "mesh.import.upUncertain", { axis: r.up.toUpperCase() }));
|
||||
const dropped = r.degenerate + r.badFaces;
|
||||
if (dropped) parts.push(tr("mesh.import.dropped", { n: dropped }));
|
||||
const fixed = r.repaired ? r.repaired.degenerate + r.repaired.holes : 0;
|
||||
if (r.repaired && (r.repaired.welded || fixed)) parts.push(tr("mesh.import.repaired", { welded: r.repaired.welded, tris: r.repaired.degenerate, holes: r.repaired.holes }));
|
||||
if (r.truncated) parts.push(tr("mesh.import.truncated"));
|
||||
return parts.join(" · ");
|
||||
}
|
||||
Reference in new issue
Block a user