AGPL-3.0 Dual-Lizenz + Pill-Stil-UI + Section-Style-Overhaul + Plan-Mode-Template
Lizenz: - AGPL-3.0 LICENSE-File im Repo-Root (GNU Volltext) - SPDX-Header + Copyright in allen Source-Files (Python/JSX/JS/Rust) - license-Feld in package.json + Cargo.toml - About-App komplett neu: Dual-Lizenz-Block (AGPL + Commercial), openbureau-Branding, Version-Pills, made-in-Switzerland-Footer UI-Restyle (3 Wellen) — alle Dialoge + Satellites + Panel-Sidebars auf gemeinsamen Pill-Stil aus BarControls (BarToggle/BarButton/BarCombo): - Welle 1: GeschossDialog/Settings, AusschnittSettings, LayoutDialog - Welle 2: ConfirmDeleteEbene, Kamera, MasseSettings, Osm, Swisstopo, TextEditor, AusschnittLayerDialog, LayerCombinations - Welle 3: LayoutsApp, MassstabApp, WerkzeugeApp, OverridesApp, ZeichnungsebenenApp; Werkzeuge mit ElementeApp-PillGroup-Layout GeschossDialog Header-Refactor: +Geschoss/+Zeichnung in Toolbar oben, move-Pfeile-Spalte breiter (kein Overlap mit G-Haken) Ausschnitte Rows als Pills, kein Outer-Border ums Suchfeld Section-Style komplett neu (gestaltung.py + GestaltungApp.jsx): - ObjectSectionAttributesSource.FromObject (richtiger Enum-Name fuer Mac) - HatchPatternPrintColor + BoundaryPrintColor mit-setzen (Display = Print) - BoundaryColor nur bei explizitem User-Override, sonst Rhino-Default - background_color_hex Parameter (BackgroundFillMode=SolidColor) - Readback aus GetCustomSectionStyle statt direkt aus Attributes - UI: Schnittkante > Section Style > Solid-Fill mit proper SectionHead - 'Boundary' (3D Pen) -> 'Background' weil sich's wie Section-Hintergrund verhaelt Plan-Mode 'Dossier Plan' via Template: - rhino/templates/dossier_plan.ini wird direkt geladen - Fallback auf Technical-Clone + ini-Patch wenn Template fehlt - Auto-Cleanup von Orphan-Modes vor Import (Name- oder Guid-Match) - ClipSectionUsage=1 + TechnicalMask=15 als bekannte Soll-Werte - Bei Template-Pfad keine ini-Patches (1:1 wie User exportiert) - Sanity-Print listet alle registrierten Modes nach Anlegen Bridge-Unification: 4 Settings-Apps (Ebenen/Project/Geschoss*Dialog) benutzen jetzt chunkende send() statt eigene bridgeSend ohne Chunk- Logik -> grosse Payloads (Hatch-Refs etc.) kommen nicht mehr truncated bei Python an (loeste 'JSON-Fehler char 990'-Regression in Ebenen- Settings) Library-Imports robust: 'import library' jetzt Top-Level in elemente.py + rhinopanel.py (statt Lazy in Methoden) -> 'No module named library'- Crashes weg auch wenn sys.path zwischendurch resettet wird Tools fuer Display-Mode-Maintenance: - _clean_display_modes.py (loescht alle Custom-Modes, Built-ins bleiben) - _inspect_plan_mode.py / _inspect_obj_section.py / _inspect_obj_boundary.py (Diagnose-Skripte fuer SectionStyle-Property-Reverse-Engineering) - _reset_rhino_settings.sh (Backup + Nuke der Rhino-Settings als letzte Bastion gegen korrupte Display-Modes)
This commit is contained in:
+275
-69
@@ -1,5 +1,7 @@
|
||||
#! python 3
|
||||
# -*- coding: utf-8 -*-
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
# Copyright (C) 2026 Karim Gabriele Varano
|
||||
"""
|
||||
gestaltung.py
|
||||
GESTALTUNG-Panel: Attribute der Selektion (Farbe, Stiftdicke, Linientyp,
|
||||
@@ -860,6 +862,11 @@ def _selection_summary(doc):
|
||||
sec_patterns = set()
|
||||
sec_scales = set()
|
||||
sec_rots = set()
|
||||
# Boundary-Subsettings (Schnittkante)
|
||||
sec_bdy_visible = set()
|
||||
sec_bdy_colors = set()
|
||||
sec_bdy_widths = set()
|
||||
sec_bg_colors = set() # Background-Fill (None wenn FillMode != SolidColor)
|
||||
# Geometry-Kind-Klassifikation: 'curve' (closed planar 2D), 'curveOpen'
|
||||
# (offene Kurve), '3d' (Brep/Extrusion/Mesh — Volumen mit Schnittflaeche),
|
||||
# 'other'. Aggregiert ueber alle Selektions-Objekte zu kind=
|
||||
@@ -926,52 +933,93 @@ def _selection_summary(doc):
|
||||
else:
|
||||
geometry_kinds.add('other')
|
||||
|
||||
# Section-Style aus Object-Attributes lesen (Rhino 8, mit Fallbacks
|
||||
# fuer Property-Namen die je nach Build variieren).
|
||||
# Section-Style aus Object-Attributes lesen — Rhino 8 Mac packt die
|
||||
# Settings in ein SectionStyle-Objekt (via GetCustomSectionStyle),
|
||||
# NICHT in direkte Attribute-Properties wie das alte API.
|
||||
if is_3d:
|
||||
src_attr = None
|
||||
try:
|
||||
src_attr = getattr(a, "SectionAttributesSource", None)
|
||||
except Exception: src_attr = None
|
||||
src_is_object = False
|
||||
if src_attr is not None:
|
||||
try:
|
||||
src_name = str(src_attr).lower()
|
||||
if "layer" in src_name: sec_sources.add("layer")
|
||||
elif "object" in src_name: sec_sources.add("object")
|
||||
if "object" in src_name:
|
||||
sec_sources.add("object"); src_is_object = True
|
||||
elif "layer" in src_name:
|
||||
sec_sources.add("layer")
|
||||
except Exception: pass
|
||||
# Hatch-Index/Scale/Rotation
|
||||
hidx = None
|
||||
for n in ("SectionHatchIndex", "HatchPatternIndex"):
|
||||
if hasattr(a, n):
|
||||
|
||||
# Wenn Source=FromObject: aus dem Custom-SectionStyle lesen.
|
||||
# Sonst (FromLayer): vom Layer.GetCustomSectionStyle() lesen damit
|
||||
# die UI auch im Layer-Modus den effektiven Hatch zeigt.
|
||||
css = None
|
||||
try:
|
||||
if src_is_object and hasattr(a, "GetCustomSectionStyle"):
|
||||
css = a.GetCustomSectionStyle()
|
||||
if css is None:
|
||||
# Fallback: Layer-SectionStyle
|
||||
try:
|
||||
v = getattr(a, n)
|
||||
if v is not None: hidx = int(v); break
|
||||
lyr = doc.Layers[obj.Attributes.LayerIndex]
|
||||
if hasattr(lyr, "GetCustomSectionStyle"):
|
||||
css = lyr.GetCustomSectionStyle()
|
||||
except Exception: pass
|
||||
if hidx is not None and hidx >= 0 and hidx < doc.HatchPatterns.Count:
|
||||
sec_enabled.add(True)
|
||||
try: sec_patterns.add(doc.HatchPatterns[hidx].Name)
|
||||
except Exception: pass
|
||||
elif hidx == -1:
|
||||
sec_enabled.add(False)
|
||||
for n, target in (
|
||||
(("SectionHatchScale", "HatchPatternScale"), sec_scales),
|
||||
(("SectionHatchRotation", "HatchPatternRotation"), sec_rots),
|
||||
):
|
||||
for nn in n:
|
||||
if hasattr(a, nn):
|
||||
except Exception: pass
|
||||
|
||||
if css is not None:
|
||||
# HatchIndex
|
||||
hidx = None
|
||||
for n in ("HatchIndex", "HatchPatternIndex"):
|
||||
if hasattr(css, n):
|
||||
try:
|
||||
v = float(getattr(a, nn))
|
||||
target.add(round(v, 4)
|
||||
if target is sec_scales
|
||||
else round(math.degrees(v), 2))
|
||||
break
|
||||
v = getattr(css, n)
|
||||
if v is not None: hidx = int(v); break
|
||||
except Exception: pass
|
||||
for n in ("SectionFillColor", "SectionHatchColor", "HatchColor"):
|
||||
if hasattr(a, n):
|
||||
try:
|
||||
c = _color_to_hex(getattr(a, n))
|
||||
if c: sec_colors.add(c); break
|
||||
if hidx is not None and hidx >= 0 and hidx < doc.HatchPatterns.Count:
|
||||
sec_enabled.add(True)
|
||||
try: sec_patterns.add(doc.HatchPatterns[hidx].Name)
|
||||
except Exception: pass
|
||||
elif hidx == -1:
|
||||
sec_enabled.add(False)
|
||||
# Scale
|
||||
for n in ("HatchScale", "HatchPatternScale"):
|
||||
if hasattr(css, n):
|
||||
try: sec_scales.add(round(float(getattr(css, n)), 4)); break
|
||||
except Exception: pass
|
||||
# Rotation (rad → deg)
|
||||
for n in ("HatchRotationRadians", "HatchRotation", "HatchAngle"):
|
||||
if hasattr(css, n):
|
||||
try: sec_rots.add(round(math.degrees(float(getattr(css, n))), 2)); break
|
||||
except Exception: pass
|
||||
# Color
|
||||
for n in ("HatchPatternColor", "HatchColor", "FillColor"):
|
||||
if hasattr(css, n):
|
||||
try:
|
||||
c = _color_to_hex(getattr(css, n))
|
||||
if c: sec_colors.add(c); break
|
||||
except Exception: pass
|
||||
# Boundary-Settings auslesen
|
||||
if hasattr(css, "BoundaryVisible"):
|
||||
try: sec_bdy_visible.add(bool(css.BoundaryVisible))
|
||||
except Exception: pass
|
||||
if hasattr(css, "BoundaryColor"):
|
||||
try:
|
||||
c = _color_to_hex(css.BoundaryColor)
|
||||
if c: sec_bdy_colors.add(c)
|
||||
except Exception: pass
|
||||
if hasattr(css, "BoundaryWidthScale"):
|
||||
try: sec_bdy_widths.add(round(float(css.BoundaryWidthScale), 2))
|
||||
except Exception: pass
|
||||
# Background nur lesen wenn FillMode != Viewport (sonst transparent)
|
||||
try:
|
||||
mode = getattr(css, "BackgroundFillMode", None)
|
||||
if mode is not None and "viewport" not in str(mode).lower():
|
||||
c = _color_to_hex(css.BackgroundFillColor)
|
||||
if c: sec_bg_colors.add(c)
|
||||
except Exception: pass
|
||||
else:
|
||||
sec_enabled.add(False)
|
||||
|
||||
# Fuellung
|
||||
if _is_closed_planar_curve(obj.Geometry):
|
||||
@@ -1072,6 +1120,10 @@ def _selection_summary(doc):
|
||||
"sectionPattern": single(sec_patterns),
|
||||
"sectionScale": single(sec_scales),
|
||||
"sectionRotation": single(sec_rots),
|
||||
"sectionBoundaryVisible": single(sec_bdy_visible),
|
||||
"sectionBoundaryColor": single(sec_bdy_colors),
|
||||
"sectionBoundaryWidthScale": single(sec_bdy_widths),
|
||||
"sectionBackgroundColor": single(sec_bg_colors),
|
||||
# geometryKind: 'curve' | 'curveOpen' | '3d' | 'mixed' | 'other'
|
||||
"geometryKind": (
|
||||
'mixed' if len(geometry_kinds & {'curve', 'curveOpen', '3d'}) > 1
|
||||
@@ -1159,6 +1211,10 @@ class GestaltungBridge(panel_base.BaseBridge):
|
||||
p.get("pattern"),
|
||||
p.get("scale"),
|
||||
p.get("rotation"),
|
||||
boundary_visible=p.get("boundaryVisible", True),
|
||||
boundary_width_scale=p.get("boundaryWidthScale", 1.0),
|
||||
boundary_color_hex=p.get("boundaryColor"),
|
||||
background_color_hex=p.get("backgroundColor"),
|
||||
)
|
||||
|
||||
def _send_selection(self):
|
||||
@@ -1478,71 +1534,221 @@ class GestaltungBridge(panel_base.BaseBridge):
|
||||
# ---- SectionStyle (per-Object, Rhino 8) -------------------------------
|
||||
|
||||
def _set_section_style(self, enabled, source, color_hex,
|
||||
pattern_name=None, scale=None, rotation_deg=None):
|
||||
"""Setzt Per-Object SectionStyle-Properties auf die selektierten
|
||||
3D-Objekte. Rhino 8 expone diese Properties auf ObjectAttributes
|
||||
unter teils variierenden Namen — wir versuchen die bekannten."""
|
||||
pattern_name=None, scale=None, rotation_deg=None,
|
||||
boundary_visible=True, boundary_width_scale=1.0,
|
||||
boundary_color_hex=None,
|
||||
background_color_hex=None):
|
||||
"""Setzt einen Per-Object SectionStyle ueber die Rhino-8 API
|
||||
(analog zu Layer.SetCustomSectionStyle). source='layer' entfernt
|
||||
den Custom-Style → Layer-Default greift. source='object' setzt
|
||||
einen frischen SectionStyle pro Objekt."""
|
||||
doc = Rhino.RhinoDoc.ActiveDoc
|
||||
objs = list(doc.Objects.GetSelectedObjects(False, False))
|
||||
is_layer_source = (source == "layer")
|
||||
print("[GESTALTUNG] _set_section_style: source={} enabled={} pattern={}".format(
|
||||
source, enabled, pattern_name))
|
||||
|
||||
# SectionStyle-Klasse + Source-Enum holen.
|
||||
# Mac Rhino 8: Enum heisst ObjectSectionAttributesSource (mit
|
||||
# "Object"-Prefix) — per Inspektion verifiziert. Ohne explizites
|
||||
# Setzen von Attributes.SectionAttributesSource = FromObject wird
|
||||
# der Custom-SectionStyle zwar persistiert, aber visuell ignoriert
|
||||
# weil der Default-Wert FromLayer bleibt.
|
||||
try:
|
||||
SS = Rhino.DocObjects.SectionStyle
|
||||
except Exception as ex:
|
||||
print("[GESTALTUNG] SectionStyle-Klasse fehlt:", ex)
|
||||
return
|
||||
SAS = None
|
||||
for cls_name in ("ObjectSectionAttributesSource", "SectionAttributesSource"):
|
||||
try:
|
||||
SAS = getattr(Rhino.DocObjects, cls_name)
|
||||
if SAS is not None:
|
||||
print("[GESTALTUNG] Source-Enum: Rhino.DocObjects.{}".format(cls_name))
|
||||
break
|
||||
except Exception: pass
|
||||
if SAS is None:
|
||||
print("[GESTALTUNG] WARNUNG: kein Source-Enum gefunden")
|
||||
if objs and not getattr(self, "_ss_api_logged", False):
|
||||
o = objs[0]
|
||||
for meth in ("SetCustomSectionStyle", "RemoveCustomSectionStyle",
|
||||
"HasCustomSectionStyle", "GetCustomSectionStyle"):
|
||||
print("[GESTALTUNG] RhinoObject.{}: {}".format(
|
||||
meth, hasattr(o, meth)))
|
||||
try:
|
||||
a = o.Attributes
|
||||
for meth in ("SetCustomSectionStyle", "RemoveCustomSectionStyle"):
|
||||
print("[GESTALTUNG] Attributes.{}: {}".format(
|
||||
meth, hasattr(a, meth)))
|
||||
except Exception: pass
|
||||
self._ss_api_logged = True
|
||||
|
||||
# Hatch-Pattern-Index ermitteln
|
||||
pat_idx = -1
|
||||
if pattern_name and pattern_name not in ("None", ""):
|
||||
try: pat_idx = doc.HatchPatterns.Find(pattern_name, True)
|
||||
except Exception: pat_idx = -1
|
||||
if pat_idx < 0 and pattern_name not in ("None", ""):
|
||||
try: pat_idx = doc.HatchPatterns.Find("Solid", True)
|
||||
except Exception: pat_idx = -1
|
||||
|
||||
col = _hex_to_color(color_hex) if color_hex else None
|
||||
scale_v = float(scale) if scale is not None else 1.0
|
||||
rot_rad = math.radians(float(rotation_deg)) if rotation_deg is not None else 0.0
|
||||
|
||||
def _try_set_attr(a, names, value):
|
||||
def _try_set(target, names, value):
|
||||
for n in names:
|
||||
if hasattr(a, n):
|
||||
if hasattr(target, n):
|
||||
try:
|
||||
setattr(a, n, value)
|
||||
setattr(target, n, value)
|
||||
return n
|
||||
except Exception: pass
|
||||
return None
|
||||
|
||||
def _apply_custom(obj, style):
|
||||
"""Setzt Custom-SectionStyle + schaltet SectionAttributesSource
|
||||
auf FromObject. Beides muss persistiert sein damit Rhino den
|
||||
Custom-Style auch tatsaechlich rendert."""
|
||||
try:
|
||||
a = obj.Attributes.Duplicate()
|
||||
if hasattr(a, "SetCustomSectionStyle"):
|
||||
a.SetCustomSectionStyle(style)
|
||||
# KRITISCH: Source auf FromObject — ohne das ignoriert Rhino
|
||||
# den Custom-Style und nutzt weiter den Layer-Style.
|
||||
if SAS is not None and hasattr(a, "SectionAttributesSource"):
|
||||
try:
|
||||
a.SectionAttributesSource = SAS.FromObject
|
||||
except Exception as ex:
|
||||
print("[GESTALTUNG] set Source.FromObject fail:", ex)
|
||||
ok_modify = doc.Objects.ModifyAttributes(obj, a, True)
|
||||
_log_post(obj, "Attributes.SetCustomSectionStyle+FromObject",
|
||||
ok_modify)
|
||||
return "Attributes.SetCustomSectionStyle"
|
||||
except Exception as ex:
|
||||
print("[GESTALTUNG] attr.SetCustomSectionStyle fail:", ex)
|
||||
return None
|
||||
|
||||
def _log_post(obj, via, ok_modify=None):
|
||||
"""Nach SetCustom: pruefen ob Rhino den Style auch behalten hat."""
|
||||
try:
|
||||
ob = doc.Objects.FindId(obj.Id) if hasattr(obj, "Id") else obj
|
||||
if ob is None: ob = obj
|
||||
a = ob.Attributes
|
||||
src = "n/a"
|
||||
if hasattr(a, "SectionAttributesSource"):
|
||||
try: src = str(a.SectionAttributesSource)
|
||||
except Exception: pass
|
||||
got = None
|
||||
if hasattr(a, "GetCustomSectionStyle"):
|
||||
try:
|
||||
css = a.GetCustomSectionStyle()
|
||||
if css is not None:
|
||||
got = "HatchIndex={}".format(getattr(css, "HatchIndex", "?"))
|
||||
except Exception as ex:
|
||||
got = "get-err: {}".format(ex)
|
||||
print("[GESTALTUNG] post via {} (modify_ok={}): Source={} Got={}".format(
|
||||
via, ok_modify, src, got))
|
||||
except Exception as ex:
|
||||
print("[GESTALTUNG] post-check:", ex)
|
||||
|
||||
def _remove_custom(obj):
|
||||
"""Entfernt Custom-SectionStyle + schaltet Source auf FromLayer
|
||||
zurueck. Damit greift wieder der Layer-Default-SectionStyle."""
|
||||
try:
|
||||
a = obj.Attributes.Duplicate()
|
||||
if hasattr(a, "RemoveCustomSectionStyle"):
|
||||
a.RemoveCustomSectionStyle()
|
||||
if SAS is not None and hasattr(a, "SectionAttributesSource"):
|
||||
try:
|
||||
a.SectionAttributesSource = SAS.FromLayer
|
||||
except Exception as ex:
|
||||
print("[GESTALTUNG] set Source.FromLayer fail:", ex)
|
||||
doc.Objects.ModifyAttributes(obj, a, True)
|
||||
return "Attributes.RemoveCustomSectionStyle+FromLayer"
|
||||
except Exception as ex:
|
||||
print("[GESTALTUNG] attr.RemoveCustomSectionStyle fail:", ex)
|
||||
return None
|
||||
|
||||
n_ok = 0
|
||||
for obj in objs:
|
||||
geom = obj.Geometry
|
||||
if not isinstance(geom, (rg.Brep, rg.Extrusion, rg.Mesh, rg.SubD)):
|
||||
continue
|
||||
a = obj.Attributes.Duplicate()
|
||||
|
||||
# Source: FromLayer vs FromObject — verschiedene Enum-Namen
|
||||
if is_layer_source:
|
||||
# Versuche SectionAttributesSource auf FromLayer
|
||||
_try_set_attr(a, ("SectionAttributesSource",),
|
||||
Rhino.DocObjects.SectionAttributesSource.FromLayer
|
||||
if hasattr(Rhino.DocObjects, "SectionAttributesSource") else 0)
|
||||
# Custom entfernen → Layer-SectionStyle wird wirksam
|
||||
via = _remove_custom(obj)
|
||||
print("[GESTALTUNG] obj {}: remove custom via {}".format(
|
||||
str(obj.Id)[:8], via))
|
||||
if via: n_ok += 1
|
||||
continue
|
||||
# Default-Farbe = Layer-Farbe wenn der User keine Override-Farbe
|
||||
# gewaehlt hat. Section-Style hat keine "ByLayer"-Source-Option,
|
||||
# also setzen wir die echte Layer-Farbe explizit auf den Style.
|
||||
obj_col = col
|
||||
obj_col_src = "user-override" if col is not None else "n/a"
|
||||
if obj_col is None:
|
||||
try:
|
||||
lyr = doc.Layers[obj.Attributes.LayerIndex]
|
||||
obj_col = lyr.Color
|
||||
obj_col_src = "layer({})".format(lyr.FullPath)
|
||||
except Exception as ex:
|
||||
obj_col = None
|
||||
obj_col_src = "fail:{}".format(ex)
|
||||
print("[GESTALTUNG] obj {} color src={} val={}".format(
|
||||
str(obj.Id)[:8], obj_col_src, obj_col))
|
||||
# Per-Object: frischen SectionStyle bauen wie in layer_builder
|
||||
style = SS()
|
||||
if pattern_name == "None" or not enabled:
|
||||
_try_set(style, ("HatchIndex", "HatchPatternIndex"), -1)
|
||||
else:
|
||||
_try_set_attr(a, ("SectionAttributesSource",),
|
||||
Rhino.DocObjects.SectionAttributesSource.FromObject
|
||||
if hasattr(Rhino.DocObjects, "SectionAttributesSource") else 1)
|
||||
|
||||
if not enabled or pattern_name == "None":
|
||||
# Hatch-Index auf -1 = keine Fuellung
|
||||
_try_set_attr(a, ("SectionHatchIndex", "HatchPatternIndex"), -1)
|
||||
else:
|
||||
if pat_idx >= 0:
|
||||
_try_set_attr(a, ("SectionHatchIndex", "HatchPatternIndex"), pat_idx)
|
||||
_try_set_attr(a, ("SectionHatchScale", "HatchPatternScale"), scale_v)
|
||||
_try_set_attr(a, ("SectionHatchRotation", "HatchPatternRotation"), rot_rad)
|
||||
if col is not None:
|
||||
_try_set_attr(a, ("SectionFillColor", "SectionHatchColor",
|
||||
"HatchColor"), col)
|
||||
|
||||
if pat_idx >= 0:
|
||||
_try_set(style, ("HatchIndex", "HatchPatternIndex"), pat_idx)
|
||||
_try_set(style, ("HatchScale", "HatchPatternScale"), scale_v)
|
||||
_try_set(style, ("HatchRotationRadians", "HatchRotation",
|
||||
"HatchAngle"), rot_rad)
|
||||
if obj_col is not None:
|
||||
# Display- UND Print-Color setzen damit beide matchen
|
||||
_try_set(style, ("HatchPatternColor", "HatchColor",
|
||||
"FillColor"), obj_col)
|
||||
_try_set(style, ("HatchPatternPrintColor",), obj_col)
|
||||
_try_set(style, ("BoundaryVisible",), bool(boundary_visible))
|
||||
try:
|
||||
doc.Objects.ModifyAttributes(obj, a, True)
|
||||
n_ok += 1
|
||||
except Exception as ex:
|
||||
print("[GESTALTUNG] SectionStyle ModifyAttributes:", ex)
|
||||
_try_set(style, ("BoundaryWidthScale",),
|
||||
float(boundary_width_scale))
|
||||
except Exception: pass
|
||||
# Boundary-Farbe: NUR setzen wenn User explizit eine Override-Farbe
|
||||
# gewaehlt hat. Sonst lassen wir Rhinos Default (schwarz) greifen
|
||||
# damit Boundary visuell unterscheidbar von der Hatch-Pattern-Farbe
|
||||
# bleibt. (Sonst wuerde HatchPatternColor=Layer + BoundaryColor=Layer
|
||||
# die Schnittflaeche als einfarbige Flaeche erscheinen lassen.)
|
||||
bcol = None
|
||||
if boundary_color_hex:
|
||||
try: bcol = _hex_to_color(boundary_color_hex)
|
||||
except Exception: bcol = None
|
||||
if bcol is not None:
|
||||
_try_set(style, ("BoundaryColor",), bcol)
|
||||
_try_set(style, ("BoundaryPrintColor",), bcol)
|
||||
# Background-Fill: User-Override (hex) → SolidColor-Mode + Farbe
|
||||
# Sonst Transparent (Viewport-Mode, Default)
|
||||
if background_color_hex:
|
||||
try:
|
||||
bgcol = _hex_to_color(background_color_hex)
|
||||
except Exception:
|
||||
bgcol = None
|
||||
if bgcol is not None:
|
||||
_try_set(style, ("BackgroundFillColor",), bgcol)
|
||||
_try_set(style, ("BackgroundFillPrintColor",), bgcol)
|
||||
# FillMode auf SolidColor via Enum (mehrere Namens-Varianten)
|
||||
for en_cls in ("SectionBackgroundFillMode",
|
||||
"BackgroundFillMode"):
|
||||
try:
|
||||
E = getattr(Rhino.DocObjects, en_cls, None)
|
||||
if E is not None:
|
||||
_try_set(style, ("BackgroundFillMode",),
|
||||
E.SolidColor)
|
||||
break
|
||||
except Exception: pass
|
||||
via = _apply_custom(obj, style)
|
||||
print("[GESTALTUNG] obj {}: set custom via {} (hatch_idx={})".format(
|
||||
str(obj.Id)[:8], via, pat_idx))
|
||||
if via: n_ok += 1
|
||||
|
||||
print("[GESTALTUNG] SectionStyle auf {} Objekt(e) appliziert".format(n_ok))
|
||||
doc.Views.Redraw()
|
||||
|
||||
Reference in New Issue
Block a user