[158] Raumbuch: Nutzung und Oberflächen je Raum (Boden/Wand/Decke, Aufbau), Raum-Belag im Grundriss statt Deckenbelag, Nassraum aus Nutzung, Belagszeile im Stempel, Objekt-Info, Liste/Blatt-Tabelle/CSV, Mengen, IFC-Psets mit Rundreise

This commit is contained in:
Claude committed 2026-11-07 16:31:05 +00:00
1 parent 58fd92b6ce
commit ef9a651781
27 files changed
+1406 -26

No files matched your search

+17 -1
View File
@@ -16,7 +16,7 @@
// das Massstab-Kriterium einer Regel (ab/bis 1:n) gilt nach --scale
// dossier-cli <projekt.obp> ifc [--ebkph] [--ebenen] (IFC mit eBKP-H-Hauptgruppen bzw. Modell-Ebenen als Klassifikation)
// --schema 4|2x3: IFC4 (Standard) oder IFC2x3 (Coordination View 2.0)
// dossier-cli <projekt.obp> dxf [--binary] [--scale 100] [--dim-unit cm] [--layout]|dwg|ifc|step|obj|stl|glb|gltf|schedule [--openings|--elements] [--format json|csv|svg|pdf]|kennzahlen [--sia416] [--ivhb] [--format json|csv|svg|pdf] [--agsf m2] [--gruenflaeche m2] [--agf-basis gf|ngf|nf] [--untergeschosse]|raumprogramm [--import tabelle] [--sheet name|nr] [--mode replace|append] [--tolerance %] [--generate] [--format json|csv|svg|pdf] [--save projekt.obp]|sun [--level EG] [--out datei]
// dossier-cli <projekt.obp> dxf [--binary] [--scale 100] [--dim-unit cm] [--layout]|dwg|ifc|step|obj|stl|glb|gltf|schedule [--openings|--elements|--rooms] [--format json|csv|svg|pdf]|kennzahlen [--sia416] [--ivhb] [--format json|csv|svg|pdf] [--agsf m2] [--gruenflaeche m2] [--agf-basis gf|ngf|nf] [--untergeschosse]|raumprogramm [--import tabelle] [--sheet name|nr] [--mode replace|append] [--tolerance %] [--generate] [--format json|csv|svg|pdf] [--save projekt.obp]|sun [--level EG] [--out datei]
// glb/gltf = glTF 2.0 (Y-up, Meter, Geschoss als Eltern; --flat ohne Geschoss-Knoten)
// dossier-cli convert <eingabe> <ausgabe> [--cmd "befehl"]… Format nach Endung: dxf/dwg/ifc/obp → obp-Import,
// obp → dxf/dwg/ifc/obj/stl/glb/gltf/step; --cmd: weitere Befehle
@@ -75,6 +75,8 @@ import {
buildOpeningReport,
openingSchedule,
elementSchedule,
roomBook,
buildRoomBookReport,
buildElementReport,
areaReportToCsv,
areaReportToSvg,
@@ -840,6 +842,20 @@ async function execute(project: Project, file: string, command: string, rest: st
}
return 0;
}
// --rooms: Raumbuch mit Oberflächen und Mengen ([158]) [--format json|csv|svg|pdf] (Default csv)
if (args.flags.has("rooms")) {
const format = args.flags.get("format") ?? "csv";
const stem = `${project.name || "projekt"}-raumbuch`;
if (format === "json") out(args, JSON.stringify(roomBook(project), null, 2), `${stem}.json`);
else {
const report = buildRoomBookReport(project);
if (format === "csv") out(args, areaReportToCsv(report), `${stem}.csv`);
else if (format === "svg") out(args, areaReportToSvg(report), `${stem}.svg`);
else if (format === "pdf") out(args, new Uint8Array(buildAreaReportPdf(report).output("arraybuffer")), `${stem}.pdf`);
else throw new Error("--format: json, csv, svg oder pdf");
}
return 0;
}
// --elements: Bauteilliste mit U-Werten aus den Schichten ([71]) [--format json|csv|svg|pdf] (Default csv)
if (args.flags.has("elements")) {
const format = args.flags.get("format") ?? "csv";
+1
View File
@@ -148,6 +148,7 @@ export type QueryName =
| "roofCutLayers"
| "openingSchedule"
| "elementSchedule"
| "roomBook"
| "uValue"
| "componentLayerFunctions"
| "sheetTables"
+2
View File
@@ -37,6 +37,8 @@ export { revealColumns, revealArea } from "../export/openingSchedule";
export type { RevealArea } from "../export/openingSchedule";
export { elementSchedule, uValueOf, uValueText, buildElementReport } from "../export/elementSchedule";
export type { ElementScheduleRow, UValueResult, ElementKind } from "../export/elementSchedule";
export { roomBook, buildRoomBookReport, usageLabel, ROOM_USAGES } from "../export/roomBook";
export type { RoomBook, RoomBookRow, FinishQty } from "../export/roomBook";
export { sheetTables, createTable, drawTablesPdf, tableCatalog, tableLabels, tableSourceLabel, TABLE_SOURCES } from "../export/sheetTable";
export type { TableOut, TablePrim, TableColumn } from "../export/sheetTable";
export { computeAreaTable, computeIvhb } from "../analysis/areaTable";
+75
View File
@@ -0,0 +1,75 @@
// [158] Raumbuch: Zeilen aus dem Kern, Bericht (CSV-Rundreise) und Blatt-Tabelle.
import { describe, expect, it } from "vitest";
import { sampleProject } from "../model/sampleProject";
import type { Layout, Project, Room } from "../model/types";
import { areaReportToCsv, parseAreaReportCsv } from "./areaReport";
import { buildRoomBookReport, roomBook, usageLabel } from "./roomBook";
import { sheetTables, tableLabels } from "./sheetTable";
import { t } from "../i18n/translate";
const base = sampleProject.rooms![0]!;
const bad: Room = {
...base,
id: "R-bad",
name: "Bad",
usage: "bath",
floorFinish: "Feinsteinzeug 30×60",
wallFinish: "Plattenbelag",
ceilingFinish: "Weissputz",
boundary: [
{ x: 6, y: 0 },
{ x: 8, y: 0 },
{ x: 8, y: 2 },
{ x: 6, y: 2 },
],
stamp: { number: "0.02", name: "Bad", showFloorArea: true, showUsage: false },
};
const p: Project = {
...sampleProject,
name: "Test",
rooms: [
{ ...base, usage: "living", floorFinish: sampleProject.components[0]!.id, ceilingFinish: "Weissputz", stamp: { number: "0.01", name: "Wohnen", showFloorArea: true, showUsage: true } },
bad,
],
};
describe("Raumbuch ([158])", () => {
it("eine Zeile je Raum mit Oberflächen, Nassraum aus der Nutzung, Mengen je Material", () => {
const b = roomBook(p);
expect(b.rows.map((r) => r.number)).toEqual(["0.01", "0.02"]);
const w = b.rows[0]!;
expect(w).toMatchObject({ usage: "living", wet: false, floorFinish: sampleProject.components[0]!.name, ceilingFinish: "Weissputz" });
expect(w.wallArea).toBeGreaterThan(0);
expect(w.wallArea).toBeLessThan(w.perimeter * w.clearHeight);
expect(b.rows[1]).toMatchObject({ wet: true, floorFinish: "Feinsteinzeug 30×60", area: 4 });
const ceil = b.quantities.find((q) => q.surface === "ceiling" && q.finish === "Weissputz")!;
expect(ceil.rooms).toBe(2);
expect(ceil.area).toBeCloseTo(w.area + 4, 9);
});
it("Bericht: Raumbuch und Mengen, CSV-Rundreise", () => {
const rep = buildRoomBookReport(p);
expect(rep.sections.map((s) => s.heading)).toEqual([t("roomBook.title"), t("roomBook.quantities")]);
const parsed = parseAreaReportCsv(areaReportToCsv(rep));
const rows = parsed.sections[0]!.rows;
expect(rows.length).toBe(2);
expect(rows[1]).toContain("Feinsteinzeug 30×60");
expect(rows[1]).toContain(usageLabel("bath"));
expect(parsed.sections[1]!.rows.some((r) => r.includes("Weissputz"))).toBe(true);
});
it("ohne Räume: leerer Bericht ohne Abschnitte", () => {
expect(buildRoomBookReport({ ...p, rooms: [] }).sections).toEqual([]);
});
it("als Tabelle auf dem Blatt", () => {
const layout: Layout = { id: "L1", name: "Blatt", paper: "a3", orientation: "landscape", viewports: [], tables: [{ id: "rb", source: "roomBook", xMm: 10, yMm: 20, widthMm: 260 }] };
const q: Project = { ...p, layouts: [layout] };
const [tb] = sheetTables(q, "L1");
expect(tb!.total).toBe(2);
const texts = tb!.prims.filter((x) => x.k === "text").map((x) => (x as { s: string }).s);
expect(texts).toContain(tableLabels(q)["roomBook.col.floorFinish"]);
expect(texts).toContain("0.02");
expect(texts).toContain(usageLabel("bath"));
});
});
+103
View File
@@ -0,0 +1,103 @@
// [158] Raumbuch: Oberflächen je Raum (Boden, Wand, Decke), Nutzung, Bodenaufbau und die Mengen daraus.
// Gerechnet wird im Rust-Kern (`src-tauri/core/src/room_book.rs`, Abfrage `roomBook`); hier nur die
// Beschriftung mit `t()` und der Berichtsaufbau, damit CSV, SVG und PDF dieselbe Quelle haben wie die
// Fenster-/Türliste (`openingSchedule.ts`). Die Blatt-Tabelle (Quelle `roomBook`) rechnet der Kern selbst.
import type { Project, RoomUsage } from "../model/types";
import { t } from "../i18n/translate";
import type { TranslationKey } from "../i18n/translate";
import { documentFor } from "../core/document";
import type { AreaReport, Cell, ReportSection } from "./areaReport";
/** Eine Zeile des Raumbuchs (Form wie `RoomBookRow` im Kern). */
export interface RoomBookRow {
id: string;
floor: string;
floorId: string;
number: string;
name: string;
/** Nettofläche (m²) = Boden- und Deckenfläche. */
area: number;
perimeter: number;
/** Lichte Höhe (m) aus den Decken, sonst Geschosshöhe. */
clearHeight: number;
/** Nutzungs-Kennung, leer ohne Angabe. */
usage: RoomUsage | "";
wet: boolean;
/** Anzeigetexte (Material-Name oder Freitext). */
floorFinish: string;
wallFinish: string;
ceilingFinish: string;
floorBuildUp: string;
/** Wandfläche netto: Umfang × lichte Höhe − Öffnungen (m²). */
wallArea: number;
openingArea: number;
}
/** Menge einer Oberfläche je Material/Freitext. */
export interface FinishQty {
surface: "floor" | "wall" | "ceiling";
finish: string;
area: number;
rooms: number;
}
export interface RoomBook {
rows: RoomBookRow[];
quantities: FinishQty[];
}
/** Wählbare Nutzungen (Reihenfolge der Auswahl, wie `RoomUsage::ALL` im Kern). */
export const ROOM_USAGES: readonly RoomUsage[] = ["living", "sleeping", "kitchen", "dining", "bath", "wc", "shower", "laundry", "circulation", "technical", "storage", "office", "other"];
export function usageLabel(u: RoomUsage | ""): string {
return u ? t(`roomBook.usage.${u}` as TranslationKey) : "";
}
/** Raumbuch des Projekts (Kern-Abfrage). */
export function roomBook(project: Project): RoomBook {
return documentFor(project).query<RoomBook>("roomBook");
}
const num = (n: number, d: number): Cell => ({ n: Number.isFinite(n) ? n : null, d });
function roomSection(rows: RoomBookRow[]): ReportSection {
return {
heading: t("roomBook.title"),
columns: [
t("openings.col.floor"),
t("roomBook.col.number"),
t("sheetTable.col.room"),
t("sheetTable.col.area"),
t("roomBook.col.usage"),
t("roomBook.col.floorFinish"),
t("roomBook.col.wallFinish"),
t("roomBook.col.ceilingFinish"),
t("roomBook.col.buildUp"),
t("roomBook.col.clearHeight"),
t("roomBook.col.wallArea"),
],
widths: [1.2, 1, 2.4, 1.2, 1.6, 2.4, 2.4, 2.4, 3, 1.2, 1.3],
rows: rows.map((r) => ({
cells: [r.floor, r.number, r.name, num(r.area, 2), usageLabel(r.usage), r.floorFinish, r.wallFinish, r.ceilingFinish, r.floorBuildUp, num(r.clearHeight, 2), num(r.wallArea, 2)],
})),
};
}
function quantitySection(qs: FinishQty[]): ReportSection {
return {
heading: t("roomBook.quantities"),
columns: [t("roomBook.col.surface"), t("roomBook.col.finish"), t("roomBook.col.rooms"), t("sheetTable.col.area")],
widths: [1.6, 4, 1.2, 1.4],
rows: qs.map((q) => ({ cells: [t(`roomBook.surface.${q.surface}`), q.finish, num(q.rooms, 0), num(q.area, 2)] })),
};
}
/** Bericht „Raumbuch": Räume und (falls Oberflächen angegeben) die Mengen je Material. */
export function buildRoomBookReport(project: Project): AreaReport {
const b = roomBook(project);
const sections: ReportSection[] = [];
if (b.rows.length) sections.push(roomSection(b.rows));
if (b.quantities.length) sections.push(quantitySection(b.quantities));
return { title: t("roomBook.title"), projectName: project.name ?? "", sections, notes: [t("roomBook.foot")] };
}
+3 -3
View File
@@ -55,10 +55,10 @@ describe("Tabellen auf dem Blatt ([111])", () => {
it("alle Quellen liefern Primitive; Katalog nennt die Spalten", () => {
const cat = tableCatalog(sampleProject);
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 })));
expect(Object.keys(cat.sources).sort()).toEqual(["areas", "earthworks", "elements", "openings", "roomBook", "rooms"]);
const p = withTables((["openings", "areas", "rooms", "elements", "earthworks", "roomBook"] as const).map((source) => table({ id: source, source })));
const out = sheetTables(p, "L1");
expect(out.map((o) => o.id)).toEqual(["openings", "areas", "rooms", "elements", "earthworks"]);
expect(out.map((o) => o.id)).toEqual(["openings", "areas", "rooms", "elements", "earthworks", "roomBook"]);
for (const o of out) expect(o.prims.some((x) => x.k === "text")).toBe(true);
});
+1 -1
View File
@@ -38,7 +38,7 @@ interface Catalog {
valueKeys: string[];
}
export const TABLE_SOURCES: readonly LayoutTableSource[] = ["openings", "areas", "rooms", "elements", "earthworks"];
export const TABLE_SOURCES: readonly LayoutTableSource[] = ["openings", "areas", "rooms", "elements", "earthworks", "roomBook"];
export function tableSourceLabel(s: LayoutTableSource): string {
return t(`sheetTable.source.${s}`);
+48
View File
@@ -883,6 +883,15 @@ export const de = {
"objinfo.room.area": "Fläche",
"objinfo.room.perimeter": "Umfang",
"objinfo.room.refFloor": "Referenzgeschoss",
"objinfo.room.usage": "Nutzung",
"objinfo.room.usageNone": "—",
"objinfo.room.wet": "Nassraum",
"objinfo.room.floorFinish": "Boden",
"objinfo.room.wallFinish": "Wand",
"objinfo.room.ceilingFinish": "Decke",
"objinfo.room.buildUp": "Aufbau",
"objinfo.room.finishes": "Oberflächen (Raumbuch)",
"objinfo.room.finishHint": "Material wählen oder Freitext eingeben",
"objinfo.room.editStamp": "Stempel bearbeiten …",
// ── Extrusions-Attribute (truck-Integration, Object-Info-Panel) ─────────
"objinfo.sectionLine.section": "Schnittlinie",
@@ -3017,6 +3026,7 @@ export const de = {
"roomStamp.showFloorArea": "Bodenfläche anzeigen",
"roomStamp.floorAreaPrefix": "Präfix Bodenfläche",
"roomStamp.showUsage": "Nutzung anzeigen",
"roomStamp.showFinish": "Bodenbelag anzeigen",
"roomStamp.roundingStep": "Flächen-Rundung",
"roomStamp.roundingStepDefault": "Standard (2 Nachkommastellen)",
"roomStamp.occupancy": "Personenzahl",
@@ -3142,6 +3152,44 @@ export const de = {
"sheetTable.source.rooms": "Raumprogramm Soll/Ist",
"sheetTable.source.elements": "Bauteile mit U-Wert",
"sheetTable.source.earthworks": "Erdarbeiten (Baugruben)",
"sheetTable.source.roomBook": "Raumbuch (Oberflächen)",
"roomBook.title": "Raumbuch",
"roomBook.empty": "Keine Räume.",
"roomBook.quantities": "Mengen je Oberfläche",
"roomBook.foot": "Bodenfläche = Deckenfläche = Raumfläche (netto). Wandfläche = Umfang × lichte Höhe − Öffnungen; lichte Höhe aus den Decken über und unter dem Raum, sonst Geschosshöhe.",
"roomBook.exportCsv": "CSV",
"roomBook.exportPdf": "PDF",
"roomBook.exportPdf.fail": "PDF des Raumbuchs konnte nicht erstellt werden.",
"roomBook.col.number": "Nr.",
"roomBook.col.usage": "Nutzung",
"roomBook.col.floorFinish": "Boden",
"roomBook.col.wallFinish": "Wand",
"roomBook.col.ceilingFinish": "Decke",
"roomBook.col.buildUp": "Bodenaufbau",
"roomBook.col.clearHeight": "Lichte Höhe [m]",
"roomBook.col.wallArea": "Wandfläche [m²]",
"roomBook.col.perimeter": "Umfang [m]",
"roomBook.col.wet": "Nassraum",
"roomBook.col.surface": "Oberfläche",
"roomBook.col.finish": "Belag / Material",
"roomBook.col.rooms": "Räume",
"roomBook.surface.floor": "Boden",
"roomBook.surface.wall": "Wand",
"roomBook.surface.ceiling": "Decke",
"roomBook.wet": "ja",
"roomBook.usage.living": "Wohnen",
"roomBook.usage.sleeping": "Schlafen",
"roomBook.usage.kitchen": "Küche",
"roomBook.usage.dining": "Essen",
"roomBook.usage.bath": "Bad",
"roomBook.usage.wc": "WC",
"roomBook.usage.shower": "Dusche",
"roomBook.usage.laundry": "Waschküche",
"roomBook.usage.circulation": "Verkehr",
"roomBook.usage.technical": "Technik",
"roomBook.usage.storage": "Lager / Abstellraum",
"roomBook.usage.office": "Büro / Arbeiten",
"roomBook.usage.other": "Übrige",
"sheetTable.filter": "Zeigen",
"sheetTable.filter.all": "Fenster und Türen",
"sheetTable.filter.window": "Nur Fenster",
+48
View File
@@ -879,6 +879,15 @@ export const en: Record<TranslationKey, string> = {
"objinfo.room.area": "Area",
"objinfo.room.perimeter": "Perimeter",
"objinfo.room.refFloor": "Reference floor",
"objinfo.room.usage": "Use",
"objinfo.room.usageNone": "—",
"objinfo.room.wet": "Wet room",
"objinfo.room.floorFinish": "Floor",
"objinfo.room.wallFinish": "Wall",
"objinfo.room.ceilingFinish": "Ceiling",
"objinfo.room.buildUp": "Build-up",
"objinfo.room.finishes": "Finishes (room book)",
"objinfo.room.finishHint": "Choose a material or type free text",
"objinfo.room.editStamp": "Edit stamp …",
// ── Extruded solid attributes (truck integration, object info panel) ────
"objinfo.sectionLine.section": "Section line",
@@ -3005,6 +3014,7 @@ export const en: Record<TranslationKey, string> = {
"roomStamp.showFloorArea": "Show floor area",
"roomStamp.floorAreaPrefix": "Floor area prefix",
"roomStamp.showUsage": "Show usage",
"roomStamp.showFinish": "Show floor finish",
"roomStamp.roundingStep": "Area rounding",
"roomStamp.roundingStepDefault": "Default (2 decimal places)",
"roomStamp.occupancy": "Occupancy",
@@ -3129,6 +3139,44 @@ export const en: Record<TranslationKey, string> = {
"sheetTable.source.rooms": "Room program target/actual",
"sheetTable.source.elements": "Elements with U-value",
"sheetTable.source.earthworks": "Earthworks (excavations)",
"sheetTable.source.roomBook": "Room book (finishes)",
"roomBook.title": "Room book",
"roomBook.empty": "No rooms.",
"roomBook.quantities": "Quantities per finish",
"roomBook.foot": "Floor area = ceiling area = room area (net). Wall area = perimeter × clear height − openings; clear height from the slabs above and below the room, otherwise storey height.",
"roomBook.exportCsv": "CSV",
"roomBook.exportPdf": "PDF",
"roomBook.exportPdf.fail": "Could not create the room book PDF.",
"roomBook.col.number": "No.",
"roomBook.col.usage": "Use",
"roomBook.col.floorFinish": "Floor",
"roomBook.col.wallFinish": "Wall",
"roomBook.col.ceilingFinish": "Ceiling",
"roomBook.col.buildUp": "Floor build-up",
"roomBook.col.clearHeight": "Clear height [m]",
"roomBook.col.wallArea": "Wall area [m²]",
"roomBook.col.perimeter": "Perimeter [m]",
"roomBook.col.wet": "Wet room",
"roomBook.col.surface": "Surface",
"roomBook.col.finish": "Finish / material",
"roomBook.col.rooms": "Rooms",
"roomBook.surface.floor": "Floor",
"roomBook.surface.wall": "Wall",
"roomBook.surface.ceiling": "Ceiling",
"roomBook.wet": "yes",
"roomBook.usage.living": "Living",
"roomBook.usage.sleeping": "Sleeping",
"roomBook.usage.kitchen": "Kitchen",
"roomBook.usage.dining": "Dining",
"roomBook.usage.bath": "Bathroom",
"roomBook.usage.wc": "WC",
"roomBook.usage.shower": "Shower",
"roomBook.usage.laundry": "Laundry",
"roomBook.usage.circulation": "Circulation",
"roomBook.usage.technical": "Technical",
"roomBook.usage.storage": "Storage",
"roomBook.usage.office": "Office",
"roomBook.usage.other": "Other",
"sheetTable.filter": "Show",
"sheetTable.filter.all": "Windows and doors",
"sheetTable.filter.window": "Windows only",
+19
View File
@@ -118,6 +118,25 @@ describe("IFC-Import als Bauteile: Rundreise Demo-Haus", () => {
expect(p.walls.filter((x) => x.isExternal === true && x.loadBearing === true).length).toBe(1);
});
it("[158] Raumbuch: Nutzung, Oberflächen und Bodenaufbau am IfcSpace (Rundreise)", async () => {
const comp = sampleProject.components[0]!;
const room0 = sampleProject.rooms![0]!;
const src: Project = {
...sampleProject,
rooms: [{ ...room0, usage: "bath", floorFinish: comp.id, wallFinish: "Abrieb 1 mm", ceilingFinish: "Weissputz", floorBuildUp: "UB 80, TSD 20" }],
};
const spf = exportIfcSpf(src);
expect(spf).toContain("Pset_SpaceCoveringRequirements");
expect(spf).toContain("Dossier_RoomBook");
// In ein Projekt mit demselben Material: Verweis über den Namen; sonst Freitext.
const { project: p } = await importInto({ ...emptyProject, components: [comp] }, src);
expect(p.rooms![0]).toMatchObject({ usage: "bath", floorFinish: comp.id, wallFinish: "Abrieb 1 mm", ceilingFinish: "Weissputz", floorBuildUp: "UB 80, TSD 20" });
const { project: q } = await importInto({ ...emptyProject, components: [] }, src);
expect(q.rooms![0]!.floorFinish).toBe(comp.name);
// Ohne Angaben: keine Raumbuch-Psets.
expect(exportIfcSpf(sampleProject)).not.toContain("Dossier_RoomBook");
});
it("Tür-Anschlag/Aufschlag und Fensterteilung aus OperationType/PartitioningType (Rundreise)", async () => {
// Lage im Raum vergleichen (die Wand kann umgekehrt ankommen): Scharnierpunkt und Aufschlagrichtung.
const physical = (o: Opening, w: Wall) => {
+32 -1
View File
@@ -1807,7 +1807,7 @@ export type LayoutTable = {
};
/** Quelle einer Blatt-Tabelle ([111]). */
export type LayoutTableSource = "openings" | "areas" | "rooms" | "elements" | "earthworks";
export type LayoutTableSource = "openings" | "areas" | "rooms" | "elements" | "earthworks" | "roomBook";
/**
* Einfache Textfelder des Titelblocks (Master). Alle optional — leere Felder
@@ -2849,6 +2849,19 @@ export type Room = {
* Zeilen (Bodenfläche/Nutzung) aus den Flags. Fehlt er, gilt der Alt-Pfad.
*/
stamp?: RoomStamp;
/** [158] Raumbuch: Nutzung (Wohnen, Bad, Verkehr …); Nassraum wird daraus abgeleitet. */
usage?: RoomUsage;
/**
* [158] Bodenbelag: Kennung eines Bauteil-Materials (`components`) oder Freitext. Ein Material mit
* Oberflächenmuster gilt im Grundriss im Raum statt des Belags der Decke.
*/
floorFinish?: string;
/** [158] Wandoberfläche (Material-Kennung oder Freitext). */
wallFinish?: string;
/** [158] Deckenoberfläche (Material-Kennung oder Freitext). */
ceilingFinish?: string;
/** [158] Bodenaufbau als Freitext (z. B. „Parkett 15, UB 80, TSD 20"). */
floorBuildUp?: string;
};
/**
@@ -2913,8 +2926,26 @@ export type RoomStamp = {
* Schrittrundung.
*/
roundingStep?: number;
/** [158] Bodenbelag des Raums als Zeile anzeigen (Live-Zeile). Fehlt/false: keine Belagszeile. */
showFinish?: boolean;
};
/** [158] Nutzung eines Raums (Raumbuch). Nassräume: Bad, WC, Dusche, Waschküche. */
export type RoomUsage =
| "living"
| "sleeping"
| "kitchen"
| "dining"
| "bath"
| "wc"
| "shower"
| "laundry"
| "circulation"
| "technical"
| "storage"
| "office"
| "other";
/**
* Ein Eintrag der Flügeleinteilung eines Fensters (VW „Flügeltabelle"): entweder
* ein Flügel (verglaste, ggf. öffenbare Einheit) oder ein Pfosten (feste vertikale
+74
View File
@@ -33,7 +33,9 @@ import type {
Dormer,
DormerKind,
DrawingLevel,
Project,
RoofShape,
Room,
SiaCategory,
SliceTermination,
StairShape,
@@ -46,6 +48,7 @@ import type {
WallReferenceLine,
} from "../model/types";
import { SIA_CATEGORIES, siaLabelFull, surfaceOpeningInfo } from "../core";
import { ROOM_USAGES, roomBook, usageLabel } from "../core";
import type { EdgeSpec, RoofEdge } from "../core";
import { Dropdown } from "../ui/Dropdown";
import type { DetailLevel } from "../model/viewTypes";
@@ -465,6 +468,9 @@ export function RoomSection({
<span className="objinfo-fval">{room.floorName}</span>
</div>
{/* [158] Raumbuch: Nutzung und Oberflächen. */}
<RoomFinishFields roomId={roomId} host={host} />
{/* Stempel bearbeiten (öffnet den Rich-Text-Editor). */}
<button
type="button"
@@ -477,6 +483,74 @@ export function RoomSection({
);
}
type RoomFinishField = "floorFinish" | "wallFinish" | "ceilingFinish" | "floorBuildUp";
/** [158] Nutzung (Nassraum abgeleitet) und Oberflächen Boden/Wand/Decke (Material aus dem Projekt oder
* Freitext; ein eingegebener Material-Name wird als Verweis gespeichert) und Bodenaufbau. */
function RoomFinishFields({ roomId, host }: { roomId: string; host: ReturnType<typeof usePanelHost> }) {
const applyChange = useStore((s) => s.applyChange);
const project = host.project;
const room = (project.rooms ?? []).find((r) => r.id === roomId);
if (!room) return null;
const comps = project.components;
const listId = `room-finish-materials-${roomId}`;
const shown = (v: string | undefined) => comps.find((c) => c.id === v)?.name ?? v ?? "";
const set = (field: RoomFinishField | "usage", value: string | undefined) =>
applyChange((p: Project) => patchItem(p, "rooms", roomId, { [field]: value } as Partial<Room>), `room:${roomId}:${field}`);
const setFinish = (field: RoomFinishField, text: string) => {
const v = text.trim();
if (!v) return set(field, undefined);
const comp = field === "floorBuildUp" ? undefined : comps.find((c) => c.name.trim() === v);
set(field, comp ? comp.id : text);
};
// Nassraum wie im Kern (Nutzung, sonst Name), für [156] „Nassräume" im Grundriss.
const wet = roomBook(project).rows.find((r) => r.id === roomId)?.wet ?? false;
const finishInput = (field: RoomFinishField, label: TranslationKey) => (
<div className="objinfo-field">
<span className="objinfo-flabel">{t(label)}</span>
<input
type="text"
className="objinfo-text"
list={field === "floorBuildUp" ? undefined : listId}
value={shown(room[field])}
placeholder={field === "floorBuildUp" ? undefined : t("objinfo.room.finishHint")}
onChange={(e) => setFinish(field, e.target.value)}
title={t(label)}
/>
</div>
);
return (
<>
<div className="objinfo-field">
<span className="objinfo-flabel">{t("objinfo.room.usage")}</span>
<Dropdown
value={room.usage ?? ""}
onChange={(v) => set("usage", v || undefined)}
options={[{ value: "", label: t("objinfo.room.usageNone") }, ...ROOM_USAGES.map((u) => ({ value: u, label: usageLabel(u) }))]}
title={t("objinfo.room.usage")}
width={170}
/>
</div>
{wet && (
<div className="objinfo-field">
<span className="objinfo-flabel">{t("objinfo.room.wet")}</span>
<span className="objinfo-fval">✓</span>
</div>
)}
<div className="objinfo-section-label">{t("objinfo.room.finishes")}</div>
<datalist id={listId}>
{comps.map((c) => (
<option key={c.id} value={c.name} />
))}
</datalist>
{finishInput("floorFinish", "objinfo.room.floorFinish")}
{finishInput("wallFinish", "objinfo.room.wallFinish")}
{finishInput("ceilingFinish", "objinfo.room.ceilingFinish")}
{finishInput("floorBuildUp", "objinfo.room.buildUp")}
</>
);
}
// ── Schnitt-/Ansichtslinien-Abschnitt (Object-Info; nur die gewählte Linie) ──
// Name (editierbar), Blickrichtung umkehren (directionSign-Flip), Endpunkt-
// Koordinaten (editierbar) + Schnitt-Tiefe; Löschen setzt linePoints zurück
+4
View File
@@ -16,6 +16,7 @@ import { KennzahlenSection } from "./KennzahlenSection";
import { AreaTableSection } from "./AreaTableSection";
import { OpeningScheduleSection } from "./OpeningScheduleSection";
import { ElementScheduleSection } from "./ElementScheduleSection";
import { RoomBookSection } from "./RoomBookSection";
import { downloadCsv } from "./downloadFile";
/** Löst je Raum die anrechenbare (Netto-)Fläche + Kategorie auf. */
@@ -87,6 +88,9 @@ export function RoomBalancePanel() {
{/* Bauteilliste mit U-Werten ([71]). */}
<ElementScheduleSection />
{/* Raumbuch: Oberflächen je Raum ([158]). */}
<RoomBookSection />
{/* Raumliste (je Raum: Name · Geschoss · SIA · Fläche). */}
<div className="balance-section-label">{t("balance.rooms")}</div>
<div className="balance-table">
+109
View File
@@ -0,0 +1,109 @@
// [158] Raumbuch im Flächenbilanz-Panel: eine Zeile je Raum mit Geschoss, Nummer, Name, Fläche, Nutzung und
// den Oberflächen (Boden, Wand, Decke), dazu die Mengen je Material. Die Zeilen rechnet der Kern
// (`roomBook`); bearbeitet werden die Angaben in der Objekt-Info des Raums. CSV und PDF kommen aus
// demselben Berichtsmodell wie die Fenster-/Türliste.
import { useMemo } from "react";
import { t } from "../i18n";
import { usePanelHost } from "./host";
import { areaReportToCsv, buildAreaReportPdf, buildRoomBookReport, roomBook, usageLabel } from "../core";
import { downloadCsv } from "./downloadFile";
import { useStore } from "../state/appStore";
const m2 = (v: number) => v.toFixed(2);
export function RoomBookSection() {
const project = usePanelHost().project;
const notify = useStore((s) => s.notify);
const book = useMemo(() => roomBook(project), [project]);
const stem = `${project.name || "projekt"}-raumbuch`;
const exportPdf = () => {
try {
buildAreaReportPdf(buildRoomBookReport(project)).save(`${stem}.pdf`);
} catch {
notify(t("roomBook.exportPdf.fail"));
}
};
return (
<div className="area-section opening-section">
<div className="balance-head">
<span className="balance-section-label">{t("roomBook.title")}</span>
{book.rows.length > 0 && (
<span className="area-actions">
<button type="button" className="balance-export" onClick={() => downloadCsv(`${stem}.csv`, areaReportToCsv(buildRoomBookReport(project)))}>
{t("roomBook.exportCsv")}
</button>
<button type="button" className="balance-export" onClick={exportPdf}>
{t("roomBook.exportPdf")}
</button>
</span>
)}
</div>
{book.rows.length === 0 ? (
<div className="balance-empty">{t("roomBook.empty")}</div>
) : (
<div className="area-scroll">
<table className="area-table opening-table">
<thead>
<tr>
<th>{t("openings.col.floor")}</th>
<th>{t("roomBook.col.number")}</th>
<th>{t("sheetTable.col.room")}</th>
<th className="num">{t("sheetTable.col.area")}</th>
<th>{t("roomBook.col.usage")}</th>
<th>{t("roomBook.col.floorFinish")}</th>
<th>{t("roomBook.col.wallFinish")}</th>
<th>{t("roomBook.col.ceilingFinish")}</th>
<th className="num">{t("roomBook.col.clearHeight")}</th>
<th className="num">{t("roomBook.col.wallArea")}</th>
</tr>
</thead>
<tbody>
{book.rows.map((r) => (
<tr key={r.id}>
<td>{r.floor}</td>
<td>{r.number}</td>
<td>{r.name}</td>
<td className="num">{m2(r.area)}</td>
<td>{usageLabel(r.usage)}</td>
<td>{r.floorFinish}</td>
<td>{r.wallFinish}</td>
<td>{r.ceilingFinish}</td>
<td className="num">{m2(r.clearHeight)}</td>
<td className="num">{m2(r.wallArea)}</td>
</tr>
))}
</tbody>
</table>
{book.quantities.length > 0 && (
<table className="area-table opening-table">
<thead>
<tr>
<th>{t("roomBook.col.surface")}</th>
<th>{t("roomBook.col.finish")}</th>
<th className="num">{t("roomBook.col.rooms")}</th>
<th className="num">{t("sheetTable.col.area")}</th>
</tr>
</thead>
<tbody>
{book.quantities.map((q) => (
<tr key={`${q.surface}:${q.finish}`}>
<td>{t(`roomBook.surface.${q.surface}`)}</td>
<td>{q.finish}</td>
<td className="num">{q.rooms}</td>
<td className="num">{m2(q.area)}</td>
</tr>
))}
</tbody>
</table>
)}
</div>
)}
<ul className="area-notes">
<li>{t("roomBook.foot")}</li>
</ul>
</div>
);
}
+7
View File
@@ -220,6 +220,13 @@ export function RoomStampEditor({ value, onApply, onCancel }: RoomStampEditorPro
/>
</div>
<div className="roomstamp-row">
<label className="roomstamp-check">
<input type="checkbox" checked={draft.showFinish === true} onChange={(e) => patch({ showFinish: e.target.checked ? true : undefined })} />
<span>{t("roomStamp.showFinish")}</span>
</label>
</div>
<label className="roomstamp-field">
<span className="roomstamp-label">{t("roomStamp.occupancy")}</span>
<input