Initial commit — Dossier Rhino 8 Plugin
OpenStudio-Suite Architektur-Plugin fuer Rhino 8 (Mac): - Smart-Elemente: Wand, Decke, Dach (Pult/Sattel/Walm/Mansarde), Oeffnungen (Fenster/Tueren mit Rahmen + Sims + Glas + Fluegel), Treppen (gerade · L · Wendel mit Schrittmass-Validierung) - Live-Previews mit Step-Lines + Soll-Range-Clamping - Bidirektionale Selection-Sync zwischen Source-Linie und Volume - Geschoss-/Ebenen-Verwaltung mit OKFF-Persistenz - Layouts mit PDF-Export - Ausschnitte / Massstab / Override-Regeln - Petrol-Gruen Theme (Rapport-konform) Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,252 @@
|
||||
import { useState } from 'react'
|
||||
import Icon from './Icon'
|
||||
|
||||
function Field({ label, hint, children }) {
|
||||
return (
|
||||
<div style={{ display: 'flex', flexDirection: 'column', gap: 3, padding: '5px 0' }}>
|
||||
<span style={{ fontSize: 10, color: 'var(--text-secondary)', fontWeight: 500, letterSpacing: 0.2 }}>
|
||||
{label}
|
||||
</span>
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: 6 }}>{children}</div>
|
||||
{hint && (
|
||||
<span style={{ fontSize: 9, color: 'var(--text-muted)', lineHeight: 1.4 }}>{hint}</span>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
function SectionLabel({ children }) {
|
||||
return (
|
||||
<div style={{
|
||||
fontSize: 9, color: 'var(--text-muted)', fontWeight: 600,
|
||||
letterSpacing: 0.5, textTransform: 'uppercase',
|
||||
padding: '8px 0 2px',
|
||||
borderTop: '1px solid var(--border-light)',
|
||||
marginTop: 6,
|
||||
}}>{children}</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default function EbenenSettingsDialog({ ebene, hatchPatterns = ['Solid'], onSave, onClose }) {
|
||||
const [draft, setDraft] = useState({
|
||||
...ebene,
|
||||
fill: {
|
||||
pattern: 'None',
|
||||
source: 'layer',
|
||||
color: null,
|
||||
scale: 1.0,
|
||||
rotation: 0,
|
||||
lw: null, // Stiftstaerke der Hatch in mm; null = wie Stift der Ebene
|
||||
...(ebene.fill || {}),
|
||||
},
|
||||
})
|
||||
|
||||
const set = (patch) => setDraft({ ...draft, ...patch })
|
||||
const setFill = (patch) => setDraft({ ...draft, fill: { ...draft.fill, ...patch } })
|
||||
|
||||
const fill = draft.fill
|
||||
const isFilled = fill.pattern !== 'None'
|
||||
const isPattern = isFilled && fill.pattern !== 'Solid'
|
||||
const fillFromLayer = fill.source === 'layer'
|
||||
const previewColor = (fillFromLayer || !fill.color) ? draft.color : fill.color
|
||||
|
||||
// Pattern-Optionen: None + Solid + Patterns
|
||||
const patternOptions = [
|
||||
'None', 'Solid',
|
||||
...hatchPatterns.filter(p => p !== 'Solid' && p !== 'None'),
|
||||
]
|
||||
|
||||
return (
|
||||
<div style={{
|
||||
position: 'absolute', inset: 0, zIndex: 150,
|
||||
background: 'var(--bg-overlay)',
|
||||
display: 'flex', alignItems: 'flex-start', justifyContent: 'center',
|
||||
paddingTop: 30,
|
||||
}}>
|
||||
<div style={{
|
||||
background: 'var(--bg-dialog)',
|
||||
border: '1px solid var(--border)',
|
||||
borderRadius: 'var(--r-lg)',
|
||||
boxShadow: 'var(--shadow-3)',
|
||||
width: 'calc(100% - 16px)', maxWidth: 300,
|
||||
display: 'flex', flexDirection: 'column',
|
||||
overflow: 'hidden',
|
||||
maxHeight: 'calc(100vh - 60px)',
|
||||
}}>
|
||||
{/* Header */}
|
||||
<div style={{
|
||||
display: 'flex', alignItems: 'center', gap: 6,
|
||||
padding: '10px 12px',
|
||||
borderBottom: '1px solid var(--border)',
|
||||
}}>
|
||||
<Icon name="settings" size={14} style={{ color: 'var(--text-secondary)', flexShrink: 0 }} />
|
||||
<span style={{
|
||||
flex: 1, fontWeight: 600, fontSize: 11,
|
||||
overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap',
|
||||
}}>
|
||||
{ebene.code} — {ebene.name}
|
||||
</span>
|
||||
<button onClick={onClose} style={{ color: 'var(--text-muted)', fontSize: 16, padding: '0 4px', lineHeight: 1 }}>×</button>
|
||||
</div>
|
||||
|
||||
{/* Body */}
|
||||
<div style={{ padding: '6px 12px 4px', overflowY: 'auto' }}>
|
||||
<Field label="CODE">
|
||||
<input
|
||||
value={draft.code}
|
||||
onChange={(ev) => set({ code: ev.target.value })}
|
||||
maxLength={4}
|
||||
style={{ flex: 1, fontSize: 11, fontFamily: 'var(--font-mono)', fontWeight: 600, minWidth: 0 }}
|
||||
/>
|
||||
</Field>
|
||||
|
||||
<Field label="NAME">
|
||||
<input
|
||||
value={draft.name}
|
||||
onChange={(ev) => set({ name: ev.target.value })}
|
||||
style={{ flex: 1, fontSize: 11, fontWeight: 600, minWidth: 0 }}
|
||||
/>
|
||||
</Field>
|
||||
|
||||
<Field label="FARBE (Stift)">
|
||||
<input
|
||||
type="color"
|
||||
value={draft.color}
|
||||
onChange={(ev) => set({ color: ev.target.value })}
|
||||
style={{
|
||||
width: 32, height: 22, padding: 0,
|
||||
border: '1px solid var(--border)', borderRadius: 'var(--r)',
|
||||
cursor: 'pointer', background: 'transparent',
|
||||
}}
|
||||
/>
|
||||
<input
|
||||
value={draft.color}
|
||||
onChange={(ev) => set({ color: ev.target.value })}
|
||||
style={{ flex: 1, fontSize: 10, fontFamily: 'var(--font-mono)', minWidth: 0 }}
|
||||
/>
|
||||
</Field>
|
||||
|
||||
<Field label="STRICHSTÄRKE (mm)">
|
||||
<input
|
||||
type="number" step="0.01" min="0.01" max="2.0"
|
||||
value={draft.lw}
|
||||
onChange={(ev) => set({ lw: parseFloat(ev.target.value) || draft.lw })}
|
||||
style={{ flex: 1, fontSize: 11, textAlign: 'right', minWidth: 0 }}
|
||||
/>
|
||||
</Field>
|
||||
|
||||
<SectionLabel>Schraffur „Nach Ebene"</SectionLabel>
|
||||
<span style={{ fontSize: 9, color: 'var(--text-muted)', lineHeight: 1.4, display: 'block', marginBottom: 4 }}>
|
||||
Wird auf neue geschlossene Kurven angewandt die auf dieser Ebene gezeichnet werden.
|
||||
</span>
|
||||
|
||||
<Field label="PATTERN">
|
||||
<select
|
||||
value={fill.pattern}
|
||||
onChange={(ev) => setFill({ pattern: ev.target.value })}
|
||||
style={{ flex: 1, fontSize: 11, minWidth: 0 }}
|
||||
>
|
||||
{patternOptions.map(p => (
|
||||
<option key={p} value={p}>{p}</option>
|
||||
))}
|
||||
</select>
|
||||
</Field>
|
||||
|
||||
{isFilled && (
|
||||
<>
|
||||
<Field label="FARBE-QUELLE">
|
||||
<select
|
||||
value={fill.source}
|
||||
onChange={(ev) => setFill({ source: ev.target.value })}
|
||||
style={{ flex: 1, fontSize: 11, minWidth: 0 }}
|
||||
>
|
||||
<option value="layer">Nach Stift (Layerfarbe)</option>
|
||||
<option value="object">Eigene Farbe</option>
|
||||
</select>
|
||||
</Field>
|
||||
|
||||
<Field label="VORSCHAU / FARBE">
|
||||
<input
|
||||
type="color"
|
||||
value={previewColor}
|
||||
disabled={fillFromLayer}
|
||||
onChange={(ev) => setFill({ color: ev.target.value, source: 'object' })}
|
||||
style={{
|
||||
width: 32, height: 22, padding: 0,
|
||||
border: '1px solid var(--border)', borderRadius: 'var(--r)',
|
||||
cursor: fillFromLayer ? 'default' : 'pointer',
|
||||
background: 'transparent',
|
||||
opacity: fillFromLayer ? 0.6 : 1,
|
||||
}}
|
||||
/>
|
||||
<span style={{ fontSize: 10, fontFamily: 'var(--font-mono)', color: 'var(--text-muted)' }}>
|
||||
{previewColor}
|
||||
</span>
|
||||
</Field>
|
||||
|
||||
{isPattern && (
|
||||
<>
|
||||
<Field label="SKALIERUNG">
|
||||
<input
|
||||
type="number" step="0.05" min="0.001"
|
||||
value={fill.scale}
|
||||
onChange={(ev) => setFill({ scale: parseFloat(ev.target.value) || 1.0 })}
|
||||
style={{ flex: 1, fontSize: 11, textAlign: 'right', minWidth: 0 }}
|
||||
/>
|
||||
</Field>
|
||||
|
||||
<Field label="DREHUNG (°)">
|
||||
<input
|
||||
type="number" step="5"
|
||||
value={fill.rotation}
|
||||
onChange={(ev) => setFill({ rotation: parseFloat(ev.target.value) || 0 })}
|
||||
style={{ flex: 1, fontSize: 11, textAlign: 'right', minWidth: 0 }}
|
||||
/>
|
||||
</Field>
|
||||
</>
|
||||
)}
|
||||
|
||||
<Field
|
||||
label="STIFTSTÄRKE (mm)"
|
||||
hint="Leer = wie Stift der Ebene. Eigener Wert ueberschreibt die Strichstaerke der Hatch-Linien."
|
||||
>
|
||||
<input
|
||||
type="number" step="0.01" min="0"
|
||||
value={fill.lw == null ? '' : fill.lw}
|
||||
placeholder="—"
|
||||
onChange={(ev) => {
|
||||
const v = ev.target.value
|
||||
if (v === '' || v === null) setFill({ lw: null })
|
||||
else {
|
||||
const f = parseFloat(v)
|
||||
if (!isNaN(f) && f >= 0) setFill({ lw: f })
|
||||
}
|
||||
}}
|
||||
style={{ flex: 1, fontSize: 11, textAlign: 'right', minWidth: 0 }}
|
||||
/>
|
||||
<button
|
||||
className="btn-text"
|
||||
style={{ fontSize: 10, padding: '2px 6px' }}
|
||||
onClick={() => setFill({ lw: null })}
|
||||
title="Auf 'wie Stift der Ebene' zuruecksetzen"
|
||||
>Default</button>
|
||||
</Field>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Footer */}
|
||||
<div style={{
|
||||
display: 'flex', alignItems: 'center', gap: 6,
|
||||
padding: '8px 12px',
|
||||
borderTop: '1px solid var(--border)',
|
||||
background: 'var(--bg-section)',
|
||||
}}>
|
||||
<div style={{ flex: 1 }} />
|
||||
<button className="btn-text" onClick={onClose}>Abbrechen</button>
|
||||
<button className="btn-contained" onClick={() => onSave(draft)}>Übernehmen</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user