[280] Träger/Unterzug als eigenes Bauteil: Project.beams, Plan (gestrichelt mit Achse), Schnitt, Ansicht, 3D, IFC IfcBeam, DXF, Befehl traeger, Objekt-Info, Griffe, Beispiel Musterhaus komplex
This commit is contained in:
97 files changed
+1479
-81
No files matched your search
@@ -1,12 +1,12 @@
|
||||
viewBox -31.5 0 93 18.478
|
||||
bytes 179206
|
||||
bytes 179502
|
||||
circle 4
|
||||
g 1
|
||||
line 259
|
||||
line 261
|
||||
path 4
|
||||
polygon 982
|
||||
polygon 983
|
||||
polyline 123
|
||||
rect 1
|
||||
svg 1
|
||||
text 4
|
||||
hash 336574edc432bcfb
|
||||
hash 61214d28614f8dcb
|
||||
@@ -1,5 +1,5 @@
|
||||
meshes [1175]
|
||||
meshes[].color [3] x1175
|
||||
meshes [1176]
|
||||
meshes[].color [3] x1176
|
||||
meshes[].indices [1056]
|
||||
meshes[].indices [108] x6
|
||||
meshes[].indices [1140]
|
||||
@@ -35,7 +35,7 @@ meshes[].indices [300] x3
|
||||
meshes[].indices [31104]
|
||||
meshes[].indices [312]
|
||||
meshes[].indices [348] x6
|
||||
meshes[].indices [36] x1012
|
||||
meshes[].indices [36] x1013
|
||||
meshes[].indices [396]
|
||||
meshes[].indices [4092]
|
||||
meshes[].indices [4812] x2
|
||||
@@ -83,7 +83,7 @@ meshes[].positions [234]
|
||||
meshes[].positions [2412] x2
|
||||
meshes[].positions [2430] x3
|
||||
meshes[].positions [2436]
|
||||
meshes[].positions [24] x980
|
||||
meshes[].positions [24] x981
|
||||
meshes[].positions [252] x2
|
||||
meshes[].positions [2580]
|
||||
meshes[].positions [2583]
|
||||
@@ -150,4 +150,4 @@ walls[].start [2] x439
|
||||
walls[].startCut [4] x270
|
||||
walls[].topDrop [2] x22
|
||||
walls[].topPlane [3] x22
|
||||
hash 91dcb660a771029a
|
||||
hash 51132759a706b1b1
|
||||
@@ -0,0 +1,120 @@
|
||||
/**
|
||||
* [280] Träger/Unterzug: Befehl `traeger` (zwei Punkte → ein Träger), Grundriss (gestrichelt, Achse), 3D (Prisma),
|
||||
* Objekt-Info, Griff, Löschen über den Auswahlkanal der Stützen, Beispielprojekt „Musterhaus komplex“.
|
||||
* (Höhenlage, Schnitt längs/quer: Rust-Tests `beam_tests.rs`.)
|
||||
*/
|
||||
|
||||
import { describe, it, expect } from "vitest";
|
||||
import { generatePlan } from "./generatePlan";
|
||||
import { projectToModel3d } from "./toWalls3d";
|
||||
import { traegerCommand } from "../commands/cmds/traeger";
|
||||
import type { CommandContext } from "../commands/types";
|
||||
import { deriveSelection } from "../state/selectionInfo";
|
||||
import { buildComplexSampleProject } from "../model/sampleProjectComplex";
|
||||
import { applyOps } from "../core";
|
||||
import { lockOps } from "../state/objectLock";
|
||||
import { beamGripPoints } from "../core";
|
||||
import type { Beam, Project } from "../model/types";
|
||||
|
||||
const beam: Beam = { id: "B1", type: "beam", floorId: "eg", categoryCode: "50", start: { x: 1, y: 2 }, end: { x: 5, y: 2 }, width: 0.25, height: 0.4 };
|
||||
|
||||
function project(beams: Beam[]): Project {
|
||||
return {
|
||||
id: "t",
|
||||
name: "T",
|
||||
lineStyles: [{ id: "thin", name: "d", weight: 0.13, color: "#111", dash: null }],
|
||||
hatches: [{ id: "none", name: "Ohne", pattern: "none", scale: 1, angle: 0, color: "#111" }],
|
||||
components: [{ id: "a", name: "A", color: "#c8c8cc", hatchId: "none", joinPriority: 10 }],
|
||||
wallTypes: [{ id: "aw", name: "AW", layers: [{ componentId: "a", thickness: 0.3 }] }],
|
||||
drawingLevels: [{ id: "eg", name: "EG", kind: "floor", visible: true, locked: false, floorHeight: 2.6, cutHeight: 1.0, baseElevation: 0 }],
|
||||
layers: [{ code: "50", name: "Tragwerk", color: "#0a0a0a", lw: 0.5, visible: true, locked: false }],
|
||||
walls: [],
|
||||
openings: [],
|
||||
ceilings: [],
|
||||
stairs: [],
|
||||
rooms: [],
|
||||
beams,
|
||||
drawings2d: [],
|
||||
context: [],
|
||||
};
|
||||
}
|
||||
|
||||
describe("Träger — Grundriss, 3D, Objekt-Info", () => {
|
||||
it("Grundriss: über der Schnitthöhe, Kanten gestrichelt und Achse als Linie", () => {
|
||||
const plan = generatePlan(project([beam]), "eg", new Set(["50"]));
|
||||
const prims = plan.primitives;
|
||||
expect(prims.some((p) => p.kind === "polygon" && p.columnId === "B1")).toBe(true);
|
||||
const dashed = prims.filter((p) => p.kind === "line" && p.dash && p.cls !== "beam-axis");
|
||||
expect(dashed.length).toBe(4);
|
||||
expect(prims.filter((p) => p.kind === "line" && p.cls === "beam-axis").length).toBe(1);
|
||||
// Klasse aus: nichts.
|
||||
expect(generatePlan(project([beam]), "eg", new Set()).primitives.filter((p) => p.kind === "polygon" && p.columnId === "B1").length).toBe(0);
|
||||
});
|
||||
|
||||
it("3D: ein Prisma 4 m × 25 cm, Oberkante an der Geschoss-Oberkante (keine Decke darüber)", () => {
|
||||
const m = projectToModel3d(project([beam]));
|
||||
const meshes = m.meshes.filter((x) => x.kind === "extrusion");
|
||||
expect(meshes.length).toBe(1);
|
||||
const pos = Array.from(meshes[0].positions);
|
||||
const z = pos.filter((_, i) => i % 3 === 2);
|
||||
expect(Math.max(...z)).toBeCloseTo(2.6, 6);
|
||||
expect(Math.min(...z)).toBeCloseTo(2.2, 6);
|
||||
const x = pos.filter((_, i) => i % 3 === 0);
|
||||
expect(Math.max(...x) - Math.min(...x)).toBeCloseTo(4, 6);
|
||||
});
|
||||
|
||||
it("Objekt-Info: kind beam mit Querschnitt, Länge und UK/OK; Griffe Anfang, Ende, Mitte", () => {
|
||||
const p = project([{ ...beam, profileName: "HEB 200", topOffset: 0.1 }]);
|
||||
const info = deriveSelection(p, { columns: ["B1"] });
|
||||
expect(info?.kind).toBe("beam");
|
||||
expect(info?.beam).toMatchObject({ width: 0.25, height: 0.4, profileName: "HEB 200", topOffset: 0.1, length: 4 });
|
||||
expect(info?.beam?.zTop).toBeCloseTo(2.7, 6);
|
||||
expect(beamGripPoints(beam)).toEqual([{ x: 1, y: 2 }, { x: 5, y: 2 }, { x: 3, y: 2 }]);
|
||||
});
|
||||
|
||||
it("Sperre über den Auswahlkanal der Stützen", () => {
|
||||
const p = project([beam]);
|
||||
const ops = lockOps(p, "columnIds", "B1", true);
|
||||
expect(ops.length).toBe(1);
|
||||
const q = applyOps(p, ops);
|
||||
expect(q.beams?.[0].locked).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Befehl traeger", () => {
|
||||
const ctxOf = (p: Project): CommandContext => ({ project: p, level: p.drawingLevels[0], defaultCategoryCode: "50", activeLineStyleId: "thin", activeWallTypeId: "aw", lastPoint: null, selection: { wallIds: [], drawingId: null } });
|
||||
|
||||
it("zwei Punkte legen einen Träger an und beenden den Befehl", () => {
|
||||
const p = project([]);
|
||||
const ctx = ctxOf(p);
|
||||
const [s1, r1] = traegerCommand.onInput(traegerCommand.init(), { kind: "point", point: { x: 0, y: 0 } }, ctx);
|
||||
expect(r1.done).toBeFalsy();
|
||||
const [, mv] = traegerCommand.onMove!(s1, { x: 3, y: 0 }, null, ctx);
|
||||
expect(mv.draft?.preview.length).toBeGreaterThan(0);
|
||||
const [, r2] = traegerCommand.onInput(s1, { kind: "point", point: { x: 3, y: 0 } }, ctx);
|
||||
expect(r2.done).toBe(true);
|
||||
const next = r2.commit!(p);
|
||||
expect(next.beams?.length).toBe(1);
|
||||
const item = next.beams![0];
|
||||
expect(item).toMatchObject({ type: "beam", floorId: "eg", categoryCode: "50", width: 0.25, height: 0.4, end: { x: 3, y: 0 } });
|
||||
});
|
||||
|
||||
it("Nulllänge wird ignoriert", () => {
|
||||
const p = project([]);
|
||||
const ctx = ctxOf(p);
|
||||
const [s1] = traegerCommand.onInput(traegerCommand.init(), { kind: "point", point: { x: 1, y: 1 } }, ctx);
|
||||
const [s2, r] = traegerCommand.onInput(s1, { kind: "point", point: { x: 1, y: 1 } }, ctx);
|
||||
expect(r.done).toBeFalsy();
|
||||
expect(s2).toBe(s1);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Beispielprojekt Musterhaus komplex", () => {
|
||||
it("enthält den Unterzug im EG; Schnitt A-A schneidet ihn quer", () => {
|
||||
const p = buildComplexSampleProject();
|
||||
const b = p.beams?.find((x) => x.id === "tg-eg-1");
|
||||
expect(b).toBeTruthy();
|
||||
const plan = generatePlan(p, "eg", new Set(["25", "30", "20"]));
|
||||
expect(plan.primitives.some((q) => q.kind === "polygon" && q.columnId === "tg-eg-1")).toBe(true);
|
||||
});
|
||||
});
|
||||
@@ -22,7 +22,7 @@ function collection(project: Project, kind: PickKind): readonly WithCategory[] {
|
||||
case "stair": return p.stairs ?? [];
|
||||
case "room": return p.rooms ?? [];
|
||||
case "roof": return p.roofs ?? [];
|
||||
case "column": return p.columns ?? [];
|
||||
case "column": return [...(p.columns ?? []), ...(p.beams ?? [])];
|
||||
case "context": return p.context ?? [];
|
||||
case "solid": return p.extrudedSolids ?? [];
|
||||
case "tree": return p.trees ?? [];
|
||||
|
||||
@@ -46,7 +46,7 @@ function candidateCodes(project: Project): Set<string> {
|
||||
const codes = new Set<string>();
|
||||
for (const c of flattenCategories(project.layers)) codes.add(c.code);
|
||||
// [115] Freie Körper und Stützen tragen ihre Klasse wie jedes Bauteil.
|
||||
for (const list of [project.walls, project.ceilings, project.roofs, project.stairs, project.openings, project.extrudedSolids, project.columns]) {
|
||||
for (const list of [project.walls, project.ceilings, project.roofs, project.stairs, project.openings, project.extrudedSolids, project.columns, project.beams]) {
|
||||
for (const e of list ?? []) codes.add(e.categoryCode);
|
||||
}
|
||||
for (const c of project.context ?? []) if (c.type === "terrainMesh" && c.categoryCode !== undefined) codes.add(c.categoryCode);
|
||||
|
||||
Reference in new issue
Block a user