Merge remote-tracking branch 'origin/master' into worktree-agent-a0f13906a9829e7a3
# Conflicts: # src-tauri/core/src/plan/elevation.rs # src-tauri/core/src/plan/section.rs
This commit is contained in:
101 files changed
+8304
-374
No files matched your search
+6
-18
@@ -66,7 +66,7 @@ import { IfcImportDialog, type IfcImportMode } from "./ui/IfcImportDialog";
|
||||
import { MeshImportHost } from "./ui/MeshImportDialog";
|
||||
import { openMeshFileDialog, requestMeshImport, splitMeshFiles } from "./state/meshImportStore";
|
||||
import { formatMeshReport, isMeshFile } from "./io/meshImport";
|
||||
import { clashMarkerOps, runClashCheck } from "./analysis/clash";
|
||||
import { runClashAndStore } from "./panels/clashSession";
|
||||
import { checkForUpdate } from "./update/checkForUpdate";
|
||||
import type { PlanViewHandle } from "./views/plan/PlanView";
|
||||
import type { DisplayResolver } from "./viewport/Viewport3D";
|
||||
@@ -292,6 +292,7 @@ const TOOL_COMMAND: Partial<Record<ToolId, string>> = {
|
||||
scalebar: "scalebar",
|
||||
revcloud: "revcloud",
|
||||
pointmarker: "pointmarker",
|
||||
grid: "grid",
|
||||
wipeout: "wipeout",
|
||||
text: "text",
|
||||
leader: "leader",
|
||||
@@ -1650,6 +1651,7 @@ export default function App() {
|
||||
removeContextObject,
|
||||
removeContextObjects,
|
||||
generateTerrain,
|
||||
patchContextObject,
|
||||
moveGripOf,
|
||||
moveElementByOf,
|
||||
moveEdgeOf,
|
||||
@@ -2375,23 +2377,8 @@ export default function App() {
|
||||
onImportPointCloud: () => openPointCloudFileDialog(),
|
||||
onImportMesh: () => openMeshFileDialog(),
|
||||
onClashCheck: () => {
|
||||
const p0 = project;
|
||||
runClashCheck(p0)
|
||||
.then((clashes) => {
|
||||
applyChange((p) => clashMarkerOps(p, clashes, activeCategoryCode));
|
||||
// window.alert ist im Tauri-WKWebView wirkungslos → Toast.
|
||||
notify(
|
||||
clashes.length === 0
|
||||
? t("clash.none")
|
||||
: `${t("clash.found")}: ${clashes.length} — ` +
|
||||
clashes
|
||||
.slice(0, 5)
|
||||
.map((c, k) => `K${k + 1} ${c.a.kind}↔${c.b.kind}${c.volume !== null ? ` ${c.volume.toFixed(3)} m³` : ""}`)
|
||||
.join(", "),
|
||||
clashes.length === 0 ? "info" : "warning",
|
||||
);
|
||||
})
|
||||
.catch((err) => notify(`${t("clash.failed")}: ${err instanceof Error ? err.message : String(err)}`, "error"));
|
||||
setLayout((l) => revealPanel(l, "clash"));
|
||||
void runClashAndStore();
|
||||
},
|
||||
onKennzahlen: () => {
|
||||
const k = computeKennzahlen(project);
|
||||
@@ -3261,6 +3248,7 @@ export default function App() {
|
||||
removeContextObject,
|
||||
removeContextObjects,
|
||||
generateTerrain,
|
||||
patchContextObject,
|
||||
commitTransformOn,
|
||||
setElementColor,
|
||||
setElementWeight,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { sampleProject } from "../model/sampleProject";
|
||||
import { candidatePairs, clashItems, clashMarkerOps, CLASH_MARKER_PREFIX } from "./clash";
|
||||
import { candidatePairs, clashHighlightLines, clashItems, clashMarkerOps, clashSelection, CLASH_MARKER_PREFIX } from "./clash";
|
||||
import { applyOps } from "../core/ops";
|
||||
import type { Project } from "../model/types";
|
||||
import type { Clash } from "./clash";
|
||||
@@ -22,11 +22,28 @@ describe("Kollisionspruefung", () => {
|
||||
expect(items.some((i) => i.kind === "wall")).toBe(true);
|
||||
});
|
||||
it("Marker ersetzen alte Marker", () => {
|
||||
const clash = { a: it0("a", "solid"), b: it0("b", "wall"), volume: 0.12, center: [1, 2, 0.5] as [number, number, number] };
|
||||
const clash = { a: it0("a", "solid"), b: it0("b", "wall"), volume: 0.12, center: [1, 2, 0.5] as [number, number, number], min: [0.5, 1.5, 0] as [number, number, number], max: [1.5, 2.5, 1] as [number, number, number] };
|
||||
const p1 = applyClashMarkers(sampleProject, [clash, clash], "A");
|
||||
const n1 = p1.drawings2d.filter((d) => d.id.startsWith(CLASH_MARKER_PREFIX)).length;
|
||||
expect(n1).toBe(4);
|
||||
const p2 = applyClashMarkers(p1, [clash], "A");
|
||||
expect(p2.drawings2d.filter((d) => d.id.startsWith(CLASH_MARKER_PREFIX)).length).toBe(2);
|
||||
});
|
||||
it("3D-Hervorhebung: 12 Kanten je Kollision als Linienpaare im Viewport-Raum (y/z getauscht)", () => {
|
||||
const clash = { a: it0("a", "solid"), b: it0("b", "wall"), volume: 0.12, center: [1, 2, 0.5] as [number, number, number], min: [0.5, 1.5, 0] as [number, number, number], max: [1.5, 2.5, 1] as [number, number, number] };
|
||||
const lines = clashHighlightLines([clash], [1, 0, 0]);
|
||||
expect(lines.length).toBe(12 * 2 * 6);
|
||||
// erster Eckpunkt: Modell (min.x, min.y, min.z) → world (x, Höhe, y), Farbe rot
|
||||
const verts = [];
|
||||
for (let k = 0; k < lines.length; k += 6) verts.push([...lines.slice(k, k + 6)]);
|
||||
expect(verts.every((v) => v[3] === 1 && v[4] === 0 && v[5] === 0)).toBe(true);
|
||||
expect(verts.every((v) => v[0] >= 0.5 && v[0] <= 1.5 && v[1] >= 0 && v[1] <= 1 && v[2] >= 1.5 && v[2] <= 2.5)).toBe(true);
|
||||
expect(clashHighlightLines([], [1, 0, 0]).length).toBe(0);
|
||||
});
|
||||
it("Auswahl eines Paars je Bauteilart", () => {
|
||||
const clash = { a: it0("s1", "solid"), b: it0("w1", "wall"), volume: null, center: [0, 0, 0] as [number, number, number], min: [0, 0, 0] as [number, number, number], max: [1, 1, 1] as [number, number, number] };
|
||||
expect(clashSelection(clash)).toEqual({ wallIds: ["w1"], ceilingIds: [], extrudedSolidIds: ["s1"], contextObjectIds: [] });
|
||||
const m = { ...clash, a: it0("m1", "mesh"), b: it0("c1", "slab") };
|
||||
expect(clashSelection(m)).toEqual({ wallIds: [], ceilingIds: ["c1"], extrudedSolidIds: [], contextObjectIds: ["m1"] });
|
||||
});
|
||||
});
|
||||
+53
-5
@@ -30,8 +30,11 @@ export interface Clash {
|
||||
b: ClashItem;
|
||||
/** Durchdringungsvolumen (m³), `null` wenn nicht berechenbar. */
|
||||
volume: number | null;
|
||||
/** Mittelpunkt der Durchdringungslinien (Welt-Meter). */
|
||||
/** Mittelpunkt der Durchdringungslinien (Modell-Meter, z = Höhe). */
|
||||
center: [number, number, number];
|
||||
/** Hüllquader der Durchdringungslinien (Modell-Meter) — für Hervorhebung und Zoom. */
|
||||
min: [number, number, number];
|
||||
max: [number, number, number];
|
||||
}
|
||||
|
||||
/** Prefix der Marker-Ids (ein neuer Lauf ersetzt die alten Marker). */
|
||||
@@ -127,13 +130,17 @@ export async function runClashCheck(
|
||||
if (!r.colliding || r.lines.length === 0) continue;
|
||||
if (r.overlapVolume !== null && r.overlapVolume < MIN_VOLUME) continue;
|
||||
const c: [number, number, number] = [0, 0, 0];
|
||||
const min: [number, number, number] = [Infinity, Infinity, Infinity];
|
||||
const max: [number, number, number] = [-Infinity, -Infinity, -Infinity];
|
||||
for (const l of r.lines) {
|
||||
c[0] += (l[0] + l[3]) / 2;
|
||||
c[1] += (l[1] + l[4]) / 2;
|
||||
c[2] += (l[2] + l[5]) / 2;
|
||||
for (let k = 0; k < 3; k++) {
|
||||
c[k] += (l[k] + l[k + 3]) / 2;
|
||||
min[k] = Math.min(min[k], l[k], l[k + 3]);
|
||||
max[k] = Math.max(max[k], l[k], l[k + 3]);
|
||||
}
|
||||
}
|
||||
const n = r.lines.length;
|
||||
const clash: Clash = { a: items[i], b: items[j], volume: r.overlapVolume, center: [c[0] / n, c[1] / n, c[2] / n] };
|
||||
const clash: Clash = { a: items[i], b: items[j], volume: r.overlapVolume, center: [c[0] / n, c[1] / n, c[2] / n], min, max };
|
||||
// Mehrere Wandschichten derselben Wand → eine Kollision (grösstes Volumen).
|
||||
const key = [items[i].id, items[j].id].sort().join("|");
|
||||
const prev = found.get(key);
|
||||
@@ -175,3 +182,44 @@ export function clashMarkerOps(project: Project, clashes: Clash[], categoryCode:
|
||||
...addItems("drawings2d", markers),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Rote Hüllquader der Kollisionen als Linienliste für den 3D-Viewport (`set_highlight_lines`):
|
||||
* `[x, y, z, r, g, b]` je Vertex, 2 Vertices je Kante, 12 Kanten je Kollision. Modell (x, y, Höhe)
|
||||
* → Viewport-Welt (x, Höhe, y). Mindestkantenlänge 0.1 m, damit hauchdünne Durchdringungen sichtbar bleiben.
|
||||
*/
|
||||
export function clashHighlightLines(clashes: Clash[], rgb: readonly [number, number, number]): Float32Array {
|
||||
const out = new Float32Array(clashes.length * 12 * 2 * 6);
|
||||
let o = 0;
|
||||
const vert = (p: readonly number[]) => {
|
||||
out[o++] = p[0];
|
||||
out[o++] = p[2];
|
||||
out[o++] = p[1];
|
||||
out[o++] = rgb[0];
|
||||
out[o++] = rgb[1];
|
||||
out[o++] = rgb[2];
|
||||
};
|
||||
for (const c of clashes) {
|
||||
const lo = [0, 1, 2].map((k) => Math.min(c.min[k], c.center[k] - 0.05));
|
||||
const hi = [0, 1, 2].map((k) => Math.max(c.max[k], c.center[k] + 0.05));
|
||||
const corner = (i: number) => [i & 1 ? hi[0] : lo[0], i & 2 ? hi[1] : lo[1], i & 4 ? hi[2] : lo[2]];
|
||||
for (let i = 0; i < 8; i++) {
|
||||
for (const bit of [1, 2, 4]) {
|
||||
if (i & bit) continue;
|
||||
vert(corner(i));
|
||||
vert(corner(i | bit));
|
||||
}
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
/** Bauteile einer Kollision je Auswahlkanal (Wand, Decke, Körper, Import). */
|
||||
export function clashSelection(c: Clash): { wallIds: string[]; ceilingIds: string[]; extrudedSolidIds: string[]; contextObjectIds: string[] } {
|
||||
const sel = { wallIds: [] as string[], ceilingIds: [] as string[], extrudedSolidIds: [] as string[], contextObjectIds: [] as string[] };
|
||||
for (const it of [c.a, c.b]) {
|
||||
const list = it.kind === "wall" ? sel.wallIds : it.kind === "slab" ? sel.ceilingIds : it.kind === "solid" ? sel.extrudedSolidIds : sel.contextObjectIds;
|
||||
if (!list.includes(it.id)) list.push(it.id);
|
||||
}
|
||||
return sel;
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import type { Project } from "../model/types";
|
||||
import { sampleProject } from "../model/sampleProject";
|
||||
import { excavationQuantities } from "./excavation";
|
||||
import { generateTerrainFromContours } from "../model/terrain";
|
||||
|
||||
/** Flaches Gelände 100 × 100 m auf ±0 und eine Baugrube 10 × 10 m, 3 m tief, 45°. */
|
||||
function project(): Project {
|
||||
return {
|
||||
...sampleProject,
|
||||
walls: [],
|
||||
context: [
|
||||
{
|
||||
id: "t",
|
||||
type: "terrainMesh",
|
||||
name: "Gelände",
|
||||
positions: [-50, -50, 0, 50, -50, 0, 50, 50, 0, -50, 50, 0],
|
||||
indices: [0, 1, 2, 0, 2, 3],
|
||||
},
|
||||
{
|
||||
id: "bg",
|
||||
type: "excavation",
|
||||
name: "Baugrube",
|
||||
outline: [
|
||||
{ x: -5, y: -5 },
|
||||
{ x: 5, y: -5 },
|
||||
{ x: 5, y: 5 },
|
||||
{ x: -5, y: 5 },
|
||||
],
|
||||
bottom: -3,
|
||||
slope: 45,
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
describe("[68] Baugrube", () => {
|
||||
it("Abtrag wie analytisch (Kegelecken)", () => {
|
||||
const [q] = excavationQuantities(project());
|
||||
const exact = 300 + (40 * 9) / 2 + (Math.PI * 27) / 3;
|
||||
expect(q.id).toBe("bg");
|
||||
expect(Math.abs(q.cut - exact) / exact).toBeLessThan(0.01);
|
||||
expect(q.fill).toBeCloseTo(0, 6);
|
||||
expect(q.bottomArea).toBeCloseTo(100, 6);
|
||||
});
|
||||
|
||||
it("ohne Baugrube leer", () => {
|
||||
expect(excavationQuantities({ ...sampleProject, context: [] })).toEqual([]);
|
||||
});
|
||||
});
|
||||
|
||||
describe("[T6] Gelände aus Höhenlinien", () => {
|
||||
it("glättet ohne Überschwingen und setzt die Äquidistanz", () => {
|
||||
const ring = (r: number) =>
|
||||
Array.from({ length: 32 }, (_, i) => ({ x: r * Math.cos((i / 32) * 2 * Math.PI), y: r * Math.sin((i / 32) * 2 * Math.PI) }));
|
||||
const contours = [0, 1, 2, 3].map((k) => ({ z: k, pts: ring(40 - 10 * k), closed: true }));
|
||||
const raw = generateTerrainFromContours(contours, { smooth: 0 });
|
||||
const smooth = generateTerrainFromContours(contours);
|
||||
expect(smooth.contourInterval).toBe(1);
|
||||
expect(smooth.indices.length).toBeGreaterThan(raw.indices.length);
|
||||
const zs = smooth.positions.filter((_, i) => i % 3 === 2);
|
||||
expect(Math.min(...zs)).toBeGreaterThanOrEqual(-1e-9);
|
||||
expect(Math.max(...zs)).toBeLessThan(3.5);
|
||||
expect(Math.max(...zs)).toBeGreaterThan(3);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,26 @@
|
||||
// Erdarbeiten ([68]): Mengen der Baugruben aus dem Rust-Kern (`src-tauri/core/src/excavation.rs`).
|
||||
// Abtrag/Auftrag je Baugrube gegen das gewachsene Terrain (Integral über ein feines Raster der exakten
|
||||
// Böschungsfunktion), Hinterfüllung = Abtrag ausserhalb der Gebäude-Grundfläche.
|
||||
|
||||
import type { Project } from "../model/types";
|
||||
import { documentFor } from "../core/document";
|
||||
|
||||
export interface ExcavationQuantity {
|
||||
id: string;
|
||||
name: string;
|
||||
/** Sohle (m, Modell ±0.00). */
|
||||
bottom: number;
|
||||
/** Sohlenfläche (m²). */
|
||||
bottomArea: number;
|
||||
/** Abtrag (m³). */
|
||||
cut: number;
|
||||
/** Auftrag/Schüttung (m³). */
|
||||
fill: number;
|
||||
/** Hinterfüllung (m³). */
|
||||
backfill: number;
|
||||
}
|
||||
|
||||
export function excavationQuantities(project: Project): ExcavationQuantity[] {
|
||||
if (!(project.context ?? []).some((o) => o.type === "excavation")) return [];
|
||||
return documentFor(project).query<ExcavationQuantity[]>("excavationQuantities");
|
||||
}
|
||||
@@ -57,6 +57,12 @@ export interface SiteCheck {
|
||||
violationArea: number;
|
||||
maxTop: number | null;
|
||||
heightExceeded: boolean;
|
||||
/** [T6] Geländehöhen an der Fassade (gewachsen/gestaltet, Modellbezug); leer ohne Gelände. */
|
||||
facadeTerrain: { x: number; y: number; natural: number | null; designed: number | null }[];
|
||||
/** Tiefstes gewachsenes Terrain an der Fassade (massgebendes Terrain, vereinfacht). */
|
||||
terrainMin: number | null;
|
||||
/** Gesamthöhe über dem massgebenden Terrain; mit Gelände prüft die Höhe dagegen statt gegen ±0.00. */
|
||||
heightAboveTerrain: number | null;
|
||||
}
|
||||
|
||||
/** Prüft das Modell gegen `project.siteRules`; `null` ohne (gültiges) Baurecht. Rechnung im Rust-Kern (`site_rules.rs`). */
|
||||
|
||||
@@ -13,34 +13,43 @@
|
||||
<polygon points="5.8275,7.08564 6.1725,7.08564 6.1725,4.48564 5.8275,4.48564" fill="#ffffff" stroke="none" stroke-width="0" stroke-linejoin="round"/>
|
||||
<polygon points="1.1725,7.08564 1.1725,4.48564 0.8275,4.48564 0.8275,7.08564" fill="#ffffff" stroke="none" stroke-width="0" stroke-linejoin="round"/>
|
||||
<polygon points="3.325,7.08564 3.475,7.08564 3.475,4.48564 3.325,4.48564" fill="#8c5544" stroke="none" stroke-width="0" stroke-linejoin="round"/>
|
||||
<polygon points="1,4.48564 6,4.48564 6,2.05885 1,2.05885" fill="#ffffff" stroke="none" stroke-width="0" stroke-linejoin="round"/>
|
||||
<polygon points="5.8275,4.48564 6.1725,4.48564 6.1725,1.88564 5.8275,1.88564" fill="#ffffff" stroke="none" stroke-width="0" stroke-linejoin="round"/>
|
||||
<polygon points="1.1725,4.48564 1.1725,1.88564 0.8275,1.88564 0.8275,4.48564" fill="#ffffff" stroke="none" stroke-width="0" stroke-linejoin="round"/>
|
||||
<line x1="6.1725" y1="4.48564" x2="6.1725" y2="2.05885" stroke="#2b3039" stroke-width="0.013"/>
|
||||
<line x1="0.8275" y1="4.48564" x2="0.8275" y2="2.05885" stroke="#2b3039" stroke-width="0.013"/>
|
||||
<polygon points="6,2.05885 6,2.28564 1,2.28564 1,2.05885" fill="#8f959e" stroke="none" stroke-width="0" stroke-linejoin="round"/>
|
||||
<polygon points="5.8275,1.88564 6.1725,1.88564 6.1725,2.28564 5.8275,2.28564" fill="#8f959e" stroke="none" stroke-width="0" stroke-linejoin="round"/>
|
||||
<polygon points="0.8275,1.88564 1.1725,1.88564 1.1725,2.28564 1,2.28564 0.8275,2.11314" fill="#8f959e" stroke="none" stroke-width="0" stroke-linejoin="round"/>
|
||||
<polygon points="1,2.05885 6,2.05885 6,2.45885 1,2.45885" fill="#8f959e" stroke="none" stroke-width="0" stroke-linejoin="round"/>
|
||||
<polygon points="5.8275,2.05885 6.1725,2.05885 6.1725,2.45885 5.8275,2.45885" fill="#8f959e" stroke="none" stroke-width="0" stroke-linejoin="round"/>
|
||||
<polygon points="0.8275,2.05885 1.1725,2.05885 1.1725,2.45885 1,2.45885 0.8275,2.28635" fill="#8f959e" stroke="none" stroke-width="0" stroke-linejoin="round"/>
|
||||
<polygon points="0.8275,7.08564 1.8,7.08564 1.8,4.48564 0.8275,4.48564" fill="#ffffff" stroke="none" stroke-width="0" stroke-linejoin="round"/>
|
||||
<polygon points="1.8,4.98564 2.7,4.98564 2.7,4.48564 1.8,4.48564" fill="#ffffff" stroke="none" stroke-width="0" stroke-linejoin="round"/>
|
||||
<polygon points="2.7,7.08564 4,7.08564 4,4.48564 2.7,4.48564" fill="#ffffff" stroke="none" stroke-width="0" stroke-linejoin="round"/>
|
||||
<polygon points="4,7.08564 5,7.08564 5,6.18564 4,6.18564" fill="#ffffff" stroke="none" stroke-width="0" stroke-linejoin="round"/>
|
||||
<polygon points="4,4.98564 5,4.98564 5,4.48564 4,4.48564" fill="#ffffff" stroke="none" stroke-width="0" stroke-linejoin="round"/>
|
||||
<polygon points="5,7.08564 6.1725,7.08564 6.1725,4.48564 5,4.48564" fill="#ffffff" stroke="none" stroke-width="0" stroke-linejoin="round"/>
|
||||
<polygon points="0.8275,4.48564 6.1725,4.48564 6.1725,1.88564 0.8275,1.88564" fill="#ffffff" stroke="none" stroke-width="0" stroke-linejoin="round"/>
|
||||
<polygon points="1,4.48564 6,4.48564 6,2.05885 1,2.05885" fill="#ffffff" stroke="none" stroke-width="0" stroke-linejoin="round"/>
|
||||
<line x1="0.8275" y1="7.08564" x2="1.8" y2="7.08564" stroke="#2b3039" stroke-width="0.013"/>
|
||||
<line x1="2.7" y1="7.08564" x2="4" y2="7.08564" stroke="#2b3039" stroke-width="0.013"/>
|
||||
<line x1="4" y1="7.08564" x2="5" y2="7.08564" stroke="#2b3039" stroke-width="0.013"/>
|
||||
<line x1="5" y1="7.08564" x2="6.1725" y2="7.08564" stroke="#2b3039" stroke-width="0.013"/>
|
||||
<line x1="0.8275" y1="4.48564" x2="1" y2="4.48564" stroke="#2b3039" stroke-width="0.013"/>
|
||||
<line x1="6" y1="4.48564" x2="6.1725" y2="4.48564" stroke="#2b3039" stroke-width="0.013"/>
|
||||
<line x1="1.8" y1="4.98564" x2="2.7" y2="4.98564" stroke="#2b3039" stroke-width="0.013"/>
|
||||
<line x1="4" y1="4.98564" x2="5" y2="4.98564" stroke="#2b3039" stroke-width="0.013"/>
|
||||
<line x1="4" y1="6.18564" x2="5" y2="6.18564" stroke="#2b3039" stroke-width="0.013"/>
|
||||
<line x1="0.8275" y1="1.88564" x2="6.1725" y2="1.88564" stroke="#2b3039" stroke-width="0.013"/>
|
||||
<line x1="1.8" y1="7.08564" x2="1.8" y2="4.98564" stroke="#2b3039" stroke-width="0.013"/>
|
||||
<line x1="0.8275" y1="7.08564" x2="0.8275" y2="4.48564" stroke="#2b3039" stroke-width="0.013"/>
|
||||
<line x1="0.8275" y1="4.48564" x2="0.8275" y2="1.88564" stroke="#2b3039" stroke-width="0.013"/>
|
||||
<line x1="2.7" y1="7.08564" x2="2.7" y2="4.98564" stroke="#2b3039" stroke-width="0.013"/>
|
||||
<line x1="4" y1="6.18564" x2="4" y2="4.98564" stroke="#2b3039" stroke-width="0.013"/>
|
||||
<line x1="5" y1="6.18564" x2="5" y2="4.98564" stroke="#2b3039" stroke-width="0.013"/>
|
||||
<line x1="6.1725" y1="7.08564" x2="6.1725" y2="4.48564" stroke="#2b3039" stroke-width="0.013"/>
|
||||
<line x1="6.1725" y1="4.48564" x2="6.1725" y2="1.88564" stroke="#2b3039" stroke-width="0.013"/>
|
||||
<polygon points="0.8275,1.88564 6.1725,1.88564 6.1725,2.11314 0.8275,2.11314 0.8275,2.11314" fill="#8f959e" stroke="none" stroke-width="0" stroke-linejoin="round"/>
|
||||
<line x1="6" y1="4.48564" x2="6" y2="2.05885" stroke="#2b3039" stroke-width="0.013"/>
|
||||
<line x1="1" y1="4.48564" x2="1" y2="2.05885" stroke="#2b3039" stroke-width="0.013"/>
|
||||
<polygon points="6,2.05885 6,2.11314 1,2.11314 1,2.05885" fill="#8f959e" stroke="none" stroke-width="0" stroke-linejoin="round"/>
|
||||
<polygon points="1,2.05885 6,2.05885 6,2.28635 1,2.28635" fill="#8f959e" stroke="none" stroke-width="0" stroke-linejoin="round"/>
|
||||
<polygon points="1.8,7.08564 2.7,7.08564 2.7,4.98564 1.8,4.98564" fill="#d9d9d4" stroke="#2b3039" stroke-width="0.018" stroke-linejoin="round"/>
|
||||
<polygon points="1.836,7.08564 2.664,7.08564 2.664,5.04864 1.836,5.04864" fill="#ede6d9" stroke="#2b3039" stroke-width="0.013" stroke-linejoin="round"/>
|
||||
<polygon points="1.8,5.06564 2.7,5.06564 2.7,4.98564 1.8,4.98564" fill="#a7adb5" stroke="none" stroke-width="0" stroke-linejoin="round"/>
|
||||
@@ -56,9 +65,14 @@
|
||||
<line x1="4.88" y1="5.10564" x2="4.12" y2="5.58564" stroke="#7d858f" stroke-width="0.01" stroke-dasharray="0.22 0.18"/>
|
||||
<line x1="4.12" y1="6.06564" x2="4.5" y2="5.10564" stroke="#7d858f" stroke-width="0.01" stroke-dasharray="0.22 0.18"/>
|
||||
<line x1="4.88" y1="6.06564" x2="4.5" y2="5.10564" stroke="#7d858f" stroke-width="0.01" stroke-dasharray="0.22 0.18"/>
|
||||
<polygon points="0.6,1.88564 6.4,1.88564 6.4,2.05885 0.6,2.05885" fill="#b8735c" stroke="none" stroke-width="0" stroke-linejoin="round"/>
|
||||
<line x1="0.6" y1="1.88564" x2="6.4" y2="1.88564" stroke="#2b3039" stroke-width="0.013"/>
|
||||
<line x1="6.4" y1="1.88564" x2="6.4" y2="0.5" stroke="#2b3039" stroke-width="0.013"/>
|
||||
<line x1="6.4" y1="0.5" x2="0.6" y2="0.5" stroke="#2b3039" stroke-width="0.013"/>
|
||||
<line x1="0.6" y1="0.5" x2="0.6" y2="1.88564" stroke="#2b3039" stroke-width="0.013"/>
|
||||
<line x1="0.6" y1="1.88564" x2="6.4" y2="1.88564" stroke="#2b3039" stroke-width="0.013"/>
|
||||
<line x1="6.4" y1="1.88564" x2="6.4" y2="2.05885" stroke="#2b3039" stroke-width="0.013"/>
|
||||
<line x1="6.4" y1="2.05885" x2="0.6" y2="2.05885" stroke="#2b3039" stroke-width="0.013"/>
|
||||
<line x1="0.6" y1="2.05885" x2="0.6" y2="1.88564" stroke="#2b3039" stroke-width="0.013"/>
|
||||
<line x1="0.6" y1="7.08564" x2="6.4" y2="7.08564" stroke="#1f242c" stroke-width="0.05"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 7.4 KiB After Width: | Height: | Size: 8.9 KiB |
+5
-2
@@ -84,6 +84,7 @@ import {
|
||||
addProgramSheet,
|
||||
defaultSheetLabels,
|
||||
checkSiteRules,
|
||||
excavationQuantities,
|
||||
exportStl,
|
||||
exportGlb,
|
||||
exportGltf,
|
||||
@@ -602,7 +603,7 @@ async function execute(project: Project, file: string, command: string, rest: st
|
||||
const o = await computeSection(project, lvl);
|
||||
if (!o) fail("keine gültige Schnittlinie");
|
||||
// Wie die App: verdeckte Kanten nach der Ebene, geschnittene Fenster/Türen.
|
||||
plan = generateSectionPlan(o, false, { visibleCodes: allCodes, hiddenLines: lvl.hiddenLines, openings: true });
|
||||
plan = generateSectionPlan(o, false, { visibleCodes: allCodes, hiddenLines: lvl.hiddenLines, openings: true, scaleDenominator: scale });
|
||||
} else {
|
||||
plan = generateElevationPlan(project, lvl, { scaleDenominator: scale });
|
||||
if (!plan) fail("keine gültige Ansichtslinie");
|
||||
@@ -683,7 +684,9 @@ async function execute(project: Project, file: string, command: string, rest: st
|
||||
const k = computeKennzahlen(project);
|
||||
const prog = checkRoomProgram(project);
|
||||
const baurecht = checkSiteRules(project);
|
||||
out(args, JSON.stringify({ kennzahlen: k, raumprogramm: prog, baurecht }, null, 2), `${project.name || "projekt"}-kennzahlen.json`);
|
||||
// [68] Erdarbeiten je Baugrube (Abtrag/Auftrag/Hinterfüllung, m³).
|
||||
const erdarbeiten = excavationQuantities(project);
|
||||
out(args, JSON.stringify({ kennzahlen: k, raumprogramm: prog, baurecht, erdarbeiten }, null, 2), `${project.name || "projekt"}-kennzahlen.json`);
|
||||
return 0;
|
||||
}
|
||||
case "raumprogramm": {
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
// Radius-, Durchmesser- und Bogenlängen-Bemassung ([38]): Klick auf den Rand eines Kreises, Bogens oder
|
||||
// einer Bogenwand (Fläche oder Achse). Der Kern (`cmd_draw.rs`, `dim_assoc::round_dimension`) findet den
|
||||
// Kreis, setzt Mittelpunkt und Randpunkte und hängt sie daran (Bezug `center`/`rim`): Verschieben oder
|
||||
// Vergrössern des Kreises, Strecken der Bogenwand führt das Mass nach. Radius und Durchmesser: ein Klick;
|
||||
// Bogenlänge: Anfang, Ende (gegen den Uhrzeigersinn), dann Lage der Masslinie.
|
||||
|
||||
import type { Command, CommandContext, CommandResult, CommandState, ToolDraft, Vec2 } from "../types";
|
||||
import { createMutation, createPreview, xy } from "../createCore";
|
||||
|
||||
export type RoundKind = "radius" | "diameter" | "arc";
|
||||
|
||||
interface RoundState extends CommandState {
|
||||
phase: "first" | "second" | "offset";
|
||||
pts: Vec2[];
|
||||
}
|
||||
|
||||
const fresh = (): RoundState => ({ phase: "first", lastPoint: null, pts: [] });
|
||||
const idle = (): [CommandState, CommandResult] => [fresh(), { draft: null, done: true }];
|
||||
|
||||
/** Fangtoleranz auf dem Rand (Modell-Meter). */
|
||||
const TOL = 0.2;
|
||||
|
||||
function draft(ctx: CommandContext, kind: RoundKind, pts: Vec2[], cursor: Vec2 | null): ToolDraft | null {
|
||||
const all = cursor ? [...pts, cursor] : pts;
|
||||
if (all.length === 0) return null;
|
||||
const pv = createPreview(ctx, { cmd: "dimround", kind, tol: TOL }, all);
|
||||
return { preview: pv.shapes, vertices: pts };
|
||||
}
|
||||
|
||||
function make(kind: RoundKind, name: string): Command {
|
||||
const keyOf = (s: RoundState) => (s.phase === "first" ? `cmd.${name}.first` : s.phase === "second" ? `cmd.${name}.second` : `cmd.${name}.offset`);
|
||||
return {
|
||||
name,
|
||||
labelKey: `cmd.${name}.label` as never,
|
||||
prompt: (s) => keyOf(s as RoundState) as never,
|
||||
accepts: () => ["point"],
|
||||
options: () => [],
|
||||
init: fresh,
|
||||
|
||||
onInput: (state, input, ctx): [CommandState, CommandResult] => {
|
||||
const s = state as RoundState;
|
||||
if (input.kind !== "point") return [s, { draft: null }];
|
||||
const pts = [...s.pts, input.point];
|
||||
if (kind !== "arc" || s.phase === "offset") {
|
||||
const commit = createMutation(ctx, { cmd: "dimround", kind, tol: TOL, pts: pts.slice(0, kind === "arc" ? 2 : 1).map(xy), side: kind === "arc" ? xy(input.point) : null });
|
||||
return [fresh(), { draft: null, done: true, commit }];
|
||||
}
|
||||
const ns: RoundState = { phase: pts.length >= 2 ? "offset" : "second", pts, lastPoint: input.point };
|
||||
return [ns, { draft: draft(ctx, kind, pts, null) }];
|
||||
},
|
||||
|
||||
onMove: (state, point, _snap, ctx): [CommandState, CommandResult] => [state, { draft: draft(ctx, kind, (state as RoundState).pts, point) }],
|
||||
onConfirm: () => idle(),
|
||||
onCancel: () => idle(),
|
||||
};
|
||||
}
|
||||
|
||||
export const radiusDimCommand = make("radius", "dimradius");
|
||||
export const diameterDimCommand = make("diameter", "dimdiameter");
|
||||
export const arcDimCommand = make("arc", "dimarc");
|
||||
@@ -0,0 +1,109 @@
|
||||
// Baugrube ([68]) — Umriss der Sohle per Klicks; der Kern (`cmd_solid.rs`) legt ein Kontext-Objekt
|
||||
// `excavation` an (Sohle = Geschoss-Unterkante − 0.30 m, Böschung 45°), das jedes Gelände-Netz unter dem
|
||||
// Umriss schneidet. Sohle, Böschung und Bermen danach im Panel „Gelände & Kontext".
|
||||
//
|
||||
// Schritte:
|
||||
// 1) „Erster Punkt der Baugrubensohle:" → Punkt
|
||||
// 2) „Nächster Punkt …" → Punkt … Schliessen per Klick auf den Startpunkt, Option „Schliessen" oder
|
||||
// Enter (≥ 3 Punkte; bei genau 2 Punkten: Rechteck aus den Ecken).
|
||||
|
||||
import type { Command, CommandContext, CommandResult, CommandState, CmdOption, DraftShape, ToolDraft, Vec2 } from "../types";
|
||||
import { createMutation } from "../createCore";
|
||||
|
||||
const EPS = 1e-6;
|
||||
const CLOSE_HIT = 0.08; // Modell-Meter: Klick nahe Startpunkt schliesst die Kontur
|
||||
|
||||
const dist = (a: Vec2, b: Vec2): number => Math.hypot(b.x - a.x, b.y - a.y);
|
||||
|
||||
interface HoleIdle extends CommandState {
|
||||
phase: "start";
|
||||
}
|
||||
interface HoleDrawing extends CommandState {
|
||||
phase: "next";
|
||||
points: Vec2[];
|
||||
cursor: Vec2 | null;
|
||||
}
|
||||
type HoleState = HoleIdle | HoleDrawing;
|
||||
|
||||
const CLOSE: CmdOption = { id: "close", labelKey: "cmd.polyline.close" };
|
||||
const UNDO: CmdOption = { id: "undo", labelKey: "cmd.polyline.undo" };
|
||||
|
||||
/** Vorschau: Kontur (ab 3 Punkten geschlossen) + Gummiband. */
|
||||
function holeDraft(points: Vec2[], cursor: Vec2 | null): ToolDraft {
|
||||
const pts = cursor ? [...points, cursor] : points;
|
||||
const preview: DraftShape[] = [{ kind: "poly", pts, closed: pts.length >= 3 }];
|
||||
const draft: ToolDraft = { preview, vertices: points };
|
||||
const last = points[points.length - 1];
|
||||
if (cursor && last && dist(last, cursor) >= EPS) draft.hud = { at: cursor, text: `${dist(last, cursor).toFixed(2)} m` };
|
||||
return draft;
|
||||
}
|
||||
|
||||
/**
|
||||
* Commit (Kern, `cmd_solid.rs`): Baugrube aus dem Umriss (≥ 3 Punkte wie gezeichnet, 2 Punkte als Rechteck);
|
||||
* entartet → nichts.
|
||||
*/
|
||||
const excavationOps = (points: Vec2[], ctx: CommandContext) => createMutation(ctx, { cmd: "excavation", pts: points });
|
||||
|
||||
const idle = (): [CommandState, CommandResult] => [{ phase: "start", lastPoint: null } as HoleIdle, { draft: null, done: true }];
|
||||
|
||||
const finish = (points: Vec2[], ctx: CommandContext): [CommandState, CommandResult] => [
|
||||
{ phase: "start", lastPoint: null } as HoleIdle,
|
||||
{ draft: null, done: true, commit: excavationOps(points, ctx) },
|
||||
];
|
||||
|
||||
export const excavationCommand: Command = {
|
||||
name: "excavation",
|
||||
labelKey: "cmd.excavation.label",
|
||||
floorOnly: true,
|
||||
prompt: (s) => ((s as HoleState).phase === "next" ? "cmd.excavation.next" : "cmd.excavation.start"),
|
||||
accepts: (s) => ((s as HoleState).phase === "next" ? ["point", "option"] : ["point"]),
|
||||
options: (s) => {
|
||||
const ps = s as HoleState;
|
||||
if (ps.phase !== "next") return [];
|
||||
return ps.points.length >= 3 ? [CLOSE, UNDO] : [UNDO];
|
||||
},
|
||||
init: (): HoleIdle => ({ phase: "start", lastPoint: null }),
|
||||
|
||||
onInput: (state, input, ctx): [CommandState, CommandResult] => {
|
||||
const s = state as HoleState;
|
||||
if (input.kind === "option") {
|
||||
if (s.phase !== "next") return [s, { draft: null }];
|
||||
if (input.id === "undo") {
|
||||
const pts = s.points.slice(0, -1);
|
||||
if (pts.length === 0) return [{ phase: "start", lastPoint: null } as HoleIdle, { draft: null }];
|
||||
const ns: HoleDrawing = { phase: "next", points: pts, cursor: s.cursor, lastPoint: pts[pts.length - 1] };
|
||||
return [ns, { draft: holeDraft(pts, s.cursor) }];
|
||||
}
|
||||
if (input.id === "close" && s.points.length >= 3) return finish(s.points, ctx);
|
||||
return [s, { draft: holeDraft(s.points, s.cursor) }];
|
||||
}
|
||||
if (input.kind !== "point") return [s, { draft: s.phase === "next" ? holeDraft(s.points, s.cursor) : null }];
|
||||
const pt = input.point;
|
||||
if (s.phase !== "next") {
|
||||
const ns: HoleDrawing = { phase: "next", points: [pt], cursor: pt, lastPoint: pt };
|
||||
return [ns, { draft: holeDraft([pt], pt) }];
|
||||
}
|
||||
// Klick nahe Startpunkt schliesst den Umriss.
|
||||
if (s.points.length >= 3 && dist(s.points[0], pt) < CLOSE_HIT) return finish(s.points, ctx);
|
||||
// Null-Strecke ignorieren.
|
||||
if (dist(s.points[s.points.length - 1], pt) < EPS) return [s, { draft: holeDraft(s.points, s.cursor) }];
|
||||
const points = [...s.points, pt];
|
||||
const ns: HoleDrawing = { phase: "next", points, cursor: pt, lastPoint: pt };
|
||||
return [ns, { draft: holeDraft(points, pt) }];
|
||||
},
|
||||
|
||||
onMove: (state, point): [CommandState, CommandResult] => {
|
||||
const s = state as HoleState;
|
||||
if (s.phase !== "next") return [s, { draft: null }];
|
||||
const ns: HoleDrawing = { ...s, cursor: point };
|
||||
return [ns, { draft: holeDraft(s.points, point) }];
|
||||
},
|
||||
|
||||
// Enter/Rechtsklick: ≥ 3 Punkte Polygon, 2 Punkte Rechteck.
|
||||
onConfirm: (state, ctx): [CommandState, CommandResult] => {
|
||||
const s = state as HoleState;
|
||||
if (s.phase === "next" && s.points.length >= 2) return finish(s.points, ctx);
|
||||
return idle();
|
||||
},
|
||||
onCancel: (): [CommandState, CommandResult] => idle(),
|
||||
};
|
||||
@@ -32,25 +32,25 @@ let lastTaper = 0;
|
||||
// ── Profil (Kern, `cmd_create.rs`): geschlossene polyline/rect/circle → Punktliste ─
|
||||
|
||||
/** Profil eines extrudierbaren 2D-Elements (Kreis: 48-Eck + Mittelpunkt/Radius). */
|
||||
interface Profile {
|
||||
export interface Profile {
|
||||
pts: Vec2[];
|
||||
circle?: { center: Vec2; r: number };
|
||||
}
|
||||
|
||||
type ProfileHit = { id: string } & Profile;
|
||||
export type ProfileHit = { id: string } & Profile;
|
||||
|
||||
function profileQuery(project: Project, req: { q: string } & Record<string, unknown>): ProfileHit | null {
|
||||
return createQuery<{ hit: (ProfileHit & { circle: Profile["circle"] | null }) | null }>(project, req).hit ?? null;
|
||||
}
|
||||
|
||||
/** Genau EIN geeignetes Profil vorgewählt (sonst null). */
|
||||
function singleSelectedProfile(project: Project, sel: CommandSelection): ProfileHit | null {
|
||||
export function singleSelectedProfile(project: Project, sel: CommandSelection): ProfileHit | null {
|
||||
if (!sel.drawingId || sel.wallIds.length > 0) return null;
|
||||
return profileQuery(project, { q: "profile", id: sel.drawingId });
|
||||
}
|
||||
|
||||
/** Nächstes Profil der Ebene am Klickpunkt (Kanten-Abstand < 0.25 m). */
|
||||
const pickProfileAt = (project: Project, levelId: string, pt: Vec2): ProfileHit | null =>
|
||||
export const pickProfileAt = (project: Project, levelId: string, pt: Vec2): ProfileHit | null =>
|
||||
profileQuery(project, { q: "pickProfile", level: levelId, pt: xy(pt) });
|
||||
|
||||
/** Commit (Kern): Quelle entfernen, Körper (Punkte + Höhe + Verjüngung) anlegen. */
|
||||
|
||||
@@ -0,0 +1,110 @@
|
||||
/**
|
||||
* `gridCommand` ([112]) und die Rundmass-Befehle ([38]): Eingabe → Zeichnung im Kern. Die Nachführung der
|
||||
* Bezüge im Store prüft `src/state/gridAssoc.test.ts`.
|
||||
*/
|
||||
|
||||
import { describe, it, expect } from "vitest";
|
||||
import { gridCommand } from "./grid";
|
||||
import { arcDimCommand, diameterDimCommand, radiusDimCommand } from "./dimround";
|
||||
import type { CommandContext, Project } from "../types";
|
||||
import type { Drawing2D } from "../../model/types";
|
||||
|
||||
function project(extra: Drawing2D[] = []): Project {
|
||||
return {
|
||||
id: "t",
|
||||
name: "T",
|
||||
lineStyles: [],
|
||||
hatches: [],
|
||||
components: [],
|
||||
wallTypes: [],
|
||||
drawingLevels: [{ id: "eg", name: "EG", kind: "floor", visible: true, locked: false, floorHeight: 2.6, cutHeight: 1.0, baseElevation: 0 }],
|
||||
layers: [{ code: "20", name: "Zeichnung", color: "#0a0a0a", lw: 0.5, visible: true, locked: false }],
|
||||
walls: [],
|
||||
openings: [],
|
||||
ceilings: [],
|
||||
stairs: [],
|
||||
rooms: [],
|
||||
drawings2d: extra,
|
||||
context: [],
|
||||
};
|
||||
}
|
||||
|
||||
function ctxOf(p: Project): CommandContext {
|
||||
return { project: p, level: p.drawingLevels[0], defaultCategoryCode: "20", activeLineStyleId: "solid", activeWallTypeId: "aw", lastPoint: null, selection: { wallIds: [], drawingId: null } };
|
||||
}
|
||||
|
||||
describe("gridCommand", () => {
|
||||
it("Ursprung + Feldweiten → Achsraster mit Beschriftung 1, 2, 3 / A, B", () => {
|
||||
const p = project();
|
||||
const ctx = ctxOf(p);
|
||||
let [s] = gridCommand.onInput(gridCommand.init(), { kind: "point", point: { x: 2, y: 1 } }, ctx);
|
||||
[s] = gridCommand.onInput(s, { kind: "text", text: "6 4.5 3x5" }, ctx);
|
||||
const [, r] = gridCommand.onInput(s, { kind: "text", text: "5 5" }, ctx);
|
||||
expect(r.done).toBe(true);
|
||||
const g = r.commit!(p).drawings2d[0].geom;
|
||||
expect(g.shape).toBe("grid");
|
||||
if (g.shape !== "grid") return;
|
||||
expect(g.origin).toEqual({ x: 2, y: 1 });
|
||||
expect(g.a.map((x) => [x.label, x.pos])).toEqual([["1", 0], ["2", 6], ["3", 10.5], ["4", 15.5], ["5", 20.5], ["6", 25.5]]);
|
||||
expect(g.b.map((x) => [x.label, x.pos])).toEqual([["A", 0], ["B", 5], ["C", 10]]);
|
||||
});
|
||||
|
||||
it("radial: Option umschalten, Strahlen und Ringe; Enter übernimmt die Vorgaben", () => {
|
||||
const p = project();
|
||||
const ctx = ctxOf(p);
|
||||
let [s] = gridCommand.onInput(gridCommand.init(), { kind: "option", id: "radial" }, ctx);
|
||||
[s] = gridCommand.onInput(s, { kind: "point", point: { x: 0, y: 0 } }, ctx);
|
||||
[s] = gridCommand.onInput(s, { kind: "text", text: "2x45" }, ctx);
|
||||
const [, r] = gridCommand.onInput(s, { kind: "text", text: "3 3" }, ctx);
|
||||
const g = r.commit!(p).drawings2d[0].geom;
|
||||
expect(g.shape === "grid" && g.radial).toBe(true);
|
||||
if (g.shape === "grid") {
|
||||
expect(g.a.map((x) => x.pos)).toEqual([0, 45, 90]);
|
||||
expect(g.b.map((x) => x.pos)).toEqual([3, 6]);
|
||||
}
|
||||
// Vorgaben (Enter, Enter) im rechtwinkligen Raster: 6 6 6 / 6 6.
|
||||
let [t] = gridCommand.onInput(gridCommand.init(), { kind: "point", point: { x: 0, y: 0 } }, ctx);
|
||||
[t] = gridCommand.onConfirm(t, ctx);
|
||||
const [, e] = gridCommand.onConfirm(t, ctx);
|
||||
const d = e.commit!(p).drawings2d[0].geom;
|
||||
expect(d.shape === "grid" && [d.a.length, d.b.length]).toEqual([4, 3]);
|
||||
});
|
||||
|
||||
it("unlesbare Feldweiten legen nichts an; Vorschau am Cursor liefert Achsen", () => {
|
||||
const p = project();
|
||||
const ctx = ctxOf(p);
|
||||
let [s] = gridCommand.onInput(gridCommand.init(), { kind: "point", point: { x: 0, y: 0 } }, ctx);
|
||||
[s] = gridCommand.onInput(s, { kind: "text", text: "abc" }, ctx);
|
||||
const [, r] = gridCommand.onInput(s, { kind: "text", text: "5" }, ctx);
|
||||
expect(r.commit!(p).drawings2d.length).toBe(0);
|
||||
const [, mv] = gridCommand.onMove(gridCommand.init(), { x: 1, y: 1 }, null, ctx);
|
||||
expect(mv.draft?.preview.length).toBeGreaterThan(0);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Rundmass-Befehle", () => {
|
||||
const circle = { id: "K", type: "drawing2d", levelId: "eg", categoryCode: "20", geom: { shape: "circle", center: { x: 5, y: 5 }, r: 2 } } as Drawing2D;
|
||||
|
||||
it("Radius/Durchmesser: ein Klick auf den Rand → Mass mit Bezug", () => {
|
||||
for (const [cmd, kind] of [[radiusDimCommand, "radius"], [diameterDimCommand, "diameter"]] as const) {
|
||||
const p = project([circle]);
|
||||
const [, r] = cmd.onInput(cmd.init(), { kind: "point", point: { x: 7, y: 5.02 } }, ctxOf(p));
|
||||
const g = r.commit!(p).drawings2d[1].geom;
|
||||
expect(g.shape === "dimension" && g.kind).toBe(kind);
|
||||
expect(g.shape === "dimension" && g.refs?.map((x) => x?.feature)).toEqual(["center", "rim"]);
|
||||
}
|
||||
});
|
||||
|
||||
it("Bogenlänge: Anfang, Ende, Lage → drei Punkte; Klick ins Leere legt nichts an", () => {
|
||||
const p = project([circle]);
|
||||
const ctx = ctxOf(p);
|
||||
let [s] = arcDimCommand.onInput(arcDimCommand.init(), { kind: "point", point: { x: 7, y: 5 } }, ctx);
|
||||
[s] = arcDimCommand.onInput(s, { kind: "point", point: { x: 5, y: 7 } }, ctx);
|
||||
const [, r] = arcDimCommand.onInput(s, { kind: "point", point: { x: 5, y: 8 } }, ctx);
|
||||
const dim = r.commit!(p).drawings2d[1];
|
||||
expect(dim.geom.shape === "dimension" && dim.geom.pts.length).toBe(3);
|
||||
expect(dim.geom.shape === "dimension" && dim.geom.offset).toBeCloseTo(1, 6);
|
||||
const [, none] = radiusDimCommand.onInput(radiusDimCommand.init(), { kind: "point", point: { x: 50, y: 50 } }, ctx);
|
||||
expect(none.commit!(p).drawings2d.length).toBe(1);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,95 @@
|
||||
// Achsraster ([112]): Ursprung klicken, dann die Feldweiten als Text (`6 4.5 3x5`: Zahlen, `N x W` =
|
||||
// N Felder zu W). Rechtwinklig: erst die Richtung 1, 2, 3 …, dann A, B, C …; radial: Strahlwinkel in
|
||||
// Grad und Ringabstände. Das Raster ist eine 2D-Zeichnung (Kern, `grid.rs`): Achsen mit Blasen in
|
||||
// allen Plänen, Schnitten und Ansichten, Fang auf Achsen und Schnittpunkte, Griffe je Achse.
|
||||
|
||||
import type { Command, CommandContext, CommandResult, CommandState, CmdOption, ToolDraft, Vec2 } from "../types";
|
||||
import { createMutation, createPreview, xy } from "../createCore";
|
||||
|
||||
type Phase = "origin" | "xs" | "ys";
|
||||
|
||||
interface GridState extends CommandState {
|
||||
phase: Phase;
|
||||
origin: Vec2 | null;
|
||||
radial: boolean;
|
||||
xs: string;
|
||||
ys: string;
|
||||
}
|
||||
|
||||
const DEFAULTS = {
|
||||
ortho: { xs: "6 6 6", ys: "6 6" },
|
||||
radial: { xs: "4x45", ys: "3 3 3" },
|
||||
};
|
||||
|
||||
const RADIAL: CmdOption = { id: "radial", labelKey: "cmd.grid.radial" };
|
||||
|
||||
const start = (radial = false): GridState => ({
|
||||
phase: "origin",
|
||||
lastPoint: null,
|
||||
origin: null,
|
||||
radial,
|
||||
xs: radial ? DEFAULTS.radial.xs : DEFAULTS.ortho.xs,
|
||||
ys: radial ? DEFAULTS.radial.ys : DEFAULTS.ortho.ys,
|
||||
});
|
||||
|
||||
const idle = (): [CommandState, CommandResult] => [start(), { draft: null, done: true }];
|
||||
|
||||
/** Vorschau (Kern): die Achsen des Rasters am Cursor. */
|
||||
function draft(ctx: CommandContext, s: GridState, at: Vec2): ToolDraft {
|
||||
const pv = createPreview(ctx, { cmd: "grid", xs: s.xs, ys: s.ys, radial: s.radial, angle: 0 }, [at]);
|
||||
return { preview: pv.shapes, vertices: [at] };
|
||||
}
|
||||
|
||||
const commit = (ctx: CommandContext, s: GridState, ys: string) =>
|
||||
createMutation(ctx, { cmd: "grid", at: xy(s.origin as Vec2), xs: s.xs, ys, radial: s.radial, angle: 0 });
|
||||
|
||||
export const gridCommand: Command = {
|
||||
name: "grid",
|
||||
labelKey: "cmd.grid.label",
|
||||
prompt: (state) => {
|
||||
const s = state as GridState;
|
||||
if (s.phase === "origin") return "cmd.grid.origin";
|
||||
if (s.phase === "xs") return s.radial ? "cmd.grid.xsRadial" : "cmd.grid.xs";
|
||||
return s.radial ? "cmd.grid.ysRadial" : "cmd.grid.ys";
|
||||
},
|
||||
accepts: (state) => ((state as GridState).phase === "origin" ? ["point", "option"] : ["text"]),
|
||||
options: (state): CmdOption[] => ((state as GridState).phase === "origin" ? [{ ...RADIAL, value: (state as GridState).radial ? "ja" : "nein" }] : []),
|
||||
floorOnly: false,
|
||||
init: () => start(),
|
||||
|
||||
onInput: (state, input, ctx): [CommandState, CommandResult] => {
|
||||
const s = state as GridState;
|
||||
if (s.phase === "origin") {
|
||||
if (input.kind === "option" && input.id === "radial") return [start(!s.radial), { draft: null }];
|
||||
if (input.kind !== "point") return [s, { draft: null }];
|
||||
const ns: GridState = { ...s, phase: "xs", origin: input.point, lastPoint: input.point };
|
||||
return [ns, { draft: draft(ctx, ns, input.point) }];
|
||||
}
|
||||
if (input.kind !== "text") return [s, { draft: null }];
|
||||
const text = input.text.trim();
|
||||
if (s.phase === "xs") {
|
||||
const ns: GridState = { ...s, phase: "ys", xs: text === "" ? s.xs : text };
|
||||
return [ns, { draft: s.origin ? draft(ctx, ns, s.origin) : null }];
|
||||
}
|
||||
const ys = text === "" && !s.radial ? s.ys : text;
|
||||
return [start(), { draft: null, done: true, commit: commit(ctx, s, ys) }];
|
||||
},
|
||||
|
||||
onMove: (state, point, _snap, ctx): [CommandState, CommandResult] => {
|
||||
const s = state as GridState;
|
||||
if (s.phase !== "origin") return [s, { draft: s.origin ? draft(ctx, s, s.origin) : null }];
|
||||
return [s, { draft: draft(ctx, s, point) }];
|
||||
},
|
||||
|
||||
// Enter: Vorgabe-Feldweiten übernehmen.
|
||||
onConfirm: (state, ctx): [CommandState, CommandResult] => {
|
||||
const s = state as GridState;
|
||||
if (s.phase === "origin") return idle();
|
||||
if (s.phase === "xs") {
|
||||
const ns: GridState = { ...s, phase: "ys" };
|
||||
return [ns, { draft: s.origin ? draft(ctx, ns, s.origin) : null }];
|
||||
}
|
||||
return [start(), { draft: null, done: true, commit: commit(ctx, s, s.ys) }];
|
||||
},
|
||||
onCancel: () => idle(),
|
||||
};
|
||||
@@ -0,0 +1,71 @@
|
||||
// Loft ([T7]): ≥ 2 geschlossene Plan-Profile nacheinander anklicken (erstes = unten), Enter, dann die
|
||||
// Gesamthöhe. Die Profile werden gleichmässig über die Höhe verteilt (Kern `cmd_solid.rs`: gleiche
|
||||
// Punktzahl durch Kantenteilung, Drehsinn angeglichen) und zu einem truck-`loft`-B-Rep-Körper
|
||||
// (`ExtrudedSolid.brep`) verbunden; die Quellprofile entfallen wie beim Extrudieren.
|
||||
|
||||
import type { Command, CommandContext, CommandResult, CommandState, Vec2 } from "../types";
|
||||
import { createMutation } from "../createCore";
|
||||
import { pickProfileAt, type ProfileHit } from "./extrude";
|
||||
|
||||
let lastHeight = 3;
|
||||
|
||||
interface LoftState extends CommandState {
|
||||
phase: "pick" | "height" | "done";
|
||||
picks: ProfileHit[];
|
||||
}
|
||||
|
||||
const draft = (s: LoftState, cursor: Vec2 | null): CommandResult["draft"] => ({
|
||||
preview: s.picks.map((p) => ({ kind: "poly" as const, pts: p.pts, closed: true })),
|
||||
vertices: [],
|
||||
hud: cursor ? { at: cursor, text: s.phase === "height" ? `${lastHeight.toFixed(2)} m` : `${s.picks.length}` } : undefined,
|
||||
});
|
||||
|
||||
const finished = (): LoftState => ({ phase: "done", picks: [], lastPoint: null });
|
||||
const done = (): [CommandState, CommandResult] => [finished(), { draft: null, done: true }];
|
||||
|
||||
function commit(s: LoftState, height: number, ctx: CommandContext): [CommandState, CommandResult] {
|
||||
lastHeight = height;
|
||||
return [
|
||||
finished(),
|
||||
{ draft: null, done: true, commit: createMutation(ctx, { cmd: "loft", sources: s.picks.map((p) => p.id), height }) },
|
||||
];
|
||||
}
|
||||
|
||||
export const loftCommand: Command = {
|
||||
name: "loft",
|
||||
labelKey: "cmd.loft.label",
|
||||
prompt: (st) => ((st as LoftState).phase === "height" ? "cmd.loft.height" : (st as LoftState).picks.length < 2 ? "cmd.loft.pick" : "cmd.loft.pickMore"),
|
||||
accepts: (st) => ((st as LoftState).phase === "height" ? ["number"] : ["point"]),
|
||||
options: () => [],
|
||||
floorOnly: true,
|
||||
|
||||
init: (): LoftState => ({ phase: "pick", picks: [], lastPoint: null }),
|
||||
|
||||
onInput: (state, input, ctx): [CommandState, CommandResult] => {
|
||||
const s = state as LoftState;
|
||||
if (s.phase === "done") return done();
|
||||
if (s.phase === "pick") {
|
||||
if (input.kind !== "point") return [s, { draft: draft(s, null) }];
|
||||
const hit = pickProfileAt(ctx.project, ctx.level.id, input.point);
|
||||
if (!hit || s.picks.some((p) => p.id === hit.id)) return [s, { draft: draft(s, null) }];
|
||||
const ns: LoftState = { ...s, picks: [...s.picks, hit] };
|
||||
return [ns, { draft: draft(ns, input.point) }];
|
||||
}
|
||||
if (input.kind !== "number" || !(input.value > 0)) return [s, { draft: draft(s, null) }];
|
||||
return commit(s, input.value, ctx);
|
||||
},
|
||||
|
||||
onMove: (state, point): [CommandState, CommandResult] => [state, { draft: draft(state as LoftState, point) }],
|
||||
|
||||
// Enter: mit ≥ 2 Profilen zur Höhe; bei der Höhe die zuletzt benutzte übernehmen.
|
||||
onConfirm: (state, ctx): [CommandState, CommandResult] => {
|
||||
const s = state as LoftState;
|
||||
if (s.phase === "pick") {
|
||||
if (s.picks.length < 2) return [s, { draft: draft(s, null) }];
|
||||
const ns: LoftState = { ...s, phase: "height" };
|
||||
return [ns, { draft: draft(ns, null) }];
|
||||
}
|
||||
return s.phase === "height" ? commit(s, lastHeight, ctx) : done();
|
||||
},
|
||||
onCancel: () => done(),
|
||||
};
|
||||
@@ -0,0 +1,98 @@
|
||||
// Rotationskörper ([T7]): geschlossenes Plan-Profil + Drehachse (2 Punkte im Plan) + Winkel → truck-
|
||||
// `revolve` als B-Rep-Körper (`ExtrudedSolid.brep`, Kern `cmd_solid.rs`). Das Profil muss ganz auf einer
|
||||
// Seite der Achse liegen; die Achse liegt waagrecht auf Höhe des grössten Profilabstands, ein voller
|
||||
// Körper steht also auf der Geschoss-UK. Die Quelle (Profil) wird ersetzt wie beim Extrudieren.
|
||||
//
|
||||
// Schritte: Profil wählen (oder vorselektiert) → Achse Anfang → Achse Ende → Winkel (Zahl oder Enter = zuletzt, 360).
|
||||
|
||||
import type { Command, CommandContext, CommandResult, CommandState, Vec2 } from "../types";
|
||||
import { createMutation } from "../createCore";
|
||||
import { pickProfileAt, singleSelectedProfile, type Profile } from "./extrude";
|
||||
|
||||
let lastAngle = 360;
|
||||
|
||||
interface RevState extends CommandState {
|
||||
phase: "pick" | "axisA" | "axisB" | "angle" | "done";
|
||||
profile: Profile | null;
|
||||
sourceId: string | null;
|
||||
a: Vec2 | null;
|
||||
b: Vec2 | null;
|
||||
cursor: Vec2 | null;
|
||||
}
|
||||
|
||||
const draft = (s: RevState, cursor: Vec2 | null): CommandResult["draft"] => {
|
||||
const preview: NonNullable<CommandResult["draft"]>["preview"] = [];
|
||||
if (s.profile) preview.push({ kind: "poly", pts: s.profile.pts, closed: true });
|
||||
const end = s.b ?? cursor;
|
||||
if (s.a && end) preview.push({ kind: "line", a: s.a, b: end });
|
||||
return { preview, vertices: s.a ? [s.a] : [], hud: cursor && s.phase === "angle" ? { at: cursor, text: `${lastAngle}°` } : undefined };
|
||||
};
|
||||
|
||||
const finished = (): RevState => ({ phase: "done", profile: null, sourceId: null, a: null, b: null, cursor: null, lastPoint: null });
|
||||
|
||||
const done = (): [CommandState, CommandResult] => [finished(), { draft: null, done: true }];
|
||||
|
||||
function commit(s: RevState, angle: number, ctx: CommandContext): [CommandState, CommandResult] {
|
||||
lastAngle = angle;
|
||||
return [
|
||||
finished(),
|
||||
{ draft: null, done: true, commit: createMutation(ctx, { cmd: "revolve", source: s.sourceId, a: s.a, b: s.b, angle }) },
|
||||
];
|
||||
}
|
||||
|
||||
export const revolveCommand: Command = {
|
||||
name: "revolve",
|
||||
labelKey: "cmd.revolve.label",
|
||||
prompt: (st) => {
|
||||
const p = (st as RevState).phase;
|
||||
return p === "axisA" ? "cmd.revolve.axisA" : p === "axisB" ? "cmd.revolve.axisB" : p === "angle" ? "cmd.revolve.angle" : "cmd.revolve.pick";
|
||||
},
|
||||
accepts: (st) => ((st as RevState).phase === "angle" ? ["number"] : ["point"]),
|
||||
options: () => [],
|
||||
floorOnly: true,
|
||||
|
||||
init: (): RevState => ({ phase: "pick", profile: null, sourceId: null, a: null, b: null, cursor: null, lastPoint: null }),
|
||||
|
||||
onInput: (state, input, ctx): [CommandState, CommandResult] => {
|
||||
let s = state as RevState;
|
||||
if (s.phase === "done") return done();
|
||||
if (s.phase === "pick") {
|
||||
if (input.kind !== "point") return [s, { draft: null }];
|
||||
// Vorselektiertes Profil: der erste Punkt ist gleich der Achsenanfang.
|
||||
const pre = singleSelectedProfile(ctx.project, ctx.selection);
|
||||
if (pre) {
|
||||
s = { ...s, phase: "axisA", profile: pre, sourceId: pre.id };
|
||||
} else {
|
||||
const hit = pickProfileAt(ctx.project, ctx.level.id, input.point);
|
||||
if (!hit) return [s, { draft: null }];
|
||||
const ns: RevState = { ...s, phase: "axisA", profile: hit, sourceId: hit.id };
|
||||
return [ns, { draft: draft(ns, null) }];
|
||||
}
|
||||
}
|
||||
if (s.phase === "axisA") {
|
||||
if (input.kind !== "point") return [s, { draft: draft(s, s.cursor) }];
|
||||
const ns: RevState = { ...s, phase: "axisB", a: input.point, lastPoint: input.point };
|
||||
return [ns, { draft: draft(ns, input.point) }];
|
||||
}
|
||||
if (s.phase === "axisB") {
|
||||
if (input.kind !== "point" || !s.a || Math.hypot(input.point.x - s.a.x, input.point.y - s.a.y) < 1e-6) return [s, { draft: draft(s, s.cursor) }];
|
||||
const ns: RevState = { ...s, phase: "angle", b: input.point, lastPoint: input.point };
|
||||
return [ns, { draft: draft(ns, input.point) }];
|
||||
}
|
||||
// angle
|
||||
if (input.kind !== "number" || !(input.value > 0)) return [s, { draft: draft(s, s.cursor) }];
|
||||
return commit(s, Math.min(360, input.value), ctx);
|
||||
},
|
||||
|
||||
onMove: (state, point): [CommandState, CommandResult] => {
|
||||
const s = { ...(state as RevState), cursor: point };
|
||||
return [s, { draft: draft(s, point) }];
|
||||
},
|
||||
|
||||
// Enter beim Winkel: zuletzt benutzten Winkel übernehmen.
|
||||
onConfirm: (state, ctx): [CommandState, CommandResult] => {
|
||||
const s = state as RevState;
|
||||
return s.phase === "angle" ? commit(s, lastAngle, ctx) : done();
|
||||
},
|
||||
onCancel: () => done(),
|
||||
};
|
||||
@@ -0,0 +1,102 @@
|
||||
/**
|
||||
* [T7] `revolveCommand` (Profil + Achse + Winkel) und `loftCommand` (≥ 2 Profile + Höhe): beide legen
|
||||
* einen B-Rep-Körper (`ExtrudedSolid.brep`) an und entfernen die Quellprofile.
|
||||
*/
|
||||
|
||||
import { describe, it, expect } from "vitest";
|
||||
import { revolveCommand } from "./revolve";
|
||||
import { loftCommand } from "./loft";
|
||||
import type { CommandContext, CmdInput, Project } from "../types";
|
||||
|
||||
const rect = (id: string, x: number, y: number, w: number, h: number) => ({
|
||||
id,
|
||||
type: "drawing2d" as const,
|
||||
levelId: "eg",
|
||||
categoryCode: "20",
|
||||
geom: { shape: "rect" as const, min: { x, y }, max: { x: x + w, y: y + h } },
|
||||
});
|
||||
|
||||
function project(): Project {
|
||||
return {
|
||||
id: "t",
|
||||
name: "T",
|
||||
lineStyles: [],
|
||||
hatches: [],
|
||||
components: [],
|
||||
wallTypes: [],
|
||||
drawingLevels: [{ id: "eg", name: "EG", kind: "floor", visible: true, locked: false, floorHeight: 2.6, cutHeight: 1.0, baseElevation: 0 }],
|
||||
layers: [{ code: "20", name: "Zeichnung", color: "#0a0a0a", lw: 0.5, visible: true, locked: false }],
|
||||
walls: [],
|
||||
openings: [],
|
||||
ceilings: [],
|
||||
stairs: [],
|
||||
rooms: [],
|
||||
drawings2d: [rect("A", 0, 1, 2, 1), rect("B", 10, 0, 1, 1)],
|
||||
extrudedSolids: [],
|
||||
context: [],
|
||||
} as unknown as Project;
|
||||
}
|
||||
|
||||
function makeCtx(p: Project, drawingId: string | null = null): CommandContext {
|
||||
return {
|
||||
project: p,
|
||||
level: p.drawingLevels[0],
|
||||
defaultCategoryCode: "20",
|
||||
activeLineStyleId: "solid",
|
||||
activeWallTypeId: "aw",
|
||||
lastPoint: null,
|
||||
selection: { wallIds: [], drawingId },
|
||||
} as CommandContext;
|
||||
}
|
||||
|
||||
/** Spielt Eingaben ab; liefert das Projekt nach dem Commit (oder null). */
|
||||
function run(cmd: typeof revolveCommand, p: Project, inputs: Array<CmdInput | "confirm">, selected: string | null = null) {
|
||||
const ctx = makeCtx(p, selected);
|
||||
let state = cmd.init();
|
||||
let commit: ((p: Project) => Project) | undefined;
|
||||
for (const i of inputs) {
|
||||
const [ns, res] = i === "confirm" ? cmd.onConfirm(state, ctx) : cmd.onInput(state, i, ctx);
|
||||
state = ns;
|
||||
if (res.commit) commit = res.commit as typeof commit;
|
||||
}
|
||||
return commit ? commit(p) : null;
|
||||
}
|
||||
|
||||
const pt = (x: number, y: number): CmdInput => ({ kind: "point", point: { x, y } });
|
||||
|
||||
describe("revolveCommand", () => {
|
||||
it("Profil wählen, Achse (2 Punkte), Winkel → Rotationskörper, Quelle entfernt", () => {
|
||||
const next = run(revolveCommand, project(), [pt(1, 1), pt(-1, 0), pt(5, 0), { kind: "number", value: 180 }])!;
|
||||
expect(next.drawings2d.map((d) => d.id)).toEqual(["B"]);
|
||||
const s = next.extrudedSolids![0];
|
||||
expect(s.brep!.spec).toMatchObject({ kind: "transform", solid: { kind: "revolve", angleDeg: 180 } });
|
||||
expect(s.height).toBeCloseTo(4, 9); // Profil 1 … 2 m neben der Achse y=0 → r_max = 2
|
||||
});
|
||||
|
||||
it("Enter beim Winkel übernimmt den zuletzt benutzten; vorgewähltes Profil überspringt die Wahl", () => {
|
||||
run(revolveCommand, project(), [pt(1, 1), pt(-1, 0), pt(5, 0), { kind: "number", value: 90 }]);
|
||||
const next = run(revolveCommand, project(), [pt(-1, 0), pt(5, 0), "confirm"], "A")!;
|
||||
expect(next.extrudedSolids![0].brep!.spec).toMatchObject({ solid: { angleDeg: 90 } });
|
||||
});
|
||||
|
||||
it("Profil, das die Achse überquert, ergibt keinen Körper", () => {
|
||||
const next = run(revolveCommand, project(), [pt(1, 1), pt(-1, 1.5), pt(5, 1.5), "confirm"]);
|
||||
expect(next?.extrudedSolids ?? []).toHaveLength(0);
|
||||
});
|
||||
});
|
||||
|
||||
describe("loftCommand", () => {
|
||||
it("zwei Profile wählen, Enter, Höhe → Loft-Körper, Quellen entfernt", () => {
|
||||
const next = run(loftCommand, project(), [pt(1, 1), pt(10.5, 0), "confirm", { kind: "number", value: 3 }])!;
|
||||
expect(next.drawings2d).toHaveLength(0);
|
||||
const s = next.extrudedSolids![0];
|
||||
expect(s.height).toBe(3);
|
||||
expect(s.brep!.spec).toMatchObject({ kind: "loft" });
|
||||
expect((s.brep!.spec as { sections: unknown[] }).sections).toHaveLength(2);
|
||||
});
|
||||
|
||||
it("mit nur einem Profil bleibt Enter wirkungslos", () => {
|
||||
const next = run(loftCommand, project(), [pt(1, 1), "confirm", { kind: "number", value: 3 }]);
|
||||
expect(next?.extrudedSolids ?? []).toHaveLength(0);
|
||||
});
|
||||
});
|
||||
@@ -47,12 +47,16 @@ import { scaleCommand } from "./cmds/scale";
|
||||
import { explodeCommand } from "./cmds/explode";
|
||||
import { dimdetachCommand } from "./cmds/dimdetach";
|
||||
import { autodimCommand } from "./cmds/autodim";
|
||||
import { gridCommand } from "./cmds/grid";
|
||||
import { arcDimCommand, diameterDimCommand, radiusDimCommand } from "./cmds/dimround";
|
||||
import { alignCommand } from "./cmds/align";
|
||||
import { joinCommand } from "./cmds/join";
|
||||
import { copyCommand } from "./cmds/copy";
|
||||
import { arrayCommand } from "./cmds/array";
|
||||
import { offsetCommand } from "./cmds/offset";
|
||||
import { extrudeCommand } from "./cmds/extrude";
|
||||
import { revolveCommand } from "./cmds/revolve";
|
||||
import { loftCommand } from "./cmds/loft";
|
||||
import { trimCommand } from "./cmds/trim";
|
||||
import { breakCommand } from "./cmds/break";
|
||||
import { extendCommand } from "./cmds/extend";
|
||||
@@ -61,6 +65,7 @@ import { chamferCommand } from "./cmds/chamfer";
|
||||
import { multilineCommand } from "./cmds/multiline";
|
||||
import { importCommand } from "./cmds/import";
|
||||
import { terrainCommand } from "./cmds/terrain";
|
||||
import { excavationCommand } from "./cmds/excavation";
|
||||
import { measureCommand } from "./cmds/measure";
|
||||
import { sectionLineCommand, viewLineCommand } from "./cmds/sectionline";
|
||||
import { georefCommand } from "./cmds/georef";
|
||||
@@ -114,12 +119,18 @@ export const COMMANDS: Record<string, Command> = {
|
||||
explode: explodeCommand,
|
||||
dimdetach: dimdetachCommand,
|
||||
autodim: autodimCommand,
|
||||
grid: gridCommand,
|
||||
dimradius: radiusDimCommand,
|
||||
dimdiameter: diameterDimCommand,
|
||||
dimarc: arcDimCommand,
|
||||
align: alignCommand,
|
||||
join: joinCommand,
|
||||
copy: copyCommand,
|
||||
array: arrayCommand,
|
||||
offset: offsetCommand,
|
||||
extrude: extrudeCommand,
|
||||
revolve: revolveCommand,
|
||||
loft: loftCommand,
|
||||
trim: trimCommand,
|
||||
break: breakCommand,
|
||||
extend: extendCommand,
|
||||
@@ -128,6 +139,7 @@ export const COMMANDS: Record<string, Command> = {
|
||||
multiline: multilineCommand,
|
||||
import: importCommand,
|
||||
terrain: terrainCommand,
|
||||
excavation: excavationCommand,
|
||||
measure: measureCommand,
|
||||
sectionline: sectionLineCommand,
|
||||
viewline: viewLineCommand,
|
||||
@@ -234,6 +246,15 @@ export const ALIASES: Record<string, string> = {
|
||||
bml: "dimdetach",
|
||||
bemassungloesen: "dimdetach",
|
||||
ab: "autodim",
|
||||
axes: "grid",
|
||||
achsraster: "grid",
|
||||
achsen: "grid",
|
||||
rad: "dimradius",
|
||||
radiusmass: "dimradius",
|
||||
dm: "dimdiameter",
|
||||
durchmessermass: "dimdiameter",
|
||||
bogenl: "dimarc",
|
||||
bogenlaenge: "dimarc",
|
||||
aussenbemassung: "autodim",
|
||||
al: "align",
|
||||
ausrichten: "align",
|
||||
@@ -244,6 +265,9 @@ export const ALIASES: Record<string, string> = {
|
||||
feld: "array",
|
||||
o: "offset",
|
||||
ex: "extrude",
|
||||
rev: "revolve",
|
||||
rotation: "revolve",
|
||||
lf: "loft",
|
||||
tr: "trim",
|
||||
br: "break",
|
||||
unterbrechen: "break",
|
||||
@@ -258,6 +282,8 @@ export const ALIASES: Record<string, string> = {
|
||||
parallel: "multiline",
|
||||
imp: "import",
|
||||
ter: "terrain",
|
||||
baugrube: "excavation",
|
||||
aushub: "excavation",
|
||||
schnittlinie: "sectionline",
|
||||
ansichtslinie: "viewline",
|
||||
bezugspunkt: "georef",
|
||||
|
||||
@@ -68,6 +68,7 @@ export type QueryName =
|
||||
| "programLayout"
|
||||
| "ivhb"
|
||||
| "siteCheck"
|
||||
| "excavationQuantities"
|
||||
| "buildingFootprint"
|
||||
| "modelTop"
|
||||
| "shadows"
|
||||
|
||||
@@ -44,6 +44,7 @@ export type { AreaReport, AreaReportOptions } from "../export/areaReport";
|
||||
export { sunPosition, shadowPolygons, shadowOfPrism, projectLatLon } from "../analysis/sun";
|
||||
export type { SunPosition } from "../analysis/sun";
|
||||
export { checkSiteRules, allowedArea, multiPolygonArea, buildingFootprint, modelTop } from "../analysis/siteRules";
|
||||
export { excavationQuantities, type ExcavationQuantity } from "../analysis/excavation";
|
||||
export type { SiteCheck } from "../analysis/siteRules";
|
||||
export { sampleProject } from "../model/sampleProject";
|
||||
export { parseDxf } from "../io/dxfParser";
|
||||
|
||||
@@ -53,12 +53,12 @@ describe("Tabellen auf dem Blatt ([111])", () => {
|
||||
expect(b.prims.filter((x) => x.k === "text" && x.s === tableLabels(p)["openings.col.mark"]).length).toBe(1);
|
||||
});
|
||||
|
||||
it("alle vier Quellen liefern Primitive; Katalog nennt die Spalten", () => {
|
||||
it("alle Quellen liefern Primitive; Katalog nennt die Spalten", () => {
|
||||
const cat = tableCatalog(sampleProject);
|
||||
expect(Object.keys(cat.sources).sort()).toEqual(["areas", "elements", "openings", "rooms"]);
|
||||
const p = withTables((["openings", "areas", "rooms", "elements"] as const).map((source) => table({ id: source, source })));
|
||||
expect(Object.keys(cat.sources).sort()).toEqual(["areas", "earthworks", "elements", "openings", "rooms"]);
|
||||
const p = withTables((["openings", "areas", "rooms", "elements", "earthworks"] as const).map((source) => table({ id: source, source })));
|
||||
const out = sheetTables(p, "L1");
|
||||
expect(out.map((o) => o.id)).toEqual(["openings", "areas", "rooms", "elements"]);
|
||||
expect(out.map((o) => o.id)).toEqual(["openings", "areas", "rooms", "elements", "earthworks"]);
|
||||
for (const o of out) expect(o.prims.some((x) => x.k === "text")).toBe(true);
|
||||
});
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ interface Catalog {
|
||||
valueKeys: string[];
|
||||
}
|
||||
|
||||
export const TABLE_SOURCES: readonly LayoutTableSource[] = ["openings", "areas", "rooms", "elements"];
|
||||
export const TABLE_SOURCES: readonly LayoutTableSource[] = ["openings", "areas", "rooms", "elements", "earthworks"];
|
||||
|
||||
export function tableSourceLabel(s: LayoutTableSource): string {
|
||||
return t(`sheetTable.source.${s}`);
|
||||
|
||||
@@ -208,6 +208,8 @@ export const de = {
|
||||
"tool.revcloud.hint": "Revisionswolke: Punkte wie Polylinie klicken, Enter beendet offen, Klick nahe Start oder \"Schliessen\" schliesst",
|
||||
"tool.pointmarker": "Punktmarker",
|
||||
"tool.pointmarker.hint": "Punktmarker: Punkt setzen — Kreuz-in-Kreis-Symbol markiert einen Referenzpunkt",
|
||||
"tool.grid": "Achsraster",
|
||||
"tool.grid.hint": "Achsraster: Ursprung setzen, dann Feldweiten eingeben — Achsen mit Blasen in allen Plänen, Schnitten und Ansichten",
|
||||
"tool.wipeout": "Maskenregion",
|
||||
"tool.wipeout.hint": "Maskenregion: Punkte wie Polylinie klicken, Klick nahe Start oder Enter (ab 3 Punkten) schliesst und deckt darunterliegende Zeichnung ab",
|
||||
"tool.text": "Text",
|
||||
@@ -384,6 +386,17 @@ export const de = {
|
||||
"attr.ends.tick": "Schrägstrich",
|
||||
"attr.ends.square": "Quadrat",
|
||||
"attr.dim.section": "Bemassung",
|
||||
"attr.grid.section": "Achsraster",
|
||||
"attr.grid.bubbles": "Achsblasen",
|
||||
"attr.grid.bubbles.both": "Beide Enden",
|
||||
"attr.grid.bubbles.start": "Nur Anfang",
|
||||
"attr.grid.bubbles.end": "Nur Ende",
|
||||
"attr.grid.extend": "Überstand (m)",
|
||||
"attr.grid.bubbleMm": "Blase Ø (mm)",
|
||||
"attr.grid.levels": "Sichtbar in",
|
||||
"attr.grid.show3d": "Im 3D-Modell zeigen",
|
||||
"attr.grid.levels.all": "Allen Geschossen",
|
||||
"attr.grid.levels.here": "Nur diesem Geschoss",
|
||||
"attr.dim.gap": "Abstand Hilfslinie (mm)",
|
||||
"attr.dim.overshoot": "Überstand (mm)",
|
||||
"attr.dim.tick": "Massstrich-Länge (mm)",
|
||||
@@ -525,6 +538,11 @@ export const de = {
|
||||
"objinfo.wall.refLine.right": "Innen (rechts)",
|
||||
"objinfo.wall.refLine.joint": "Fuge",
|
||||
"objinfo.wall.sliceTermination": "An Decke enden",
|
||||
"objinfo.wall.roofAttach": "An Dach anschliessen",
|
||||
"objinfo.wall.roofAttach.auto": "Automatisch",
|
||||
"objinfo.wall.roofAttach.on": "Ja, bis unters Dach",
|
||||
"objinfo.wall.roofAttach.off": "Nein",
|
||||
"objinfo.wall.roofAttach.tip": "Automatisch: Die Wand endet je Schicht an der Dach-Unterkante, wo ihre Krone darüber liegt. Ja: zusätzlich bis unter das Dach verlängert. Nein: Dächer schneiden die Wand nicht.",
|
||||
"objinfo.wall.sliceTermination.both": "Aus",
|
||||
"objinfo.wall.sliceTermination.below": "Unten",
|
||||
"objinfo.wall.sliceTermination.above": "Oben",
|
||||
@@ -797,6 +815,7 @@ export const de = {
|
||||
"objinfo.stair.shape.L": "L-Treppe",
|
||||
"objinfo.stair.shape.spiral": "Wendel",
|
||||
"objinfo.stair.width": "Laufbreite",
|
||||
"objinfo.stair.column": "Mittelsäule (Radius)",
|
||||
"objinfo.stair.steps": "Stufenanzahl",
|
||||
"objinfo.stair.rise": "Steighöhe (gesamt)",
|
||||
"objinfo.stair.riser": "Steigungshöhe",
|
||||
@@ -1615,6 +1634,9 @@ export const de = {
|
||||
"cmd.ceilingOpening.start": "Erste Ecke der Aussparung (in einer Decke):",
|
||||
"cmd.ceilingOpening.corner": "Gegenecke:",
|
||||
"cmd.roofHole.label": "Dachhof",
|
||||
"cmd.excavation.label": "Baugrube",
|
||||
"cmd.excavation.start": "Erster Punkt der Baugrubensohle:",
|
||||
"cmd.excavation.next": "Nächster Punkt (Enter bei 2 Punkten = Rechteck, ab 3 Punkten Polygon):",
|
||||
"cmd.roofHole.start": "Erster Punkt des Innenhofs (im Dach):",
|
||||
"cmd.roofHole.next": "Nächster Punkt (Enter bei 2 Punkten = Rechteck, ab 3 Punkten Polygon):",
|
||||
"cmd.roof.shape.sattel": "Satteldach",
|
||||
@@ -1758,6 +1780,23 @@ export const de = {
|
||||
"cmd.revcloud.arcSize": "Beulengrösse",
|
||||
"cmd.pointmarker.label": "Punktmarker",
|
||||
"cmd.pointmarker.point": "Punkt:",
|
||||
"cmd.grid.label": "Achsraster",
|
||||
"cmd.grid.origin": "Ursprung des Achsrasters ( Radial ):",
|
||||
"cmd.grid.radial": "Radial",
|
||||
"cmd.grid.xs": "Feldweiten Achsen 1, 2, 3 … (z. B. 6 4.5 3x5, Enter = 6 6 6):",
|
||||
"cmd.grid.ys": "Feldweiten Achsen A, B, C … (z. B. 5 5, Enter = 6 6):",
|
||||
"cmd.grid.xsRadial": "Strahlwinkel in Grad (z. B. 8x45, Enter = 4x45):",
|
||||
"cmd.grid.ysRadial": "Ringabstände ab der Mitte (z. B. 3 3 4):",
|
||||
"cmd.dimradius.label": "Radiusmass",
|
||||
"cmd.dimradius.first": "Kreis, Bogen oder Bogenwand anklicken:",
|
||||
"cmd.dimdiameter.label": "Durchmessermass",
|
||||
"cmd.dimdiameter.first": "Kreis, Bogen oder Bogenwand anklicken:",
|
||||
"cmd.dimarc.label": "Bogenlänge",
|
||||
"cmd.dimarc.first": "Bogenanfang auf Kreis, Bogen oder Bogenwand:",
|
||||
"cmd.dimarc.second": "Bogenende:",
|
||||
"cmd.dimarc.offset": "Lage der Masslinie:",
|
||||
"history.cmd.grid": "Achsraster",
|
||||
"history.cmd.dimround": "Radius-/Bogenmass",
|
||||
"cmd.wipeout.label": "Maskenregion",
|
||||
"cmd.wipeout.start": "Startpunkt:",
|
||||
"cmd.wipeout.next": "Nächster Punkt:",
|
||||
@@ -1838,6 +1877,17 @@ export const de = {
|
||||
"cmd.offset.label": "Versatz",
|
||||
"cmd.offset.pick": "Kurve wählen:",
|
||||
"cmd.offset.side": "Seite oder Distanz:",
|
||||
"cmd.revolve.label": "Rotationskörper",
|
||||
"cmd.revolve.pick": "Geschlossenes Profil wählen:",
|
||||
"cmd.revolve.axisA": "Drehachse: Anfangspunkt:",
|
||||
"cmd.revolve.axisB": "Drehachse: Endpunkt:",
|
||||
"cmd.revolve.angle": "Drehwinkel (°, Enter = zuletzt):",
|
||||
"cmd.loft.label": "Loft",
|
||||
"cmd.loft.pick": "Profile der Reihe nach wählen (unten zuerst):",
|
||||
"cmd.loft.pickMore": "Weiteres Profil wählen oder Enter:",
|
||||
"cmd.loft.height": "Gesamthöhe:",
|
||||
"history.cmd.revolve": "Rotationskörper",
|
||||
"history.cmd.loft": "Loft",
|
||||
"cmd.extrude.label": "Extrudieren",
|
||||
"cmd.extrude.pick": "Geschlossenes Profil wählen:",
|
||||
"cmd.extrude.height": "Höhe:",
|
||||
@@ -1968,6 +2018,20 @@ export const de = {
|
||||
"site.type.mesh": "Mesh",
|
||||
"site.type.contours": "Konturen",
|
||||
"site.type.terrain": "Gelände",
|
||||
"site.type.excavation": "Baugrube",
|
||||
"site.smooth": "Glätten",
|
||||
"site.smooth.hint": "Höhenlinien als Bruchkanten, flache Dreiecke behoben, Fläche ohne Überschwingen geglättet",
|
||||
"site.excavation.draw": "Baugrube zeichnen",
|
||||
"site.excavation.hint": "Umriss der Sohle zeichnen; Böschungen schneiden das Gelände",
|
||||
"site.contourInterval": "Äquidistanz [m]",
|
||||
"site.contourIndexEvery": "Zähllinie jede",
|
||||
"site.excavation.bottom": "Sohle [m]",
|
||||
"site.excavation.slope": "Böschung [°]",
|
||||
"site.excavation.fillSlope": "Schüttung [°]",
|
||||
"site.excavation.bermWidth": "Berme [m]",
|
||||
"site.excavation.bermHeight": "Berme alle [m]",
|
||||
"site.excavation.qty": "Abtrag {cut} m³ · Auftrag {fill} m³ · Hinterfüllung {backfill} m³",
|
||||
"site.excavation.noTerrain": "Kein Gelände unter der Baugrube",
|
||||
"site.type.image": "Luftbild",
|
||||
"site.group.image": "Luftbild",
|
||||
"site.dwgHint": "DWG? Zuerst mit dem gratis ODA File Converter in DXF umwandeln.",
|
||||
@@ -2238,6 +2302,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}",
|
||||
@@ -2412,6 +2477,7 @@ export const de = {
|
||||
"siteRules.inside": "Gebäude innerhalb der zulässigen Fläche",
|
||||
"siteRules.heightOk": "Höhe {top} m ≤ {max} m",
|
||||
"siteRules.heightOver": "Höhe {top} m über {max} m",
|
||||
"siteRules.terrainAtFacade": "Massgebendes Terrain an der Fassade: {z} m (Höhe darüber gemessen)",
|
||||
"siteRules.defaultSetback": "Grenzabstand",
|
||||
"siteRules.maxHeight": "Gesamthöhe max.",
|
||||
"siteRules.edges": "Grenzabstand je Kante ({n})",
|
||||
@@ -2421,6 +2487,15 @@ export const de = {
|
||||
"siteRules.addLine.hint": "Eine Linie wählen; das Gebäude bleibt auf der Seite der Parzelle.",
|
||||
"siteRules.clearLines": "Alle Baulinien entfernen",
|
||||
"clash.none": "Keine Kollisionen gefunden.",
|
||||
"clash.run": "Prüfung starten",
|
||||
"clash.running": "Prüfung läuft …",
|
||||
"clash.clear": "Leeren",
|
||||
"clash.empty": "Keine Treffer. Die Prüfung vergleicht freie Körper und Importe mit Wänden, Decken und anderen Körpern.",
|
||||
"clash.kind.wall": "Wand",
|
||||
"clash.kind.slab": "Decke",
|
||||
"clash.kind.solid": "Körper",
|
||||
"clash.kind.mesh": "Import",
|
||||
"nav.clash": "Kollisionen",
|
||||
"clash.found": "Kollisionen gefunden",
|
||||
"clash.failed": "Kollisionsprüfung fehlgeschlagen",
|
||||
"about.title": "Über dossier",
|
||||
@@ -2744,6 +2819,7 @@ export const de = {
|
||||
"sheetTable.source.areas": "Flächentabelle (SIA 416)",
|
||||
"sheetTable.source.rooms": "Raumprogramm Soll/Ist",
|
||||
"sheetTable.source.elements": "Bauteile mit U-Wert",
|
||||
"sheetTable.source.earthworks": "Erdarbeiten (Baugruben)",
|
||||
"sheetTable.filter": "Zeigen",
|
||||
"sheetTable.filter.all": "Fenster und Türen",
|
||||
"sheetTable.filter.window": "Nur Fenster",
|
||||
@@ -2791,6 +2867,11 @@ export const de = {
|
||||
"sheetTable.col.diffPct": "Diff. [%]",
|
||||
"sheetTable.col.buildup": "Aufbau",
|
||||
"sheetTable.col.area": "Fläche [m²]",
|
||||
"sheetTable.col.name": "Bezeichnung",
|
||||
"sheetTable.col.bottom": "Sohle [m]",
|
||||
"sheetTable.col.cut": "Abtrag [m³]",
|
||||
"sheetTable.col.fill": "Auftrag [m³]",
|
||||
"sheetTable.col.backfill": "Hinterfüllung [m³]",
|
||||
"sheetTable.col.thickness": "Dicke [cm]",
|
||||
"sheetTable.v.window": "Fenster",
|
||||
"sheetTable.v.door": "Tür",
|
||||
@@ -2976,6 +3057,7 @@ export const de = {
|
||||
"history.cmd.revcloud": "Revisionswolke",
|
||||
"history.cmd.roof": "Dach zeichnen",
|
||||
"history.cmd.roofHole": "Dachöffnung",
|
||||
"history.cmd.excavation": "Baugrube",
|
||||
"history.cmd.room": "Raum zeichnen",
|
||||
"history.cmd.roomInside": "Raum aus Umriss",
|
||||
"history.cmd.scalebar": "Massstabsbalken",
|
||||
|
||||
@@ -206,6 +206,8 @@ export const en: Record<TranslationKey, string> = {
|
||||
"tool.revcloud.hint": "Revision cloud: click points like a polyline, Enter finishes open, clicking near start or \"Close\" closes it",
|
||||
"tool.pointmarker": "Point marker",
|
||||
"tool.pointmarker.hint": "Point marker: set a point — a cross-in-circle symbol marks a reference point",
|
||||
"tool.grid": "Structural grid",
|
||||
"tool.grid.hint": "Structural grid: set the origin, then enter bay widths — axes with bubbles in all plans, sections and elevations",
|
||||
"tool.wipeout": "Mask region",
|
||||
"tool.wipeout.hint": "Mask region: click points like a polyline, clicking near start or Enter (3+ points) closes and covers the drawing underneath",
|
||||
"tool.text": "Text",
|
||||
@@ -382,6 +384,17 @@ export const en: Record<TranslationKey, string> = {
|
||||
"attr.ends.tick": "Tick",
|
||||
"attr.ends.square": "Square",
|
||||
"attr.dim.section": "Dimension",
|
||||
"attr.grid.section": "Structural grid",
|
||||
"attr.grid.bubbles": "Axis bubbles",
|
||||
"attr.grid.bubbles.both": "Both ends",
|
||||
"attr.grid.bubbles.start": "Start only",
|
||||
"attr.grid.bubbles.end": "End only",
|
||||
"attr.grid.extend": "Extension (m)",
|
||||
"attr.grid.bubbleMm": "Bubble Ø (mm)",
|
||||
"attr.grid.levels": "Visible on",
|
||||
"attr.grid.show3d": "Show in 3D model",
|
||||
"attr.grid.levels.all": "All levels",
|
||||
"attr.grid.levels.here": "This level only",
|
||||
"attr.dim.gap": "Extension gap (mm)",
|
||||
"attr.dim.overshoot": "Overshoot (mm)",
|
||||
"attr.dim.tick": "Tick length (mm)",
|
||||
@@ -523,6 +536,11 @@ export const en: Record<TranslationKey, string> = {
|
||||
"objinfo.wall.refLine.right": "Interior (right)",
|
||||
"objinfo.wall.refLine.joint": "Joint",
|
||||
"objinfo.wall.sliceTermination": "End at ceiling",
|
||||
"objinfo.wall.roofAttach": "Attach to roof",
|
||||
"objinfo.wall.roofAttach.auto": "Automatic",
|
||||
"objinfo.wall.roofAttach.on": "Yes, up to the roof",
|
||||
"objinfo.wall.roofAttach.off": "No",
|
||||
"objinfo.wall.roofAttach.tip": "Automatic: each wall layer ends at the roof underside where its top lies above it. Yes: also extended up to the roof. No: roofs do not cut the wall.",
|
||||
"objinfo.wall.sliceTermination.both": "Off",
|
||||
"objinfo.wall.sliceTermination.below": "Below",
|
||||
"objinfo.wall.sliceTermination.above": "Above",
|
||||
@@ -794,6 +812,7 @@ export const en: Record<TranslationKey, string> = {
|
||||
"objinfo.stair.shape.L": "L-shaped",
|
||||
"objinfo.stair.shape.spiral": "Spiral",
|
||||
"objinfo.stair.width": "Run width",
|
||||
"objinfo.stair.column": "Centre column (radius)",
|
||||
"objinfo.stair.steps": "Step count",
|
||||
"objinfo.stair.rise": "Total rise",
|
||||
"objinfo.stair.riser": "Riser height",
|
||||
@@ -1604,6 +1623,9 @@ export const en: Record<TranslationKey, string> = {
|
||||
"cmd.ceilingOpening.start": "First corner of the opening (inside a slab):",
|
||||
"cmd.ceilingOpening.corner": "Opposite corner:",
|
||||
"cmd.roofHole.label": "Roof court",
|
||||
"cmd.excavation.label": "Excavation",
|
||||
"cmd.excavation.start": "First point of the excavation bottom:",
|
||||
"cmd.excavation.next": "Next point (Enter with 2 points = rectangle, 3 or more = polygon):",
|
||||
"cmd.roofHole.start": "First point of the courtyard (inside the roof):",
|
||||
"cmd.roofHole.next": "Next point (Enter with 2 points = rectangle, 3 or more = polygon):",
|
||||
"cmd.roof.shape.sattel": "Gable roof",
|
||||
@@ -1747,6 +1769,23 @@ export const en: Record<TranslationKey, string> = {
|
||||
"cmd.revcloud.arcSize": "Arc size",
|
||||
"cmd.pointmarker.label": "Point marker",
|
||||
"cmd.pointmarker.point": "Point:",
|
||||
"cmd.grid.label": "Structural grid",
|
||||
"cmd.grid.origin": "Grid origin ( Radial ):",
|
||||
"cmd.grid.radial": "Radial",
|
||||
"cmd.grid.xs": "Bay widths for axes 1, 2, 3 … (e.g. 6 4.5 3x5, Enter = 6 6 6):",
|
||||
"cmd.grid.ys": "Bay widths for axes A, B, C … (e.g. 5 5, Enter = 6 6):",
|
||||
"cmd.grid.xsRadial": "Ray angles in degrees (e.g. 8x45, Enter = 4x45):",
|
||||
"cmd.grid.ysRadial": "Ring spacings from the centre (e.g. 3 3 4):",
|
||||
"cmd.dimradius.label": "Radius dimension",
|
||||
"cmd.dimradius.first": "Pick a circle, arc or arc wall:",
|
||||
"cmd.dimdiameter.label": "Diameter dimension",
|
||||
"cmd.dimdiameter.first": "Pick a circle, arc or arc wall:",
|
||||
"cmd.dimarc.label": "Arc length",
|
||||
"cmd.dimarc.first": "Arc start on a circle, arc or arc wall:",
|
||||
"cmd.dimarc.second": "Arc end:",
|
||||
"cmd.dimarc.offset": "Position of the dimension line:",
|
||||
"history.cmd.grid": "Structural grid",
|
||||
"history.cmd.dimround": "Radius/arc dimension",
|
||||
"cmd.wipeout.label": "Mask region",
|
||||
"cmd.wipeout.start": "Start point:",
|
||||
"cmd.wipeout.next": "Next point:",
|
||||
@@ -1826,6 +1865,17 @@ export const en: Record<TranslationKey, string> = {
|
||||
"cmd.offset.label": "Offset",
|
||||
"cmd.offset.pick": "Select curve:",
|
||||
"cmd.offset.side": "Side or distance:",
|
||||
"cmd.revolve.label": "Revolve",
|
||||
"cmd.revolve.pick": "Select closed profile:",
|
||||
"cmd.revolve.axisA": "Revolve axis: start point:",
|
||||
"cmd.revolve.axisB": "Revolve axis: end point:",
|
||||
"cmd.revolve.angle": "Revolve angle (°, Enter = last):",
|
||||
"cmd.loft.label": "Loft",
|
||||
"cmd.loft.pick": "Select profiles in order (bottom first):",
|
||||
"cmd.loft.pickMore": "Select another profile or Enter:",
|
||||
"cmd.loft.height": "Total height:",
|
||||
"history.cmd.revolve": "Revolve",
|
||||
"history.cmd.loft": "Loft",
|
||||
"cmd.extrude.label": "Extrude",
|
||||
"cmd.extrude.pick": "Select closed profile:",
|
||||
"cmd.extrude.height": "Height:",
|
||||
@@ -1956,6 +2006,20 @@ export const en: Record<TranslationKey, string> = {
|
||||
"site.type.mesh": "Mesh",
|
||||
"site.type.contours": "Contours",
|
||||
"site.type.terrain": "Terrain",
|
||||
"site.type.excavation": "Excavation",
|
||||
"site.smooth": "Smooth",
|
||||
"site.smooth.hint": "Contours as breaklines, flat triangles fixed, surface smoothed without overshoot",
|
||||
"site.excavation.draw": "Draw excavation",
|
||||
"site.excavation.hint": "Draw the outline of the pit bottom; slopes cut the terrain",
|
||||
"site.contourInterval": "Contour interval [m]",
|
||||
"site.contourIndexEvery": "Index contour every",
|
||||
"site.excavation.bottom": "Bottom [m]",
|
||||
"site.excavation.slope": "Slope [°]",
|
||||
"site.excavation.fillSlope": "Fill slope [°]",
|
||||
"site.excavation.bermWidth": "Berm [m]",
|
||||
"site.excavation.bermHeight": "Berm every [m]",
|
||||
"site.excavation.qty": "Cut {cut} m³ · Fill {fill} m³ · Backfill {backfill} m³",
|
||||
"site.excavation.noTerrain": "No terrain below the excavation",
|
||||
"site.type.image": "Aerial",
|
||||
"site.group.image": "Aerial imagery",
|
||||
"site.dwgHint": "DWG? Convert it to DXF first with the free ODA File Converter.",
|
||||
@@ -2188,6 +2252,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}",
|
||||
@@ -2362,6 +2427,7 @@ export const en: Record<TranslationKey, string> = {
|
||||
"siteRules.inside": "Building inside the buildable area",
|
||||
"siteRules.heightOk": "Height {top} m ≤ {max} m",
|
||||
"siteRules.heightOver": "Height {top} m exceeds {max} m",
|
||||
"siteRules.terrainAtFacade": "Reference terrain at the façade: {z} m (height measured from it)",
|
||||
"siteRules.defaultSetback": "Boundary distance",
|
||||
"siteRules.maxHeight": "Max. total height",
|
||||
"siteRules.edges": "Distance per edge ({n})",
|
||||
@@ -2370,6 +2436,15 @@ export const en: Record<TranslationKey, string> = {
|
||||
"siteRules.addLine": "Building line from selection",
|
||||
"siteRules.addLine.hint": "Select a line; the building stays on the parcel side.",
|
||||
"siteRules.clearLines": "Remove all building lines",
|
||||
"clash.run": "Run check",
|
||||
"clash.running": "Checking …",
|
||||
"clash.clear": "Clear",
|
||||
"clash.empty": "No results. The check compares free solids and imports with walls, slabs and other solids.",
|
||||
"clash.kind.wall": "Wall",
|
||||
"clash.kind.slab": "Slab",
|
||||
"clash.kind.solid": "Solid",
|
||||
"clash.kind.mesh": "Import",
|
||||
"nav.clash": "Clashes",
|
||||
"clash.none": "No clashes found.",
|
||||
"clash.found": "Clashes found",
|
||||
"clash.failed": "Clash detection failed",
|
||||
@@ -2731,6 +2806,7 @@ export const en: Record<TranslationKey, string> = {
|
||||
"sheetTable.source.areas": "Area table (SIA 416)",
|
||||
"sheetTable.source.rooms": "Room program target/actual",
|
||||
"sheetTable.source.elements": "Elements with U-value",
|
||||
"sheetTable.source.earthworks": "Earthworks (excavations)",
|
||||
"sheetTable.filter": "Show",
|
||||
"sheetTable.filter.all": "Windows and doors",
|
||||
"sheetTable.filter.window": "Windows only",
|
||||
@@ -2778,6 +2854,11 @@ export const en: Record<TranslationKey, string> = {
|
||||
"sheetTable.col.diffPct": "Diff. [%]",
|
||||
"sheetTable.col.buildup": "Build-up",
|
||||
"sheetTable.col.area": "Area [m²]",
|
||||
"sheetTable.col.name": "Name",
|
||||
"sheetTable.col.bottom": "Bottom [m]",
|
||||
"sheetTable.col.cut": "Cut [m³]",
|
||||
"sheetTable.col.fill": "Fill [m³]",
|
||||
"sheetTable.col.backfill": "Backfill [m³]",
|
||||
"sheetTable.col.thickness": "Thickness [cm]",
|
||||
"sheetTable.v.window": "Window",
|
||||
"sheetTable.v.door": "Door",
|
||||
@@ -2962,6 +3043,7 @@ export const en: Record<TranslationKey, string> = {
|
||||
"history.cmd.revcloud": "Revision cloud",
|
||||
"history.cmd.roof": "Draw roof",
|
||||
"history.cmd.roofHole": "Roof opening",
|
||||
"history.cmd.excavation": "Excavation",
|
||||
"history.cmd.room": "Draw room",
|
||||
"history.cmd.roomInside": "Room from outline",
|
||||
"history.cmd.scalebar": "Scale bar",
|
||||
|
||||
@@ -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" as const, up: "z" as const, upAuto: false, upCertain: true, unitScale: 1, triangles: 12, degenerate: 0, badFaces: 0, truncated: false, warnings: [] as string[], objects: 1 };
|
||||
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(" · ");
|
||||
}
|
||||
+25
-6
@@ -19,14 +19,32 @@ let terrainSeq = 0;
|
||||
export const TERRAIN_LAYER = "Terrain";
|
||||
|
||||
/**
|
||||
* Erzeugt ein TIN aus Konturen (Rust-Kern, `cmd_solid.rs::terrain_from_contours`): alle endlichen
|
||||
* Stützpunkte der Konturen als Vertices (Z = Kontur-Höhe, nicht endlich → 0), 2D-Delaunay über die
|
||||
* (x, y)-Projektion (`delaunay.rs`), Dreiecke mit (nahezu) null Fläche verworfen. Offene und
|
||||
* geschlossene Konturen gleich; unter 3 Punkten ein leeres Mesh.
|
||||
* Erzeugt ein Gelände aus Konturen (Rust-Kern, `terrain.rs`): Konturen verdichtet und als Bruchkanten
|
||||
* erzwungen (constrained Delaunay), flache Dreiecke behoben, adaptiv geglättet ohne Überschwingen.
|
||||
* `contourInterval` = kleinster Höhenabstand der Konturen (Höhenlinien im Grundriss). Unter 3 Punkten
|
||||
* ein leeres Mesh.
|
||||
*/
|
||||
export function generateTerrainFromContours(contours: Contour[]): TerrainMesh {
|
||||
export function generateTerrainFromContours(contours: Contour[], opts: TerrainOptions = {}): TerrainMesh {
|
||||
const id = `terrain-${Date.now()}-${terrainSeq++}`;
|
||||
return JSON.parse(core().terrain_from_contours_json(toMarkedJson(contours), id)) as TerrainMesh;
|
||||
const json = core().terrain_from_contours_opts_json(
|
||||
toMarkedJson(contours),
|
||||
id,
|
||||
opts.smooth ?? 2,
|
||||
opts.maxEdge ?? 0,
|
||||
opts.breaklines === false ? 0 : 1,
|
||||
);
|
||||
return JSON.parse(json) as TerrainMesh;
|
||||
}
|
||||
|
||||
/**
|
||||
* [T6] Optionen der Gelände-Erzeugung (`terrain.rs`): `smooth` = Glättungsstufen 0–4 (0 = reines TIN mit
|
||||
* Bruchkanten, Standard 2), `maxEdge` = Verdichtung/grösste Kante in m (0 = automatisch), `breaklines` =
|
||||
* Höhenlinien als Bruchkanten erzwingen (Standard ja).
|
||||
*/
|
||||
export interface TerrainOptions {
|
||||
smooth?: number;
|
||||
maxEdge?: number;
|
||||
breaklines?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -91,5 +109,6 @@ export function terrainMeshFromGrid(grid: TerrainGrid): TerrainMesh {
|
||||
categoryCode: TERRAIN_CATEGORY.code,
|
||||
positions,
|
||||
indices,
|
||||
contourInterval: 1,
|
||||
};
|
||||
}
|
||||
@@ -453,7 +453,7 @@ export type ContextImage = {
|
||||
};
|
||||
|
||||
/** Kontext-Objekt (Tag `type`). */
|
||||
export type ContextObject = ImportedMesh | ContourSet | TerrainMesh | ContextImage;
|
||||
export type ContextObject = ImportedMesh | ContourSet | TerrainMesh | ContextImage | Excavation;
|
||||
|
||||
/**
|
||||
* Eine einzelne Kontur (Höhenlinie / Polylinie) auf konstanter Höhe `z`. `pts`
|
||||
@@ -521,7 +521,16 @@ export type CustomPalette = {
|
||||
export type DetailLevel = "grob" | "mittel" | "fein";
|
||||
|
||||
/** Merkmal, an dem ein Bemassungspunkt hängt ([38], `dim_assoc.rs`). */
|
||||
export type DimFeature = "wall" | "opening" | "vertex" | "edge" | "center" | "intersection";
|
||||
export type DimFeature =
|
||||
| "wall"
|
||||
| "opening"
|
||||
| "vertex"
|
||||
| "edge"
|
||||
| "center"
|
||||
| "intersection"
|
||||
| "axis"
|
||||
| "axiscross"
|
||||
| "rim";
|
||||
|
||||
/** Bezug eines Bemassungspunkts auf ein Element ([38]). */
|
||||
export type DimRef = {
|
||||
@@ -887,6 +896,11 @@ export type Drawing2DGeom =
|
||||
* wenn ein Bezug ungültig wird. Fehlt das Feld, ist die Bemassung frei wie bisher.
|
||||
*/
|
||||
refs?: Array<DimRef | null>;
|
||||
/**
|
||||
* Art der Bemassung (fehlt = linear): Radius/Durchmesser (`pts` = Mittelpunkt, Punkt auf dem
|
||||
* Kreis) und Bogenlänge (`pts` = Mittelpunkt, Bogenanfang, Bogenende).
|
||||
*/
|
||||
kind?: "radius" | "diameter" | "arc";
|
||||
}
|
||||
| {
|
||||
shape: "kote";
|
||||
@@ -921,6 +935,24 @@ export type Drawing2DGeom =
|
||||
segments: number;
|
||||
}
|
||||
| { shape: "pointmarker"; at: Vec2 }
|
||||
| {
|
||||
shape: "grid";
|
||||
origin: Vec2;
|
||||
angle: number;
|
||||
radial?: boolean;
|
||||
a: Array<GridAxis>;
|
||||
b: Array<GridAxis>;
|
||||
/** Überstand der Achsen über die äusserste Querachse (Meter, Standard 1.5). */
|
||||
extend?: number;
|
||||
/** Enden mit Achsblase (Standard Anfang und Ende). */
|
||||
bubbles?: "start" | "end" | "both";
|
||||
/** Blasen-Durchmesser in Papier-mm (Standard 8). */
|
||||
bubbleMm?: number;
|
||||
/** Geschosse, in denen das Raster gezeigt wird; fehlt oder leer = in allen. */
|
||||
levels?: Array<string>;
|
||||
/** Im 3D-Modell als dünne Linien zeigen. */
|
||||
show3d?: boolean;
|
||||
}
|
||||
| {
|
||||
shape: "text";
|
||||
at: Vec2;
|
||||
@@ -1117,6 +1149,28 @@ export type DrawingLevelKind = "floor" | "section" | "elevation" | "drawing";
|
||||
*/
|
||||
export type EndMark = "none" | "arrow" | "arrowOpen" | "dot" | "tick" | "square";
|
||||
|
||||
/**
|
||||
* [68] Baugrube / Geländebearbeitung: Sohle als Umriss auf der Höhe `bottom` (m, Modell ±0.00).
|
||||
* Ausserhalb steigt die Böschung mit `slope` (Grad, Default 45; je Kante `edgeSlopes`, 0 = Default)
|
||||
* bis zum Gelände (Abtrag); liegt das Gelände tiefer, fällt eine Schüttung mit `fillSlope` (Default
|
||||
* 33.7 ≈ 2:3) bis zum Gelände (Auftrag). Bermen: alle `bermHeight` m Höhe eine waagrechte Berme der
|
||||
* Breite `bermWidth`. Schneidet jedes Gelände-Netz, das den Umriss enthält.
|
||||
*/
|
||||
export type Excavation = {
|
||||
type: "excavation";
|
||||
id: string;
|
||||
name: string;
|
||||
layer?: string;
|
||||
categoryCode?: string;
|
||||
outline: Array<Vec2>;
|
||||
bottom: number;
|
||||
slope?: number;
|
||||
fillSlope?: number;
|
||||
edgeSlopes?: Array<number>;
|
||||
bermWidth?: number;
|
||||
bermHeight?: number;
|
||||
};
|
||||
|
||||
/** Ein extrudierter Körper: geschlossenes Profil (Modell-Meter) + Höhe. */
|
||||
export type ExtrudedSolid = {
|
||||
id: string;
|
||||
@@ -1218,6 +1272,9 @@ export type FrameDetail = {
|
||||
rebates?: OpeningSides;
|
||||
};
|
||||
|
||||
/** Eine Achse des Achsrasters: Beschriftung und Lage (Abstand bzw. Winkel/Radius, s. `Grid`). */
|
||||
export type GridAxis = { label: string; pos: number };
|
||||
|
||||
/**
|
||||
* Raster-Regel: generiert Wände entlang gleichmäßiger X-/Y-Achsen.
|
||||
* Typischer Anwendungsfall: Tragwerks-Achsraster (z. B. 3 m Abstand).
|
||||
@@ -1627,7 +1684,7 @@ export type LayoutTable = {
|
||||
};
|
||||
|
||||
/** Quelle einer Blatt-Tabelle ([111]). */
|
||||
export type LayoutTableSource = "openings" | "areas" | "rooms" | "elements";
|
||||
export type LayoutTableSource = "openings" | "areas" | "rooms" | "elements" | "earthworks";
|
||||
|
||||
/**
|
||||
* Einfache Textfelder des Titelblocks (Master). Alle optional — leere Felder
|
||||
@@ -2852,6 +2909,11 @@ export type Stair = {
|
||||
* Dreieck als SIA-Vollpfeil). Fehlt sie, gilt "line".
|
||||
*/
|
||||
arrowStyle?: "line" | "filled";
|
||||
/**
|
||||
* Nur Wendel: Radius (Meter) der Mittelsäule (Spindel) im Zentrum. Fehlt er oder ist er
|
||||
* ≤ 0, gibt es keine Säule.
|
||||
*/
|
||||
centerColumn?: number;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -2945,6 +3007,13 @@ export type TerrainMesh = {
|
||||
* statt mit der Grundfarbe. Fehlt es, bleibt das Gelände einfarbig.
|
||||
*/
|
||||
vertexColors?: Array<number>;
|
||||
/**
|
||||
* [T6] Äquidistanz der Höhenlinien im Grundriss in m (aus dem Netz neu erzeugt, inkl. Baugruben).
|
||||
* Fehlt der Wert oder ist er ≤ 0, zeigt der Grundriss nur den Rahmen.
|
||||
*/
|
||||
contourInterval?: number;
|
||||
/** [T6] Jede n-te Höhenlinie ist Zähllinie (dicker, beschriftet). Default 5. */
|
||||
contourIndexEvery?: number;
|
||||
};
|
||||
|
||||
/** Ein zusammenhängender Textabschnitt mit einheitlicher Formatierung. */
|
||||
@@ -3236,6 +3305,12 @@ export type Wall = {
|
||||
* Additiv; Alt-Projekte laden unverändert (Default = "both").
|
||||
*/
|
||||
sliceTermination?: SliceTermination;
|
||||
/**
|
||||
* An Dach anschliessen ([G2]): `undefined` = automatisch (die Wand endet an der Dach-Unterkante,
|
||||
* wo ihre Krone darüber liegt — je Schicht, Giebel/Traufe/Grat/Kehle/Gaube), `true` = zusätzlich bis
|
||||
* unter das Dach verlängert, `false` = Dächer schneiden die Wand nicht.
|
||||
*/
|
||||
roofAttach?: boolean;
|
||||
/**
|
||||
* Ansichtsschraffur ([100]): Drehung (Grad) des Oberflächenmusters dieses Elements gegenüber der
|
||||
* Ausrichtung am Element (Default 0).
|
||||
|
||||
@@ -501,6 +501,45 @@ export function AttributesPanel() {
|
||||
(Modellmass, s. `model/dimension.ts`); leer/0 fällt auf den
|
||||
Standard zurück. Die Masszahl selbst wird direkt im Plan am
|
||||
eigenen Griff verschoben (rastet nahe der Standardlage ein). */}
|
||||
{drawing?.geom.shape === "grid" && (() => {
|
||||
const geom = drawing.geom as Extract<typeof drawing.geom, { shape: "grid" }>;
|
||||
const here = geom.levels?.includes(drawing.levelId) && geom.levels.length === 1;
|
||||
return (
|
||||
<>
|
||||
<div className="attr-section-label">{t("attr.grid.section")}</div>
|
||||
<span className="attr-key">{t("attr.grid.bubbles")}</span>
|
||||
<span className="attr-val">
|
||||
<select value={geom.bubbles ?? "both"} onChange={(e) => host.onSetGridProps(drawing.id, { bubbles: e.target.value as "start" | "end" | "both" })}>
|
||||
<option value="both">{t("attr.grid.bubbles.both")}</option>
|
||||
<option value="start">{t("attr.grid.bubbles.start")}</option>
|
||||
<option value="end">{t("attr.grid.bubbles.end")}</option>
|
||||
</select>
|
||||
</span>
|
||||
<span className="attr-key">{t("attr.grid.extend")}</span>
|
||||
<span className="attr-val">
|
||||
<input className="attr-num" style={{ width: 72 }} type="number" step={0.1} min={0} value={geom.extend ?? 1.5}
|
||||
onChange={(e) => { const v = Number(e.target.value); if (Number.isFinite(v) && v >= 0) host.onSetGridProps(drawing.id, { extend: v }); }} />
|
||||
</span>
|
||||
<span className="attr-key">{t("attr.grid.bubbleMm")}</span>
|
||||
<span className="attr-val">
|
||||
<input className="attr-num" style={{ width: 72 }} type="number" step={0.5} min={2} value={geom.bubbleMm ?? 8}
|
||||
onChange={(e) => { const v = Number(e.target.value); if (Number.isFinite(v) && v >= 2) host.onSetGridProps(drawing.id, { bubbleMm: v }); }} />
|
||||
</span>
|
||||
<span className="attr-key">{t("attr.grid.show3d")}</span>
|
||||
<span className="attr-val">
|
||||
<input type="checkbox" checked={geom.show3d === true} onChange={(e) => host.onSetGridProps(drawing.id, { show3d: e.target.checked })} />
|
||||
</span>
|
||||
<span className="attr-key">{t("attr.grid.levels")}</span>
|
||||
<span className="attr-val">
|
||||
<select value={here ? "here" : "all"} onChange={(e) => host.onSetGridProps(drawing.id, { levels: e.target.value === "here" ? [drawing.levelId] : undefined })}>
|
||||
<option value="all">{t("attr.grid.levels.all")}</option>
|
||||
<option value="here">{t("attr.grid.levels.here")}</option>
|
||||
</select>
|
||||
</span>
|
||||
</>
|
||||
);
|
||||
})()}
|
||||
|
||||
{drawing?.geom.shape === "dimension" && (
|
||||
<>
|
||||
<div className="attr-section-label">{t("attr.dim.section")}</div>
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
// Kollisionen ([T8]): Liste der Treffer der letzten Prüfung. Klick wählt beide beteiligten Bauteile
|
||||
// (Auswahl-Umriss im 3D) und fährt die 3D-Kamera auf die Durchdringung; im 3D sind alle Treffer als
|
||||
// rote Hüllquader markiert (`clashHighlightLines`, `views/viewportContent.tsx`).
|
||||
|
||||
import { t } from "../i18n";
|
||||
import { getState } from "../state/appStore";
|
||||
import { clashSelection, type Clash } from "../analysis/clash";
|
||||
import { focusCamera, viewportAvailable } from "../viewport/cameraBridge";
|
||||
import { runClashAndStore, setClashSession, useClashSession } from "./clashSession";
|
||||
|
||||
/** Klick auf einen Treffer: Bauteile wählen, Kamera auf die Durchdringung. */
|
||||
export function focusClash(c: Clash, index: number): void {
|
||||
const s = getState();
|
||||
const sel = clashSelection(c);
|
||||
s.clearSelection();
|
||||
s.setSelectedWallIds(sel.wallIds);
|
||||
s.setSelectedCeilingIds(sel.ceilingIds);
|
||||
s.setSelectedExtrudedSolidIds(sel.extrudedSolidIds);
|
||||
s.setSelectedContextObjectIds(sel.contextObjectIds);
|
||||
setClashSession({ selected: index });
|
||||
const radius = Math.hypot(c.max[0] - c.min[0], c.max[1] - c.min[1], c.max[2] - c.min[2]) / 2;
|
||||
if (viewportAvailable()) focusCamera(c.center, radius);
|
||||
}
|
||||
|
||||
const itemText = (it: Clash["a"]) => `${t(`clash.kind.${it.kind}`)} ${it.id}`;
|
||||
|
||||
export function ClashPanel() {
|
||||
const session = useClashSession();
|
||||
return (
|
||||
<div className="bcf-panel">
|
||||
<div className="bcf-bar">
|
||||
<button type="button" className="bcf-btn" disabled={session.running} onClick={() => void runClashAndStore()}>
|
||||
{session.running ? t("clash.running") : t("clash.run")}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
className="bcf-btn"
|
||||
disabled={session.clashes.length === 0}
|
||||
onClick={() => setClashSession({ clashes: [], selected: null })}
|
||||
>
|
||||
{t("clash.clear")}
|
||||
</button>
|
||||
</div>
|
||||
{session.clashes.length === 0 && <div className="bcf-empty">{t("clash.empty")}</div>}
|
||||
<ul className="bcf-list">
|
||||
{session.clashes.map((c, k) => (
|
||||
<li key={`${c.a.id}|${c.b.id}`}>
|
||||
<button type="button" className={`bcf-topic${k === session.selected ? " is-active" : ""}`} onClick={() => focusClash(c, k)}>
|
||||
<span className="bcf-status">{`K${k + 1}`}</span>
|
||||
<span className="bcf-topic-title">{`${itemText(c.a)} ↔ ${itemText(c.b)}`}</span>
|
||||
{c.volume !== null && <span className="bcf-count">{`${c.volume.toFixed(3)} m³`}</span>}
|
||||
</button>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1461,6 +1461,13 @@ export function StairSection({
|
||||
value={stair.width}
|
||||
onCommit={(v) => host.onSetStairWidth(v)}
|
||||
/>
|
||||
{stair.shape === "spiral" && (
|
||||
<DimensionField
|
||||
label={t("objinfo.stair.column")}
|
||||
value={stair.centerColumn ?? 0}
|
||||
onCommit={(v) => host.onSetStairColumn(v)}
|
||||
/>
|
||||
)}
|
||||
<DimensionField
|
||||
label={t("objinfo.stair.steps")}
|
||||
value={stair.stepCount}
|
||||
@@ -2055,6 +2062,23 @@ export function WallSection({
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* An Dach anschliessen ([G2]): automatisch endet die Wand an der Dach-Unterkante, "Ja"
|
||||
verlängert sie bis unter das Dach, "Nein" lässt die Dächer die Wand nicht schneiden. */}
|
||||
<div className="objinfo-field">
|
||||
<span className="objinfo-flabel">{t("objinfo.wall.roofAttach")}</span>
|
||||
<Dropdown
|
||||
value={wall.roofAttach}
|
||||
onChange={(v) => host.onSetWallRoofAttach(v as "auto" | "on" | "off")}
|
||||
options={[
|
||||
{ value: "auto", label: t("objinfo.wall.roofAttach.auto") },
|
||||
{ value: "on", label: t("objinfo.wall.roofAttach.on") },
|
||||
{ value: "off", label: t("objinfo.wall.roofAttach.off") },
|
||||
]}
|
||||
title={t("objinfo.wall.roofAttach.tip")}
|
||||
width={120}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* Aufbau-Typ-Segment. */}
|
||||
<div className="objinfo-field">
|
||||
<span className="objinfo-flabel">{t("objinfo.wall.buildup")}</span>
|
||||
|
||||
+121
-2
@@ -13,7 +13,7 @@
|
||||
// Bezeichner englisch, UI-Text/Kommentare deutsch (CONVENTIONS.md). Alle sichtbaren
|
||||
// Texte über t(...).
|
||||
|
||||
import { useState } from "react";
|
||||
import { useMemo, useState } from "react";
|
||||
import { t } from "../i18n";
|
||||
import type { TranslationKey } from "../i18n";
|
||||
import { usePanelHost } from "./host";
|
||||
@@ -26,6 +26,7 @@ import { openContextImportWindowNative } from "../native/contextImportWindow";
|
||||
import { SunStudySection } from "./SunStudySection";
|
||||
import { SiteRulesSection } from "./SiteRulesSection";
|
||||
import { PointCloudSection } from "./PointCloudSection";
|
||||
import { excavationQuantities } from "../core";
|
||||
|
||||
/** Typ-spezifisches Badge-Label (i18n-Key) je Kontext-Objekt-Art. */
|
||||
function typeBadgeKey(obj: ContextObject): TranslationKey {
|
||||
@@ -38,6 +39,8 @@ function typeBadgeKey(obj: ContextObject): TranslationKey {
|
||||
return "site.type.terrain";
|
||||
case "image":
|
||||
return "site.type.image";
|
||||
case "excavation":
|
||||
return "site.type.excavation";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,9 +56,42 @@ function layerOf(obj: ContextObject): string {
|
||||
return t("site.group.contours");
|
||||
case "image":
|
||||
return t("site.group.image");
|
||||
case "excavation":
|
||||
return t("site.group.terrain");
|
||||
}
|
||||
}
|
||||
|
||||
/** Zahl-Eingabe für ein Feld eines Kontext-Objekts (leer = Standard, ungültig = keine Änderung). */
|
||||
function NumField(props: {
|
||||
label: string;
|
||||
value: number | undefined;
|
||||
step: number;
|
||||
min?: number;
|
||||
placeholder?: string;
|
||||
onChange: (v: number | undefined) => void;
|
||||
}) {
|
||||
return (
|
||||
<label className="site-prop">
|
||||
<span>{props.label}</span>
|
||||
<input
|
||||
type="number"
|
||||
step={props.step}
|
||||
min={props.min}
|
||||
placeholder={props.placeholder}
|
||||
value={props.value ?? ""}
|
||||
onChange={(e) => {
|
||||
const raw = e.target.value.trim();
|
||||
if (raw === "") return props.onChange(undefined);
|
||||
const v = Number(raw);
|
||||
if (Number.isFinite(v)) props.onChange(v);
|
||||
}}
|
||||
/>
|
||||
</label>
|
||||
);
|
||||
}
|
||||
|
||||
const fmt1 = (v: number) => v.toLocaleString("de-CH", { maximumFractionDigits: 1, minimumFractionDigits: 1 });
|
||||
|
||||
/** Gruppiert Kontext-Objekte nach Ebene, Reihenfolge des ersten Auftretens. */
|
||||
function groupByLayer(objects: ContextObject[]): { layer: string; items: ContextObject[] }[] {
|
||||
const order: string[] = [];
|
||||
@@ -73,6 +109,15 @@ function groupByLayer(objects: ContextObject[]): { layer: string; items: Context
|
||||
return order.map((layer) => ({ layer, items: byLayer.get(layer)! }));
|
||||
}
|
||||
|
||||
function ExcavationQty({ q }: { q: { cut: number; fill: number; backfill: number } | undefined }) {
|
||||
if (!q) return <div className="site-qty">{t("site.excavation.noTerrain")}</div>;
|
||||
return (
|
||||
<div className="site-qty">
|
||||
{t("site.excavation.qty", { cut: fmt1(q.cut), fill: fmt1(q.fill), backfill: fmt1(q.backfill) })}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export function SitePanel() {
|
||||
const host = usePanelHost();
|
||||
const notify = useStore((s) => s.notify);
|
||||
@@ -89,9 +134,16 @@ export function SitePanel() {
|
||||
? selectedSet
|
||||
: (contourSets[0]?.id ?? "");
|
||||
|
||||
// [T6] Glätten beim Erzeugen (Bruchkanten werden immer erzwungen).
|
||||
const [smooth, setSmooth] = useState(true);
|
||||
// [68] Mengen der Baugruben (Kern), nur neu, wenn sich das Projekt ändert.
|
||||
const quantities = useMemo(() => excavationQuantities(host.project), [host.project]);
|
||||
const patch = (id: string, field: string) => (v: number | undefined) =>
|
||||
host.onPatchContextObject(id, { [field]: v }, `site-${id}-${field}`);
|
||||
|
||||
const onGenerate = () => {
|
||||
if (!effectiveSet) return;
|
||||
const id = host.onGenerateTerrain(effectiveSet);
|
||||
const id = host.onGenerateTerrain(effectiveSet, { smooth: smooth ? 2 : 0 });
|
||||
if (id === null) {
|
||||
// Kein sinnvolles TIN — ruhiger Hinweis als Toast (keine harte Fehlerbox;
|
||||
// window.alert wäre im Tauri-WKWebView ohnehin wirkungslos).
|
||||
@@ -153,11 +205,22 @@ export function SitePanel() {
|
||||
{contourSets[0].name}
|
||||
</span>
|
||||
)}
|
||||
<label className="site-check" title={t("site.smooth.hint")}>
|
||||
<input type="checkbox" checked={smooth} onChange={(e) => setSmooth(e.target.checked)} />
|
||||
{t("site.smooth")}
|
||||
</label>
|
||||
<button type="button" className="site-btn" onClick={onGenerate}>
|
||||
{t("site.generateTerrain")}
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
{objects.some((o) => o.type === "terrainMesh") && (
|
||||
<div className="site-actions">
|
||||
<button type="button" className="site-btn" title={t("site.excavation.hint")} onClick={() => host.onStartExcavation()}>
|
||||
{t("site.excavation.draw")}
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="site-sep" />
|
||||
<SunStudySection />
|
||||
@@ -213,6 +276,62 @@ export function SitePanel() {
|
||||
>
|
||||
×
|
||||
</button>
|
||||
{obj.type === "terrainMesh" && (
|
||||
<div className="site-props">
|
||||
<NumField
|
||||
label={t("site.contourInterval")}
|
||||
value={obj.contourInterval}
|
||||
step={0.5}
|
||||
min={0}
|
||||
placeholder="—"
|
||||
onChange={patch(obj.id, "contourInterval")}
|
||||
/>
|
||||
<NumField
|
||||
label={t("site.contourIndexEvery")}
|
||||
value={obj.contourIndexEvery}
|
||||
step={1}
|
||||
min={1}
|
||||
placeholder="5"
|
||||
onChange={patch(obj.id, "contourIndexEvery")}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
{obj.type === "excavation" && (
|
||||
<div className="site-props">
|
||||
<NumField
|
||||
label={t("site.excavation.bottom")}
|
||||
value={obj.bottom}
|
||||
step={0.05}
|
||||
onChange={(v) => v !== undefined && patch(obj.id, "bottom")(v)}
|
||||
/>
|
||||
<NumField label={t("site.excavation.slope")} value={obj.slope} step={5} min={5} placeholder="45" onChange={patch(obj.id, "slope")} />
|
||||
<NumField
|
||||
label={t("site.excavation.fillSlope")}
|
||||
value={obj.fillSlope}
|
||||
step={5}
|
||||
min={5}
|
||||
placeholder="33.7"
|
||||
onChange={patch(obj.id, "fillSlope")}
|
||||
/>
|
||||
<NumField
|
||||
label={t("site.excavation.bermWidth")}
|
||||
value={obj.bermWidth}
|
||||
step={0.25}
|
||||
min={0}
|
||||
placeholder="—"
|
||||
onChange={patch(obj.id, "bermWidth")}
|
||||
/>
|
||||
<NumField
|
||||
label={t("site.excavation.bermHeight")}
|
||||
value={obj.bermHeight}
|
||||
step={0.5}
|
||||
min={0}
|
||||
placeholder="—"
|
||||
onChange={patch(obj.id, "bermHeight")}
|
||||
/>
|
||||
<ExcavationQty q={quantities.find((x) => x.id === obj.id)} />
|
||||
</div>
|
||||
)}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
|
||||
@@ -84,11 +84,14 @@ export function SiteRulesSection() {
|
||||
{rules.maxHeight !== undefined && check.maxTop !== null && (
|
||||
<div>
|
||||
{t(check.heightExceeded ? "siteRules.heightOver" : "siteRules.heightOk", {
|
||||
top: fmt(check.maxTop, 2),
|
||||
top: fmt(check.heightAboveTerrain ?? check.maxTop, 2),
|
||||
max: fmt(rules.maxHeight, 2),
|
||||
})}
|
||||
</div>
|
||||
)}
|
||||
{check.terrainMin !== null && (
|
||||
<div>{t("siteRules.terrainAtFacade", { z: fmt(check.terrainMin, 2) })}</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
|
||||
@@ -253,6 +253,17 @@ export function ToolIcon({ id }: { id: ToolId }) {
|
||||
/>
|
||||
</svg>
|
||||
);
|
||||
case "grid":
|
||||
// Achsraster: zwei Achsen mit Blasen.
|
||||
return (
|
||||
<svg {...common}>
|
||||
<line x1="5" y1="5" x2="5" y2="15" strokeDasharray="2 1" />
|
||||
<line x1="11" y1="5" x2="11" y2="15" strokeDasharray="2 1" />
|
||||
<line x1="1" y1="10" x2="15" y2="10" strokeDasharray="2 1" />
|
||||
<circle cx="5" cy="3" r="2" fill="none" />
|
||||
<circle cx="11" cy="3" r="2" fill="none" />
|
||||
</svg>
|
||||
);
|
||||
case "pointmarker":
|
||||
// Kreuz-in-Kreis (Punkt-/Knotenmarker).
|
||||
return (
|
||||
@@ -347,6 +358,7 @@ const TOOLS_2D: ToolId[] = [
|
||||
"scalebar",
|
||||
"revcloud",
|
||||
"pointmarker",
|
||||
"grid",
|
||||
"wipeout",
|
||||
"text",
|
||||
"leader",
|
||||
@@ -355,7 +367,7 @@ const TOOLS_2D: ToolId[] = [
|
||||
"image",
|
||||
];
|
||||
const TOOLS_3D: ToolId[] = ["wall", "ceiling", "window", "door", "stair", "room"];
|
||||
const COMMANDS_3D = ["column", "ceilingopening", "roof", "roofhole", "roofwindow", "dormer", "extrude", "solid", "solidbool", "sectionline", "viewline", "autodim"];
|
||||
const COMMANDS_3D = ["column", "ceilingopening", "roof", "roofhole", "roofwindow", "dormer", "extrude", "revolve", "loft", "solid", "solidbool", "sectionline", "viewline", "autodim", "excavation"];
|
||||
const COMMANDS_EDIT = ["move", "copy", "array", "rotate", "mirror", "offset", "multiline", "trim", "break", "extend", "fillet", "chamfer", "join", "defblock", "measure"];
|
||||
|
||||
type ToolsView = "list" | "icons";
|
||||
|
||||
@@ -26,6 +26,7 @@ import { ElementTreePanel, ElementsTabIcon } from "./ElementTreePanel";
|
||||
import { ViewSnapshotsPanel, ViewSnapshotsTabIcon } from "./ViewSnapshotsPanel";
|
||||
import { LayoutsPanel, LayoutsTabIcon } from "./LayoutsPanel";
|
||||
import { BcfPanel } from "./BcfPanel";
|
||||
import { ClashPanel } from "./ClashPanel";
|
||||
import { HistoryPanel } from "./HistoryPanel";
|
||||
import {
|
||||
ToolsTabIcon,
|
||||
@@ -52,6 +53,7 @@ export const BUILTIN_PANEL_IDS = {
|
||||
viewSnapshots: "view-snapshots",
|
||||
layouts: "layouts",
|
||||
bcf: "bcf",
|
||||
clash: "clash",
|
||||
history: "history",
|
||||
} as const;
|
||||
|
||||
@@ -162,6 +164,16 @@ registerPanel({
|
||||
render: () => <BcfPanel />,
|
||||
});
|
||||
|
||||
// Kollisionen ([T8]) — Treffer der Kollisionsprüfung, Klick zoomt im 3D auf die Durchdringung. Nicht im
|
||||
// Standard-Layout; öffnet sich beim Prüflauf („Modell > Kollisionsprüfung") bzw. über „Fenster > Panels".
|
||||
registerPanel({
|
||||
id: BUILTIN_PANEL_IDS.clash,
|
||||
title: "nav.clash",
|
||||
icon: <BcfTabIcon />,
|
||||
hasDisplayMode: false,
|
||||
render: () => <ClashPanel />,
|
||||
});
|
||||
|
||||
// Verlauf ([84]) — Undo-Schritte als Liste, Klick springt zum Schritt. Nicht im Standard-Layout,
|
||||
// erreichbar über „Bearbeiten > Verlauf" bzw. „Fenster > Panels".
|
||||
registerPanel({
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
// Sitzungszustand der Kollisionsprüfung ([T8]): die Ergebnisse der letzten Prüfung leben ausserhalb des
|
||||
// Projekts (Marker im Grundriss kommen weiterhin als Zeichnungs-Elemente), damit Liste (ClashPanel) und
|
||||
// 3D-Hervorhebung (viewportContent) dieselben Treffer zeigen. Kleiner Modul-Speicher wie `bcfSession`.
|
||||
|
||||
import { useSyncExternalStore } from "react";
|
||||
import { clashMarkerOps, runClashCheck, type Clash } from "../analysis/clash";
|
||||
import { t } from "../i18n";
|
||||
import { getState } from "../state/appStore";
|
||||
|
||||
export interface ClashSession {
|
||||
clashes: Clash[];
|
||||
/** Index des gewählten Treffers (Liste/Zoom) oder null. */
|
||||
selected: number | null;
|
||||
/** Prüfung läuft. */
|
||||
running: boolean;
|
||||
}
|
||||
|
||||
let state: ClashSession = { clashes: [], selected: null, running: false };
|
||||
const listeners = new Set<() => void>();
|
||||
|
||||
export const getClashSession = (): ClashSession => state;
|
||||
|
||||
export function setClashSession(patch: Partial<ClashSession>): void {
|
||||
state = { ...state, ...patch };
|
||||
for (const l of listeners) l();
|
||||
}
|
||||
|
||||
export function useClashSession(): ClashSession {
|
||||
return useSyncExternalStore(
|
||||
(cb) => {
|
||||
listeners.add(cb);
|
||||
return () => listeners.delete(cb);
|
||||
},
|
||||
getClashSession,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prüfung ausführen: Ergebnis in die Sitzung (Liste + 3D-Hervorhebung), Marker in den Grundriss, Meldung.
|
||||
* Läuft auf dem aktuellen Projektstand des Stores.
|
||||
*/
|
||||
export async function runClashAndStore(): Promise<void> {
|
||||
if (state.running) return;
|
||||
const st = getState();
|
||||
setClashSession({ running: true });
|
||||
try {
|
||||
const clashes = await runClashCheck(st.project);
|
||||
st.applyChange((p) => clashMarkerOps(p, clashes, st.activeCategoryCode));
|
||||
setClashSession({ clashes, selected: null, running: false });
|
||||
// window.alert ist im Tauri-WKWebView wirkungslos → Toast.
|
||||
st.notify(
|
||||
clashes.length === 0
|
||||
? t("clash.none")
|
||||
: `${t("clash.found")}: ${clashes.length} — ` +
|
||||
clashes
|
||||
.slice(0, 5)
|
||||
.map((c, k) => `K${k + 1} ${c.a.kind}↔${c.b.kind}${c.volume !== null ? ` ${c.volume.toFixed(3)} m³` : ""}`)
|
||||
.join(", "),
|
||||
clashes.length === 0 ? "info" : "warning",
|
||||
);
|
||||
} catch (err) {
|
||||
setClashSession({ running: false });
|
||||
st.notify(`${t("clash.failed")}: ${err instanceof Error ? err.message : String(err)}`, "error");
|
||||
}
|
||||
}
|
||||
+15
-1
@@ -40,6 +40,7 @@ import type {
|
||||
WallType,
|
||||
} from "../model/types";
|
||||
import type { MeasurementReadout, SnapSettings, ToolId } from "../tools/types";
|
||||
import type { TerrainOptions } from "../model/terrain";
|
||||
import type { Selection } from "../state/selectionInfo";
|
||||
import type { TextStylePreset } from "../text/richText";
|
||||
import type { ScheduleKind } from "../export/exportSchedule";
|
||||
@@ -296,6 +297,11 @@ export interface PanelHostValue {
|
||||
drawingId: string,
|
||||
patch: { start?: EndMark; end?: EndMark; sizeMm?: number },
|
||||
) => void;
|
||||
/** Achsraster ([112]): Blasenseite, Überstand (m), Blasen-Ø (Papier-mm), Geschosse (leer = alle). */
|
||||
onSetGridProps: (
|
||||
drawingId: string,
|
||||
patch: { bubbles?: "start" | "end" | "both"; extend?: number; bubbleMm?: number; levels?: string[] | undefined; show3d?: boolean },
|
||||
) => void;
|
||||
onSetDimensionStyle: (
|
||||
drawingId: string,
|
||||
patch: {
|
||||
@@ -397,6 +403,8 @@ export interface PanelHostValue {
|
||||
* "both" = heutiges Verhalten, "below"/"above" = die Wand endet an der Decke.
|
||||
*/
|
||||
onSetWallSliceTermination: (termination: SliceTermination) => void;
|
||||
/** An Dach anschliessen ([G2]): "auto" = Default (Wand endet an der Dach-Unterkante). */
|
||||
onSetWallRoofAttach: (attach: "auto" | "on" | "off") => void;
|
||||
/** Ansichtsschraffur ([100]) an der gewählten Wand bzw. am gewählten Dach drehen/versetzen. */
|
||||
onSetSurfacePatternPlacement?: (patch: { surfacePatternAngle?: number; surfacePatternOffset?: { x: number; y: number } }) => void;
|
||||
/** Weist der Wand einen Wandtyp-Preset (mehrschichtiger Aufbau) zu. */
|
||||
@@ -527,6 +535,8 @@ export interface PanelHostValue {
|
||||
onSetStairArrowStyle: (style: "line" | "filled") => void;
|
||||
/** Setzt den Referenzpunkt der Laufbreite (links/mitte/rechts). */
|
||||
onSetStairReferenz: (referenz: "links" | "mitte" | "rechts") => void;
|
||||
/** Radius der Mittelsäule (Wendel) in Metern; ≤ 0 entfernt sie. */
|
||||
onSetStairColumn: (radius: number) => void;
|
||||
/** Weist der Treppe einen Treppentyp (Bibliothek) zu; "" löst die Zuweisung. */
|
||||
onSetStairType: (typeId: string) => void;
|
||||
|
||||
@@ -581,7 +591,11 @@ export interface PanelHostValue {
|
||||
* Erzeugt aus einem ContourSet (per ID) ein Gelände-TIN. Liefert die neue
|
||||
* TerrainMesh-ID oder null (unbekannte ID / kein sinnvolles TIN).
|
||||
*/
|
||||
onGenerateTerrain: (contourSetId: string) => string | null;
|
||||
onGenerateTerrain: (contourSetId: string, opts?: TerrainOptions) => string | null;
|
||||
/** [T6]/[68] Ändert Felder eines Kontext-Objekts (Äquidistanz, Baugruben-Sohle …). */
|
||||
onPatchContextObject: (id: string, patch: Record<string, unknown>, coalesceKey?: string) => void;
|
||||
/** [68] Startet den Befehl „Baugrube" (Umriss zeichnen). */
|
||||
onStartExcavation: () => void;
|
||||
/**
|
||||
* Setzt/ersetzt den Georeferenzierungs-Bezug (`Project.geoAnchor`) — welcher
|
||||
* Modell-Punkt welcher realen LV95-Koordinate entspricht. `undefined` löscht
|
||||
|
||||
@@ -119,12 +119,14 @@ export function levelArg(level: DrawingLevel) {
|
||||
export function generateSectionPlan(
|
||||
output: SectionOutput,
|
||||
mono = false,
|
||||
opts: { hiddenLines?: boolean; visibleCodes?: Set<string>; categoryDisplay?: CategoryDisplayResolver; openings?: boolean } = {},
|
||||
opts: { hiddenLines?: boolean; visibleCodes?: Set<string>; categoryDisplay?: CategoryDisplayResolver; openings?: boolean; scaleDenominator?: number } = {},
|
||||
): Plan {
|
||||
const { project, level } = output;
|
||||
const text = JSON.stringify({
|
||||
level: levelArg(level),
|
||||
hiddenLines: !!opts.hiddenLines,
|
||||
// Massstabsnenner für die Achsblasen des Rasters ([112]); Default 100.
|
||||
scale: opts.scaleDenominator ?? 100,
|
||||
...visibilityArgs(project, opts.visibleCodes, opts.categoryDisplay),
|
||||
});
|
||||
const args = output.bodies.slice();
|
||||
|
||||
@@ -104,6 +104,11 @@ export interface RWall {
|
||||
* Nur für Boxen ohne Löcher/Öffnungen (render3d `WallInput::top_drop`).
|
||||
*/
|
||||
topDrop?: [number, number];
|
||||
/**
|
||||
* Ebene Oberkante unter einer Dachfläche ([G2]): `[z am Anfang, dz/dx, dz/dy]` (Grundriss-Meter);
|
||||
* übersteuert `topDrop` (render3d `WallInput::top_plane`). Fehlt = waagrecht.
|
||||
*/
|
||||
topPlane?: [number, number, number];
|
||||
color: RRgb;
|
||||
/**
|
||||
* Immer leer: die Schichten werden TS-seitig in eigene Voll-Boxen zerlegt
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
// [112]/[38] Achsraster und Bemassung im Store: eine Bemassung zwischen zwei Achsen folgt der verschobenen
|
||||
// Achse (Kern führt `pts` im selben Undo-Schritt nach); Rundmass folgt dem Kreis; Achsfang im Kern.
|
||||
import { describe, it, expect, beforeEach } from "vitest";
|
||||
import { getState, setState } from "./appStore";
|
||||
import { emptyProject } from "../model/sampleProject";
|
||||
import { addItems, cmdMutation, patchItem } from "../core";
|
||||
import type { Drawing2D } from "../model/types";
|
||||
|
||||
const dims = (): Drawing2D[] => getState().project.drawings2d.filter((d) => d.geom.shape === "dimension");
|
||||
const xs = (d: Drawing2D): number[] => (d.geom.shape === "dimension" ? d.geom.pts.map((q) => q.x) : []);
|
||||
|
||||
beforeEach(() => {
|
||||
setState({ project: emptyProject, undoDepth: 0, redoDepth: 0, canUndo: false, canRedo: false });
|
||||
getState().clearHistory();
|
||||
getState().setProject(cmdMutation({ cmd: "grid", at: [2, 1], xs: "6 6", ys: "5", ctx: { level: "eg", cat: "20" }, stamp: "g" }));
|
||||
});
|
||||
|
||||
describe("Achsraster im Store", () => {
|
||||
it("Bemassung zwischen zwei Achsen: Achse verschieben → Mass folgt, ein Undo-Schritt", () => {
|
||||
const grid = getState().project.drawings2d.find((d) => d.geom.shape === "grid")!;
|
||||
expect(grid).toBeDefined();
|
||||
// Achse 1 bei x = 2, Achse 2 bei x = 8, Kette auf y = 3 zwischen den gefangenen Achspunkten.
|
||||
getState().setProject(cmdMutation({ cmd: "dimension", pts: [[2, 3], [8, 3]], snaps: [[2, 3], [8, 3]], offset: 1, ctx: { level: "eg" }, stamp: "t" }));
|
||||
const d0 = dims()[0];
|
||||
expect(d0.geom.shape === "dimension" && d0.geom.refs?.map((r) => r?.feature)).toEqual(["axis", "axis"]);
|
||||
expect(xs(d0)).toEqual([2, 8]);
|
||||
|
||||
getState().applyChange((p) =>
|
||||
patchItem(p, "drawings2d", grid.id, (d) => (d.geom.shape === "grid" ? { ...d, geom: { ...d.geom, a: d.geom.a.map((x) => (x.label === "2" ? { ...x, pos: 7.5 } : x)) } } : d)),
|
||||
);
|
||||
expect(xs(dims()[0])).toEqual([2, 9.5]);
|
||||
getState().undo();
|
||||
expect(xs(dims()[0])).toEqual([2, 8]);
|
||||
getState().redo();
|
||||
expect(xs(dims()[0])).toEqual([2, 9.5]);
|
||||
});
|
||||
|
||||
it("Raster verschieben mit der Bemassung bleibt verbunden; Achsschnittpunkt hängt als axiscross an", () => {
|
||||
getState().setProject(cmdMutation({ cmd: "dimension", pts: [[2, 1], [8, 1]], snaps: [[2, 1], [8, 1]], offset: 1, ctx: { level: "eg" }, stamp: "t" }));
|
||||
const d = dims()[0];
|
||||
expect(d.geom.shape === "dimension" && d.geom.refs?.map((r) => r?.feature)).toEqual(["axiscross", "axiscross"]);
|
||||
// Ursprung des Rasters um (1, 0) verschieben → Punkte folgen.
|
||||
const grid = getState().project.drawings2d.find((x) => x.geom.shape === "grid")!;
|
||||
getState().applyChange((p) => patchItem(p, "drawings2d", grid.id, (x) => (x.geom.shape === "grid" ? { ...x, geom: { ...x.geom, origin: { x: 3, y: 1 } } } : x)));
|
||||
expect(xs(dims()[0])).toEqual([3, 9]);
|
||||
});
|
||||
|
||||
it("Radiusmass folgt dem Kreis", () => {
|
||||
getState().applyChange(
|
||||
addItems("drawings2d", [{ id: "K", type: "drawing2d", levelId: "eg", categoryCode: "20", geom: { shape: "circle", center: { x: 20, y: 20 }, r: 2 } } as Drawing2D]),
|
||||
);
|
||||
getState().setProject(cmdMutation({ cmd: "dimround", kind: "radius", pts: [[22, 20]], ctx: { level: "eg" }, stamp: "r" }));
|
||||
getState().applyChange((p) => patchItem(p, "drawings2d", "K", (x) => (x.geom.shape === "circle" ? { ...x, geom: { ...x.geom, center: { x: 30, y: 20 }, r: 3 } } : x)));
|
||||
const d = dims()[0];
|
||||
expect(d.geom.shape === "dimension" && d.geom.pts).toEqual([{ x: 30, y: 20 }, { x: 33, y: 20 }]);
|
||||
});
|
||||
});
|
||||
@@ -124,6 +124,8 @@ export interface WallInfo {
|
||||
layerBoundaries: LayerBoundaryChoice[];
|
||||
/** Terminierungs-Regel am Deckenanschluss (Default "both" = heutiges Verhalten). */
|
||||
sliceTermination: SliceTermination;
|
||||
/** An Dach anschliessen ([G2]): "auto" (Default), "on" (bis unter das Dach verlängern), "off". */
|
||||
roofAttach: "auto" | "on" | "off";
|
||||
wallTypeId: string;
|
||||
/** Aktuelle Gesamtdicke (Meter). */
|
||||
thickness: number;
|
||||
@@ -257,6 +259,8 @@ export interface StairInfo {
|
||||
arrowStyle?: "line" | "filled";
|
||||
/** Referenzpunkt der Laufbreite (links/mitte/rechts). Fehlt → "mitte". */
|
||||
referenz?: "links" | "mitte" | "rechts";
|
||||
/** Nur Wendel: Radius der Mittelsäule (Meter); fehlt → keine Säule. */
|
||||
centerColumn?: number;
|
||||
/** Zugewiesener Treppentyp (Bibliothek, `Stair.typeId`) oder undefined. */
|
||||
typeId?: string;
|
||||
/** Geschoss, dem die Treppe zugeordnet ist. */
|
||||
|
||||
+11
-6
@@ -9,9 +9,9 @@
|
||||
//
|
||||
// Bezeichner englisch, Kommentare deutsch (CONVENTIONS.md).
|
||||
|
||||
import { generateTerrainFromContours } from "../model/terrain";
|
||||
import { generateTerrainFromContours, type TerrainOptions } from "../model/terrain";
|
||||
import type { ContextObject, Project } from "../model/types";
|
||||
import { addItems, fieldOps, removeItems } from "../core/opsBuild";
|
||||
import { addItems, fieldOps, patchItem, removeItems } from "../core/opsBuild";
|
||||
import type { CoreOp } from "../core/ops";
|
||||
import { ensureContextCategories } from "../model/contextCategories";
|
||||
import type { StoreApi } from "./store";
|
||||
@@ -32,7 +32,9 @@ export interface SiteSlice {
|
||||
* weiteres Kontext-Objekt hinzu. Liefert die ID des neuen TerrainMesh, oder
|
||||
* null, wenn der ContourSet nicht existiert / kein Mesh entsteht.
|
||||
*/
|
||||
generateTerrain: (contourSetId: string) => string | null;
|
||||
generateTerrain: (contourSetId: string, opts?: TerrainOptions) => string | null;
|
||||
/** [T6]/[68] Ändert Felder eines Kontext-Objekts (Gelände, Baugrube) in einem Schritt; `coalesceKey` für Tippen. */
|
||||
patchContextObject: (id: string, patch: Record<string, unknown>, coalesceKey?: string) => void;
|
||||
/** Leert die gesamte Kontext-Schicht. */
|
||||
clearContext: () => void;
|
||||
}
|
||||
@@ -44,7 +46,7 @@ export interface SiteSlice {
|
||||
*/
|
||||
type SiteSliceDeps = {
|
||||
project: Project;
|
||||
applyChange: (ops: readonly CoreOp[] | ((p: Project) => readonly CoreOp[])) => void;
|
||||
applyChange: (ops: readonly CoreOp[] | ((p: Project) => readonly CoreOp[]), coalesceKey?: string) => void;
|
||||
};
|
||||
|
||||
export function createSiteSlice(
|
||||
@@ -81,13 +83,16 @@ export function createSiteSlice(
|
||||
get().applyChange((p) => removeItems(p, "context", ids));
|
||||
},
|
||||
|
||||
generateTerrain: (contourSetId) => {
|
||||
patchContextObject: (id, patch, coalesceKey) =>
|
||||
get().applyChange((p) => patchItem(p, "context", id, (o) => ({ ...o, ...patch }) as ContextObject), coalesceKey),
|
||||
|
||||
generateTerrain: (contourSetId, opts) => {
|
||||
const ctx = get().project.context ?? [];
|
||||
const set = ctx.find(
|
||||
(o) => o.id === contourSetId && o.type === "contourSet",
|
||||
);
|
||||
if (!set || set.type !== "contourSet") return null;
|
||||
const terrain = generateTerrainFromContours(set.contours);
|
||||
const terrain = generateTerrainFromContours(set.contours, opts);
|
||||
if (terrain.indices.length === 0) return null; // kein sinnvolles TIN
|
||||
addToContext([terrain]);
|
||||
return terrain.id;
|
||||
|
||||
@@ -169,6 +169,7 @@ export function usePanelHostBase(opts: {
|
||||
| "removeContextObject"
|
||||
| "removeContextObjects"
|
||||
| "generateTerrain"
|
||||
| "patchContextObject"
|
||||
| "commitTransformOn"
|
||||
| "setElementColor"
|
||||
| "setElementWeight"
|
||||
@@ -293,6 +294,7 @@ export function usePanelHostBase(opts: {
|
||||
removeContextObject,
|
||||
removeContextObjects,
|
||||
generateTerrain,
|
||||
patchContextObject,
|
||||
commitTransformOn,
|
||||
setElementColor,
|
||||
setElementWeight,
|
||||
@@ -600,6 +602,17 @@ export function usePanelHostBase(opts: {
|
||||
patchItem(p, "drawings2d", drawingId, (d) => ({ ...d, endMarks: { ...d.endMarks, ...patch } })),
|
||||
),
|
||||
),
|
||||
onSetGridProps: (drawingId, patch) =>
|
||||
setProject(
|
||||
opsMutation((p) =>
|
||||
patchItem(p, "drawings2d", drawingId, (d) => {
|
||||
if (d.geom.shape !== "grid") return d;
|
||||
const geom = { ...d.geom, ...patch };
|
||||
if (patch.levels === undefined && "levels" in patch) delete geom.levels;
|
||||
return { ...d, geom };
|
||||
}),
|
||||
),
|
||||
),
|
||||
onSetDimensionStyle: (drawingId, patch) =>
|
||||
setProject(
|
||||
opsMutation((p) =>
|
||||
@@ -800,6 +813,11 @@ export function usePanelHostBase(opts: {
|
||||
sliceTermination: termination === "both" ? undefined : termination,
|
||||
});
|
||||
},
|
||||
onSetWallRoofAttach: (attach) => {
|
||||
if (selection?.kind === "wall")
|
||||
// "auto" ist der Default ⇒ als undefined speichern.
|
||||
updateWall(selection.id, { roofAttach: attach === "auto" ? undefined : attach === "on" });
|
||||
},
|
||||
onSetWallType: (wallTypeId) => {
|
||||
if (selection?.kind === "wall")
|
||||
updateWall(selection.id, { wallTypeId });
|
||||
@@ -967,6 +985,10 @@ export function usePanelHostBase(opts: {
|
||||
onSetStairArrowStyle: (arrowStyle) => {
|
||||
if (selection?.kind === "stair") updateStair(selection.id, { arrowStyle });
|
||||
},
|
||||
onSetStairColumn: (radius) => {
|
||||
if (selection?.kind === "stair")
|
||||
updateStair(selection.id, { centerColumn: radius > 0 ? radius : undefined });
|
||||
},
|
||||
onSetStairReferenz: (referenz) => {
|
||||
if (selection?.kind === "stair") updateStair(selection.id, { referenz });
|
||||
},
|
||||
@@ -1083,6 +1105,8 @@ export function usePanelHostBase(opts: {
|
||||
onRemoveContextObject: removeContextObject,
|
||||
onRemoveContextObjects: removeContextObjects,
|
||||
onGenerateTerrain: generateTerrain,
|
||||
onPatchContextObject: patchContextObject,
|
||||
onStartExcavation: () => onRunCommand("excavation"),
|
||||
onSetGeoAnchor: (anchor) => {
|
||||
applyChange((p) => setFieldIfChanged(p, "geoAnchor", anchor));
|
||||
},
|
||||
|
||||
@@ -48,6 +48,8 @@ function contextObjectsBounds(objs: ContextObject[]): Vec2[] | null {
|
||||
} else if (obj.type === "image") {
|
||||
acc(obj.min.x, obj.min.y);
|
||||
acc(obj.max.x, obj.max.y);
|
||||
} else if (obj.type === "excavation") {
|
||||
for (const p of obj.outline) acc(p.x, p.y);
|
||||
} else {
|
||||
// importedMesh / terrainMesh: flaches (x,y,z…)-Array, Stride 3.
|
||||
const pos = obj.positions;
|
||||
@@ -351,6 +353,7 @@ export function useProjectActions(
|
||||
const removeContextObject = useStore((s) => s.removeContextObject);
|
||||
const removeContextObjects = useStore((s) => s.removeContextObjects);
|
||||
const generateTerrain = useStore((s) => s.generateTerrain);
|
||||
const patchContextObject = useStore((s) => s.patchContextObject);
|
||||
const moveGripOf = useStore((s) => s.moveGripOf);
|
||||
const moveElementByOf = useStore((s) => s.moveElementByOf);
|
||||
const moveEdgeOf = useStore((s) => s.moveEdgeOf);
|
||||
@@ -465,6 +468,7 @@ export function useProjectActions(
|
||||
removeContextObject,
|
||||
removeContextObjects,
|
||||
generateTerrain,
|
||||
patchContextObject,
|
||||
moveGripOf,
|
||||
moveElementByOf,
|
||||
moveEdgeOf,
|
||||
|
||||
@@ -4945,11 +4945,39 @@ body {
|
||||
}
|
||||
.site-panel .site-row {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
padding: 4px 6px;
|
||||
border-radius: 5px;
|
||||
}
|
||||
/* [T6]/[68] Felder von Gelände und Baugrube unter der Zeile. */
|
||||
.site-panel .site-props {
|
||||
flex: 1 0 100%;
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 4px 8px;
|
||||
font-size: 11px;
|
||||
}
|
||||
.site-panel .site-prop {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 4px;
|
||||
}
|
||||
.site-panel .site-prop input {
|
||||
width: 64px;
|
||||
}
|
||||
.site-panel .site-qty {
|
||||
grid-column: 1 / -1;
|
||||
color: var(--text-dim, inherit);
|
||||
}
|
||||
.site-panel .site-check {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 3px;
|
||||
font-size: 11px;
|
||||
}
|
||||
.site-panel .site-row:hover {
|
||||
background: var(--accent-dim);
|
||||
}
|
||||
|
||||
@@ -346,6 +346,18 @@ const pointmarkerTool: Tool = {
|
||||
onCancel: (s) => [s, { draft: null, done: true }],
|
||||
};
|
||||
|
||||
// Achsraster ([112]): Platzhalter-Werkzeug, gekoppelt an den `grid`-Befehl (Ursprung + Feldweiten).
|
||||
const gridTool: Tool = {
|
||||
id: "grid",
|
||||
labelKey: "tool.grid",
|
||||
hintKey: () => "tool.grid.hint",
|
||||
init: () => ({ phase: "idle" }),
|
||||
onClick: (s) => [s, { draft: null }],
|
||||
onMove: (s) => [s, { draft: null }],
|
||||
onCommitGesture: (s) => [s, { draft: null, done: true }],
|
||||
onCancel: (s) => [s, { draft: null, done: true }],
|
||||
};
|
||||
|
||||
// Wipeout/Maskenregion: Platzhalter-Werkzeug, gekoppelt an den
|
||||
// `wipeout`-Befehl (Punktfolge, schliesst automatisch → weisse Maskenfläche).
|
||||
// Freies 2D-Element (nicht floorOnly).
|
||||
@@ -456,6 +468,7 @@ const TOOLS: Record<ToolId, Tool> = {
|
||||
scalebar: scalebarTool,
|
||||
revcloud: revcloudTool,
|
||||
pointmarker: pointmarkerTool,
|
||||
grid: gridTool,
|
||||
wipeout: wipeoutTool,
|
||||
text: textTool,
|
||||
leader: leaderTool,
|
||||
|
||||
@@ -35,6 +35,7 @@ export type ToolId =
|
||||
| "scalebar"
|
||||
| "revcloud"
|
||||
| "pointmarker"
|
||||
| "grid"
|
||||
| "wipeout"
|
||||
| "text"
|
||||
| "leader"
|
||||
|
||||
@@ -182,6 +182,15 @@ export function CommandIcon({ name }: { name: string }) {
|
||||
<line x1="8" y1="3" x2="8" y2="9" strokeDasharray="1.5 1.5" />
|
||||
</svg>
|
||||
);
|
||||
case "excavation":
|
||||
// Baugrube: Geländelinie mit Grube, Böschungen schräg.
|
||||
return (
|
||||
<svg {...common}>
|
||||
<polyline points="1,5 4,5 6.5,11 9.5,11 12,5 15,5" />
|
||||
<line x1="4.8" y1="6.5" x2="3.6" y2="6.5" />
|
||||
<line x1="11.2" y1="6.5" x2="12.4" y2="6.5" />
|
||||
</svg>
|
||||
);
|
||||
case "roofhole":
|
||||
// Dachhof: Dach-Umriss mit ausgespartem Innenhof.
|
||||
return (
|
||||
@@ -225,6 +234,24 @@ export function CommandIcon({ name }: { name: string }) {
|
||||
<path d="M9.5 12.5 L12.5 9.5 L12.5 4.5" />
|
||||
</svg>
|
||||
);
|
||||
case "revolve":
|
||||
// Rotationskörper: Profil neben einer Achse, Drehbogen.
|
||||
return (
|
||||
<svg {...common}>
|
||||
<path d="M8 2.5 V13.5" strokeDasharray="1.4 1.2" />
|
||||
<path d="M9.5 4.5 H13 V11.5 H9.5 Z" />
|
||||
<path d="M6.5 4.5 H3 V11.5 H6.5" />
|
||||
</svg>
|
||||
);
|
||||
case "loft":
|
||||
// Loft: grosses Profil unten, kleines oben, verbunden.
|
||||
return (
|
||||
<svg {...common}>
|
||||
<rect x="2.5" y="9.5" width="11" height="3" />
|
||||
<rect x="5.5" y="3.5" width="5" height="2" />
|
||||
<path d="M2.5 9.5 L5.5 5.5 M13.5 9.5 L10.5 5.5" />
|
||||
</svg>
|
||||
);
|
||||
case "voidbox":
|
||||
// Durchbruch: Wand mit gestricheltem, durchkreuztem Ausschnitt.
|
||||
return (
|
||||
|
||||
@@ -5,6 +5,8 @@ import { afterEach, describe, expect, it } from "vitest";
|
||||
import { projectToModel3d, sampleProject } from "../core";
|
||||
import {
|
||||
FOV_Y,
|
||||
focusCamera,
|
||||
focusedCamera,
|
||||
camera3dFromViewCamera,
|
||||
captureSnapshot,
|
||||
getCamera,
|
||||
@@ -153,6 +155,25 @@ describe("Schnittebene", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("Fokus auf einen Punkt (Kollisionsliste)", () => {
|
||||
it("zentriert das Ziel auf den Modellpunkt, behält die Blickrichtung, Abstand folgt dem Radius", () => {
|
||||
const cam = orbitCamera({ yaw: 0.4, pitch: 0.3, dist: 15, target: [1, 2, 3], ortho: false, orthoHalfHeight: 8 });
|
||||
const f = focusedCamera(cam, [4, 5, 6], 2);
|
||||
close(f.target, modelToWorld([4, 5, 6]));
|
||||
const d = (c: Camera3d) => {
|
||||
const v = [c.target[0] - c.eye[0], c.target[1] - c.eye[1], c.target[2] - c.eye[2]];
|
||||
const l = Math.hypot(...v);
|
||||
return v.map((x) => x / l);
|
||||
};
|
||||
close(d(f), d(cam));
|
||||
const near = Math.hypot(...f.target.map((t, i) => t - f.eye[i]));
|
||||
expect(near).toBeGreaterThan(2);
|
||||
expect(near).toBeLessThan(15);
|
||||
const ortho = focusedCamera({ ...cam, perspective: false, orthoHalfHeight: 8 }, [0, 0, 0], 2);
|
||||
expect(ortho.orthoHalfHeight).toBeLessThan(8);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Registrierung", () => {
|
||||
function fakeViewport() {
|
||||
const state = { cam: orbitCamera({ yaw: 0.4, pitch: 0.3, dist: 15, target: [1, 2, 3], ortho: false, orthoHalfHeight: 8 }), written: null as Camera3d | null, section: undefined as unknown };
|
||||
@@ -181,6 +202,14 @@ describe("Registrierung", () => {
|
||||
expect(setCamera(vc)).toBe(false);
|
||||
});
|
||||
|
||||
it("focusCamera schreibt die fokussierte Kamera in den Viewport (false ohne Viewport)", () => {
|
||||
expect(focusCamera([1, 2, 3], 1)).toBe(false);
|
||||
const { state, a } = fakeViewport();
|
||||
registerViewportCamera(a);
|
||||
expect(focusCamera([5, 6, 7], 1)).toBe(true);
|
||||
close(state.written!.target, modelToWorld([5, 6, 7]));
|
||||
});
|
||||
|
||||
it("getCamera → setCamera am angemeldeten Viewport lässt die Kamera unverändert", () => {
|
||||
const { state, a } = fakeViewport();
|
||||
registerViewportCamera(a);
|
||||
|
||||
@@ -257,6 +257,29 @@ export function setCamera(cam: ViewCamera, opts: { animate?: boolean } = {}): bo
|
||||
return c3 ? api.write(c3, opts.animate === true) : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Kamera, die einen Modellpunkt (x, y, Höhe) ins Ziel nimmt: gleiche Blickrichtung, Abstand so, dass eine
|
||||
* Kugel vom Radius `radius` (Meter) bequem ins Bild passt; orthografisch schrumpft die Sichthöhe.
|
||||
*/
|
||||
export function focusedCamera(cam: Camera3d, centerModel: readonly number[], radius: number): Camera3d {
|
||||
const target = modelToWorld(centerModel);
|
||||
const d = norm(sub(cam.target, cam.eye)) ?? ([0, 0, -1] as V3);
|
||||
const r = Math.max(radius, 0.5);
|
||||
const dist = Math.max((r * 2.2) / Math.tan((cam.fovY || FOV_Y) / 2), 1.5);
|
||||
return {
|
||||
...cam,
|
||||
target,
|
||||
eye: [target[0] - d[0] * dist, target[1] - d[1] * dist, target[2] - d[2] * dist],
|
||||
orthoHalfHeight: cam.perspective ? cam.orthoHalfHeight : r * 2.2,
|
||||
};
|
||||
}
|
||||
|
||||
/** Fokus der Live-Kamera auf einen Modellpunkt; `false` ohne Viewport. */
|
||||
export function focusCamera(centerModel: readonly number[], radius: number, opts: { animate?: boolean } = {}): boolean {
|
||||
const cur = api?.read();
|
||||
return api && cur ? api.write(focusedCamera(cur.camera, centerModel, radius), opts.animate !== false) : false;
|
||||
}
|
||||
|
||||
/** PNG des aktuellen 3D-Bildes, oder null (kein Viewport, leeres/nicht lesbares Bild). */
|
||||
export async function captureSnapshot(opts: { maxEdge?: number } = {}): Promise<Uint8Array | null> {
|
||||
if (!api) return null;
|
||||
|
||||
@@ -47,5 +47,6 @@ export function drawingMoveAnchor(d: Drawing2D, verts: Vec2[]): Vec2 | null {
|
||||
const g = d.geom;
|
||||
if (g.shape === "circle" || g.shape === "arc" || g.shape === "ellipse") return g.center;
|
||||
if (g.shape === "text" || g.shape === "kote" || g.shape === "detailref" || g.shape === "scalebar" || g.shape === "pointmarker") return g.at;
|
||||
if (g.shape === "grid") return g.origin;
|
||||
return null;
|
||||
}
|
||||
@@ -37,6 +37,8 @@ import { unitsForLevel } from "../tools/displayUnits";
|
||||
import { setSheetOwnerOutlines, setSheetSnapSegments, snapSegmentsFromPrimitives } from "../tools/sheetSnapGeometry";
|
||||
import { pushNativeScene, pushNativeWalls } from "./plan/nativeSync";
|
||||
import { selectionHighlightLines } from "../core";
|
||||
import { clashHighlightLines } from "../analysis/clash";
|
||||
import { useClashSession } from "../panels/clashSession";
|
||||
import { applyGroupDimmingToPlan } from "../state/groupActions";
|
||||
import { PlanView } from "./plan/PlanView";
|
||||
import type {
|
||||
@@ -61,6 +63,8 @@ import type { DetailLevel, RenderMode, View3d, ViewType } from "../model/viewTyp
|
||||
* grauen Wand-/Deckenton, dem hellen Hidden-Line-Weiss und dem Bodenraster ab.
|
||||
*/
|
||||
const HIGHLIGHT_RGB: [number, number, number] = [1.0, 0.5, 0.1];
|
||||
/** Rot der Kollisions-Hüllquader im 3D ([T8]). */
|
||||
const CLASH_RGB: [number, number, number] = [0.88, 0.14, 0.16];
|
||||
|
||||
/** Hauptinhalt — abhängig von der aktiven Zeichnungsebene und dem Ansichtstyp. */
|
||||
export function Content({
|
||||
@@ -285,7 +289,8 @@ export function Content({
|
||||
// im WASM-Zweig (Viewport3D reicht sie nur dort an Wasm3DViewport durch);
|
||||
// die three.js-Sicht hebt die Auswahl weiterhin über ihr eigenes Material
|
||||
// hervor. Leere Auswahl → null (kein Highlight).
|
||||
const highlightLines = useMemo(
|
||||
const clashes = useClashSession().clashes;
|
||||
const selectionLines = useMemo(
|
||||
() =>
|
||||
selectedWallIds.length === 0 &&
|
||||
selectedCeilingIds.length === 0 &&
|
||||
@@ -314,6 +319,16 @@ export function Content({
|
||||
selectedContextObjectIds,
|
||||
],
|
||||
);
|
||||
// Kollisionen der letzten Prüfung: rote Hüllquader zusätzlich zur Auswahl-Hervorhebung.
|
||||
const highlightLines = useMemo(() => {
|
||||
if (clashes.length === 0) return selectionLines;
|
||||
const clashLines = clashHighlightLines(clashes, CLASH_RGB);
|
||||
if (!selectionLines) return clashLines;
|
||||
const merged = new Float32Array(selectionLines.length + clashLines.length);
|
||||
merged.set(selectionLines, 0);
|
||||
merged.set(clashLines, selectionLines.length);
|
||||
return merged;
|
||||
}, [selectionLines, clashes]);
|
||||
|
||||
if (level.kind === "section" || level.kind === "elevation") {
|
||||
return (
|
||||
@@ -669,7 +684,7 @@ function useCrossKindOverlay(
|
||||
} else if (l.kind === "section") {
|
||||
const sOut = sectionOutputs[l.id];
|
||||
prims = sOut
|
||||
? generateSectionPlan(sOut, mono, { hiddenLines: l.hiddenLines, visibleCodes, categoryDisplay })
|
||||
? generateSectionPlan(sOut, mono, { hiddenLines: l.hiddenLines, visibleCodes, categoryDisplay, scaleDenominator })
|
||||
.primitives
|
||||
: [];
|
||||
} else {
|
||||
@@ -1155,9 +1170,10 @@ function SectionPlanView({
|
||||
visibleCodes,
|
||||
categoryDisplay,
|
||||
openings: true,
|
||||
scaleDenominator,
|
||||
})
|
||||
: null,
|
||||
[isElevation, output, mono, level.hiddenLines, visibleCodes, categoryDisplay, inputs],
|
||||
[isElevation, output, mono, level.hiddenLines, visibleCodes, categoryDisplay, inputs, scaleDenominator],
|
||||
);
|
||||
const rawPlan = isElevation ? elevationPlan : sectionPlan;
|
||||
// Grundriss-Unterlage (Nutzer-Wunsch: "in der Ansicht auch mal einen
|
||||
|
||||
Reference in new issue
Block a user