[278] Nutzungseinheiten und Wohnungsspiegel: Project.units, Room.unitId/roomCount, Kern-Abfrage mit Zimmerzahl und SIA-416-Flächen, Panel, Objekt-Info, Blatt-Tabelle, CSV/PDF, CLI, Beispiel Wettbewerb

This commit is contained in:
Claude committed 2026-11-17 22:08:06 +00:00
1 parent 605a54713c
commit 89c2d0c9a8
38 files changed
+1445 -54

No files matched your search

+24 -1
View File
@@ -20,6 +20,8 @@ import type {
Project,
Room,
RoomStamp,
RoomUsage,
Unit,
RoofType,
SiaCategory,
Vec2,
@@ -223,6 +225,21 @@ const ROOMS_PER_FLOOR: RoomDef[] = [
[P(10, 9.5), "10", "Abstellraum", "NNF"],
];
/** Nutzung je Raumname (Raumbuch, Zimmerzahl im Wohnungsspiegel [278]). */
const USAGE: Record<string, RoomUsage> = { "Wohnen/Essen": "living", Zimmer: "sleeping", Diele: "circulation", Bad: "bath", Treppenhaus: "circulation", Eingang: "circulation", Abstellraum: "storage" };
/** [278] Nutzungseinheiten: je Geschoss eine West- (Räume 01–04) und eine Ost-Wohnung (05–08); Nummer „Geschoss.Seite“ (EG = 0). */
const UNIT_NR = { eg: "0", og1: "1", og2: "2" } as const;
const unitOf = (floor: keyof typeof UNIT_NR, key: string): string | undefined => {
const n = Number(key);
return n >= 1 && n <= 4 ? `whg-${floor}-w` : n >= 5 && n <= 8 ? `whg-${floor}-o` : undefined;
};
function units(): Unit[] {
return FLOORS.flatMap((f) => [
{ id: `whg-${f.id}-w`, name: `${UNIT_NR[f.id]}.1`, usage: "living" as const, color: "#4f8fc0" },
{ id: `whg-${f.id}-o`, name: `${UNIT_NR[f.id]}.2`, usage: "living" as const, color: "#c0874f" },
]);
}
function addRooms(p: Project): Project {
const prefix = { eg: "E", og1: "1", og2: "2" } as const;
for (const f of FLOORS) {
@@ -235,7 +252,10 @@ function addRooms(p: Project): Project {
const made = ops.find((o) => o.kind === "add" && o.collection === "rooms");
if (!made || made.kind !== "add") throw new Error(`Wettbewerb: Raum ${nr} nicht erkannt`);
const stamp: RoomStamp = { number: nr, name, showFloorArea: true, showUsage: false, roundingStep: 0.1 };
const room = { ...(made.items[0] as unknown as Room), id: `raum-${nr}`, name, siaCategory: cat, stamp };
const unitId = unitOf(f.id, key);
// Ost-Wohnungen: Wohnen/Essen mit offener Küche zählt 1.5 Zimmer (2.5-Zi-Whg), West: 2-Zi-Whg nach der Vorgabe aus der Nutzung.
const roomCount = unitId?.endsWith("-o") && baseName === "Wohnen/Essen" ? 1.5 : undefined;
const room = { ...(made.items[0] as unknown as Room), id: `raum-${nr}`, name, siaCategory: cat, stamp, usage: USAGE[name], ...(unitId ? { unitId } : {}), ...(roomCount !== undefined ? { roomCount } : {}) };
p = applyOps(p, [{ kind: "add", collection: "rooms", items: [room as unknown as { id: string }] } as CoreOp]);
}
}
@@ -274,6 +294,7 @@ export function buildWettbewerbSampleProject(): Project {
roofs,
stairs,
rooms: [],
units: units(),
drawings2d: cadastre(),
context: [neighbours()],
// Raumprogramm des Wettbewerbs (Soll); die Räume im Modell liefern das Ist.
@@ -322,6 +343,8 @@ export function buildWettbewerbSampleProject(): Project {
],
layouts: [
{ id: "lay-situation", name: "Situation 1:500", paper: "a3", orientation: "landscape", planNumber: "001", viewports: [{ id: "vp-situation", snapshotId: "vs-situation", xMm: 20, yMm: 20, widthMm: 380, heightMm: 260, scaleDenominator: 500 }] },
// [278] Wohnungsspiegel als lebendige Tabelle (folgt dem Modell).
{ id: "lay-wohnungsspiegel", name: "Wohnungsspiegel", paper: "a4", orientation: "landscape", planNumber: "002", viewports: [], tables: [{ id: "tab-wohnungsspiegel", source: "unitSchedule", xMm: 20, yMm: 20, widthMm: 257 }] },
],
};
+39 -1
View File
@@ -2213,7 +2213,8 @@ export type LayoutTableSource =
| "roomBook"
| "costs"
| "siteProof"
| "designOptionCompare";
| "designOptionCompare"
| "unitSchedule";
/**
* Einfache Textfelder des Titelblocks (Master). Alle optional — leere Felder
@@ -3376,6 +3377,10 @@ export type Project = {
* [272] Benannte Variantenkombinationen (Archicad „Design Option Combinations“): je Satz genau eine Variante.
*/
designOptionCombinations?: Array<DesignOptionCombination>;
/**
* [278] Nutzungseinheiten (Wohnungen, Gewerbe) für den Wohnungsspiegel; Räume verweisen mit `unitId` darauf.
*/
units?: Array<Unit>;
};
/** Protokolleintrag einer Publikation ([79]): Datum, Blätter mit Revision, erzeugte Dateien. */
@@ -3770,6 +3775,16 @@ export type Room = {
* [272] Variante, zu der das Element gehört (`Project.designOptionSets`). Fehlt ⇒ Hauptmodell (immer sichtbar).
*/
designOption?: DesignOptionRef;
/**
* [278] Nutzungseinheit (`Project.units`, Id), zu der der Raum gehört (Wohnung, Gewerbeeinheit). Fehlt oder
* unbekannt ⇒ keiner Einheit zugeordnet (Gemeinschaftsfläche).
*/
unitId?: string;
/**
* [278] Zimmerzahl-Beitrag dieses Raums für den Wohnungsspiegel (CH-Konvention: Zimmer 1, Wohnküche/halbes Zimmer 0.5,
* Nebenraum 0). Fehlt ⇒ Vorgabe aus der Nutzung (`unit_schedule::default_room_count`).
*/
roomCount?: number;
};
/**
@@ -4445,6 +4460,29 @@ export type UiViewTabs = {
activeId: string;
};
/**
* [278] Nutzungseinheit (Wohnung, Gewerbe-, Büroeinheit): fasst Räume für den Wohnungsspiegel zusammen. Die Räume
* verweisen mit `Room.unitId` auf sie; Fläche, Geschoss und Zimmerzahl rechnet der Kern aus den Räumen.
*/
export type Unit = {
id: string;
/** Nummer/Bezeichnung, z. B. „2.1“. */
name: string;
/**
* Typ, z. B. „3.5-Zi-Whg“. Fehlt er, leitet der Spiegel bei Wohnungen „n-Zi-Whg“ aus der Zimmerzahl ab.
*/
unitType?: string;
/** Nutzung (Fehlt ⇒ Wohnen). */
usage?: UnitUsage;
/** Farbe der Einheit (hex) für Darstellungen. */
color?: string;
/** Bemerkung (reiner Text). */
note?: string;
};
/** [278] Nutzung einer Nutzungseinheit. */
export type UnitUsage = "living" | "commercial" | "office" | "other";
export type Vec2 = { x: number; y: number };
/**