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,58 @@
|
||||
# ! python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
werkzeuge.py
|
||||
WERKZEUGE-Panel: Architektur-orientierte Toolbar als React-WebView.
|
||||
Feuert Rhino-Befehle via RunScript bei Button-Klick.
|
||||
"""
|
||||
import os
|
||||
import sys
|
||||
import Rhino
|
||||
import scriptcontext as sc
|
||||
|
||||
_HERE = os.path.dirname(os.path.abspath(__file__))
|
||||
if _HERE not in sys.path:
|
||||
sys.path.insert(0, _HERE)
|
||||
|
||||
import panel_base
|
||||
|
||||
PANEL_GUID_STR = "6d9f5040-7e1f-4f2b-c4d5-f6071829304a"
|
||||
|
||||
|
||||
class WerkzeugeBridge(panel_base.BaseBridge):
|
||||
def __init__(self):
|
||||
panel_base.BaseBridge.__init__(self, "werkzeuge")
|
||||
|
||||
def _on_ready(self):
|
||||
# Keine initialen Daten noetig — Toolbar ist statisch
|
||||
pass
|
||||
|
||||
def handle(self, data):
|
||||
if not isinstance(data, dict): return
|
||||
t = data.get("type", "")
|
||||
p = data.get("payload") or {}
|
||||
if not isinstance(p, dict): p = {}
|
||||
if t == "READY":
|
||||
self._on_ready()
|
||||
elif t == "RUN":
|
||||
cmd = p.get("cmd")
|
||||
if cmd and isinstance(cmd, str):
|
||||
# Whitelist: alles muss mit "_" beginnen (Rhino-Befehl) und
|
||||
# darf keine Zeilenumbrueche oder Semikolons enthalten.
|
||||
cmd = cmd.strip()
|
||||
if cmd.startswith("_") and "\n" not in cmd and ";" not in cmd:
|
||||
try:
|
||||
Rhino.RhinoApp.RunScript(cmd, False)
|
||||
print("[WERKZEUGE] {}".format(cmd))
|
||||
except Exception as ex:
|
||||
print("[WERKZEUGE] RunScript-Fehler:", ex)
|
||||
else:
|
||||
print("[WERKZEUGE] Befehl ignoriert (kein '_' Praefix oder unsicher):", cmd)
|
||||
|
||||
|
||||
def _bridge_factory():
|
||||
return WerkzeugeBridge()
|
||||
|
||||
|
||||
panel_base.register_and_open("werkzeuge", "WERKZEUGE", PANEL_GUID_STR, _bridge_factory,
|
||||
icon_spec=("W", "#3a6fa8"))
|
||||
Reference in New Issue
Block a user