9fcada260e
- Fix sed $-anchor issue: 'Panel registriert' now replaced globally - Translate: Listener aktiv, Select-Handler, Closing-Hook, Doppelklick-Handler - Translate SPLASH messages: gesetzt/angewendet - Translate ALIAS-LOADER, WELCOME, ELEMENTE migration messages - Full rsync of all rhino/*.py to PROJECTS (previously partial sync missed schnitte.py, wand_grips.py, treppe_grips.py, text_editor.py, welcome.py etc.)
113 lines
3.9 KiB
Python
113 lines
3.9 KiB
Python
#! python3
|
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
# Copyright (C) 2026 Karim Gabriele Varano
|
|
"""Dumpt ALLE Section-/Hatch-relevanten Properties des selektierten Objekts.
|
|
So sehen wir was Rhino's eigene Section-Style-UI tatsaechlich setzt vs.
|
|
was unser Plugin-Code setzt.
|
|
|
|
Vorgehen:
|
|
1. Ein 3D-Objekt selektieren (Wand, Box, ...)
|
|
2. In Rhinos Properties-Panel manuell SectionStyle → Custom mit spezifischen
|
|
Werten setzen (z.B. Pattern Color=Gruen, Pattern Rotation=20, Pattern
|
|
Scale=2.4, Boundary Color=Rot, Boundary Width Scale=6) → Apply
|
|
3. _RunPythonScript /Users/karim/STUDIO/DOSSIER/rhino/_inspect_obj_section.py
|
|
4. Output an Claude
|
|
"""
|
|
import Rhino
|
|
|
|
|
|
def _fmt(v):
|
|
if v is None: return "None"
|
|
s = str(v)
|
|
if len(s) > 80: s = s[:77] + "..."
|
|
return s
|
|
|
|
|
|
def _dump_group(css, prefix, title):
|
|
"""Dumpt Properties auf css deren Name mit `prefix` (case-insens) anfaengt."""
|
|
print("--- {} ---".format(title))
|
|
p_lower = prefix.lower()
|
|
found = False
|
|
for n in sorted(dir(css)):
|
|
if n.startswith("_"): continue
|
|
if p_lower not in n.lower(): continue
|
|
try:
|
|
v = getattr(css, n)
|
|
if callable(v): continue
|
|
found = True
|
|
print(" {:32s} = {}".format(n, _fmt(v)))
|
|
except Exception as ex:
|
|
print(" {:32s} = <unreadable: {}>".format(n, ex))
|
|
if not found:
|
|
print(" (nichts)")
|
|
|
|
|
|
doc = Rhino.RhinoDoc.ActiveDoc
|
|
objs = list(doc.Objects.GetSelectedObjects(False, False))
|
|
if not objs:
|
|
print("[INSPECT] Bitte ein Objekt selektieren")
|
|
else:
|
|
obj = objs[0]
|
|
a = obj.Attributes
|
|
print("[INSPECT] Object: {} (Id={})".format(type(obj).__name__, obj.Id))
|
|
|
|
# SectionAttributesSource (FromLayer / FromObject)
|
|
print("")
|
|
print("=== Attributes ===")
|
|
try:
|
|
print(" SectionAttributesSource =", a.SectionAttributesSource)
|
|
except Exception as ex:
|
|
print(" SectionAttributesSource err:", ex)
|
|
try:
|
|
print(" HatchBackgroundFillColor =", a.HatchBackgroundFillColor)
|
|
except Exception: pass
|
|
try:
|
|
print(" HatchBoundaryVisible =", a.HatchBoundaryVisible)
|
|
except Exception: pass
|
|
|
|
# Custom SectionStyle aus Object
|
|
print("")
|
|
print("=== Object.GetCustomSectionStyle() ===")
|
|
css = None
|
|
if hasattr(a, "GetCustomSectionStyle"):
|
|
try:
|
|
css = a.GetCustomSectionStyle()
|
|
except Exception as ex:
|
|
print(" err:", ex)
|
|
|
|
if css is None:
|
|
print(" None (kein Custom-SectionStyle set)")
|
|
else:
|
|
print(" Type:", type(css).__name__)
|
|
print("")
|
|
# Gruppierte Property-Dumps damit Mapping zu Rhino-UI klar wird
|
|
_dump_group(css, "Hatch", "Hatch (Pattern, Color, Scale, Rotation)")
|
|
print("")
|
|
_dump_group(css, "Boundary", "Boundary (Visible, Color, Width)")
|
|
print("")
|
|
_dump_group(css, "Background", "Background (FillColor, FillMode)")
|
|
print("")
|
|
# Section-spezifisch (SectionFillRule etc.)
|
|
print("--- Misc Section ---")
|
|
for n in ("SectionFillRule", "Name", "Id", "HasUserData", "Index"):
|
|
if hasattr(css, n):
|
|
try: print(" {:32s} = {}".format(n, _fmt(getattr(css, n))))
|
|
except Exception: pass
|
|
|
|
# Layer-Default SectionStyle als Vergleich
|
|
print("")
|
|
print("=== Layer.GetCustomSectionStyle (Layer-Default) ===")
|
|
try:
|
|
lyr = doc.Layers[a.LayerIndex]
|
|
print(" Layer:", lyr.FullPath, "Color:", lyr.Color)
|
|
if hasattr(lyr, "GetCustomSectionStyle"):
|
|
l_css = lyr.GetCustomSectionStyle()
|
|
if l_css is None:
|
|
print(" Layer hat KEIN Custom-SectionStyle")
|
|
else:
|
|
_dump_group(l_css, "Hatch", "Layer.Hatch")
|
|
_dump_group(l_css, "Boundary", "Layer.Boundary")
|
|
_dump_group(l_css, "Background", "Layer.Background")
|
|
except Exception as ex:
|
|
print(" err:", ex)
|