Mass-Style Preset (Raum-Rundung + Dim-Format) + Rundung als Dropdown
Frontend: - RaumProperties Rundung: 5er-Button-Reihe → Dropdown mit "Aus Mass-Style" als erstem Eintrag (leer = Default aus aktivem Preset uebernehmen) - Dach-Typ + Mansarde-Variante: text-only Button-Reihen → Dropdowns - Mass-Style-Section neu im DimensionenApp ganz oben: - Picker fuer aktives Preset - + (neu mit aktuellen Werten als Vorlage) / Loeschen - Inline-Editor: Name, Raum-Rundung, Mass-Dezimalstellen, Mass-Einheit Backend (rhino/mass_style.py — neu): - doc.Strings["dossier_mass_styles"]: JSON-Liste der Presets - doc.Strings["dossier_mass_style_active"]: aktive Preset-ID - list_presets/save_preset/delete_preset/get_active_id/set_active_id - Convenience: raum_rundung_default(doc), dim_dezimalstellen_default(doc) - Default-Presets bei erster Initialisierung: 1:50 / 1:100 / 1:500 elemente.py: - _read_meta: raum_rundung leer wenn UserString fehlt (vorher gezwungen "0.1") - _resolve_raum_rundung(meta, doc): per-Raum-Override > Mass-Style-Default - _make_raum_stamp_text + state-send nutzen Resolver - State sendet rundung (raw, kann "" sein) + rundungEffective + areaFmt damit React-Panel "Aus Mass-Style" anzeigen kann dimensionen.py: - Bridge-Endpoints MASS_STYLE_SET_ACTIVE / SAVE / DELETE - _broadcast_raum_regen: bei Preset-Wechsel alle Raeume queuen → Stempel- Flaechen kommen mit neuer Default-Rundung - _compute_state liefert massStyles + massStyleActive + signature update NOCH NICHT verdrahtet: Mass-Linien-Formatierung (dimDezimalstellen, dimEinheit) — Datenmodell ist da, Anwendung auf Rhino-Dimension-Renderer folgt in einem naechsten Schritt. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -5,6 +5,7 @@ import {
|
||||
setRefPoint, setCoordSystem,
|
||||
setDimPosition, setDimDimension, setDimRotationZ,
|
||||
setCircleRadius, setLineLength, setRectangleDims,
|
||||
setMassStyleActive, saveMassStyle, deleteMassStyle,
|
||||
} from './lib/rhinoBridge'
|
||||
|
||||
// ---- Helpers --------------------------------------------------------------
|
||||
@@ -140,6 +141,149 @@ function Field({ label, children, style }) {
|
||||
)
|
||||
}
|
||||
|
||||
// ---- Mass-Style Section ---------------------------------------------------
|
||||
// Globaler Preset-Picker fuer Raum-Rundung + Mass-Linien-Dezimalstellen.
|
||||
// Hostet hier weil das thematisch zu Dimensionen passt, der Preset wird aber
|
||||
// dokument-weit angewendet (Raum-Stempel lesen ihn auch).
|
||||
|
||||
const RAUM_RUNDUNGS_LABELS = {
|
||||
'exakt': 'Exakt (2 Nachk.)',
|
||||
'0.01': 'auf 0.01 m²',
|
||||
'0.1': 'auf 0.1 m²',
|
||||
'0.5': 'auf 0.5 m²',
|
||||
'1': 'auf 1 m²',
|
||||
}
|
||||
|
||||
function MassStyleSection({ massStyles, activeId }) {
|
||||
const styles = Array.isArray(massStyles) ? massStyles : []
|
||||
const active = styles.find(p => p.id === activeId) || styles[0]
|
||||
const update = (patch) => {
|
||||
if (!active) return
|
||||
saveMassStyle({ ...active, ...patch })
|
||||
}
|
||||
const addNew = () => {
|
||||
const name = (window.prompt('Name für neuen Mass-Style:') || '').trim()
|
||||
if (!name) return
|
||||
// Aktuelle Werte als Vorlage uebernehmen (oder Defaults)
|
||||
const tmpl = active || { raumRundung: '0.1', dimDezimalstellen: 2, dimEinheit: 'm' }
|
||||
saveMassStyle({
|
||||
name,
|
||||
raumRundung: tmpl.raumRundung,
|
||||
dimDezimalstellen: tmpl.dimDezimalstellen,
|
||||
dimEinheit: tmpl.dimEinheit,
|
||||
})
|
||||
}
|
||||
const remove = () => {
|
||||
if (!active) return
|
||||
if (styles.length <= 1) {
|
||||
window.alert('Mindestens ein Mass-Style muss erhalten bleiben.')
|
||||
return
|
||||
}
|
||||
if (!window.confirm(`Mass-Style "${active.name}" löschen?`)) return
|
||||
deleteMassStyle(active.id)
|
||||
}
|
||||
return (
|
||||
<div style={{
|
||||
padding: '8px 12px',
|
||||
borderBottom: '1px solid var(--border-light)',
|
||||
background: 'var(--bg-section)',
|
||||
}}>
|
||||
<div style={{
|
||||
display: 'flex', alignItems: 'center', gap: 6, marginBottom: 6,
|
||||
}}>
|
||||
<Icon name="straighten" size={12} style={{ color: 'var(--text-muted)' }} />
|
||||
<span style={{ fontSize: 9, color: 'var(--text-muted)',
|
||||
textTransform: 'uppercase', letterSpacing: '0.06em',
|
||||
fontWeight: 600, flex: 1 }}>
|
||||
Mass-Style
|
||||
</span>
|
||||
</div>
|
||||
<div style={{ display: 'flex', gap: 4, marginBottom: 6 }}>
|
||||
<select
|
||||
value={activeId || (active?.id || '')}
|
||||
onChange={(e) => setMassStyleActive(e.target.value)}
|
||||
style={{ flex: 1, fontSize: 11 }}
|
||||
>
|
||||
{styles.map(p => (
|
||||
<option key={p.id} value={p.id}>{p.name}</option>
|
||||
))}
|
||||
</select>
|
||||
<button
|
||||
onClick={addNew}
|
||||
className="btn-outlined"
|
||||
style={{ padding: '3px 6px' }}
|
||||
title="Neuen Mass-Style anlegen (mit aktuellen Werten als Vorlage)"
|
||||
><Icon name="add" size={12} /></button>
|
||||
<button
|
||||
onClick={remove}
|
||||
className="btn-outlined"
|
||||
style={{ padding: '3px 6px' }}
|
||||
title="Aktuellen Mass-Style löschen"
|
||||
disabled={styles.length <= 1}
|
||||
><Icon name="delete" size={12} /></button>
|
||||
</div>
|
||||
{active && (
|
||||
<div style={{ display: 'flex', flexDirection: 'column', gap: 4 }}>
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: 6 }}>
|
||||
<span style={{ fontSize: 9, color: 'var(--text-muted)', width: 90 }}>
|
||||
Name
|
||||
</span>
|
||||
<input
|
||||
type="text"
|
||||
value={active.name}
|
||||
onChange={(e) => update({ name: e.target.value })}
|
||||
style={{ flex: 1, fontSize: 11, padding: '2px 6px' }}
|
||||
/>
|
||||
</div>
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: 6 }}>
|
||||
<span style={{ fontSize: 9, color: 'var(--text-muted)', width: 90 }}>
|
||||
Raum-Rundung
|
||||
</span>
|
||||
<select
|
||||
value={active.raumRundung}
|
||||
onChange={(e) => update({ raumRundung: e.target.value })}
|
||||
style={{ flex: 1, fontSize: 11 }}
|
||||
>
|
||||
{Object.entries(RAUM_RUNDUNGS_LABELS).map(([v, l]) => (
|
||||
<option key={v} value={v}>{l}</option>
|
||||
))}
|
||||
</select>
|
||||
</div>
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: 6 }}>
|
||||
<span style={{ fontSize: 9, color: 'var(--text-muted)', width: 90 }}>
|
||||
Mass-Dezimalstellen
|
||||
</span>
|
||||
<select
|
||||
value={active.dimDezimalstellen}
|
||||
onChange={(e) => update({ dimDezimalstellen: parseInt(e.target.value, 10) })}
|
||||
style={{ flex: 1, fontSize: 11 }}
|
||||
>
|
||||
{[0, 1, 2, 3, 4].map(n => (
|
||||
<option key={n} value={n}>{n} {n === 1 ? 'Stelle' : 'Stellen'}</option>
|
||||
))}
|
||||
</select>
|
||||
</div>
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: 6 }}>
|
||||
<span style={{ fontSize: 9, color: 'var(--text-muted)', width: 90 }}>
|
||||
Mass-Einheit
|
||||
</span>
|
||||
<select
|
||||
value={active.dimEinheit}
|
||||
onChange={(e) => update({ dimEinheit: e.target.value })}
|
||||
style={{ flex: 1, fontSize: 11 }}
|
||||
>
|
||||
<option value="m">m (Meter)</option>
|
||||
<option value="cm">cm (Zentimeter)</option>
|
||||
<option value="mm">mm (Millimeter)</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
// ---- Hauptkomponente ------------------------------------------------------
|
||||
|
||||
export default function DimensionenApp() {
|
||||
@@ -195,6 +339,11 @@ export default function DimensionenApp() {
|
||||
}}>
|
||||
<div style={{ flex: 1, overflowY: 'auto', overflowX: 'hidden' }}>
|
||||
|
||||
<MassStyleSection
|
||||
massStyles={state.massStyles}
|
||||
activeId={state.massStyleActive}
|
||||
/>
|
||||
|
||||
{/* Header: Selektions-Info + World/CPlane */}
|
||||
<div style={{
|
||||
display: 'flex', alignItems: 'center', gap: 6,
|
||||
|
||||
+26
-48
@@ -848,21 +848,17 @@ function RaumProperties({ raum, geschosse, onUpdate, onDelete, hatchPatterns })
|
||||
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: 6 }}>
|
||||
<span style={{ fontSize: 10, color: 'var(--text-muted)', width: 60 }}>Rundung</span>
|
||||
<div style={{ flex: 1, display: 'flex', gap: 2 }}>
|
||||
{RAUM_RUNDUNGEN.map(r => (
|
||||
<button key={r}
|
||||
onClick={() => onUpdate({ rundung: r })}
|
||||
className={raum.rundung === r ? 'btn-contained' : 'btn-outlined'}
|
||||
style={{ flex: 1, padding: '3px 4px', fontSize: 10 }}
|
||||
title={r === 'exakt' ? '2 Nachkommastellen, ohne Rundung'
|
||||
: r === '0.01' ? 'auf 0.01 m²'
|
||||
: r === '0.1' ? 'auf 0.1 m²'
|
||||
: r === '0.5' ? 'auf 0.5 m²'
|
||||
: 'auf ganze m²'}>
|
||||
{r}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
<select value={raum.rundung || ''}
|
||||
onChange={(e) => onUpdate({ rundung: e.target.value })}
|
||||
style={{ flex: 1, fontSize: 11 }}
|
||||
title="Rundung der Flächenangabe. Leer = Default aus Mass-Style.">
|
||||
<option value="">Aus Mass-Style</option>
|
||||
<option value="exakt">Exakt (2 Nachkommastellen)</option>
|
||||
<option value="0.01">auf 0.01 m²</option>
|
||||
<option value="0.1">auf 0.1 m²</option>
|
||||
<option value="0.5">auf 0.5 m²</option>
|
||||
<option value="1">auf 1 m²</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: 6 }}>
|
||||
@@ -1279,24 +1275,14 @@ function DachProperties({ dach, geschosse, onUpdate, onDelete }) {
|
||||
{/* Dach-Typ */}
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: 6 }}>
|
||||
<span style={{ fontSize: 10, color: 'var(--text-muted)', width: 50 }}>Typ</span>
|
||||
<div style={{ flex: 1, display: 'flex', gap: 2 }}>
|
||||
{[
|
||||
{ code: 'pult', label: 'Pult' },
|
||||
{ code: 'sattel', label: 'Sattel' },
|
||||
{ code: 'walm', label: 'Walm' },
|
||||
{ code: 'mansarde', label: 'Mansarde' },
|
||||
].map(o => (
|
||||
<button key={o.code}
|
||||
onClick={() => onUpdate({ dachTyp: o.code })}
|
||||
className={dachTyp === o.code ? 'btn-contained' : 'btn-outlined'}
|
||||
style={{ flex: 1, padding: '3px 4px', fontSize: 9 }}
|
||||
title={o.code === 'pult'
|
||||
? 'Geneigte Fläche, Traufe = 1. Kante'
|
||||
: 'Erfordert Rechteck-Outline (4 Ecken)'}>
|
||||
{o.label}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
<select value={dachTyp}
|
||||
onChange={(e) => onUpdate({ dachTyp: e.target.value })}
|
||||
style={{ flex: 1, fontSize: 11 }}>
|
||||
<option value="pult">Pult — Geneigte Fläche, Traufe = 1. Kante</option>
|
||||
<option value="sattel">Sattel — Rechteck-Outline (4 Ecken)</option>
|
||||
<option value="walm">Walm — Rechteck-Outline (4 Ecken)</option>
|
||||
<option value="mansarde">Mansarde — Rechteck-Outline (4 Ecken)</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: 6 }}>
|
||||
@@ -1359,21 +1345,13 @@ function DachProperties({ dach, geschosse, onUpdate, onDelete }) {
|
||||
<>
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: 6 }}>
|
||||
<span style={{ fontSize: 10, color: 'var(--text-muted)', width: 50 }}>Variante</span>
|
||||
<div style={{ flex: 1, display: 'flex', gap: 2 }}>
|
||||
{[
|
||||
{ code: 'walm', label: 'Walm', hint: 'Knick auf allen 4 Seiten (Pariser Stil)' },
|
||||
{ code: 'giebel', label: 'Giebel', hint: 'Knick nur an langen Seiten, Schmalseiten als Giebelwand (DACH-Standard)' },
|
||||
{ code: 'walm_giebel', label: 'W-G', hint: 'Unten Walm (Knick rundum), oben Giebel mit First über voller Länge' },
|
||||
].map(o => (
|
||||
<button key={o.code}
|
||||
onClick={() => onUpdate({ dachVariante: o.code })}
|
||||
className={(dach.dachVariante || 'walm') === o.code ? 'btn-contained' : 'btn-outlined'}
|
||||
style={{ flex: 1, padding: '3px 6px', fontSize: 10 }}
|
||||
title={o.hint}>
|
||||
{o.label}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
<select value={dach.dachVariante || 'walm'}
|
||||
onChange={(e) => onUpdate({ dachVariante: e.target.value })}
|
||||
style={{ flex: 1, fontSize: 11 }}>
|
||||
<option value="walm">Walm — Knick auf allen 4 Seiten (Pariser Stil)</option>
|
||||
<option value="giebel">Giebel — Knick nur an langen Seiten (DACH-Standard)</option>
|
||||
<option value="walm_giebel">Walm + Giebel — Unten Walm, oben Giebel</option>
|
||||
</select>
|
||||
</div>
|
||||
<MansardeFields dach={dach} onUpdate={onUpdate} />
|
||||
</>
|
||||
|
||||
@@ -171,6 +171,11 @@ export function saveOverridesPreset(name) { send('SAVE_OVERRIDES_PRESET', { name
|
||||
export function openOverridesPanel() { send('OPEN_OVERRIDES_PANEL', {}) }
|
||||
export function openKameraPanel() { send('OPEN_KAMERA_PANEL', {}) }
|
||||
|
||||
// --- Mass-Style (Dimensionen-Panel hostet) ---
|
||||
export function setMassStyleActive(id) { send('MASS_STYLE_SET_ACTIVE', { id }) }
|
||||
export function saveMassStyle(preset) { send('MASS_STYLE_SAVE', { preset }) }
|
||||
export function deleteMassStyle(id) { send('MASS_STYLE_DELETE', { id }) }
|
||||
|
||||
// --- Kamera-Panel ---
|
||||
export function setKameraViewport(state) { send('SET_VIEWPORT', { ...state }) }
|
||||
export function setKameraProjection(parallel) { send('SET_PROJECTION', { parallel: !!parallel }) }
|
||||
|
||||
Reference in New Issue
Block a user