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,
|
||||
|
||||
Reference in New Issue
Block a user