[94][95][96] Standards: SIA-400-Baustoffe mit Ansichtsschraffur, Linientypen, „Standards laden“

- Kern standards.rs: 33 Baustoffe/Bekleidungen (Schnittschraffur, Füll-/Ansichtsfarbe, Textur, λ, Rohdichte,
  VKF-RF), Schraffuren, Linientypen, Wand-/Decken-/Dachaufbauten; merge_ops ergänzt nur Fehlendes
- Kern surface_pattern.rs: Ansichtsschraffur (Lattung, Boden-Deckel, Läuferverband, Schindeln, Trapezblech,
  Naturstein polygonal, Plattenteilung), massstabsabhängig ausgedünnt; in Ansicht (Wände, Dächer) und
  Dachaufsicht; je Element drehbar/versetzbar
- Modell: Component.lambda/density/fireClass/elevationColor/surfacePattern/standardId,
  Wall/Roof.surfacePatternAngle/Offset
- render2d/Chunk-Pfad: Punkte im Strichmuster bleiben (Strichpunkt war Strichlinie), Bögen mit Punkten über
  den Strichpfad, Strichmuster skalieren mit dem Massstab; SVG runde Kappen bei Punkten
- Neue Projekte mit Standards, Ressourcen-Manager „Standards laden“, Bauteil-Felder, Textur von ambientCG laden
This commit is contained in:
Claude committed 2026-10-29 23:15:07 +00:00
1 parent f24d41607b
commit 2bd39cf404
35 files changed
+1707 -33

No files matched your search

+2
View File
@@ -1582,6 +1582,7 @@ export default function App() {
patchPenSetColor,
patchPenSetWeight,
seedStandardPenSet,
loadStandards,
addCustomPalette,
renameCustomPalette,
deleteCustomPalette,
@@ -2536,6 +2537,7 @@ export default function App() {
onPatchPenSetColor: patchPenSetColor,
onPatchPenSetWeight: patchPenSetWeight,
onSeedStandardPenSet: seedStandardPenSet,
onLoadStandards: loadStandards,
onAddCustomPalette: addCustomPalette,
onRenameCustomPalette: renameCustomPalette,
onDeleteCustomPalette: deleteCustomPalette,
+1 -1
View File
@@ -574,7 +574,7 @@ async function execute(project: Project, file: string, command: string, rest: st
// Wie die App: verdeckte Kanten nach der Ebene, geschnittene Fenster/Türen.
plan = generateSectionPlan(o, false, { visibleCodes: allCodes, hiddenLines: lvl.hiddenLines, openings: true });
} else {
plan = generateElevationPlan(project, lvl);
plan = generateElevationPlan(project, lvl, { scaleDenominator: scale });
if (!plan) fail("keine gültige Ansichtslinie");
}
if (args.flags.get("format") === "json") {
+1 -1
View File
@@ -111,7 +111,7 @@ export async function callTool(file: string, name: string, args: Record<string,
if (!o) return text("keine gültige Schnittlinie", true);
return text(planToSvgString(generateSectionPlan(o, false, { visibleCodes: codes }), { scaleDenominator: scale }));
}
const plan = generateElevationPlan(project, lvl);
const plan = generateElevationPlan(project, lvl, { scaleDenominator: scale });
return plan ? text(planToSvgString(plan, { scaleDenominator: scale })) : text("keine gültige Ansichtslinie", true);
}
case "apply_ops": {
+1 -1
View File
@@ -57,7 +57,7 @@ export type LoadFileResult =
| { ok: false; error: string };
/** Wurzel-Abfragen des Kerns (`queries.rs::run_root`). */
export type RootQueryName = "penRebakeOps" | "penDeleteOps" | "penSeedOps" | "folderPdfPages" | "layoutTitleBlock" | "translatePatch" | "translateOps" | "selectionFilterPatch";
export type RootQueryName = "penRebakeOps" | "penDeleteOps" | "penSeedOps" | "standardsMergeOps" | "folderPdfPages" | "layoutTitleBlock" | "translatePatch" | "translateOps" | "selectionFilterPatch";
/** Abfragen des Kerns (`queries.rs`). */
export type QueryName =
+30
View File
@@ -1116,6 +1116,36 @@ export const de = {
"resources.col.prio.hint": "Höhere Priorität läuft am Stoß durch",
"resources.col.texture": "Textur",
"resources.col.material": "Material",
"material.fetchAmbient": "Textur laden",
"material.fetchAmbient.hint": "Lädt die Texturkarten dieses ambientCG-Materials (CC0) herunter.",
"resources.loadStandards": "Standards laden",
"resources.loadStandards.hint": "Ergänzt die SIA-400-Standards (Baustoffe mit Schraffur, Ansichtsschraffur, Textur und Kennwerten, Linientypen, Wand-/Decken-/Dachaufbauten). Vorhandene Einträge (gleiche id oder gleicher Name) bleiben unverändert.",
"resources.col.lambda": "Wärmeleitfähigkeit λ [W/mK]",
"resources.col.density": "Rohdichte [kg/m³]",
"resources.col.fireClass": "Brandverhalten (VKF)",
"resources.col.fireClass.none": "—",
"resources.col.elevationColor": "Ansichtsfarbe",
"resources.col.surfacePattern": "Ansichtsschraffur",
"resources.col.surfacePattern.hint": "Muster auf sichtbaren Flächen (Ansicht, Dachaufsicht): Masse in Metern am Bau, Ausrichtung am Element; bei grobem Massstab ausgedünnt.",
"resources.surfacePattern.none": "Keine",
"resources.surfacePattern.lines": "Lattung / Schalung (Linien)",
"resources.surfacePattern.boardBatten": "Boden-Deckel-Schalung",
"resources.surfacePattern.runningBond": "Läuferverband",
"resources.surfacePattern.shingles": "Schindeln",
"resources.surfacePattern.trapezoid": "Trapezblech",
"resources.surfacePattern.polygonal": "Naturstein polygonal",
"resources.surfacePattern.grid": "Plattenteilung",
"resources.surfacePattern.direction": "Richtung",
"resources.surfacePattern.direction.auto": "Standard",
"resources.surfacePattern.direction.vertical": "Senkrecht",
"resources.surfacePattern.direction.horizontal": "Waagrecht",
"resources.surfacePattern.spacing": "Abstand / Länge [m]",
"resources.surfacePattern.height": "Lagenhöhe [m]",
"resources.surfacePattern.width": "Leisten-/Gurtbreite [m]",
"objinfo.surfacePattern": "Ansichtsschraffur",
"objinfo.surfacePattern.angle": "Drehung [°]",
"objinfo.surfacePattern.offsetX": "Versatz entlang [m]",
"objinfo.surfacePattern.offsetY": "Versatz quer [m]",
"resources.col.color.hint": "Grundfarbe — 3D-Diffusfarbe + Fallback für Vorder-/Hintergrund, falls dort keine eigene Farbe gesetzt ist",
"resources.col.foreground": "Vordergrund",
"resources.col.foreground.hint": "Farbe der Muster-/Schraffurlinien (Vordergrund)",
+30
View File
@@ -1109,6 +1109,36 @@ export const en: Record<TranslationKey, string> = {
"resources.col.prio.hint": "Higher priority runs through at the join",
"resources.col.texture": "Texture",
"resources.col.material": "Material",
"material.fetchAmbient": "Load texture",
"material.fetchAmbient.hint": "Downloads the texture maps of this ambientCG material (CC0).",
"resources.loadStandards": "Load standards",
"resources.loadStandards.hint": "Adds the SIA 400 standards (materials with hatch, surface pattern, texture and physical values, line types, wall/ceiling/roof build-ups). Existing entries (same id or same name) stay unchanged.",
"resources.col.lambda": "Thermal conductivity λ [W/mK]",
"resources.col.density": "Density [kg/m³]",
"resources.col.fireClass": "Reaction to fire (VKF)",
"resources.col.fireClass.none": "—",
"resources.col.elevationColor": "Elevation colour",
"resources.col.surfacePattern": "Surface pattern",
"resources.col.surfacePattern.hint": "Pattern drawn on visible faces (elevation, roof top view): sizes in metres on site, oriented along the element; thinned at coarse scales.",
"resources.surfacePattern.none": "None",
"resources.surfacePattern.lines": "Battens / boarding (lines)",
"resources.surfacePattern.boardBatten": "Board and batten",
"resources.surfacePattern.runningBond": "Running bond",
"resources.surfacePattern.shingles": "Shingles",
"resources.surfacePattern.trapezoid": "Trapezoidal sheet",
"resources.surfacePattern.polygonal": "Polygonal stone",
"resources.surfacePattern.grid": "Panel grid",
"resources.surfacePattern.direction": "Direction",
"resources.surfacePattern.direction.auto": "Default",
"resources.surfacePattern.direction.vertical": "Vertical",
"resources.surfacePattern.direction.horizontal": "Horizontal",
"resources.surfacePattern.spacing": "Spacing / length [m]",
"resources.surfacePattern.height": "Course height [m]",
"resources.surfacePattern.width": "Batten / flange width [m]",
"objinfo.surfacePattern": "Surface pattern",
"objinfo.surfacePattern.angle": "Rotation [°]",
"objinfo.surfacePattern.offsetX": "Offset along [m]",
"objinfo.surfacePattern.offsetY": "Offset across [m]",
"resources.col.color.hint": "Base color — 3D diffuse color + fallback for foreground/background when they have no color of their own",
"resources.col.foreground": "Foreground",
"resources.col.foreground.hint": "Color of the pattern/hatch lines (foreground)",
+30
View File
@@ -0,0 +1,30 @@
import { describe, expect, it } from "vitest";
import { emptyProject, sampleProject } from "./sampleProject";
import { standardsMergeOps, withStandards } from "./standards";
describe("Standard-Bibliothek ([94]–[96])", () => {
it("bringt Baustoffe, Linientypen und Aufbauten in ein neues Projekt", () => {
const p = withStandards({ ...emptyProject, components: [], hatches: [], lineStyles: [], wallTypes: [], ceilingTypes: [], roofTypes: [] });
const stb = p.components.find((c) => c.name === "Stahlbeton")!;
expect(stb.lambda).toBe(2.3);
expect(stb.fireClass).toBe("RF1");
expect(p.hatches.some((h) => h.id === stb.hatchId)).toBe(true);
expect(p.components.find((c) => c.name === "Backstein")!.surfacePattern?.kind).toBe("runningBond");
expect(p.lineStyles.find((l) => l.name === "Strichpunktlinie (Achse)")!.dash).toEqual([12, 1.5, 0, 1.5]);
expect(p.wallTypes.map((t) => t.name)).toContain("Holzständerwand hinterlüftet");
expect(p.ceilingTypes?.length).toBe(1);
expect(p.roofTypes?.length).toBe(1);
expect(standardsMergeOps(p)).toEqual([]);
});
it("verdoppelt im bestehenden Projekt nichts und nutzt gleichnamige Einträge", () => {
const p = withStandards(sampleProject);
const names = p.components.map((c) => c.name.toLowerCase());
expect(names.filter((n) => n === "backstein").length).toBe(1);
// Beispiel-Bauteil „Backstein" (id brick) bleibt und wird vom Standard-Aufbau benutzt
const iw = p.wallTypes.find((t) => t.id === "std-wt-iw-backstein")!;
expect(iw.layers[1].componentId).toBe("brick");
expect(p.components.length).toBeGreaterThan(sampleProject.components.length);
expect(standardsMergeOps(p)).toEqual([]);
});
});
+19
View File
@@ -0,0 +1,19 @@
// Standard-Bibliothek ([94]–[96]) aus dem Rust-Kern (`src-tauri/core/src/standards.rs`): Baustoffe mit
// SIA-400-Schnittschraffur, Ansichtsfarbe/-schraffur, 3D-Textur und Kennwerten (λ, Rohdichte, VKF-RF),
// Linientypen nach SIA 400 / ISO 128 und Standard-Aufbauten. Hier nur dünne Fassaden: der Kern liefert die
// Ops, die fehlende Einträge anhängen (gleiche id oder gleicher Name gilt als vorhanden).
import type { Project } from "./types";
import type { CoreOp } from "../core/ops";
import { applyOps } from "../core/ops";
import { documentFor } from "../core/document";
/** Ops, die die fehlenden Standard-Ressourcen anhängen („Standards laden"); leer, wenn alles da ist. */
export function standardsMergeOps(project: Project): CoreOp[] {
return documentFor(project).queryRoot<CoreOp[]>("standardsMergeOps");
}
/** Projekt mit allen Standard-Ressourcen (für neue Projekte). */
export function withStandards(project: Project): Project {
return applyOps(project, standardsMergeOps(project));
}
+61
View File
@@ -322,6 +322,26 @@ export type Component = {
abbrev?: string;
/** Verschneidungs-Rang: höher läuft am Stoß durch (Backbone). */
joinPriority: number;
/** Wärmeleitfähigkeit λ in W/(m·K) (Bemessungswert, z. B. SIA 381/1, Herstellerangabe). */
lambda?: number;
/** Rohdichte in kg/m³. */
density?: number;
/**
* Brandverhalten nach VKF (Brandschutzrichtlinie 13-15): "RF1" (kein Brandbeitrag), "RF2"
* (geringer), "RF3" (zulässiger), "RF4" (unzulässig). Freitext, damit auch Zusätze („RF1 (cr)") gehen.
*/
fireClass?: string;
/** Flächenfarbe in der Ansicht (Fassade/Dachaufsicht). Fehlt sie, gilt die bisherige Farbe. */
elevationColor?: string;
/**
* Ansichtsschraffur ([94]): Oberflächenmuster, das auf sichtbaren Flächen dieses Bauteils gezeichnet
* wird (Ansicht, Dachaufsicht im Grundriss). Masse in Metern am Bau, Ausrichtung am Element.
*/
surfacePattern?: SurfacePattern;
/**
* Herkunft: Kennung des Standard-Eintrags ([94], „Standards laden"), damit erneutes Laden nichts verdoppelt.
*/
standardId?: string;
};
/**
@@ -2095,6 +2115,16 @@ export type Roof = {
color?: string;
/** Stift-Kopplung von `color` (s. `Component.colorPenId`-Doku). */
colorPenId?: string;
/**
* Ansichtsschraffur ([94]): Drehung (Grad) des Oberflächenmusters dieses Elements gegenüber der
* Ausrichtung am Element (Default 0).
*/
surfacePatternAngle?: number;
/**
* Ansichtsschraffur ([94]): Versatz (m) des Musterursprungs (x entlang, y quer/aufwärts) gegenüber
* der Elementkante.
*/
surfacePatternOffset?: Vec2;
};
/**
@@ -2470,6 +2500,27 @@ export type SunStudy = {
show: boolean;
};
/**
* Ansichtsschraffur eines Bauteils ([94]): Muster auf sichtbaren Flächen, im Kern zu Linien gerechnet
* (`surface_pattern.rs`). Masse in Metern am Bau; Ursprung an der Elementkante (Wandanfang/UK, Traufe).
*/
export type SurfacePattern = {
kind: "lines" | "boardBatten" | "runningBond" | "shingles" | "trapezoid" | "polygonal" | "grid";
direction?: "vertical" | "horizontal";
/** Hauptabstand (m): Linien-/Rippenabstand, Steinlänge, Plattenbreite. */
spacing: number;
/** Lagen-/Plattenhöhe (m; Läuferverband, Schindeln, Raster). Fehlt sie, gilt `spacing`. */
height?: number;
/** Breite (m) der Deckleiste bzw. des Trapez-Obergurts. */
width?: number;
/** Grunddrehung (Grad) zusätzlich zur Richtung. */
angle?: number;
/** Strichstärke (Papier-mm); Default 0.1. */
weightMm?: number;
/** Linienfarbe; Default Vordergrund des Bauteils bzw. Dunkelgrau. */
color?: string;
};
/** Schwenkrichtung der Tür relativ zur Wandachse. */
export type SwingSide = "left" | "right";
@@ -2737,6 +2788,16 @@ export type Wall = {
* Additiv; Alt-Projekte laden unverändert (Default = "both").
*/
sliceTermination?: SliceTermination;
/**
* Ansichtsschraffur ([94]): Drehung (Grad) des Oberflächenmusters dieses Elements gegenüber der
* Ausrichtung am Element (Default 0).
*/
surfacePatternAngle?: number;
/**
* Ansichtsschraffur ([94]): Versatz (m) des Musterursprungs (x entlang, y quer/aufwärts) gegenüber
* der Elementkante.
*/
surfacePatternOffset?: Vec2;
};
/**
+2
View File
@@ -52,6 +52,7 @@ import {
SectionLineSection,
DetailRefSection,
} from "./ObjectInfoPanel";
import { SurfacePatternPlacement } from "./SurfacePatternPlacement";
/** UI-Zustand des 3-Optionen-Quellen-Dropdowns (nicht 1:1 das Modell-Feld:
* „custom" ist abgeleitet aus „ist ein expliziter Wert gesetzt?", nicht
@@ -784,6 +785,7 @@ export function AttributesPanel() {
{sel.wall && <WallSection wall={sel.wall} host={host} />}
{sel.ceiling && <CeilingSection ceiling={sel.ceiling} host={host} />}
{sel.roof && <RoofSection roof={sel.roof} host={host} />}
{(sel.wall || sel.roof) && <SurfacePatternPlacement kind={sel.wall ? "wall" : "roof"} id={sel.id} host={host} />}
{sel.opening && <OpeningSection opening={sel.opening} host={host} />}
{sel.stair && <StairSection stair={sel.stair} host={host} />}
{sel.room && <RoomSection room={sel.room} roomId={sel.id} host={host} />}
+53
View File
@@ -0,0 +1,53 @@
// Ansichtsschraffur am Element ([94]): Drehung und Versatz des Oberflächenmusters je Wand bzw. Dach
// (das Muster selbst gehört zum Bauteil der sichtbaren Schicht). Nur sichtbar, wenn ein Bauteil des
// Elements ein Muster trägt.
import { t } from "../i18n";
import type { usePanelHost } from "./host";
export function SurfacePatternPlacement({
kind,
id,
host,
}: {
kind: "wall" | "roof";
id: string;
host: ReturnType<typeof usePanelHost>;
}) {
const p = host.project;
const el = kind === "wall" ? p.walls.find((w) => w.id === id) : p.roofs?.find((r) => r.id === id);
if (!el || !host.onSetSurfacePatternPlacement) return null;
const typeId = kind === "wall" ? (el as { wallTypeId?: string }).wallTypeId : (el as { roofTypeId?: string }).roofTypeId;
const types = kind === "wall" ? p.wallTypes : p.roofTypes ?? [];
const layers = types.find((tp) => tp.id === typeId)?.layers ?? [];
const hasPattern = layers.some((l) => p.components.find((c) => c.id === l.componentId)?.surfacePattern);
if (!hasPattern) return null;
const angle = el.surfacePatternAngle ?? 0;
const off = el.surfacePatternOffset ?? { x: 0, y: 0 };
const set = host.onSetSurfacePatternPlacement;
const field = (key: Parameters<typeof t>[0], value: number, step: number, apply: (v: number) => void) => (
<div className="objinfo-field">
<span className="objinfo-flabel">{t(key)}</span>
<input
type="number"
className="objinfo-text"
step={step}
value={Number(value.toFixed(3))}
title={t(key)}
onChange={(e) => {
const v = Number(e.target.value);
if (Number.isFinite(v)) apply(v);
}}
/>
</div>
);
return (
<>
<div className="objinfo-sep" />
<div className="objinfo-section-label">{t("objinfo.surfacePattern")}</div>
{field("objinfo.surfacePattern.angle", angle, 1, (v) => set({ surfacePatternAngle: v || undefined }))}
{field("objinfo.surfacePattern.offsetX", off.x, 0.01, (x) => set({ surfacePatternOffset: { x, y: off.y } }))}
{field("objinfo.surfacePattern.offsetY", off.y, 0.01, (y) => set({ surfacePatternOffset: { x: off.x, y } }))}
</>
);
}
+2
View File
@@ -394,6 +394,8 @@ export interface PanelHostValue {
* "both" = heutiges Verhalten, "below"/"above" = die Wand endet an der Decke.
*/
onSetWallSliceTermination: (termination: SliceTermination) => void;
/** Ansichtsschraffur ([94]) 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. */
onSetWallType: (wallTypeId: string) => void;
/** Setzt die Gesamtdicke einer einschichtigen Wand (Meter). */
+3 -1
View File
@@ -22,6 +22,8 @@ export interface ElevationOptions {
*/
visibleCodes?: Set<string>;
categoryDisplay?: CategoryDisplayResolver;
/** Massstabsnenner (1:N) für die Ausdünnung der Ansichtsschraffur ([94]); Default 100. */
scaleDenominator?: number;
}
/**
@@ -32,7 +34,7 @@ export function generateElevationPlan(project: Project, level: DrawingLevel, opt
if (!hasLine(level)) return null;
const shadows = opts.shadows ?? level.shadows ?? false;
const text = JSON.stringify({ level: levelArg(level), ...visibilityArgs(project, opts.visibleCodes, opts.categoryDisplay) });
const buf = decodePlanBuf(documentFor(project).queryBin("elevationPlan", [opts.mono ? 1 : 0, shadows ? 1 : 0], text));
const buf = decodePlanBuf(documentFor(project).queryBin("elevationPlan", [opts.mono ? 1 : 0, shadows ? 1 : 0, opts.scaleDenominator ?? 100], text));
if (buf.groups.length === 0) return null;
const b = buf.bounds ?? [0, 0, 1, 1];
return lazyPlan(
+4
View File
@@ -57,6 +57,7 @@ import {
PEN_FALLBACK_COLOR,
PEN_FALLBACK_WEIGHT,
} from "../model/penSets";
import { standardsMergeOps } from "../model/standards";
import { reorderByIds } from "../model/reorder";
import { transformMutation } from "../tools/transform";
import type { CopyMode, TransformOp, TransformSelection } from "../tools/transform";
@@ -182,6 +183,8 @@ export interface ProjectSlice {
patchPenSetWeight: (setId: string, penId: string, weight: number) => void;
/** Ersetzt `pens`/legt einen neuen Satz mit der 255er-CAD-Standardpalette an (s. `model/penSets.ts`). */
seedStandardPenSet: () => void;
/** Ergänzt die fehlenden SIA-400-Standards (Baustoffe, Schraffuren, Linientypen, Aufbauten; [94]–[96]). */
loadStandards: () => void;
// ── Benutzerdefinierte Farbpaletten (s. model/types.ts::CustomPalette) ────
addCustomPalette: () => void;
@@ -1022,6 +1025,7 @@ export function createProjectSlice(
}),
seedStandardPenSet: () => applyChange((p) => seedStandardPenSetOps(p)),
loadStandards: () => applyChange((p) => standardsMergeOps(p)),
addCustomPalette: () =>
applyChange(
+4
View File
@@ -787,6 +787,10 @@ export function usePanelHostBase(opts: {
if (selection?.kind === "wall")
updateWall(selection.id, { referenceOffset: offset ?? undefined });
},
onSetSurfacePatternPlacement: (patch) => {
if (selection?.kind === "wall") updateWall(selection.id, patch, "surface-pattern");
else if (selection?.kind === "roof") updateRoof(selection.id, patch, "surface-pattern");
},
onSetWallSliceTermination: (termination) => {
if (selection?.kind === "wall")
// "both" ist der Default ⇒ als undefined speichern (Alt-Projekt-Parität).
+2
View File
@@ -112,6 +112,7 @@ export function useProjectActions(
const patchPenSetColor = useStore((s) => s.patchPenSetColor);
const patchPenSetWeight = useStore((s) => s.patchPenSetWeight);
const seedStandardPenSet = useStore((s) => s.seedStandardPenSet);
const loadStandards = useStore((s) => s.loadStandards);
const addCustomPalette = useStore((s) => s.addCustomPalette);
const renameCustomPalette = useStore((s) => s.renameCustomPalette);
const deleteCustomPalette = useStore((s) => s.deleteCustomPalette);
@@ -419,6 +420,7 @@ export function useProjectActions(
patchPenSetColor,
patchPenSetWeight,
seedStandardPenSet,
loadStandards,
addCustomPalette,
renameCustomPalette,
deleteCustomPalette,
+6 -3
View File
@@ -39,6 +39,7 @@ import {
import type { LockInfo } from "../native/projectFile";
import { addRecentProject, removeRecentProject } from "./recentProjects";
import { emptyProject, sampleProject } from "../model/sampleProject";
import { withStandards } from "../model/standards";
import type { Project } from "../model/types";
import type { PlanViewHandle } from "../views/plan/PlanView";
@@ -366,8 +367,10 @@ export function useProjectFileActions(
// `guardDiscard`: bei ungespeicherten Änderungen erst der Dialog, s. o.
const onNewProject = () => guardDiscard(() => {
releaseCurrentProjectLock();
getState().loadProject(emptyProject);
lastSavedProjectRef.current = emptyProject;
// Neue Projekte bringen die SIA-400-Standards mit ([94]–[96]).
const next = withStandards(emptyProject);
getState().loadProject(next);
lastSavedProjectRef.current = next;
});
// Übernimmt ein neues, noch UNGESPEICHERTES Projekt aus Vorlagen-Inhalt
@@ -390,7 +393,7 @@ export function useProjectFileActions(
// Startzustand, s. state/projectSlice.ts).
const onNewProjectFromSample = () => guardDiscard(() => {
releaseCurrentProjectLock();
const next = structuredClone(sampleProject);
const next = withStandards(structuredClone(sampleProject));
getState().loadProject(next);
lastSavedProjectRef.current = next;
});
+12
View File
@@ -151,6 +151,8 @@ export interface ResourceManagerHandlers {
onPatchPenSetWeight?: (setId: string, penId: string, weight: number) => void;
/** Ersetzt `pens`/legt einen neuen Satz mit der 255er-CAD-Standardpalette an. */
onSeedStandardPenSet?: () => void;
/** Ergänzt die fehlenden SIA-400-Standards ([94]–[96], „Standards laden"). */
onLoadStandards?: () => void;
/**
* Farbpaletten (Tab „Paletten"): eigene Paletten verwalten + Sichtbarkeit
* der Bänke im Farbwahl-Popover. Optional wie die Stift-Handler.
@@ -318,6 +320,16 @@ export function ResourceManager({
</span>
{t("resources.title")}
</div>
{handlers.onLoadStandards && (
<button
className="res-add res-load-standards"
title={t("resources.loadStandards.hint")}
onPointerDown={(e) => e.stopPropagation()}
onClick={() => handlers.onLoadStandards?.()}
>
{t("resources.loadStandards")}
</button>
)}
{!windowed && (
<button
className="res-close"
@@ -0,0 +1,88 @@
// Bauteil-Kennwerte und Ansichtsschraffur ([94]–[95]): λ, Rohdichte, VKF-Brandverhalten, Ansichtsfarbe und
// das Oberflächenmuster (Art, Richtung, Masse). Teil des Bauteil-Details im Ressourcen-Manager.
import type { Component, SurfacePattern } from "../../model/types";
import { t } from "../../i18n";
import { ColorField, FieldRow, NumberField, SelectField } from "./fields";
type Kind = SurfacePattern["kind"];
const KINDS: Kind[] = ["lines", "boardBatten", "runningBond", "shingles", "trapezoid", "polygonal", "grid"];
const FIRE = ["", "RF1", "RF2", "RF3", "RF4"];
/** Vorgaben je Musterart (Meter), damit ein neu gewähltes Muster sofort sinnvoll aussieht. */
const DEFAULTS: Record<Kind, Omit<SurfacePattern, "kind">> = {
lines: { spacing: 0.08 },
boardBatten: { spacing: 0.2, width: 0.06 },
runningBond: { spacing: 0.26, height: 0.075 },
shingles: { spacing: 0.1, height: 0.12 },
trapezoid: { spacing: 0.2, width: 0.06 },
polygonal: { spacing: 0.45, height: 0.35 },
grid: { spacing: 1.25, height: 0.625 },
};
const posOrUndef = (v: number) => (Number.isFinite(v) && v > 0 ? v : undefined);
export function ComponentStandardFields({
component,
onPatch,
}: {
component: Component;
onPatch: (patch: Partial<Component>) => void;
}) {
const sp = component.surfacePattern;
const patchPattern = (p: Partial<SurfacePattern>) => sp && onPatch({ surfacePattern: { ...sp, ...p } });
return (
<>
<FieldRow label={t("resources.col.lambda")}>
<NumberField value={component.lambda ?? 0} step={0.001} min={0} onChange={(v) => onPatch({ lambda: posOrUndef(v) })} />
</FieldRow>
<FieldRow label={t("resources.col.density")}>
<NumberField value={component.density ?? 0} step={10} min={0} onChange={(v) => onPatch({ density: posOrUndef(v) })} />
</FieldRow>
<FieldRow label={t("resources.col.fireClass")}>
<SelectField
value={component.fireClass ?? ""}
onChange={(v) => onPatch({ fireClass: v || undefined })}
options={FIRE.map((f) => ({ value: f, label: f || t("resources.col.fireClass.none") }))}
/>
</FieldRow>
<FieldRow label={t("resources.col.elevationColor")}>
<ColorField color={component.elevationColor ?? component.color} onChange={(elevationColor) => onPatch({ elevationColor })} />
</FieldRow>
<FieldRow label={t("resources.col.surfacePattern")} hint={t("resources.col.surfacePattern.hint")}>
<SelectField
value={sp?.kind ?? ""}
onChange={(k) => onPatch({ surfacePattern: k ? { ...DEFAULTS[k as Kind], kind: k as Kind } : undefined })}
options={[
{ value: "", label: t("resources.surfacePattern.none") },
...KINDS.map((k) => ({ value: k, label: t(`resources.surfacePattern.${k}`) })),
]}
/>
</FieldRow>
{sp && (
<>
<FieldRow label={t("resources.surfacePattern.direction")}>
<SelectField
value={sp.direction ?? ""}
onChange={(d) => patchPattern({ direction: (d || undefined) as SurfacePattern["direction"] })}
options={[
{ value: "", label: t("resources.surfacePattern.direction.auto") },
{ value: "vertical", label: t("resources.surfacePattern.direction.vertical") },
{ value: "horizontal", label: t("resources.surfacePattern.direction.horizontal") },
]}
/>
</FieldRow>
<FieldRow label={t("resources.surfacePattern.spacing")}>
<NumberField value={sp.spacing} step={0.01} min={0.005} onChange={(v) => v > 0 && patchPattern({ spacing: v })} />
</FieldRow>
<FieldRow label={t("resources.surfacePattern.height")}>
<NumberField value={sp.height ?? sp.spacing} step={0.005} min={0} onChange={(v) => patchPattern({ height: posOrUndef(v) })} />
</FieldRow>
<FieldRow label={t("resources.surfacePattern.width")}>
<NumberField value={sp.width ?? 0} step={0.005} min={0} onChange={(v) => patchPattern({ width: posOrUndef(v) })} />
</FieldRow>
</>
)}
</>
);
}
+22
View File
@@ -21,6 +21,7 @@ import { HatchSwatch } from "../hatchPreview";
import { t } from "../../i18n";
import { activePenSet, resolvePenColor } from "../../model/penSets";
import { PenColorField } from "../PenColorField";
import { ComponentStandardFields } from "./ComponentStandardFields";
import {
DeleteButton,
FieldRow,
@@ -45,6 +46,7 @@ function MaterialCell({
onClear: () => void;
}) {
const [open, setOpen] = useState(false);
const [fetching, setFetching] = useState(false);
const label = materialLabel(material);
return (
<>
@@ -61,6 +63,24 @@ function MaterialCell({
)}
<span className="res-material-name">{label}</span>
</button>
{material?.libraryId && !material.color && (
// Standard-Bauteil mit ambientCG-Kennung ohne gebündelte Karten ([94]): bei Bedarf laden.
<button
className="res-add"
disabled={fetching}
title={t("material.fetchAmbient.hint")}
onClick={() => {
const id = material.libraryId!;
setFetching(true);
fetchMaterialMaps(id, "1K", material.sizeM ?? DEFAULT_TILE_SIZE_M)
.then(({ material: m }) => onAssign(m))
.catch((e) => console.error("[ambientcg] download failed:", e))
.finally(() => setFetching(false));
}}
>
{t("material.fetchAmbient")}
</button>
)}
{open && (
<MaterialPicker
material={material}
@@ -87,6 +107,7 @@ function materialLabel(m: ComponentMaterial | undefined): string {
if (m.libraryId) {
const asset = MATERIAL_LIBRARY.find((a) => a.id === m.libraryId);
if (asset) return asset.name;
if (!m.color) return `ambientCG ${m.libraryId}`;
}
return t("material.uploaded");
}
@@ -739,6 +760,7 @@ function ComponentDetail({
onClear={() => onPatch({ material: undefined })}
/>
</FieldRow>
<ComponentStandardFields component={component} onPatch={onPatch} />
</div>
</div>
);
+3 -3
View File
@@ -664,7 +664,7 @@ function useCrossKindOverlay(
let prims: Primitive[];
if (l.kind === "elevation") {
prims =
generateElevationPlan(project, l, { mono, visibleCodes, categoryDisplay })?.primitives ?? [];
generateElevationPlan(project, l, { mono, visibleCodes, categoryDisplay, scaleDenominator })?.primitives ?? [];
} else if (l.kind === "section") {
const sOut = sectionOutputs[l.id];
prims = sOut
@@ -1140,9 +1140,9 @@ function SectionPlanView({
const elevationPlan = useMemo(
() =>
isElevation
? generateElevationPlan(inputs.project, inputs.level, { mono, visibleCodes, categoryDisplay })
? generateElevationPlan(inputs.project, inputs.level, { mono, visibleCodes, categoryDisplay, scaleDenominator })
: null,
[isElevation, inputs, mono, visibleCodes, categoryDisplay],
[isElevation, inputs, mono, visibleCodes, categoryDisplay, scaleDenominator],
);
const sectionPlan = useMemo(