Rename all log tags to match English module names

[EBENEN] → [LAYERS], [EBENEN-BE] → [LAYERS-BE]
[ZEICHNUNGSEBENEN] → [DRAWING-LEVELS]
[GESTALTUNG] → [STYLES]
[OBERLEISTE] → [TOOLBAR]
[WERKZEUGE] → [TOOLS]
[DIMENSIONEN] → [DIMENSIONS]
[AUSSCHNITTE] → [VIEWPORTS]
[MASSSTAB] → [SCALE]
[SCHNITT] → [SECTION], [SCHNITT_GRIPS] → [SECTION-GRIPS]
[WAND_GRIPS] → [WALL-GRIPS], [TREPPE_GRIPS] → [STAIR-GRIPS]
[CURVE_DOTS] → [CURVE-DOTS]
[panel_base] → [CORE]
[ALIAS-LOADER] → [ALIASES]
[BEGIN-CMD] → [CMD-HOOK]
This commit is contained in:
2026-06-06 12:48:27 +02:00
parent 84ff943f92
commit b9a2124026
16 changed files with 471 additions and 471 deletions
+17 -17
View File
@@ -39,7 +39,7 @@ def _read_defaults():
out[k] = v out[k] = v
return out return out
except Exception as ex: except Exception as ex:
print("[ALIAS-LOADER] Defaults lesen:", ex) print("[ALIASES] Defaults lesen:", ex)
return {} return {}
@@ -54,7 +54,7 @@ def _read_user_overrides():
so = data.get("shortcuts_user") so = data.get("shortcuts_user")
if isinstance(so, dict): return so if isinstance(so, dict): return so
except Exception as ex: except Exception as ex:
print("[ALIAS-LOADER] Settings lesen:", ex) print("[ALIASES] Settings lesen:", ex)
return {} return {}
@@ -162,7 +162,7 @@ def _xml_persist_shortcut(xml_key, macro, verbose=False):
if line_end < 0: line_end = len(content) if line_end < 0: line_end = len(content)
line_trim = content[line_start:line_end].strip() line_trim = content[line_start:line_end].strip()
if line_trim == new_entry: if line_trim == new_entry:
if verbose: print("[ALIAS-LOADER] XML '{}' unchanged".format(xml_key)) if verbose: print("[ALIASES] XML '{}' unchanged".format(xml_key))
continue continue
# Sonst: loeschen inkl. preceding-newline+whitespace damit # Sonst: loeschen inkl. preceding-newline+whitespace damit
# keine orphan-line uebrig bleibt # keine orphan-line uebrig bleibt
@@ -176,11 +176,11 @@ def _xml_persist_shortcut(xml_key, macro, verbose=False):
# ShortcutKeys-Section finden # ShortcutKeys-Section finden
sec_start = content.find('<child key="ShortcutKeys">') sec_start = content.find('<child key="ShortcutKeys">')
if sec_start < 0: if sec_start < 0:
if verbose: print("[ALIAS-LOADER] ShortcutKeys-section fehlt") if verbose: print("[ALIASES] ShortcutKeys-section fehlt")
continue continue
sec_end = content.find('</child>', sec_start) sec_end = content.find('</child>', sec_start)
if sec_end < 0: if sec_end < 0:
if verbose: print("[ALIAS-LOADER] ShortcutKeys-close fehlt") if verbose: print("[ALIASES] ShortcutKeys-close fehlt")
continue continue
# Indent vom letzten <entry> in der Section uebernehmen # Indent vom letzten <entry> in der Section uebernehmen
section = content[sec_start:sec_end] section = content[sec_start:sec_end]
@@ -199,9 +199,9 @@ def _xml_persist_shortcut(xml_key, macro, verbose=False):
with open(path, "w", encoding="utf-8") as f: with open(path, "w", encoding="utf-8") as f:
f.write(content) f.write(content)
n_written += 1 n_written += 1
if verbose: print("[ALIAS-LOADER] XML {} '{}'".format(action, xml_key)) if verbose: print("[ALIASES] XML {} '{}'".format(action, xml_key))
except Exception as ex: except Exception as ex:
print("[ALIAS-LOADER] XML-Write {}: {}".format(path, ex)) print("[ALIASES] XML-Write {}: {}".format(path, ex))
return n_written return n_written
@@ -368,7 +368,7 @@ def apply_all():
# Konflikt-Check (gleicher Trigger → letzter gewinnt, Warning) # Konflikt-Check (gleicher Trigger → letzter gewinnt, Warning)
norm = (spec_type, str(trigger).lower()) norm = (spec_type, str(trigger).lower())
if norm in seen_triggers: if norm in seen_triggers:
print("[ALIAS-LOADER] Konflikt: '{}' fuer {} bereits von {} belegt" print("[ALIASES] Konflikt: '{}' fuer {} bereits von {} belegt"
.format(trigger, action_id, seen_triggers[norm])) .format(trigger, action_id, seen_triggers[norm]))
seen_triggers[norm] = action_id seen_triggers[norm] = action_id
@@ -383,7 +383,7 @@ def apply_all():
try: try:
added = aliases.Add(tname, macro) added = aliases.Add(tname, macro)
except Exception as _addex: except Exception as _addex:
print("[ALIAS-LOADER] Add({}, ...) Exception: {}" print("[ALIASES] Add({}, ...) Exception: {}"
.format(tname, _addex)) .format(tname, _addex))
if not added: if not added:
try: aliases.SetMacro(tname, macro) try: aliases.SetMacro(tname, macro)
@@ -392,7 +392,7 @@ def apply_all():
try: try:
is_ok = aliases.IsAlias(tname) is_ok = aliases.IsAlias(tname)
if not is_ok: if not is_ok:
print("[ALIAS-LOADER] WARN: '{}' (action={}) NICHT registriert " print("[ALIASES] WARN: '{}' (action={}) NICHT registriert "
"— Rhino lehnt Namen wahrscheinlich ab (z.B. reine Zahl)" "— Rhino lehnt Namen wahrscheinlich ab (z.B. reine Zahl)"
.format(tname, action_id)) .format(tname, action_id))
n_skipped += 1 n_skipped += 1
@@ -409,7 +409,7 @@ def apply_all():
got = skset.GetMacro(sk) got = skset.GetMacro(sk)
api_ok = (got == macro) api_ok = (got == macro)
except Exception as _sex: except Exception as _sex:
print("[ALIAS-LOADER] SetMacro({}): {}".format(trigger, _sex)) print("[ALIASES] SetMacro({}): {}".format(trigger, _sex))
if not api_ok and xml_key: if not api_ok and xml_key:
# Enum-Wert fehlt → direkt ins XML (mit verbose-Log). # Enum-Wert fehlt → direkt ins XML (mit verbose-Log).
# n_xml=0 kann "schon korrekt" ODER "gescheitert" heissen # n_xml=0 kann "schon korrekt" ODER "gescheitert" heissen
@@ -426,7 +426,7 @@ def apply_all():
# damit Rhino-Quit-Save sie nicht ueberschreibt # damit Rhino-Quit-Save sie nicht ueberschreibt
_quit_xml_pairs.append((xml_key, macro)) _quit_xml_pairs.append((xml_key, macro))
else: else:
print("[ALIAS-LOADER] WARN F-Key {} ({}) konnte weder " print("[ALIASES] WARN F-Key {} ({}) konnte weder "
"API noch XML set werden".format(trigger, action_id)) "API noch XML set werden".format(trigger, action_id))
n_skipped += 1; continue n_skipped += 1; continue
n_fkey += 1 n_fkey += 1
@@ -439,7 +439,7 @@ def apply_all():
if len(letter_only) == 1 and letter_only.isalpha(): if len(letter_only) == 1 and letter_only.isalpha():
aliases.SetMacro(letter_only, macro) aliases.SetMacro(letter_only, macro)
n_alias += 1 n_alias += 1
print("[ALIAS-LOADER] {} ({}): Cmd+Letter nicht im Enum, " print("[ALIASES] {} ({}): Cmd+Letter nicht im Enum, "
"fallback Alias '{}'".format(action_id, trigger, letter_only)) "fallback Alias '{}'".format(action_id, trigger, letter_only))
else: else:
n_skipped += 1 n_skipped += 1
@@ -447,16 +447,16 @@ def apply_all():
skset.SetMacro(sk, macro) skset.SetMacro(sk, macro)
n_cmd += 1 n_cmd += 1
else: else:
print("[ALIAS-LOADER] Unbekannter Type:", spec_type); n_skipped += 1 print("[ALIASES] Unbekannter Type:", spec_type); n_skipped += 1
except Exception as ex: except Exception as ex:
print("[ALIAS-LOADER] Apply", action_id, "->", trigger, ":", ex) print("[ALIASES] Apply", action_id, "->", trigger, ":", ex)
n_skipped += 1 n_skipped += 1
# Quit-Hook installieren falls XML-only Shortcuts set wurden — diese # Quit-Hook installieren falls XML-only Shortcuts set wurden — diese
# ueberlebt sonst Rhino's Auto-Save beim Quit nicht. # ueberlebt sonst Rhino's Auto-Save beim Quit nicht.
if _quit_xml_pairs: if _quit_xml_pairs:
_install_quit_xml_save(list(_quit_xml_pairs)) _install_quit_xml_save(list(_quit_xml_pairs))
print("[ALIAS-LOADER] {} XML-only Shortcuts werden bei Quit " print("[ALIASES] {} XML-only Shortcuts werden bei Quit "
"re-persistiert (closing hook installed)" "re-persistiert (closing hook installed)"
.format(len(_quit_xml_pairs))) .format(len(_quit_xml_pairs)))
@@ -465,5 +465,5 @@ def apply_all():
if __name__ == "__main__": if __name__ == "__main__":
a, f, c, s = apply_all() a, f, c, s = apply_all()
print("[ALIAS-LOADER] OK: {} alias, {} fkey, {} cmd, {} skipped" print("[ALIASES] OK: {} alias, {} fkey, {} cmd, {} skipped"
.format(a, f, c, s)) .format(a, f, c, s))
+33 -33
View File
@@ -149,9 +149,9 @@ def _apply_camera(vp, cam):
Rhino.RhinoApp.RunScript( Rhino.RhinoApp.RunScript(
"_-Zoom _Factor {:.6f} _Enter".format(factor), False) "_-Zoom _Factor {:.6f} _Enter".format(factor), False)
except Exception as ex: except Exception as ex:
print("[AUSSCHNITTE] Frustum-Apply:", ex) print("[VIEWPORTS] Frustum-Apply:", ex)
except Exception as ex: except Exception as ex:
print("[AUSSCHNITTE] Camera-Apply:", ex) print("[VIEWPORTS] Camera-Apply:", ex)
def _capture_layers(doc): def _capture_layers(doc):
@@ -243,7 +243,7 @@ def apply_snapshot_to_detail(doc, detail, snap_id):
Liefert True bei Erfolg.""" Liefert True bei Erfolg."""
snap = next((s for s in _load_snapshots(doc) if s.get("id") == snap_id), None) snap = next((s for s in _load_snapshots(doc) if s.get("id") == snap_id), None)
if not snap: if not snap:
print("[AUSSCHNITTE] apply_to_detail: snap not found", snap_id) print("[VIEWPORTS] apply_to_detail: snap not found", snap_id)
return False return False
# Page-View ermitteln (fuer SetActiveDetail/SetPageAsActive) # Page-View ermitteln (fuer SetActiveDetail/SetPageAsActive)
page_view = None page_view = None
@@ -257,14 +257,14 @@ def apply_snapshot_to_detail(doc, detail, snap_id):
except Exception: except Exception:
continue continue
except Exception as ex: except Exception as ex:
print("[AUSSCHNITTE] page-view-suche:", ex) print("[VIEWPORTS] page-view-suche:", ex)
# Detail muss aktiv sein, damit Kamera-Aenderungen anschlagen # Detail muss aktiv sein, damit Kamera-Aenderungen anschlagen
was_active = False was_active = False
try: was_active = detail.IsActive try: was_active = detail.IsActive
except Exception: pass except Exception: pass
if page_view is not None and not was_active: if page_view is not None and not was_active:
try: page_view.SetActiveDetail(detail.Id) try: page_view.SetActiveDetail(detail.Id)
except Exception as ex: print("[AUSSCHNITTE] SetActiveDetail:", ex) except Exception as ex: print("[VIEWPORTS] SetActiveDetail:", ex)
# Kamera + Layer + Name # Kamera + Layer + Name
vp = detail.Viewport vp = detail.Viewport
_apply_camera(vp, snap.get("camera")) _apply_camera(vp, snap.get("camera"))
@@ -274,7 +274,7 @@ def apply_snapshot_to_detail(doc, detail, snap_id):
if new_name and vp.Name != new_name: if new_name and vp.Name != new_name:
vp.Name = new_name vp.Name = new_name
except Exception as ex: except Exception as ex:
print("[AUSSCHNITTE] Detail-Rename:", ex) print("[VIEWPORTS] Detail-Rename:", ex)
# Massstab # Massstab
ratio = _parse_scale(snap.get("scale", "")) ratio = _parse_scale(snap.get("scale", ""))
if ratio is not None: if ratio is not None:
@@ -300,7 +300,7 @@ def apply_snapshot_to_detail(doc, detail, snap_id):
(page_view or doc.Views).Redraw() (page_view or doc.Views).Redraw()
except Exception: except Exception:
doc.Views.Redraw() doc.Views.Redraw()
print("[AUSSCHNITTE] '{}' auf Detail {} applied".format(snap.get("name"), detail.Id)) print("[VIEWPORTS] '{}' auf Detail {} applied".format(snap.get("name"), detail.Id))
return True return True
@@ -450,7 +450,7 @@ class AusschnittBridge(panel_base.BaseBridge):
snaps.insert(idx + 1, copy) snaps.insert(idx + 1, copy)
self._store(doc, snaps) self._store(doc, snaps)
self._send_list() self._send_list()
print("[AUSSCHNITTE] '{}' dupliziert".format(src.get("name"))) print("[VIEWPORTS] '{}' dupliziert".format(src.get("name")))
def _set_field(self, snap_id, field, value): def _set_field(self, snap_id, field, value):
if not snap_id: return if not snap_id: return
@@ -466,7 +466,7 @@ class AusschnittBridge(panel_base.BaseBridge):
def _capture(self, doc, name, existing_id=None, prior_scale=""): def _capture(self, doc, name, existing_id=None, prior_scale=""):
view = doc.Views.ActiveView view = doc.Views.ActiveView
if view is None: if view is None:
print("[AUSSCHNITTE] Keine aktive View") print("[VIEWPORTS] Keine aktive View")
return None return None
vp = view.ActiveViewport vp = view.ActiveViewport
# Aktuelle Skala vom MASSSTAB-Modul holen — nur sinnvoll bei Parallel- # Aktuelle Skala vom MASSSTAB-Modul holen — nur sinnvoll bei Parallel-
@@ -483,7 +483,7 @@ class AusschnittBridge(panel_base.BaseBridge):
else: else:
scale_str = "1:{:.1f}".format(ratio) scale_str = "1:{:.1f}".format(ratio)
except Exception as ex: except Exception as ex:
print("[AUSSCHNITTE] Live-Skala lesen:", ex) print("[VIEWPORTS] Live-Skala lesen:", ex)
# Fallback: wenn kein Massstab gepinnt war, die aus dem Frustum # Fallback: wenn kein Massstab gepinnt war, die aus dem Frustum
# berechnete Live-Skala speichern. So bleibt das Massstab-Dropdown # berechnete Live-Skala speichern. So bleibt das Massstab-Dropdown
# nach Restore konsistent (auch wenn der eigentliche Zoom-Restore # nach Restore konsistent (auch wenn der eigentliche Zoom-Restore
@@ -495,7 +495,7 @@ class AusschnittBridge(panel_base.BaseBridge):
if live is not None and live > 0: if live is not None and live > 0:
scale_str = "1:{:.0f}".format(live) if live >= 10 else "1:{:.1f}".format(live) scale_str = "1:{:.0f}".format(live) if live >= 10 else "1:{:.1f}".format(live)
except Exception as ex: except Exception as ex:
print("[AUSSCHNITTE] Live-Skala (Fallback):", ex) print("[VIEWPORTS] Live-Skala (Fallback):", ex)
if not scale_str and prior_scale: if not scale_str and prior_scale:
scale_str = prior_scale # Perspective -> alten Wert nicht ueberschreiben scale_str = prior_scale # Perspective -> alten Wert nicht ueberschreiben
# Darstellungs-Override aus dem aktuellen Doc-Setting uebernehmen. # Darstellungs-Override aus dem aktuellen Doc-Setting uebernehmen.
@@ -523,7 +523,7 @@ class AusschnittBridge(panel_base.BaseBridge):
snaps.append(snap) snaps.append(snap)
self._store(doc, snaps) self._store(doc, snaps)
self._send_list() self._send_list()
print("[AUSSCHNITTE] '{}' gespeichert".format(name)) print("[VIEWPORTS] '{}' gespeichert".format(name))
def _update(self, snap_id): def _update(self, snap_id):
doc = Rhino.RhinoDoc.ActiveDoc doc = Rhino.RhinoDoc.ActiveDoc
@@ -540,7 +540,7 @@ class AusschnittBridge(panel_base.BaseBridge):
break break
self._store(doc, snaps) self._store(doc, snaps)
self._send_list() self._send_list()
print("[AUSSCHNITTE] '{}' aktualisiert".format(target.get("name"))) print("[VIEWPORTS] '{}' aktualisiert".format(target.get("name")))
def _restore(self, snap_id): def _restore(self, snap_id):
doc = Rhino.RhinoDoc.ActiveDoc doc = Rhino.RhinoDoc.ActiveDoc
@@ -559,7 +559,7 @@ class AusschnittBridge(panel_base.BaseBridge):
import layers_panel as rhinopanel import layers_panel as rhinopanel
rhinopanel.apply_layer_preset_by_name(doc, kombi) rhinopanel.apply_layer_preset_by_name(doc, kombi)
except Exception as ex: except Exception as ex:
print("[AUSSCHNITTE] kombi-apply '{}':".format(kombi), ex) print("[VIEWPORTS] kombi-apply '{}':".format(kombi), ex)
_apply_layers_global(doc, snap.get("layers", [])) _apply_layers_global(doc, snap.get("layers", []))
else: else:
_apply_layers_global(doc, snap.get("layers", [])) _apply_layers_global(doc, snap.get("layers", []))
@@ -584,7 +584,7 @@ class AusschnittBridge(panel_base.BaseBridge):
if b is not None: b._send_state(force=True) if b is not None: b._send_state(force=True)
except Exception: pass except Exception: pass
except Exception as ex: except Exception as ex:
print("[AUSSCHNITTE] darstellung apply:", ex) print("[VIEWPORTS] darstellung apply:", ex)
# Overrides: nur anwenden wenn das Snap "applyOverrides" set hat. # Overrides: nur anwenden wenn das Snap "applyOverrides" set hat.
# Sonst bleibt der aktuelle User-Override-State unangetastet. # Sonst bleibt der aktuelle User-Override-State unangetastet.
if snap.get("applyOverrides"): if snap.get("applyOverrides"):
@@ -600,7 +600,7 @@ class AusschnittBridge(panel_base.BaseBridge):
b._send_state(force=True) b._send_state(force=True)
except Exception: pass except Exception: pass
except Exception as ex: except Exception as ex:
print("[AUSSCHNITTE] overrides-apply:", ex) print("[VIEWPORTS] overrides-apply:", ex)
# Viewport ZUERST umbenennen — der per-Viewport-Massstab in massstab.py # Viewport ZUERST umbenennen — der per-Viewport-Massstab in massstab.py
# wird unter vp.Name geschluesselt. Erst nach dem Rename schreibt # wird unter vp.Name geschluesselt. Erst nach dem Rename schreibt
# _apply_scale unter dem neuen Namen, sonst landet der Wert beim alten # _apply_scale unter dem neuen Namen, sonst landet der Wert beim alten
@@ -610,7 +610,7 @@ class AusschnittBridge(panel_base.BaseBridge):
if new_name and vp.Name != new_name: if new_name and vp.Name != new_name:
vp.Name = new_name vp.Name = new_name
except Exception as ex: except Exception as ex:
print("[AUSSCHNITTE] Rename:", ex) print("[VIEWPORTS] Rename:", ex)
# Gespeicherten Massstab anwenden (z.B. "1:50") — falls present und # Gespeicherten Massstab anwenden (z.B. "1:50") — falls present und
# Viewport parallel ist (in Perspective ignoriert massstab._apply_scale). # Viewport parallel ist (in Perspective ignoriert massstab._apply_scale).
try: try:
@@ -621,7 +621,7 @@ class AusschnittBridge(panel_base.BaseBridge):
_, model_v = ratio # (page=1, model=N) -> N _, model_v = ratio # (page=1, model=N) -> N
import massstab import massstab
massstab._apply_scale(doc, vp, float(model_v)) massstab._apply_scale(doc, vp, float(model_v))
print("[AUSSCHNITTE] Massstab set auf 1:{} (applied={})".format( print("[VIEWPORTS] Massstab set auf 1:{} (applied={})".format(
model_v, massstab.get_applied_scale_ratio())) model_v, massstab.get_applied_scale_ratio()))
# Andere Panels (Massstab, Oberleiste) sofort ueber den # Andere Panels (Massstab, Oberleiste) sofort ueber den
# neuen appliedScale informieren — sonst zeigt das Dropdown # neuen appliedScale informieren — sonst zeigt das Dropdown
@@ -630,15 +630,15 @@ class AusschnittBridge(panel_base.BaseBridge):
for key in ("massstab_bridge", "oberleiste_bridge"): for key in ("massstab_bridge", "oberleiste_bridge"):
try: try:
b = sc.sticky.get(key) b = sc.sticky.get(key)
print("[AUSSCHNITTE] force-send via {}: {}".format(key, "OK" if b is not None else "MISSING")) print("[VIEWPORTS] force-send via {}: {}".format(key, "OK" if b is not None else "MISSING"))
if b is not None: if b is not None:
b._send_state(force=True) b._send_state(force=True)
except Exception as e: except Exception as e:
print("[AUSSCHNITTE] force-send {} failed: {}".format(key, e)) print("[VIEWPORTS] force-send {} failed: {}".format(key, e))
except Exception as ex: except Exception as ex:
print("[AUSSCHNITTE] Massstab-Restore:", ex) print("[VIEWPORTS] Massstab-Restore:", ex)
view.Redraw() view.Redraw()
print("[AUSSCHNITTE] '{}' wiederhergestellt".format(snap.get("name"))) print("[VIEWPORTS] '{}' wiederhergestellt".format(snap.get("name")))
def _apply_to_detail(self, snap_id): def _apply_to_detail(self, snap_id):
doc = Rhino.RhinoDoc.ActiveDoc doc = Rhino.RhinoDoc.ActiveDoc
@@ -653,9 +653,9 @@ class AusschnittBridge(panel_base.BaseBridge):
detail = d detail = d
break break
except Exception as ex: except Exception as ex:
print("[AUSSCHNITTE] Active-Detail-Suche:", ex) print("[VIEWPORTS] Active-Detail-Suche:", ex)
if detail is None: if detail is None:
print("[AUSSCHNITTE] Kein Detail ausgewaehlt — bitte:") print("[VIEWPORTS] Kein Detail ausgewaehlt — bitte:")
print(" 1) ins Layout wechseln") print(" 1) ins Layout wechseln")
print(" 2) Detail-Rahmen einmal anklicken (so dass er hervorgehoben ist)") print(" 2) Detail-Rahmen einmal anklicken (so dass er hervorgehoben ist)")
print(" 3) erneut 'Auf Detail anwenden' waehlen") print(" 3) erneut 'Auf Detail anwenden' waehlen")
@@ -668,7 +668,7 @@ class AusschnittBridge(panel_base.BaseBridge):
doc = Rhino.RhinoDoc.ActiveDoc doc = Rhino.RhinoDoc.ActiveDoc
snap = next((s for s in self._load(doc) if s.get("id") == snap_id), None) snap = next((s for s in self._load(doc) if s.get("id") == snap_id), None)
if not snap: if not snap:
print("[AUSSCHNITTE] Snap not found:", snap_id) print("[VIEWPORTS] Snap not found:", snap_id)
return return
snap_by_id = {} snap_by_id = {}
for ls in (snap.get("layers") or []): for ls in (snap.get("layers") or []):
@@ -714,7 +714,7 @@ class AusschnittBridge(panel_base.BaseBridge):
target["layers"] = new_list target["layers"] = new_list
self._store(doc, snaps) self._store(doc, snaps)
self._send_list() self._send_list()
print("[AUSSCHNITTE] Ebenen-Sichtbarkeit von '{}' aktualisiert".format(target.get("name"))) print("[VIEWPORTS] Ebenen-Sichtbarkeit von '{}' aktualisiert".format(target.get("name")))
def _save_preset(self, name, layers): def _save_preset(self, name, layers):
if not name: return if not name: return
@@ -738,7 +738,7 @@ class AusschnittBridge(panel_base.BaseBridge):
presets.append({"name": name, "layers": clean}) presets.append({"name": name, "layers": clean})
self._store_presets(doc, presets) self._store_presets(doc, presets)
self._send_list() self._send_list()
print("[AUSSCHNITTE] Ebenenkombination '{}' gespeichert ({} Ebenen)".format(name, len(clean))) print("[VIEWPORTS] Ebenenkombination '{}' gespeichert ({} Ebenen)".format(name, len(clean)))
def _delete_preset(self, name): def _delete_preset(self, name):
if not name: return if not name: return
@@ -773,7 +773,7 @@ class AusschnittBridge(panel_base.BaseBridge):
doc = Rhino.RhinoDoc.ActiveDoc doc = Rhino.RhinoDoc.ActiveDoc
snap = next((s for s in self._load(doc) if s.get("id") == snap_id), None) snap = next((s for s in self._load(doc) if s.get("id") == snap_id), None)
if not snap: if not snap:
print("[AUSSCHNITTE] open_settings: snap not found", snap_id) print("[VIEWPORTS] open_settings: snap not found", snap_id)
return return
outer = self outer = self
bridge_holder = {"form": None, "id": snap_id} bridge_holder = {"form": None, "id": snap_id}
@@ -788,19 +788,19 @@ class AusschnittBridge(panel_base.BaseBridge):
import toolbar as oberleiste import toolbar as oberleiste
display_modes = oberleiste._list_display_modes() display_modes = oberleiste._list_display_modes()
except Exception as ex: except Exception as ex:
print("[AUSSCHNITTE] display_modes:", ex) print("[VIEWPORTS] display_modes:", ex)
overrides_presets = [] overrides_presets = []
try: try:
import overrides import overrides
overrides_presets = [item.get("name") for item in overrides.list_presets() if item.get("name")] overrides_presets = [item.get("name") for item in overrides.list_presets() if item.get("name")]
except Exception as ex: except Exception as ex:
print("[AUSSCHNITTE] overrides_presets:", ex) print("[VIEWPORTS] overrides_presets:", ex)
layer_kombis = [] layer_kombis = []
try: try:
import layers_panel as rhinopanel import layers_panel as rhinopanel
layer_kombis = rhinopanel.list_layer_preset_names(d) layer_kombis = rhinopanel.list_layer_preset_names(d)
except Exception as ex: except Exception as ex:
print("[AUSSCHNITTE] layer_kombis:", ex) print("[VIEWPORTS] layer_kombis:", ex)
cam = sn.get("camera") or {} cam = sn.get("camera") or {}
return { return {
"snap": { "snap": {
@@ -826,7 +826,7 @@ class AusschnittBridge(panel_base.BaseBridge):
sid = bridge_holder["id"] sid = bridge_holder["id"]
target = next((s for s in snaps if s.get("id") == sid), None) target = next((s for s in snaps if s.get("id") == sid), None)
if target is None: if target is None:
print("[AUSSCHNITTE] persist settings: snap weg"); return print("[VIEWPORTS] persist settings: snap weg"); return
# Massstab # Massstab
sc_val = (settings.get("scale") or "").strip() sc_val = (settings.get("scale") or "").strip()
target["scale"] = sc_val target["scale"] = sc_val
@@ -848,7 +848,7 @@ class AusschnittBridge(panel_base.BaseBridge):
target["darstellung"] = darst if darst in ("einfach", "standard", "detail") else "" target["darstellung"] = darst if darst in ("einfach", "standard", "detail") else ""
outer._store(d, snaps) outer._store(d, snaps)
outer._send_list() outer._send_list()
print("[AUSSCHNITTE] Settings fuer '{}' aktualisiert".format(target.get("name"))) print("[VIEWPORTS] Settings fuer '{}' aktualisiert".format(target.get("name")))
class _AusschnittSettingsBridge(panel_base.BaseBridge): class _AusschnittSettingsBridge(panel_base.BaseBridge):
def __init__(self): def __init__(self):
+6 -6
View File
@@ -35,7 +35,7 @@ def _on_begin_command(sender, e):
try: try:
cmd = getattr(e, "CommandEnglishName", "") or "" cmd = getattr(e, "CommandEnglishName", "") or ""
if sc.sticky.get(_VERBOSE_KEY): if sc.sticky.get(_VERBOSE_KEY):
print("[BEGIN-CMD] cmd='{}'".format(cmd)) print("[CMD-HOOK] cmd='{}'".format(cmd))
if cmd not in _DRAWING_COMMANDS: return if cmd not in _DRAWING_COMMANDS: return
try: try:
guid = System.Guid(_GESTALTUNG_PANEL_GUID) guid = System.Guid(_GESTALTUNG_PANEL_GUID)
@@ -44,15 +44,15 @@ def _on_begin_command(sender, e):
Rhino.UI.Panels.FocusPanel(guid) Rhino.UI.Panels.FocusPanel(guid)
except Exception: pass except Exception: pass
if sc.sticky.get(_VERBOSE_KEY): if sc.sticky.get(_VERBOSE_KEY):
print("[BEGIN-CMD] Gestaltung-Panel opened/focused") print("[CMD-HOOK] Gestaltung-Panel opened/focused")
except Exception as ex: except Exception as ex:
print("[BEGIN-CMD] OpenPanel:", ex) print("[CMD-HOOK] OpenPanel:", ex)
try: try:
Rhino.RhinoApp.RunScript( Rhino.RhinoApp.RunScript(
'-_ShowPanel "DOSSIER Gestaltung"', False) '-_ShowPanel "DOSSIER Gestaltung"', False)
except Exception: pass except Exception: pass
except Exception as ex: except Exception as ex:
print("[BEGIN-CMD] handler:", ex) print("[CMD-HOOK] handler:", ex)
def install(verbose=False): def install(verbose=False):
@@ -66,9 +66,9 @@ def install(verbose=False):
Rhino.Commands.Command.BeginCommand += _on_begin_command Rhino.Commands.Command.BeginCommand += _on_begin_command
sc.sticky[_HANDLER_KEY] = _on_begin_command sc.sticky[_HANDLER_KEY] = _on_begin_command
sc.sticky[_VERBOSE_KEY] = bool(verbose) sc.sticky[_VERBOSE_KEY] = bool(verbose)
print("[BEGIN-CMD] Hook installed (verbose={})".format(bool(verbose))) print("[CMD-HOOK] Hook installed (verbose={})".format(bool(verbose)))
except Exception as ex: except Exception as ex:
print("[BEGIN-CMD] install:", ex) print("[CMD-HOOK] install:", ex)
def set_verbose(flag): def set_verbose(flag):
+3 -3
View File
@@ -138,7 +138,7 @@ class _VertexDotConduit(rd.DisplayConduit):
pt, "·", _MARKER_FILL, _MARKER_BORDER) pt, "·", _MARKER_FILL, _MARKER_BORDER)
except Exception: pass except Exception: pass
except Exception as ex: except Exception as ex:
print("[CURVE_DOTS] DrawForeground:", ex) print("[CURVE-DOTS] DrawForeground:", ex)
# --- Install ------------------------------------------------------------- # --- Install -------------------------------------------------------------
@@ -156,6 +156,6 @@ def install_curve_vertex_dots():
conduit = _VertexDotConduit() conduit = _VertexDotConduit()
conduit.Enabled = True conduit.Enabled = True
sc.sticky[_STICKY_CONDUIT] = conduit sc.sticky[_STICKY_CONDUIT] = conduit
print("[CURVE_DOTS] Vertex dot conduit active") print("[CURVE-DOTS] Vertex dot conduit active")
except Exception as ex: except Exception as ex:
print("[CURVE_DOTS] install:", ex) print("[CURVE-DOTS] install:", ex)
+7 -7
View File
@@ -183,7 +183,7 @@ def _apply_xform(doc, objs, xform):
if doc.Objects.Transform(obj.Id, xform, True): if doc.Objects.Transform(obj.Id, xform, True):
n += 1 n += 1
except Exception as ex: except Exception as ex:
print("[DIMENSIONEN] Transform-Fehler:", ex) print("[DIMENSIONS] Transform-Fehler:", ex)
return n return n
@@ -201,14 +201,14 @@ class _UndoRecord(object):
try: try:
self.serial = self.doc.BeginUndoRecord(self.label) self.serial = self.doc.BeginUndoRecord(self.label)
except Exception as ex: except Exception as ex:
print("[DIMENSIONEN] BeginUndoRecord:", ex) print("[DIMENSIONS] BeginUndoRecord:", ex)
self.serial = 0 self.serial = 0
return self return self
def __exit__(self, exc_type, exc_val, exc_tb): def __exit__(self, exc_type, exc_val, exc_tb):
if self.serial: if self.serial:
try: self.doc.EndUndoRecord(self.serial) try: self.doc.EndUndoRecord(self.serial)
except Exception as ex: except Exception as ex:
print("[DIMENSIONEN] EndUndoRecord:", ex) print("[DIMENSIONS] EndUndoRecord:", ex)
return False # exceptions propagieren return False # exceptions propagieren
@@ -227,7 +227,7 @@ def _scale_around_point(doc, objs, plane, ref_world, sx, sy, sz):
ausgerichtet an plane.""" ausgerichtet an plane."""
if sx == 1 and sy == 1 and sz == 1: return if sx == 1 and sy == 1 and sz == 1: return
if sx <= 0 or sy <= 0 or sz <= 0: if sx <= 0 or sy <= 0 or sz <= 0:
print("[DIMENSIONEN] Ungueltige Skalierungsfaktoren:", sx, sy, sz) print("[DIMENSIONS] Ungueltige Skalierungsfaktoren:", sx, sy, sz)
return return
p = rg.Plane(plane) p = rg.Plane(plane)
p.Origin = ref_world p.Origin = ref_world
@@ -593,7 +593,7 @@ def _install_listeners(bridge):
b = sc.sticky.get("dimensionen_bridge") b = sc.sticky.get("dimensionen_bridge")
if b is not None: if b is not None:
try: b.tick_idle() try: b.tick_idle()
except Exception as ex: print("[DIMENSIONEN] idle:", ex) except Exception as ex: print("[DIMENSIONS] idle:", ex)
def on_select(s, e): def on_select(s, e):
# Swisstopo-Import feuert tausende Selection-Events → bail. # Swisstopo-Import feuert tausende Selection-Events → bail.
@@ -619,9 +619,9 @@ def _install_listeners(bridge):
Rhino.RhinoDoc.DeselectObjects += on_select Rhino.RhinoDoc.DeselectObjects += on_select
Rhino.RhinoDoc.DeselectAllObjects += on_select Rhino.RhinoDoc.DeselectAllObjects += on_select
except Exception as ex: except Exception as ex:
print("[DIMENSIONEN] select-events:", ex) print("[DIMENSIONS] select-events:", ex)
sc.sticky[flag] = True sc.sticky[flag] = True
print("[DIMENSIONEN] Listener active (Idle + SelectObjects)") print("[DIMENSIONS] Listener active (Idle + SelectObjects)")
def _bridge_factory(): def _bridge_factory():
+9 -9
View File
@@ -82,7 +82,7 @@ def _find_hatch_pattern_index(doc, name):
if hp.Name and hp.Name.strip().lower() == target: if hp.Name and hp.Name.strip().lower() == target:
return i return i
except Exception as ex: except Exception as ex:
print("[EBENEN] hatch lookup:", ex) print("[LAYERS] hatch lookup:", ex)
return -1 return -1
@@ -154,7 +154,7 @@ def _apply_section_style(doc, layer, section_cfg, layer_color):
try: try:
SS = Rhino.DocObjects.SectionStyle SS = Rhino.DocObjects.SectionStyle
except Exception as ex: except Exception as ex:
print("[EBENEN] SectionStyle-Klasse nicht da:", ex); return print("[LAYERS] SectionStyle-Klasse nicht da:", ex); return
pat = (section_cfg.get("hatchPattern") or "None").strip() pat = (section_cfg.get("hatchPattern") or "None").strip()
show = bool(section_cfg.get("boundaryShow", True)) show = bool(section_cfg.get("boundaryShow", True))
@@ -341,7 +341,7 @@ def _build_ebene_layer(doc, parent_id, e, diag_prefix=""):
_apply_section_style(doc, doc.Layers[sub_idx], _apply_section_style(doc, doc.Layers[sub_idx],
e.get("section"), e.get("color")) e.get("section"), e.get("color"))
except Exception as ex: except Exception as ex:
print("[EBENEN] section-style apply ({}{}): {}".format( print("[LAYERS] section-style apply ({}{}): {}".format(
diag_prefix, sub_name, ex)) diag_prefix, sub_name, ex))
return sub_idx return sub_idx
@@ -384,7 +384,7 @@ def build_layers(doc, zeichnungsebenen, ebenen):
diag_prefix=z_name + "/") diag_prefix=z_name + "/")
doc.Views.Redraw() doc.Views.Redraw()
n_total = len(walk_ebenen(ebenen)) n_total = len(walk_ebenen(ebenen))
print("[EBENEN] {} drawing levels x {} layers updated (incl. {} sub)".format( print("[LAYERS] {} drawing levels x {} layers updated (incl. {} sub)".format(
len(zeichnungsebenen), len(ebenen), max(0, n_total - len(ebenen)))) len(zeichnungsebenen), len(ebenen), max(0, n_total - len(ebenen))))
@@ -487,10 +487,10 @@ def delete_ebene(doc, code, move_to=None):
if doc.Layers.Delete(from_idx, True): if doc.Layers.Delete(from_idx, True):
deleted_layers += 1 deleted_layers += 1
except Exception as ex: except Exception as ex:
print("[EBENEN] Layer-Delete:", ex) print("[LAYERS] Layer-Delete:", ex)
doc.Views.Redraw() doc.Views.Redraw()
print("[EBENEN] Ebene {} entfernt: {} Sublayer, {} Objekte verschoben, {} Objekte geloescht".format( print("[LAYERS] Ebene {} entfernt: {} Sublayer, {} Objekte verschoben, {} Objekte geloescht".format(
code, deleted_layers, moved, deleted_objs)) code, deleted_layers, moved, deleted_objs))
@@ -656,7 +656,7 @@ def cleanup_default_layers(doc):
except Exception: except Exception:
pass pass
if deleted: if deleted:
print("[EBENEN] Default layer removed: {}".format(", ".join(deleted))) print("[LAYERS] Default layer removed: {}".format(", ".join(deleted)))
def _find_sublayer_by_code_recursive(doc, parent_id, code): def _find_sublayer_by_code_recursive(doc, parent_id, code):
@@ -682,14 +682,14 @@ def set_active_sublayer(doc, zeichnungsebene_id, code):
7101_Strassen liegt zwei Ebenen tief).""" 7101_Strassen liegt zwei Ebenen tief)."""
parent_idx = _find_top_by_id(doc, zeichnungsebene_id) parent_idx = _find_top_by_id(doc, zeichnungsebene_id)
if parent_idx < 0: if parent_idx < 0:
print("[EBENEN] Parent-Layer fuer Zeichnungsebene {} not found".format(zeichnungsebene_id)) print("[LAYERS] Parent-Layer fuer Zeichnungsebene {} not found".format(zeichnungsebene_id))
return return
parent_id = doc.Layers[parent_idx].Id parent_id = doc.Layers[parent_idx].Id
sub_idx = _find_sublayer_by_code_recursive(doc, parent_id, code) sub_idx = _find_sublayer_by_code_recursive(doc, parent_id, code)
if sub_idx >= 0: if sub_idx >= 0:
doc.Layers.SetCurrentLayerIndex(sub_idx, True) doc.Layers.SetCurrentLayerIndex(sub_idx, True)
else: else:
print("[EBENEN] Sublayer with code {} under parent {} not found".format(code, doc.Layers[parent_idx].Name)) print("[LAYERS] Sublayer with code {} under parent {} not found".format(code, doc.Layers[parent_idx].Name))
def apply_visibility(doc, zeichnungsebenen, ebenen, active_z_id, active_code, z_mode, e_mode): def apply_visibility(doc, zeichnungsebenen, ebenen, active_z_id, active_code, z_mode, e_mode):
+83 -83
View File
@@ -88,14 +88,14 @@ def _list_hatch_patterns_full(doc):
try: lines = hp.GetHatchLines() try: lines = hp.GetHatchLines()
except Exception: pass except Exception: pass
if lines is None: if lines is None:
print("[EBENEN] hp[{}] '{}' HatchLines=None".format( print("[LAYERS] hp[{}] '{}' HatchLines=None".format(
i, hp.Name)) i, hp.Name))
else: else:
try: cnt = len(lines) try: cnt = len(lines)
except Exception: except Exception:
try: cnt = lines.Count try: cnt = lines.Count
except Exception: cnt = -1 except Exception: cnt = -1
print("[EBENEN] hp[{}] '{}' HatchLines type={} count={}".format( print("[LAYERS] hp[{}] '{}' HatchLines type={} count={}".format(
i, hp.Name, type(lines).__name__, cnt)) i, hp.Name, type(lines).__name__, cnt))
for hl in lines: for hl in lines:
try: try:
@@ -132,9 +132,9 @@ def _list_hatch_patterns_full(doc):
} }
hlines.append(entry) hlines.append(entry)
except Exception as ex: except Exception as ex:
print("[EBENEN] hp[{}] hl FAIL:".format(i), ex) print("[LAYERS] hp[{}] hl FAIL:".format(i), ex)
except Exception as ex: except Exception as ex:
print("[EBENEN] hp[{}] HatchLines outer FAIL:".format(i), ex) print("[LAYERS] hp[{}] HatchLines outer FAIL:".format(i), ex)
out.append({ out.append({
"index": i, "index": i,
"name": hp.Name or "", "name": hp.Name or "",
@@ -146,7 +146,7 @@ def _list_hatch_patterns_full(doc):
except Exception: except Exception:
continue continue
except Exception as ex: except Exception as ex:
print("[EBENEN] _list_hatch_patterns_full:", ex) print("[LAYERS] _list_hatch_patterns_full:", ex)
return out return out
@@ -198,7 +198,7 @@ def _list_linetypes_full(doc):
stype = "Space" stype = "Space"
segs.append({"length": length, "type": stype}) segs.append({"length": length, "type": stype})
except Exception as ex: except Exception as ex:
print("[EBENEN] lt[{}] GetSegment({}) FAIL: {}".format( print("[LAYERS] lt[{}] GetSegment({}) FAIL: {}".format(
i, s, ex)) i, s, ex))
ref = 0 ref = 0
try: ref = int(lt.Reference) try: ref = int(lt.Reference)
@@ -211,10 +211,10 @@ def _list_linetypes_full(doc):
"isReference": (ref > 0), "isReference": (ref > 0),
}) })
except Exception as ex: except Exception as ex:
print("[EBENEN] linetype outer FAIL:", ex) print("[LAYERS] linetype outer FAIL:", ex)
continue continue
except Exception as ex: except Exception as ex:
print("[EBENEN] _list_linetypes_full:", ex) print("[LAYERS] _list_linetypes_full:", ex)
return out return out
@@ -242,7 +242,7 @@ def _read_launcher_schema():
and r.get("lw") is not None] and r.get("lw") is not None]
if clean: return clean if clean: return clean
except Exception as ex: except Exception as ex:
print("[EBENEN] launcher-schema lesen ({}):".format(p), ex) print("[LAYERS] launcher-schema lesen ({}):".format(p), ex)
return None return None
@@ -272,7 +272,7 @@ def _broadcast_state(doc=None, hatch_patterns=None):
"layerCombinationActive": get_active_comb_name(doc), "layerCombinationActive": get_active_comb_name(doc),
} }
except Exception as ex: except Exception as ex:
print("[EBENEN] broadcast prepare:", ex) print("[LAYERS] broadcast prepare:", ex)
return return
for key in ("ebenen_bridge_ref", "zeichnungsebenen_bridge_ref"): for key in ("ebenen_bridge_ref", "zeichnungsebenen_bridge_ref"):
b = sc.sticky.get(key) b = sc.sticky.get(key)
@@ -621,7 +621,7 @@ def store_layer_presets(doc, presets):
doc.Strings.SetString(_PRESETS_KEY, doc.Strings.SetString(_PRESETS_KEY,
json.dumps(presets, ensure_ascii=False)) json.dumps(presets, ensure_ascii=False))
except Exception as ex: except Exception as ex:
print("[EBENEN] store_layer_presets:", ex) print("[LAYERS] store_layer_presets:", ex)
def get_active_comb_name(doc): def get_active_comb_name(doc):
@@ -636,7 +636,7 @@ def set_active_comb_name(doc, name):
try: try:
doc.Strings.SetString(_ACTIVE_COMB_KEY, name or "") doc.Strings.SetString(_ACTIVE_COMB_KEY, name or "")
except Exception as ex: except Exception as ex:
print("[EBENEN] set_active_comb_name:", ex) print("[LAYERS] set_active_comb_name:", ex)
def list_layer_preset_names(doc): def list_layer_preset_names(doc):
@@ -653,7 +653,7 @@ def _notify_oberleiste_combs():
b._cached_combinations = None b._cached_combinations = None
b._send_state(force=True) b._send_state(force=True)
except Exception as ex: except Exception as ex:
print("[EBENEN] notify oberleiste combs:", ex) print("[LAYERS] notify oberleiste combs:", ex)
def _notify_layer_combinations_editor(): def _notify_layer_combinations_editor():
@@ -663,7 +663,7 @@ def _notify_layer_combinations_editor():
b = sc.sticky.get("layer_combinations_bridge") b = sc.sticky.get("layer_combinations_bridge")
if b is not None: b._send_state() if b is not None: b._send_state()
except Exception as ex: except Exception as ex:
print("[EBENEN] notify layer-combinations editor:", ex) print("[LAYERS] notify layer-combinations editor:", ex)
def apply_layer_preset_by_name(doc, name): def apply_layer_preset_by_name(doc, name):
@@ -673,7 +673,7 @@ def apply_layer_preset_by_name(doc, name):
presets = load_layer_presets(doc) presets = load_layer_presets(doc)
preset = next((p for p in presets if p.get("name") == name), None) preset = next((p for p in presets if p.get("name") == name), None)
if preset is None: if preset is None:
print("[EBENEN] apply_layer_preset_by_name: '{}' not found".format(name)) print("[LAYERS] apply_layer_preset_by_name: '{}' not found".format(name))
return False return False
payload = { payload = {
"layers": preset.get("layers") or [], "layers": preset.get("layers") or [],
@@ -687,7 +687,7 @@ def apply_layer_preset_by_name(doc, name):
try: try:
eb._apply_combination(payload) eb._apply_combination(payload)
except Exception as ex: except Exception as ex:
print("[EBENEN] apply via bridge:", ex) print("[LAYERS] apply via bridge:", ex)
return False return False
else: else:
# Fallback: direkt doc.Strings + doc.Layer setzen (kein Bridge offen) # Fallback: direkt doc.Strings + doc.Layer setzen (kein Bridge offen)
@@ -725,7 +725,7 @@ def _apply_layer_preset_inline(doc, payload):
doc.Strings.SetString("dossier_ebenen", json.dumps(e_list, ensure_ascii=False)) doc.Strings.SetString("dossier_ebenen", json.dumps(e_list, ensure_ascii=False))
doc.Strings.SetString("dossier_zeichnungsebenen", json.dumps(z_list, ensure_ascii=False)) doc.Strings.SetString("dossier_zeichnungsebenen", json.dumps(z_list, ensure_ascii=False))
except Exception as ex: except Exception as ex:
print("[EBENEN] inline preset-apply (eye-state):", ex) print("[LAYERS] inline preset-apply (eye-state):", ex)
# Layer-ID-Pfad als Sekundaer (AUSSCHNITTE-Kompat) # Layer-ID-Pfad als Sekundaer (AUSSCHNITTE-Kompat)
layer_states = payload.get("layers") or [] layer_states = payload.get("layers") or []
if layer_states: if layer_states:
@@ -767,7 +767,7 @@ def save_current_as_layer_preset(doc, name):
"locked": bool(layer.IsLocked), "locked": bool(layer.IsLocked),
}) })
except Exception as ex: except Exception as ex:
print("[EBENEN] save_current_as_layer_preset enum:", ex) print("[LAYERS] save_current_as_layer_preset enum:", ex)
# 2) Eye-States aus dossier_ebenen / dossier_zeichnungsebenen # 2) Eye-States aus dossier_ebenen / dossier_zeichnungsebenen
pe_state, pz_state = [], [] pe_state, pz_state = [], []
try: try:
@@ -789,7 +789,7 @@ def save_current_as_layer_preset(doc, name):
"visible": bool(z.get("visible", True)), "visible": bool(z.get("visible", True)),
}) })
except Exception as ex: except Exception as ex:
print("[EBENEN] save_current_as_layer_preset eye-states:", ex) print("[LAYERS] save_current_as_layer_preset eye-states:", ex)
presets = load_layer_presets(doc) presets = load_layer_presets(doc)
new_data = { new_data = {
"name": name, "name": name,
@@ -806,7 +806,7 @@ def save_current_as_layer_preset(doc, name):
set_active_comb_name(doc, name) set_active_comb_name(doc, name)
_notify_oberleiste_combs() _notify_oberleiste_combs()
_notify_layer_combinations_editor() _notify_layer_combinations_editor()
print("[EBENEN] '{}' gespeichert: {} Layer + {} Ebenen Eye-State".format( print("[LAYERS] '{}' gespeichert: {} Layer + {} Ebenen Eye-State".format(
name, len(layers), len(pe_state))) name, len(layers), len(pe_state)))
return True return True
@@ -820,7 +820,7 @@ def delete_layer_preset(doc, name):
set_active_comb_name(doc, None) set_active_comb_name(doc, None)
_notify_oberleiste_combs() _notify_oberleiste_combs()
_notify_layer_combinations_editor() _notify_layer_combinations_editor()
print("[EBENEN] Kombination '{}' geloescht".format(name)) print("[LAYERS] Kombination '{}' geloescht".format(name))
return True return True
@@ -870,7 +870,7 @@ class EbenenBridge(panel_base.BaseBridge):
"hatchPatterns": _hatch_pattern_names(doc), "hatchPatterns": _hatch_pattern_names(doc),
}) })
except Exception as ex: except Exception as ex:
print("[EBENEN] State-Sync:", ex) print("[LAYERS] State-Sync:", ex)
else: else:
payload = {"hatchPatterns": _hatch_pattern_names(doc)} payload = {"hatchPatterns": _hatch_pattern_names(doc)}
# Falls der User im Launcher eigene Default-Ebenen definiert hat, # Falls der User im Launcher eigene Default-Ebenen definiert hat,
@@ -878,7 +878,7 @@ class EbenenBridge(panel_base.BaseBridge):
launcher_schema = _read_launcher_schema() launcher_schema = _read_launcher_schema()
if launcher_schema: if launcher_schema:
payload["defaultEbenen"] = launcher_schema payload["defaultEbenen"] = launcher_schema
print("[EBENEN] FIRST_RUN mit Launcher-Schema ({} Ebenen)".format( print("[LAYERS] FIRST_RUN mit Launcher-Schema ({} Ebenen)".format(
len(launcher_schema))) len(launcher_schema)))
self.send("FIRST_RUN", payload) self.send("FIRST_RUN", payload)
@@ -894,7 +894,7 @@ class EbenenBridge(panel_base.BaseBridge):
if t == "READY": if t == "READY":
self._on_ready() self._on_ready()
elif t == "APPLY": elif t == "APPLY":
print("[EBENEN-BE] APPLY from mode={} payload-z={} payload-e={}".format( print("[LAYERS-BE] APPLY from mode={} payload-z={} payload-e={}".format(
self._mode, self._mode,
len(p.get("zeichnungsebenen") or []), len(p.get("zeichnungsebenen") or []),
len(p.get("ebenen") or []))) len(p.get("ebenen") or [])))
@@ -902,13 +902,13 @@ class EbenenBridge(panel_base.BaseBridge):
z_payload = p.get("zeichnungsebenen") or [] z_payload = p.get("zeichnungsebenen") or []
e_raw = doc.Strings.GetValue("dossier_ebenen") e_raw = doc.Strings.GetValue("dossier_ebenen")
e_payload = json.loads(e_raw) if e_raw else [] e_payload = json.loads(e_raw) if e_raw else []
print("[EBENEN-BE] mode=zeichnungsebenen: e from doc.Strings n={}".format(len(e_payload))) print("[LAYERS-BE] mode=zeichnungsebenen: e from doc.Strings n={}".format(len(e_payload)))
self._apply(z_payload, e_payload, save_z=True, save_e=False) self._apply(z_payload, e_payload, save_z=True, save_e=False)
else: else:
e_payload = p.get("ebenen") or [] e_payload = p.get("ebenen") or []
z_raw = doc.Strings.GetValue("dossier_zeichnungsebenen") z_raw = doc.Strings.GetValue("dossier_zeichnungsebenen")
z_payload = json.loads(z_raw) if z_raw else [] z_payload = json.loads(z_raw) if z_raw else []
print("[EBENEN-BE] mode=ebenen: z from doc.Strings n={}".format(len(z_payload))) print("[LAYERS-BE] mode=ebenen: z from doc.Strings n={}".format(len(z_payload)))
self._apply(z_payload, e_payload, save_z=False, save_e=True) self._apply(z_payload, e_payload, save_z=False, save_e=True)
elif t == "LAYER_STYLE": elif t == "LAYER_STYLE":
layer_builder.update_layer_style(doc, p["code"], p.get("color"), p.get("lw")) layer_builder.update_layer_style(doc, p["code"], p.get("color"), p.get("lw"))
@@ -942,16 +942,16 @@ class EbenenBridge(panel_base.BaseBridge):
if new_z is not None: if new_z is not None:
self._set_active_zeichnungsebene(new_z) self._set_active_zeichnungsebene(new_z)
except Exception as ex: except Exception as ex:
print("[SCHNITT] auto-activate:", ex) print("[SECTION] auto-activate:", ex)
except Exception as ex: except Exception as ex:
print("[SCHNITT] CREATE_SCHNITT:", ex) print("[SECTION] CREATE_SCHNITT:", ex)
elif t == "DELETE_SCHNITT": elif t == "DELETE_SCHNITT":
try: try:
import schnitte import schnitte
if schnitte.delete_schnitt_entry(doc, p.get("id") or ""): if schnitte.delete_schnitt_entry(doc, p.get("id") or ""):
_broadcast_state(doc) _broadcast_state(doc)
except Exception as ex: except Exception as ex:
print("[SCHNITT] DELETE_SCHNITT:", ex) print("[SECTION] DELETE_SCHNITT:", ex)
elif t == "SET_ACTIVE_LAYER": elif t == "SET_ACTIVE_LAYER":
code = p.get("code", "") code = p.get("code", "")
if code: if code:
@@ -1015,21 +1015,21 @@ class EbenenBridge(panel_base.BaseBridge):
elif t == "OPEN_LAYER_COMBINATIONS_DIALOG": elif t == "OPEN_LAYER_COMBINATIONS_DIALOG":
try: open_layer_combinations_window() try: open_layer_combinations_window()
except Exception as ex: except Exception as ex:
print("[EBENEN] open layer-combinations:", ex) print("[LAYERS] open layer-combinations:", ex)
elif t == "OPEN_PROJECT_SETTINGS": elif t == "OPEN_PROJECT_SETTINGS":
try: self._open_project_settings() try: self._open_project_settings()
except Exception as ex: except Exception as ex:
print("[EBENEN] open project-settings:", ex) print("[LAYERS] open project-settings:", ex)
elif t == "OPEN_LIBRARY": elif t == "OPEN_LIBRARY":
try: self._open_library() try: self._open_library()
except Exception as ex: except Exception as ex:
print("[EBENEN] open library:", ex) print("[LAYERS] open library:", ex)
elif t == "PICK_TEXTURE_FILE": elif t == "PICK_TEXTURE_FILE":
# Oeffnet macOS-File-Picker fuer Bild-Dateien. Antwort an # Oeffnet macOS-File-Picker fuer Bild-Dateien. Antwort an
# Frontend via TEXTURE_PICKED-Message. # Frontend via TEXTURE_PICKED-Message.
try: self._pick_texture_file(p) try: self._pick_texture_file(p)
except Exception as ex: except Exception as ex:
print("[EBENEN] pick texture:", ex) print("[LAYERS] pick texture:", ex)
# ---- Helpers ---- # ---- Helpers ----
@@ -1843,7 +1843,7 @@ class EbenenBridge(panel_base.BaseBridge):
path = dlg.FileName or "" path = dlg.FileName or ""
self.send("TEXTURE_PICKED", {"slot": slot, "path": path}) self.send("TEXTURE_PICKED", {"slot": slot, "path": path})
except Exception as ex: except Exception as ex:
print("[EBENEN] pick texture:", ex) print("[LAYERS] pick texture:", ex)
self.send("TEXTURE_PICKED", {"slot": slot, "path": None}) self.send("TEXTURE_PICKED", {"slot": slot, "path": None})
def _open_library(self): def _open_library(self):
@@ -1913,7 +1913,7 @@ class EbenenBridge(panel_base.BaseBridge):
GeschossSettingsDialog. Save updated den Eintrag in doc.Strings + GeschossSettingsDialog. Save updated den Eintrag in doc.Strings +
triggert Cross-Panel-Sync.""" triggert Cross-Panel-Sync."""
if not isinstance(geschoss, dict) or not geschoss.get("id"): if not isinstance(geschoss, dict) or not geschoss.get("id"):
print("[EBENEN] open_geschoss_settings: kein Geschoss-Payload") print("[LAYERS] open_geschoss_settings: kein Geschoss-Payload")
return return
gid = geschoss["id"] gid = geschoss["id"]
doc = Rhino.RhinoDoc.ActiveDoc doc = Rhino.RhinoDoc.ActiveDoc
@@ -1935,16 +1935,16 @@ class EbenenBridge(panel_base.BaseBridge):
val = updated.pop("projectZeroMum") val = updated.pop("projectZeroMum")
val = float(val) if val is not None else 0.0 val = float(val) if val is not None else 0.0
doc.Strings.SetString("dossier_project_zero_mum", str(val)) doc.Strings.SetString("dossier_project_zero_mum", str(val))
print("[EBENEN] project_zero_mum = {} m.ü.M".format(val)) print("[LAYERS] project_zero_mum = {} m.ü.M".format(val))
except Exception as ex: except Exception as ex:
print("[EBENEN] project_zero_mum save:", ex) print("[LAYERS] project_zero_mum save:", ex)
z_raw = doc.Strings.GetValue("dossier_zeichnungsebenen") z_raw = doc.Strings.GetValue("dossier_zeichnungsebenen")
if not z_raw: if not z_raw:
print("[EBENEN] save_geschoss: kein z-Store"); return print("[LAYERS] save_geschoss: kein z-Store"); return
try: try:
z_list = json.loads(z_raw) z_list = json.loads(z_raw)
except Exception as ex: except Exception as ex:
print("[EBENEN] save_geschoss JSON:", ex); return print("[LAYERS] save_geschoss JSON:", ex); return
replaced = False replaced = False
for i, z in enumerate(z_list): for i, z in enumerate(z_list):
if isinstance(z, dict) and z.get("id") == gid: if isinstance(z, dict) and z.get("id") == gid:
@@ -1952,7 +1952,7 @@ class EbenenBridge(panel_base.BaseBridge):
replaced = True replaced = True
break break
if not replaced: if not replaced:
print("[EBENEN] save_geschoss: id {} not found".format(gid)) print("[LAYERS] save_geschoss: id {} not found".format(gid))
return return
# Build_layers + Save via _apply (durchlaeuft ohne save_e) # Build_layers + Save via _apply (durchlaeuft ohne save_e)
e_raw = doc.Strings.GetValue("dossier_ebenen") e_raw = doc.Strings.GetValue("dossier_ebenen")
@@ -1970,7 +1970,7 @@ class EbenenBridge(panel_base.BaseBridge):
import schnitte import schnitte
schnitte.activate_schnitt(doc, updated) schnitte.activate_schnitt(doc, updated)
except Exception as ex: except Exception as ex:
print("[SCHNITT] post-save reactivate:", ex) print("[SECTION] post-save reactivate:", ex)
panel_base.open_satellite_window( panel_base.open_satellite_window(
"geschoss_settings", "geschoss_settings",
params=params, params=params,
@@ -1984,7 +1984,7 @@ class EbenenBridge(panel_base.BaseBridge):
die aktuelle Ebene live (SAVE_KEEP), Schliess-/Übernehmen-Knopf die aktuelle Ebene live (SAVE_KEEP), Schliess-/Übernehmen-Knopf
persistiert + schliesst (SAVE).""" persistiert + schliesst (SAVE)."""
if not isinstance(ebene, dict) or not ebene.get("code"): if not isinstance(ebene, dict) or not ebene.get("code"):
print("[EBENEN] open_ebenen_settings: kein Ebene-Payload") print("[LAYERS] open_ebenen_settings: kein Ebene-Payload")
return return
bridge_holder = {"form": None} bridge_holder = {"form": None}
apply_self = self apply_self = self
@@ -2035,7 +2035,7 @@ class EbenenBridge(panel_base.BaseBridge):
if not e_raw: return if not e_raw: return
try: e_list = json.loads(e_raw) try: e_list = json.loads(e_raw)
except Exception as ex: except Exception as ex:
print("[EBENEN] save_ebene JSON:", ex); return print("[LAYERS] save_ebene JSON:", ex); return
# Rekursive Suche + Replace durch den Tree — Sub-Ebenen # Rekursive Suche + Replace durch den Tree — Sub-Ebenen
# (children) liegen verschachtelt, nicht in der Top-Level-Liste. # (children) liegen verschachtelt, nicht in der Top-Level-Liste.
def _replace_in_tree(lst, target_code, new_data): def _replace_in_tree(lst, target_code, new_data):
@@ -2055,7 +2055,7 @@ class EbenenBridge(panel_base.BaseBridge):
return False return False
replaced = _replace_in_tree(e_list, orig_code, updated) replaced = _replace_in_tree(e_list, orig_code, updated)
if not replaced: if not replaced:
print("[EBENEN] save_ebene: code {} not found".format(orig_code)) print("[LAYERS] save_ebene: code {} not found".format(orig_code))
return return
z_raw = doc.Strings.GetValue("dossier_zeichnungsebenen") z_raw = doc.Strings.GetValue("dossier_zeichnungsebenen")
try: z_list = json.loads(z_raw) if z_raw else [] try: z_list = json.loads(z_raw) if z_raw else []
@@ -2074,7 +2074,7 @@ class EbenenBridge(panel_base.BaseBridge):
"""Oeffnet den vollen GeschossDialog (Mehrfach-Editor) als """Oeffnet den vollen GeschossDialog (Mehrfach-Editor) als
Satelliten-Fenster. Save schreibt die ganze z-Liste neu.""" Satelliten-Fenster. Save schreibt die ganze z-Liste neu."""
if not isinstance(zeichnungsebenen, list): if not isinstance(zeichnungsebenen, list):
print("[EBENEN] open_geschoss_dialog: keine Liste"); return print("[LAYERS] open_geschoss_dialog: keine Liste"); return
def on_save(payload): def on_save(payload):
doc = Rhino.RhinoDoc.ActiveDoc doc = Rhino.RhinoDoc.ActiveDoc
if doc is None: return if doc is None: return
@@ -2092,7 +2092,7 @@ class EbenenBridge(panel_base.BaseBridge):
on_save=on_save) on_save=on_save)
def _apply(self, zeichnungsebenen, ebenen, save_z=True, save_e=True): def _apply(self, zeichnungsebenen, ebenen, save_z=True, save_e=True):
print("[EBENEN] _apply START z={} e={} (save_z={} save_e={})".format( print("[LAYERS] _apply START z={} e={} (save_z={} save_e={})".format(
len(zeichnungsebenen) if zeichnungsebenen else 0, len(zeichnungsebenen) if zeichnungsebenen else 0,
len(ebenen) if ebenen else 0, save_z, save_e)) len(ebenen) if ebenen else 0, save_z, save_e))
doc = Rhino.RhinoDoc.ActiveDoc doc = Rhino.RhinoDoc.ActiveDoc
@@ -2147,19 +2147,19 @@ class EbenenBridge(panel_base.BaseBridge):
new_ids = _schn.schnitt_ids_in_list(zeichnungsebenen) new_ids = _schn.schnitt_ids_in_list(zeichnungsebenen)
schnitte_removed = old_ids - new_ids schnitte_removed = old_ids - new_ids
except Exception as ex: except Exception as ex:
print("[SCHNITT] cleanup detection:", ex) print("[SECTION] cleanup detection:", ex)
_set_processing(True) _set_processing(True)
try: try:
print("[EBENEN] _apply: build_layers ...") print("[LAYERS] _apply: build_layers ...")
layer_builder.build_layers(doc, zeichnungsebenen, ebenen) layer_builder.build_layers(doc, zeichnungsebenen, ebenen)
print("[EBENEN] _apply: json.dumps ...") print("[LAYERS] _apply: json.dumps ...")
# WICHTIG: ensure_ascii=False umgeht einen Bug in Rhinos eigener # WICHTIG: ensure_ascii=False umgeht einen Bug in Rhinos eigener
# json/encoder.py die bei ASCII-escape s.decode('utf-8') aufruft # json/encoder.py die bei ASCII-escape s.decode('utf-8') aufruft
# und dabei mit 0xC4 (Umlaut) in den CP1252-Decoder lauft. # und dabei mit 0xC4 (Umlaut) in den CP1252-Decoder lauft.
z_json = json.dumps(zeichnungsebenen, ensure_ascii=False) z_json = json.dumps(zeichnungsebenen, ensure_ascii=False)
e_json = json.dumps(ebenen, ensure_ascii=False) e_json = json.dumps(ebenen, ensure_ascii=False)
print("[EBENEN] _apply: SetString ...") print("[LAYERS] _apply: SetString ...")
if save_z: if save_z:
doc.Strings.SetString("dossier_zeichnungsebenen", z_json) doc.Strings.SetString("dossier_zeichnungsebenen", z_json)
if save_e: if save_e:
@@ -2175,10 +2175,10 @@ class EbenenBridge(panel_base.BaseBridge):
for sid in schnitte_removed: for sid in schnitte_removed:
n_total += _schn.cleanup_schnitt_artifacts( n_total += _schn.cleanup_schnitt_artifacts(
doc, sid, active_id=active_id) doc, sid, active_id=active_id)
print("[SCHNITT] {} Schnitt(e) geloescht, {} Symbol-Curves entfernt".format( print("[SECTION] {} Schnitt(e) geloescht, {} Symbol-Curves entfernt".format(
len(schnitte_removed), n_total)) len(schnitte_removed), n_total))
except Exception as ex: except Exception as ex:
print("[SCHNITT] artifact cleanup:", ex) print("[SECTION] artifact cleanup:", ex)
# Smart-Elemente (Waende) regenerieren — Geschoss-Hoehen/OKFF # Smart-Elemente (Waende) regenerieren — Geschoss-Hoehen/OKFF
# haben sich evtl. geaendert, gebundene Waende muessen neu # haben sich evtl. geaendert, gebundene Waende muessen neu
# extrudiert werden. Best-effort, faengt jeden Fehler ab. # extrudiert werden. Best-effort, faengt jeden Fehler ab.
@@ -2187,17 +2187,17 @@ class EbenenBridge(panel_base.BaseBridge):
if elem_bridge is not None: if elem_bridge is not None:
elem_bridge._regenerate_all() elem_bridge._regenerate_all()
except Exception as _ex: except Exception as _ex:
print("[EBENEN] elemente regen:", _ex) print("[LAYERS] elemente regen:", _ex)
n_with_fill = sum(1 for e in ebenen if isinstance(e, dict) n_with_fill = sum(1 for e in ebenen if isinstance(e, dict)
and isinstance(e.get("fill"), dict) and isinstance(e.get("fill"), dict)
and e["fill"].get("pattern") not in (None, "None")) and e["fill"].get("pattern") not in (None, "None"))
print("[EBENEN] dossier_ebenen saved: {} layers, of which {} with fill, JSON-len={}".format( print("[LAYERS] dossier_ebenen saved: {} layers, of which {} with fill, JSON-len={}".format(
len(ebenen), n_with_fill, len(e_json))) len(ebenen), n_with_fill, len(e_json)))
re_read = doc.Strings.GetValue("dossier_ebenen") re_read = doc.Strings.GetValue("dossier_ebenen")
print("[EBENEN] dossier_ebenen verified: len={}".format(len(re_read) if re_read else 0)) print("[LAYERS] dossier_ebenen verified: len={}".format(len(re_read) if re_read else 0))
print("[EBENEN] _apply: cleanup_default_layers ...") print("[LAYERS] _apply: cleanup_default_layers ...")
layer_builder.cleanup_default_layers(doc) layer_builder.cleanup_default_layers(doc)
print("[EBENEN] _apply: ensure_active_sublayer ...") print("[LAYERS] _apply: ensure_active_sublayer ...")
self._ensure_active_sublayer() self._ensure_active_sublayer()
# Existierende 'Nach Ebene'-Hatches an neue Pattern/Skala/Drehung # Existierende 'Nach Ebene'-Hatches an neue Pattern/Skala/Drehung
# angleichen — ABER nur wenn die Fill-Signatur sich tatsaechlich # angleichen — ABER nur wenn die Fill-Signatur sich tatsaechlich
@@ -2208,16 +2208,16 @@ class EbenenBridge(panel_base.BaseBridge):
if fill_changed: if fill_changed:
gestaltung.refresh_layer_fills(doc) gestaltung.refresh_layer_fills(doc)
else: else:
print("[EBENEN] _apply: fill signature unchanged -> no hatch refresh") print("[LAYERS] _apply: fill signature unchanged -> no hatch refresh")
# Plot-Color Repair laeuft immer (no-op falls schon synchron) # Plot-Color Repair laeuft immer (no-op falls schon synchron)
gestaltung.repair_plot_colors(doc) gestaltung.repair_plot_colors(doc)
except Exception as ex: except Exception as ex:
print("[EBENEN] gestaltung sync:", ex) print("[LAYERS] gestaltung sync:", ex)
finally: finally:
_set_processing(False) _set_processing(False)
print("[EBENEN] _apply: update_clipping ...") print("[LAYERS] _apply: update_clipping ...")
self._update_clipping() self._update_clipping()
print("[EBENEN] _apply: send APPLY_OK") print("[LAYERS] _apply: send APPLY_OK")
self.send("APPLY_OK", {}) self.send("APPLY_OK", {})
# Strukturelle Aenderung (neue/umbenannte/geloeschte Ebene) → aktives # Strukturelle Aenderung (neue/umbenannte/geloeschte Ebene) → aktives
# Preset passt nicht mehr exakt. # Preset passt nicht mehr exakt.
@@ -2225,7 +2225,7 @@ class EbenenBridge(panel_base.BaseBridge):
# Anderes Panel (Zeichnungsebenen/Ebenen) ueber den neuen State # Anderes Panel (Zeichnungsebenen/Ebenen) ueber den neuen State
# informieren — sonst hinkt es hinter der DOM-Persistenz her. # informieren — sonst hinkt es hinter der DOM-Persistenz her.
_broadcast_state(doc) _broadcast_state(doc)
print("[EBENEN] _apply: DONE") print("[LAYERS] _apply: DONE")
def _ensure_active_sublayer(self): def _ensure_active_sublayer(self):
"""Setzt den aktiven Rhino-Layer auf den DOSSIER-Sublayer (Fallback: erste Z + 20_WAENDE).""" """Setzt den aktiven Rhino-Layer auf den DOSSIER-Sublayer (Fallback: erste Z + 20_WAENDE)."""
@@ -2343,7 +2343,7 @@ class EbenenBridge(panel_base.BaseBridge):
any_changed = (_vis_lock_changed(z_full, merged_z) any_changed = (_vis_lock_changed(z_full, merged_z)
or _vis_lock_changed(e_full, merged_e)) or _vis_lock_changed(e_full, merged_e))
if has_new_structural: if has_new_structural:
print("[EBENEN] _apply_visibility: structural change pending → skip save (waiting for APPLY)") print("[LAYERS] _apply_visibility: structural change pending → skip save (waiting for APPLY)")
else: else:
doc.Strings.SetString("dossier_zeichnungsebenen", json.dumps(merged_z, ensure_ascii=False)) doc.Strings.SetString("dossier_zeichnungsebenen", json.dumps(merged_z, ensure_ascii=False))
doc.Strings.SetString("dossier_ebenen", json.dumps(merged_e, ensure_ascii=False)) doc.Strings.SetString("dossier_ebenen", json.dumps(merged_e, ensure_ascii=False))
@@ -2442,7 +2442,7 @@ class EbenenBridge(panel_base.BaseBridge):
if eb is not None: eb._notify_active_geschoss() if eb is not None: eb._notify_active_geschoss()
except Exception: pass except Exception: pass
except Exception as ex: except Exception as ex:
print("[SCHNITT] activate fehler:", ex) print("[SECTION] activate fehler:", ex)
return return
# Geschoss-Pfad (default): falls vorher ein Schnitt aktiv war, # Geschoss-Pfad (default): falls vorher ein Schnitt aktiv war,
# dessen Clipping-Planes aufraeumen + Pre-Schnitt-View restoren. # dessen Clipping-Planes aufraeumen + Pre-Schnitt-View restoren.
@@ -2452,7 +2452,7 @@ class EbenenBridge(panel_base.BaseBridge):
if prev_was_schnitt: if prev_was_schnitt:
schnitte.restore_pre_schnitt_view(doc) schnitte.restore_pre_schnitt_view(doc)
except Exception as ex: except Exception as ex:
print("[SCHNITT] cleanup beim Wechsel auf Geschoss:", ex) print("[SECTION] cleanup beim Wechsel auf Geschoss:", ex)
# Aktiven Sublayer auf die GLEICHE Ebene unter dem neuen Geschoss # Aktiven Sublayer auf die GLEICHE Ebene unter dem neuen Geschoss
# umschalten — wenn User auf "20 Wände" steht und das Geschoss # umschalten — wenn User auf "20 Wände" steht und das Geschoss
# wechselt, soll Rhino's aktiver Layer "1OG::20_Wände" werden statt # wechselt, soll Rhino's aktiver Layer "1OG::20_Wände" werden statt
@@ -2495,12 +2495,12 @@ class EbenenBridge(panel_base.BaseBridge):
vp.SetConstructionPlane(new_plane) vp.SetConstructionPlane(new_plane)
updated += 1 updated += 1
except Exception as ex: except Exception as ex:
print("[EBENEN] CPlane fehler ({}): {}".format(vp.Name if vp else "?", ex)) print("[LAYERS] CPlane fehler ({}): {}".format(vp.Name if vp else "?", ex))
# KEIN doc.Views.Redraw() hier — die folgende SET_VISIBILITY-Round- # KEIN doc.Views.Redraw() hier — die folgende SET_VISIBILITY-Round-
# trip (30 ms debounce in React) feuert ohnehin layer_builder # trip (30 ms debounce in React) feuert ohnehin layer_builder
# .apply_visibility() das am Ende selbst redrawt. Sparen wir uns # .apply_visibility() das am Ende selbst redrawt. Sparen wir uns
# einen doppelten Full-Repaint pro Geschoss-Klick. # einen doppelten Full-Repaint pro Geschoss-Klick.
print("[EBENEN] CPlane Z={} on {} top-style view(s) set".format(okff, updated)) print("[LAYERS] CPlane Z={} on {} top-style view(s) set".format(okff, updated))
def _needs_clipping_update(self, doc, prev_active_id, new_z): def _needs_clipping_update(self, doc, prev_active_id, new_z):
"""Liefert True wenn entweder das alte oder das neue Geschoss """Liefert True wenn entweder das alte oder das neue Geschoss
@@ -2596,16 +2596,16 @@ class EbenenBridge(panel_base.BaseBridge):
doc = Rhino.RhinoDoc.ActiveDoc doc = Rhino.RhinoDoc.ActiveDoc
z_id = doc.Strings.GetValue("dossier_active_id") z_id = doc.Strings.GetValue("dossier_active_id")
if not z_id: if not z_id:
print("[EBENEN] Keine aktive Zeichnungsebene") print("[LAYERS] Keine aktive Zeichnungsebene")
return return
parent_idx = layer_builder._find_top_by_id(doc, z_id) parent_idx = layer_builder._find_top_by_id(doc, z_id)
if parent_idx < 0: if parent_idx < 0:
print("[EBENEN] Parent fuer aktive Zeichnungsebene not found") print("[LAYERS] Parent fuer aktive Zeichnungsebene not found")
return return
parent_id = doc.Layers[parent_idx].Id parent_id = doc.Layers[parent_idx].Id
sub_idx = layer_builder._find_sublayer_by_code(doc, parent_id, code) sub_idx = layer_builder._find_sublayer_by_code(doc, parent_id, code)
if sub_idx < 0: if sub_idx < 0:
print("[EBENEN] Sublayer {} unter {} not found".format(code, doc.Layers[parent_idx].Name)) print("[LAYERS] Sublayer {} unter {} not found".format(code, doc.Layers[parent_idx].Name))
return return
objs = list(doc.Objects.GetSelectedObjects(False, False)) objs = list(doc.Objects.GetSelectedObjects(False, False))
moved = 0 moved = 0
@@ -2615,7 +2615,7 @@ class EbenenBridge(panel_base.BaseBridge):
if doc.Objects.ModifyAttributes(obj, attrs, True): if doc.Objects.ModifyAttributes(obj, attrs, True):
moved += 1 moved += 1
doc.Views.Redraw() doc.Views.Redraw()
print("[EBENEN] {} Objekt(e) auf {} verschoben".format(moved, doc.Layers[sub_idx].FullPath)) print("[LAYERS] {} Objekt(e) auf {} verschoben".format(moved, doc.Layers[sub_idx].FullPath))
def _set_active_sublayer(self, code): def _set_active_sublayer(self, code):
if not code: if not code:
@@ -2637,7 +2637,7 @@ class EbenenBridge(panel_base.BaseBridge):
if z_id: if z_id:
layer_builder.set_active_sublayer(doc, z_id, code) layer_builder.set_active_sublayer(doc, z_id, code)
else: else:
print("[EBENEN] Aktive Zeichnungsebene unbekannt — Layer wird nicht set") print("[LAYERS] Aktive Zeichnungsebene unbekannt — Layer wird nicht set")
def _remove_ebene_from_state(self, code): def _remove_ebene_from_state(self, code):
doc = Rhino.RhinoDoc.ActiveDoc doc = Rhino.RhinoDoc.ActiveDoc
@@ -2649,7 +2649,7 @@ class EbenenBridge(panel_base.BaseBridge):
doc.Strings.SetString("dossier_ebenen", json.dumps(ebenen, ensure_ascii=False)) doc.Strings.SetString("dossier_ebenen", json.dumps(ebenen, ensure_ascii=False))
_broadcast_state(doc) _broadcast_state(doc)
except Exception as ex: except Exception as ex:
print("[EBENEN] remove:", ex) print("[LAYERS] remove:", ex)
def _update_ebene_field(self, code, field, value): def _update_ebene_field(self, code, field, value):
doc = Rhino.RhinoDoc.ActiveDoc doc = Rhino.RhinoDoc.ActiveDoc
@@ -2677,7 +2677,7 @@ class EbenenBridge(panel_base.BaseBridge):
doc.Strings.SetString("dossier_ebenen", json.dumps(ebenen, ensure_ascii=False)) doc.Strings.SetString("dossier_ebenen", json.dumps(ebenen, ensure_ascii=False))
_broadcast_state(doc) _broadcast_state(doc)
except Exception as ex: except Exception as ex:
print("[EBENEN] update:", ex) print("[LAYERS] update:", ex)
# ---- Ebenen-Kombinationen / Presets (geteilt mit AUSSCHNITTE) -------- # ---- Ebenen-Kombinationen / Presets (geteilt mit AUSSCHNITTE) --------
@@ -2715,7 +2715,7 @@ class EbenenBridge(panel_base.BaseBridge):
}) })
layers_out.sort(key=lambda x: x["fullPath"]) layers_out.sort(key=lambda x: x["fullPath"])
except Exception as ex: except Exception as ex:
print("[EBENEN] _send_combination layers:", ex) print("[LAYERS] _send_combination layers:", ex)
try: try:
presets = self._load_presets(doc) presets = self._load_presets(doc)
except Exception: except Exception:
@@ -2782,11 +2782,11 @@ class EbenenBridge(panel_base.BaseBridge):
}) })
try: doc.Views.Redraw() try: doc.Views.Redraw()
except Exception: pass except Exception: pass
print("[EBENEN] Eye-State-Preset angewandt: {} Ebenen, {} Zeichnungsebenen".format( print("[LAYERS] Eye-State-Preset angewandt: {} Ebenen, {} Zeichnungsebenen".format(
len(pe_states or []), len(pz_states or []))) len(pe_states or []), len(pz_states or [])))
return return
except Exception as ex: except Exception as ex:
print("[EBENEN] _apply_combination eye-state:", ex) print("[LAYERS] _apply_combination eye-state:", ex)
# Fall through zum Layer-ID-Pfad als Fallback # Fall through zum Layer-ID-Pfad als Fallback
# --- Layer-ID-Pfad (alt / AUSSCHNITTE) --- # --- Layer-ID-Pfad (alt / AUSSCHNITTE) ---
@@ -2876,12 +2876,12 @@ class EbenenBridge(panel_base.BaseBridge):
"ebenen": ebenen_list, "ebenen": ebenen_list,
}) })
except Exception as ex: except Exception as ex:
print("[EBENEN] STATE_SYNC push:", ex) print("[LAYERS] STATE_SYNC push:", ex)
except Exception as ex: except Exception as ex:
print("[EBENEN] _apply_combination sync:", ex) print("[LAYERS] _apply_combination sync:", ex)
try: doc.Views.Redraw() try: doc.Views.Redraw()
except Exception: pass except Exception: pass
print("[EBENEN] Kombination angewandt: {} Layer".format(n)) print("[LAYERS] Kombination angewandt: {} Layer".format(n))
def _save_preset(self, name, layers): def _save_preset(self, name, layers):
name = (name or "").strip() name = (name or "").strip()
@@ -2905,7 +2905,7 @@ class EbenenBridge(panel_base.BaseBridge):
store_layer_presets(doc, presets) store_layer_presets(doc, presets)
_notify_oberleiste_combs() _notify_oberleiste_combs()
_notify_layer_combinations_editor() _notify_layer_combinations_editor()
print("[EBENEN] Kombination '{}' gespeichert ({} Layer)".format(name, len(clean))) print("[LAYERS] Kombination '{}' gespeichert ({} Layer)".format(name, len(clean)))
def _save_current_as_preset(self, name): def _save_current_as_preset(self, name):
"""Speichert die aktuellen Eye-States (dossier_ebenen + dossier_zeichnungs- """Speichert die aktuellen Eye-States (dossier_ebenen + dossier_zeichnungs-
@@ -3103,11 +3103,11 @@ def _install_layer_listener(bridge):
if updated: if updated:
_broadcast_state(doc) _broadcast_state(doc)
except Exception as ex: except Exception as ex:
print("[EBENEN] Layer-Event:", ex) print("[LAYERS] Layer-Event:", ex)
Rhino.RhinoDoc.LayerTableEvent += on_layer_event Rhino.RhinoDoc.LayerTableEvent += on_layer_event
sc.sticky["ebenen_layer_listener"] = True sc.sticky["ebenen_layer_listener"] = True
print("[EBENEN] Layer-Listener active") print("[LAYERS] Layer-Listener active")
panel_base.register_and_open("ebenen", "Ebenen", PANEL_GUID_STR, _ebenen_bridge_factory, panel_base.register_and_open("ebenen", "Ebenen", PANEL_GUID_STR, _ebenen_bridge_factory,
+44 -44
View File
@@ -104,7 +104,7 @@ def _detect_dpi():
try: try:
from System.Diagnostics import Process, ProcessStartInfo from System.Diagnostics import Process, ProcessStartInfo
except Exception as ex: except Exception as ex:
print("[MASSSTAB] auto-detect: .NET Process not available:", ex) print("[SCALE] auto-detect: .NET Process not available:", ex)
return None return None
if not os.path.isfile("/usr/bin/osascript"): if not os.path.isfile("/usr/bin/osascript"):
# Vermutlich nicht macOS -> nichts zu detecten # Vermutlich nicht macOS -> nichts zu detecten
@@ -137,10 +137,10 @@ def _detect_dpi():
if not finished: if not finished:
try: p.Kill() try: p.Kill()
except Exception: pass except Exception: pass
print("[MASSSTAB] auto-detect: osascript timeout") print("[SCALE] auto-detect: osascript timeout")
return None return None
if p.ExitCode != 0: if p.ExitCode != 0:
print("[MASSSTAB] auto-detect osascript ExitCode={}:".format(p.ExitCode), err) print("[SCALE] auto-detect osascript ExitCode={}:".format(p.ExitCode), err)
return None return None
import json as _json import json as _json
data = _json.loads((out or "").strip()) data = _json.loads((out or "").strip())
@@ -154,15 +154,15 @@ def _detect_dpi():
return None return None
dpi = px * 25.4 / mm dpi = px * 25.4 / mm
if dpi < 30.0 or dpi > 600.0: if dpi < 30.0 or dpi > 600.0:
print("[MASSSTAB] auto-detect: DPI {:.1f} ausserhalb 30..600 -> ignoriert".format(dpi)) print("[SCALE] auto-detect: DPI {:.1f} ausserhalb 30..600 -> ignoriert".format(dpi))
return None return None
print("[MASSSTAB] DPI auto-detected: {:.1f} physical (screen {:.0f}x{:.0f}px / ... logical {:.0f}x{:.0f})".format( print("[SCALE] DPI auto-detected: {:.1f} physical (screen {:.0f}x{:.0f}px / ... logical {:.0f}x{:.0f})".format(
dpi, px, float(data.get("py") or 0), dpi, px, float(data.get("py") or 0),
mm, float(data.get("mh") or 0), mm, float(data.get("mh") or 0),
lpx, float(data.get("lpy") or 0))) lpx, float(data.get("lpy") or 0)))
return dpi return dpi
except Exception as ex: except Exception as ex:
print("[MASSSTAB] auto-detect failed:", ex) print("[SCALE] auto-detect failed:", ex)
return None return None
finally: finally:
if script_path: if script_path:
@@ -188,7 +188,7 @@ def _read_config():
if isinstance(data, dict): if isinstance(data, dict):
cfg = data cfg = data
except Exception as ex: except Exception as ex:
print("[MASSSTAB] config lesen:", ex) print("[SCALE] config lesen:", ex)
_config_cache = cfg _config_cache = cfg
return cfg return cfg
@@ -204,7 +204,7 @@ def _write_config(cfg):
_config_cache = cfg # Cache mit dem geschriebenen Stand aktualisieren _config_cache = cfg # Cache mit dem geschriebenen Stand aktualisieren
return True return True
except Exception as ex: except Exception as ex:
print("[MASSSTAB] config schreiben:", ex) print("[SCALE] config schreiben:", ex)
return False return False
@@ -266,7 +266,7 @@ def _set_dpi(doc, value, source="manual"):
cfg["dpi_source"] = source cfg["dpi_source"] = source
if not _write_config(cfg): if not _write_config(cfg):
return False return False
print("[MASSSTAB] DPI={:.1f} ({}) -> {}".format(v, source, _CONFIG_PATH)) print("[SCALE] DPI={:.1f} ({}) -> {}".format(v, source, _CONFIG_PATH))
return True return True
@@ -421,9 +421,9 @@ def _apply_scaled_lineweights(doc, enabled, scale_n):
layer.PlotWeight = new layer.PlotWeight = new
n_layer += 1 n_layer += 1
except Exception as ex: except Exception as ex:
print("[MASSSTAB] LW scale layer '{}': {}".format(layer.Name, ex)) print("[SCALE] LW scale layer '{}': {}".format(layer.Name, ex))
except Exception as ex: except Exception as ex:
print("[MASSSTAB] LW scale layers:", ex) print("[SCALE] LW scale layers:", ex)
# -- Objekte ------------------------------------------------------------- # -- Objekte -------------------------------------------------------------
try: try:
@@ -451,11 +451,11 @@ def _apply_scaled_lineweights(doc, enabled, scale_n):
except Exception: except Exception:
pass pass
except Exception as ex: except Exception as ex:
print("[MASSSTAB] LW scale objects:", ex) print("[SCALE] LW scale objects:", ex)
try: doc.Views.Redraw() try: doc.Views.Redraw()
except Exception: pass except Exception: pass
print("[MASSSTAB] PlotWeight-Skalierung x{:.1f}: {} Layer, {} Objekte angepasst".format( print("[SCALE] PlotWeight-Skalierung x{:.1f}: {} Layer, {} Objekte angepasst".format(
factor, n_layer, n_obj)) factor, n_layer, n_obj))
# Diagnose: zeige die ersten paar Layer mit ihren echten PlotWeights # Diagnose: zeige die ersten paar Layer mit ihren echten PlotWeights
try: try:
@@ -463,7 +463,7 @@ def _apply_scaled_lineweights(doc, enabled, scale_n):
for layer in doc.Layers: for layer in doc.Layers:
if layer.IsDeleted or not layer.PlotWeight: continue if layer.IsDeleted or not layer.PlotWeight: continue
stored = layer.GetUserString(_LW_ORIG_KEY) or "-" stored = layer.GetUserString(_LW_ORIG_KEY) or "-"
print("[MASSSTAB] Layer '{}' PlotWeight={:.3f}mm (orig={})".format( print("[SCALE] Layer '{}' PlotWeight={:.3f}mm (orig={})".format(
layer.Name, float(layer.PlotWeight), stored)) layer.Name, float(layer.PlotWeight), stored))
shown += 1 shown += 1
if shown >= 5: break if shown >= 5: break
@@ -499,7 +499,7 @@ def write_plotweight(doc, target, value):
try: try:
target.PlotWeight = v * factor target.PlotWeight = v * factor
except Exception as ex: except Exception as ex:
print("[MASSSTAB] write_plotweight set:", ex) print("[SCALE] write_plotweight set:", ex)
def apply_scaled_hatches(doc, scale_n): def apply_scaled_hatches(doc, scale_n):
@@ -572,11 +572,11 @@ def apply_scaled_hatches(doc, scale_n):
if doc.Objects.Replace(hid, new_g): if doc.Objects.Replace(hid, new_g):
n_scaled += 1 n_scaled += 1
except Exception as ex: except Exception as ex:
print("[MASSSTAB] hatch set PatternScale:", ex) print("[SCALE] hatch set PatternScale:", ex)
except Exception as ex: except Exception as ex:
print("[MASSSTAB] hatch iter:", ex) print("[SCALE] hatch iter:", ex)
if n_scaled or hatch_ids: if n_scaled or hatch_ids:
print("[MASSSTAB] Hatch-Skalierung: {} gefunden, {} mit Faktor x{:.2f} angepasst".format( print("[SCALE] Hatch-Skalierung: {} gefunden, {} mit Faktor x{:.2f} angepasst".format(
len(hatch_ids), n_scaled, factor)) len(hatch_ids), n_scaled, factor))
try: doc.Views.Redraw() try: doc.Views.Redraw()
except Exception: pass except Exception: pass
@@ -599,7 +599,7 @@ def post_create_hatch_scale(doc, hatch_obj, user_scale):
a.SetUserString(_HATCH_ORIG_KEY, "{:.6f}".format(u)) a.SetUserString(_HATCH_ORIG_KEY, "{:.6f}".format(u))
doc.Objects.ModifyAttributes(hatch_obj, a, True) doc.Objects.ModifyAttributes(hatch_obj, a, True)
except Exception as ex: except Exception as ex:
print("[MASSSTAB] post_create_hatch_scale orig:", ex) print("[SCALE] post_create_hatch_scale orig:", ex)
# Mit aktuellem Massstab skalieren (sqrt-Formel /10, siehe apply_scaled_hatches) # Mit aktuellem Massstab skalieren (sqrt-Formel /10, siehe apply_scaled_hatches)
scale_n = _read_user_scale(doc, default=1.0) scale_n = _read_user_scale(doc, default=1.0)
if not scale_n or scale_n <= 0: scale_n = 1.0 if not scale_n or scale_n <= 0: scale_n = 1.0
@@ -612,7 +612,7 @@ def post_create_hatch_scale(doc, hatch_obj, user_scale):
new_g.PatternScale = u * factor new_g.PatternScale = u * factor
doc.Objects.Replace(h2.Id, new_g) doc.Objects.Replace(h2.Id, new_g)
except Exception as ex: except Exception as ex:
print("[MASSSTAB] post_create_hatch_scale rescale:", ex) print("[SCALE] post_create_hatch_scale rescale:", ex)
def read_plotweight(target): def read_plotweight(target):
@@ -656,7 +656,7 @@ def _set_lineweights_enabled(doc, enabled):
try: try:
doc.Strings.SetString(_LW_KEY, flag) doc.Strings.SetString(_LW_KEY, flag)
except Exception as ex: except Exception as ex:
print("[MASSSTAB] _set_lineweights_enabled persist:", ex) print("[SCALE] _set_lineweights_enabled persist:", ex)
# Print-Display togglen — primaerer Befehl auf Mac Rhino # Print-Display togglen — primaerer Befehl auf Mac Rhino
on_off = "_On" if enabled else "_Off" on_off = "_On" if enabled else "_Off"
yes_no = "_Yes" if enabled else "_No" yes_no = "_Yes" if enabled else "_No"
@@ -675,11 +675,11 @@ def _set_lineweights_enabled(doc, enabled):
scale_n = _read_user_scale(doc, default=1.0) scale_n = _read_user_scale(doc, default=1.0)
_apply_scaled_lineweights(doc, enabled, scale_n) _apply_scaled_lineweights(doc, enabled, scale_n)
except Exception as ex: except Exception as ex:
print("[MASSSTAB] PlotWeight-Scale:", ex) print("[SCALE] PlotWeight-Scale:", ex)
try: try:
for v in doc.Views: v.Redraw() for v in doc.Views: v.Redraw()
except Exception: pass except Exception: pass
print("[MASSSTAB] Print-Display:", "AN (Strichstaerken sichtbar)" if enabled else "AUS") print("[SCALE] Print-Display:", "AN (Strichstaerken sichtbar)" if enabled else "AUS")
return True return True
@@ -702,7 +702,7 @@ def _write_user_scale(doc, ratio):
try: try:
doc.Strings.SetString(_DOC_USER_SCALE_KEY, "{:.6f}".format(float(ratio))) doc.Strings.SetString(_DOC_USER_SCALE_KEY, "{:.6f}".format(float(ratio)))
except Exception as ex: except Exception as ex:
print("[MASSSTAB] _write_user_scale:", ex) print("[SCALE] _write_user_scale:", ex)
def _ensure_user_scales_loaded(doc): def _ensure_user_scales_loaded(doc):
@@ -723,7 +723,7 @@ def _ensure_user_scales_loaded(doc):
except Exception: except Exception:
pass pass
except Exception as ex: except Exception as ex:
print("[MASSSTAB] _ensure_user_scales_loaded:", ex) print("[SCALE] _ensure_user_scales_loaded:", ex)
_user_set_scales_loaded = True _user_set_scales_loaded = True
@@ -733,7 +733,7 @@ def _write_user_scales(doc):
doc.Strings.SetString(_DOC_USER_SCALES_KEY, doc.Strings.SetString(_DOC_USER_SCALES_KEY,
json.dumps(_user_set_scales, ensure_ascii=False)) json.dumps(_user_set_scales, ensure_ascii=False))
except Exception as ex: except Exception as ex:
print("[MASSSTAB] _write_user_scales:", ex) print("[SCALE] _write_user_scales:", ex)
def _get_applied_scale_for_vp(doc, vp_name): def _get_applied_scale_for_vp(doc, vp_name):
@@ -778,7 +778,7 @@ def _rescale_doc_patterns(doc, factor):
doc.Objects.Replace(obj.Id, g2) doc.Objects.Replace(obj.Id, g2)
n_h += 1 n_h += 1
except Exception as ex: except Exception as ex:
print("[MASSSTAB] hatch rescale:", ex) print("[SCALE] hatch rescale:", ex)
# Per-Objekt Linetype-Scale (Rhino 8 Attribut) # Per-Objekt Linetype-Scale (Rhino 8 Attribut)
try: try:
a = obj.Attributes a = obj.Attributes
@@ -796,7 +796,7 @@ def _rescale_doc_patterns(doc, factor):
except Exception: except Exception:
pass pass
except Exception as ex: except Exception as ex:
print("[MASSSTAB] _rescale_doc_patterns:", ex) print("[SCALE] _rescale_doc_patterns:", ex)
# Globale Linetype-Pattern-Length-Skala (Rhino-doc-Setting) versuchen. # Globale Linetype-Pattern-Length-Skala (Rhino-doc-Setting) versuchen.
# Property-Namen variieren je nach Version — wir probieren. # Property-Namen variieren je nach Version — wir probieren.
@@ -815,7 +815,7 @@ def _rescale_doc_patterns(doc, factor):
pass pass
try: doc.Views.Redraw() try: doc.Views.Redraw()
except Exception: pass except Exception: pass
print("[MASSSTAB] Rescale x{:.4f}: {} Hatches, {} per-obj Linetypes{}".format( print("[SCALE] Rescale x{:.4f}: {} Hatches, {} per-obj Linetypes{}".format(
factor, n_h, n_l, ", global Linetype-Scale" if set_global else "")) factor, n_h, n_l, ", global Linetype-Scale" if set_global else ""))
@@ -833,7 +833,7 @@ def _apply_scale(doc, vp, ratio):
if vp is None or doc is None: return False if vp is None or doc is None: return False
try: try:
if not vp.IsParallelProjection: if not vp.IsParallelProjection:
print("[MASSSTAB] Viewport ist nicht parallel — Skala nicht setzbar") print("[SCALE] Viewport ist nicht parallel — Skala nicht setzbar")
return False return False
except Exception: except Exception:
return False return False
@@ -856,7 +856,7 @@ def _apply_scale(doc, vp, ratio):
# factor > 1 zoomt rein (kleineres Frustum). factor = cur_w / new_w. # factor > 1 zoomt rein (kleineres Frustum). factor = cur_w / new_w.
factor = cur_w / new_frustum_u factor = cur_w / new_frustum_u
if factor <= 0 or not (factor < 1e9 and factor > 1e-9): if factor <= 0 or not (factor < 1e9 and factor > 1e-9):
print("[MASSSTAB] _apply_scale: ungueltiger Faktor", factor) print("[SCALE] _apply_scale: ungueltiger Faktor", factor)
return False return False
applied = False applied = False
# Verschiedene API-Signaturen je nach Rhino-Version durchprobieren. # Verschiedene API-Signaturen je nach Rhino-Version durchprobieren.
@@ -875,7 +875,7 @@ def _apply_scale(doc, vp, ratio):
Rhino.RhinoApp.RunScript("_-Zoom _Factor {:.6f} _Enter".format(factor), False) Rhino.RhinoApp.RunScript("_-Zoom _Factor {:.6f} _Enter".format(factor), False)
applied = True applied = True
except Exception as ex3: except Exception as ex3:
print("[MASSSTAB] _apply_scale alle Varianten failed:", print("[SCALE] _apply_scale alle Varianten failed:",
ex1, ex2, ex3) ex1, ex2, ex3)
if not applied: if not applied:
return False return False
@@ -884,12 +884,12 @@ def _apply_scale(doc, vp, ratio):
if _get_lineweights_enabled(doc): if _get_lineweights_enabled(doc):
_apply_scaled_lineweights(doc, True, float(ratio)) _apply_scaled_lineweights(doc, True, float(ratio))
except Exception as ex: except Exception as ex:
print("[MASSSTAB] LW-Rescale:", ex) print("[SCALE] LW-Rescale:", ex)
# Hatches mit sqrt(N) skalieren — moderate Anpassung. # Hatches mit sqrt(N) skalieren — moderate Anpassung.
try: try:
apply_scaled_hatches(doc, float(ratio)) apply_scaled_hatches(doc, float(ratio))
except Exception as ex: except Exception as ex:
print("[MASSSTAB] Hatch-Rescale:", ex) print("[SCALE] Hatch-Rescale:", ex)
# Neuen Wert ZUERST persistieren — sowohl per-Viewport (fuer das # Neuen Wert ZUERST persistieren — sowohl per-Viewport (fuer das
# Dropdown, damit jeder Viewport seinen eigenen Massstab behaelt) als # Dropdown, damit jeder Viewport seinen eigenen Massstab behaelt) als
# auch als globaler "letzter Wert". WICHTIG: vor dem Raumstempel- # auch als globaler "letzter Wert". WICHTIG: vor dem Raumstempel-
@@ -899,22 +899,22 @@ def _apply_scale(doc, vp, ratio):
try: try:
_set_applied_scale_for_vp(doc, vp.Name, float(ratio)) _set_applied_scale_for_vp(doc, vp.Name, float(ratio))
except Exception as ex: except Exception as ex:
print("[MASSSTAB] per-vp scale write:", ex) print("[SCALE] per-vp scale write:", ex)
# Raumstempel im masstab-Modus regennen mit der NEUEN Skala. # Raumstempel im masstab-Modus regennen mit der NEUEN Skala.
try: try:
import elemente as _el import elemente as _el
n_regen = _el.regen_masstab_raeume(doc) n_regen = _el.regen_masstab_raeume(doc)
if n_regen > 0: if n_regen > 0:
print("[MASSSTAB] {} masstab-Raum/Raeume regenned".format(n_regen)) print("[SCALE] {} masstab-Raum/Raeume regenned".format(n_regen))
except Exception as ex: except Exception as ex:
print("[MASSSTAB] Raumstempel-Regen:", ex) print("[SCALE] Raumstempel-Regen:", ex)
try: doc.Views.Redraw() try: doc.Views.Redraw()
except Exception: pass except Exception: pass
print("[MASSSTAB] Skala 1:{:.2f} set (Faktor {:.4f}, soll-frustum {:.4f} {})".format( print("[SCALE] Skala 1:{:.2f} set (Faktor {:.4f}, soll-frustum {:.4f} {})".format(
ratio, factor, new_frustum_u, str(doc.ModelUnitSystem))) ratio, factor, new_frustum_u, str(doc.ModelUnitSystem)))
return True return True
except Exception as ex: except Exception as ex:
print("[MASSSTAB] _apply_scale:", ex) print("[SCALE] _apply_scale:", ex)
return False return False
@@ -924,7 +924,7 @@ def _zoom_extents(doc, vp, selected_only=False):
if selected_only: if selected_only:
objs = list(doc.Objects.GetSelectedObjects(False, False)) objs = list(doc.Objects.GetSelectedObjects(False, False))
if not objs: if not objs:
print("[MASSSTAB] Keine Selektion fuer Zoom-Selection") print("[SCALE] Keine Selektion fuer Zoom-Selection")
return False return False
bbox = Rhino.Geometry.BoundingBox.Empty bbox = Rhino.Geometry.BoundingBox.Empty
for o in objs: for o in objs:
@@ -957,7 +957,7 @@ def _zoom_extents(doc, vp, selected_only=False):
except Exception: pass except Exception: pass
return True return True
except Exception as ex: except Exception as ex:
print("[MASSSTAB] _zoom_extents:", ex) print("[SCALE] _zoom_extents:", ex)
return False return False
@@ -972,7 +972,7 @@ class MassstabBridge(panel_base.BaseBridge):
def _on_ready(self): def _on_ready(self):
# Einmalige Bootstrap-Detection falls noch keine DPI in der Config. # Einmalige Bootstrap-Detection falls noch keine DPI in der Config.
try: _bootstrap_dpi() try: _bootstrap_dpi()
except Exception as ex: print("[MASSSTAB] bootstrap:", ex) except Exception as ex: print("[SCALE] bootstrap:", ex)
self._send_state(force=True) self._send_state(force=True)
def handle(self, data): def handle(self, data):
@@ -1014,7 +1014,7 @@ class MassstabBridge(panel_base.BaseBridge):
elif t == "DETECT_DPI": elif t == "DETECT_DPI":
v = _force_redetect_dpi() v = _force_redetect_dpi()
if v is None: if v is None:
print("[MASSSTAB] Auto-Detect: keine Bildschirminfo verfuegbar") print("[SCALE] Auto-Detect: keine Bildschirminfo verfuegbar")
self._send_state(force=True) self._send_state(force=True)
elif t == "SET_LINEWEIGHTS": elif t == "SET_LINEWEIGHTS":
doc, _ = _active_vp() doc, _ = _active_vp()
@@ -1061,7 +1061,7 @@ def _install_listeners(bridge):
Rhino.RhinoApp.Idle += on_idle Rhino.RhinoApp.Idle += on_idle
Rhino.RhinoDoc.ActiveDocumentChanged += on_view_change Rhino.RhinoDoc.ActiveDocumentChanged += on_view_change
sc.sticky[flag] = True sc.sticky[flag] = True
print("[MASSSTAB] Listener active (Idle-Poll + Doc-Change)") print("[SCALE] Listener active (Idle-Poll + Doc-Change)")
def get_current_scale_ratio(): def get_current_scale_ratio():
+18 -18
View File
@@ -582,7 +582,7 @@ def _try_load_png_white(png_path, size):
g.Dispose() g.Dispose()
return target return target
except Exception as ex: except Exception as ex:
print("[panel_base] PNG-load failed:", ex) print("[CORE] PNG-load failed:", ex)
return None return None
@@ -628,7 +628,7 @@ def _try_load_svg_white(svg_path, size):
g.Dispose() g.Dispose()
return target return target
except Exception as ex: except Exception as ex:
print("[panel_base] SVG-load failed:", ex) print("[CORE] SVG-load failed:", ex)
return None return None
@@ -717,7 +717,7 @@ def make_panel_icon(name_or_letter, bg_hex):
if os.path.isfile(png_path): if os.path.isfile(png_path):
icon_bmp = _try_load_png_white(png_path, size - 8) icon_bmp = _try_load_png_white(png_path, size - 8)
if icon_bmp is not None: chosen_path = png_path if icon_bmp is not None: chosen_path = png_path
else: print("[panel_base] PNG loaded but Bitmap is None:", else: print("[CORE] PNG loaded but Bitmap is None:",
png_path) png_path)
# PNG-not-found ist normal: Fallback auf SVG dann Material-Font. # PNG-not-found ist normal: Fallback auf SVG dann Material-Font.
# Nur loggen wenn final ALLES failt (s.u.). # Nur loggen wenn final ALLES failt (s.u.).
@@ -734,12 +734,12 @@ def make_panel_icon(name_or_letter, bg_hex):
size - 2*pad, size - 2*pad) size - 2*pad, size - 2*pad)
used_svg = True used_svg = True
used_material = True # → kein Letter-Fallback used_material = True # → kein Letter-Fallback
print("[panel_base] Icon path: {}{}".format( print("[CORE] Icon path: {}{}".format(
name_or_letter, chosen_path)) name_or_letter, chosen_path))
except Exception as ex: except Exception as ex:
print("[panel_base] Icon composite error:", ex) print("[CORE] Icon composite error:", ex)
except Exception as ex: except Exception as ex:
print("[panel_base] Icon path check error:", ex) print("[CORE] Icon path check error:", ex)
# 1) Material-Icon-Font (wenn keine SVG present) # 1) Material-Icon-Font (wenn keine SVG present)
mat_cp = _MATERIAL_CODEPOINTS.get(name_or_letter) mat_cp = _MATERIAL_CODEPOINTS.get(name_or_letter)
@@ -759,7 +759,7 @@ def make_panel_icon(name_or_letter, bg_hex):
drawing.Colors.White) drawing.Colors.White)
used_material = True used_material = True
except Exception as ex: except Exception as ex:
print("[panel_base] Material render error:", ex) print("[CORE] Material render error:", ex)
used_material = False used_material = False
# 2) Fallback: Buchstabe (erstes Zeichen bzw. eingegebener Buchstabe) # 2) Fallback: Buchstabe (erstes Zeichen bzw. eingegebener Buchstabe)
@@ -787,7 +787,7 @@ def make_panel_icon(name_or_letter, bg_hex):
tag, safe, bg_hex.lstrip("#"))) tag, safe, bg_hex.lstrip("#")))
bmp.Save(path, drawing.ImageFormat.Png) bmp.Save(path, drawing.ImageFormat.Png)
except Exception as ex: except Exception as ex:
print("[panel_base] Icon save error:", ex) print("[CORE] Icon save error:", ex)
path = None path = None
# WICHTIG: Mac Rhinos RegisterPanel meldet "expected Icon, got Icon" # WICHTIG: Mac Rhinos RegisterPanel meldet "expected Icon, got Icon"
# wenn wir Eto.Drawing.Icon uebergeben — die API erwartet # wenn wir Eto.Drawing.Icon uebergeben — die API erwartet
@@ -797,35 +797,35 @@ def make_panel_icon(name_or_letter, bg_hex):
try: try:
import System.Drawing as _sd import System.Drawing as _sd
ic = _sd.Icon(path) ic = _sd.Icon(path)
print("[panel_base] Icon created via System.Drawing.Icon(path) [{}]".format(tag)) print("[CORE] Icon created via System.Drawing.Icon(path) [{}]".format(tag))
return ic return ic
except Exception as ex: except Exception as ex:
print("[panel_base] System.Drawing.Icon(path) failed:", ex) print("[CORE] System.Drawing.Icon(path) failed:", ex)
# System.Drawing.Bitmap als Fallback (manche RegisterPanel-Overloads akzeptieren Bitmap) # System.Drawing.Bitmap als Fallback (manche RegisterPanel-Overloads akzeptieren Bitmap)
try: try:
import System.Drawing as _sd import System.Drawing as _sd
bmp_sd = _sd.Bitmap(path) bmp_sd = _sd.Bitmap(path)
print("[panel_base] Icon created via System.Drawing.Bitmap(path) [{}]".format(tag)) print("[CORE] Icon created via System.Drawing.Bitmap(path) [{}]".format(tag))
return bmp_sd return bmp_sd
except Exception as ex: except Exception as ex:
print("[panel_base] System.Drawing.Bitmap(path) failed:", ex) print("[CORE] System.Drawing.Bitmap(path) failed:", ex)
# Eto.Drawing.Icon als letzter Versuch — falls Rhino-Version anders ist # Eto.Drawing.Icon als letzter Versuch — falls Rhino-Version anders ist
try: try:
ic = drawing.Icon(path) ic = drawing.Icon(path)
print("[panel_base] Icon erzeugt via Eto.Drawing.Icon(path) [{}]".format(tag)) print("[CORE] Icon erzeugt via Eto.Drawing.Icon(path) [{}]".format(tag))
return ic return ic
except Exception as ex: except Exception as ex:
print("[panel_base] Eto.Drawing.Icon(path) failed:", ex) print("[CORE] Eto.Drawing.Icon(path) failed:", ex)
# Bitmap-Fallback (in-memory) — wenn alles vorherige fehlschlaegt # Bitmap-Fallback (in-memory) — wenn alles vorherige fehlschlaegt
try: try:
ic = drawing.Icon(1.0, bmp) ic = drawing.Icon(1.0, bmp)
print("[panel_base] Icon erzeugt via Eto.Drawing.Icon(scale, bmp) [{}]".format(tag)) print("[CORE] Icon erzeugt via Eto.Drawing.Icon(scale, bmp) [{}]".format(tag))
return ic return ic
except Exception: pass except Exception: pass
print("[panel_base] Icon Fallback: Eto.Bitmap zurueck ({})".format(tag)) print("[CORE] Icon Fallback: Eto.Bitmap zurueck ({})".format(tag))
return bmp return bmp
except Exception as ex: except Exception as ex:
print("[panel_base] Icon-Erstellung failed:", ex) print("[CORE] Icon-Erstellung failed:", ex)
return None return None
@@ -839,7 +839,7 @@ def find_plugin():
if p is not None: if p is not None:
return p return p
except Exception as ex: except Exception as ex:
print("[panel_base] Plugin-Suche:", ex) print("[CORE] Plugin-Suche:", ex)
return None return None
+9 -9
View File
@@ -100,7 +100,7 @@ def _update_linePts(doc, schnitt_id, new_p1, new_p2):
doc.Strings.SetString("dossier_zeichnungsebenen", doc.Strings.SetString("dossier_zeichnungsebenen",
json.dumps(z_list, ensure_ascii=False)) json.dumps(z_list, ensure_ascii=False))
except Exception as ex: except Exception as ex:
print("[SCHNITT_GRIPS] persist linePts:", ex) print("[SECTION-GRIPS] persist linePts:", ex)
return False return False
# Symbol regenerieren — Layer aus altem Symbol uebernehmen # Symbol regenerieren — Layer aus altem Symbol uebernehmen
@@ -133,7 +133,7 @@ def _update_linePts(doc, schnitt_id, new_p1, new_p2):
if i == 0 and gid and gid != System.Guid.Empty: if i == 0 and gid and gid != System.Guid.Empty:
first_new_id = gid first_new_id = gid
except Exception as ex: except Exception as ex:
print("[SCHNITT_GRIPS] add new symbol curve:", ex) print("[SECTION-GRIPS] add new symbol curve:", ex)
# Neue Hauptlinie selektieren — damit der Conduit die Marker # Neue Hauptlinie selektieren — damit der Conduit die Marker
# gleich wieder zeigt (sonst muesste der User nochmal klicken). # gleich wieder zeigt (sonst muesste der User nochmal klicken).
@@ -150,7 +150,7 @@ def _update_linePts(doc, schnitt_id, new_p1, new_p2):
if active_id == schnitt_id: if active_id == schnitt_id:
schnitte.activate_schnitt(doc, target, skip_view=True) schnitte.activate_schnitt(doc, target, skip_view=True)
except Exception as ex: except Exception as ex:
print("[SCHNITT_GRIPS] re-activate:", ex) print("[SECTION-GRIPS] re-activate:", ex)
# Panel-Broadcast (linePts haben sich geaendert, Ebenen-Panel will # Panel-Broadcast (linePts haben sich geaendert, Ebenen-Panel will
# ggf. mit-rendern) # ggf. mit-rendern)
@@ -162,7 +162,7 @@ def _update_linePts(doc, schnitt_id, new_p1, new_p2):
except Exception: pass except Exception: pass
return True return True
except Exception as ex: except Exception as ex:
print("[SCHNITT_GRIPS] update endpoint:", ex) print("[SECTION-GRIPS] update endpoint:", ex)
return False return False
@@ -236,7 +236,7 @@ class _SchnittEndpointConduit(rd.DisplayConduit):
e.Display.DrawLine(self.drag_preview, _MARKER_HOVER, 2) e.Display.DrawLine(self.drag_preview, _MARKER_HOVER, 2)
except Exception: pass except Exception: pass
except Exception as ex: except Exception as ex:
print("[SCHNITT_GRIPS] DrawForeground:", ex) print("[SECTION-GRIPS] DrawForeground:", ex)
# --- MouseCallback -------------------------------------------------------- # --- MouseCallback --------------------------------------------------------
@@ -291,7 +291,7 @@ class _SchnittMouseHandler(Rhino.UI.MouseCallback):
sid, z, kind, anchor_pt = hit sid, z, kind, anchor_pt = hit
self._start_drag(view.Document, sid, z, kind, anchor_pt) self._start_drag(view.Document, sid, z, kind, anchor_pt)
except Exception as ex: except Exception as ex:
print("[SCHNITT_GRIPS] OnMouseDown:", ex) print("[SECTION-GRIPS] OnMouseDown:", ex)
def _start_drag(self, doc, schnitt_id, z, kind, anchor_pt): def _start_drag(self, doc, schnitt_id, z, kind, anchor_pt):
if doc is None: return if doc is None: return
@@ -370,7 +370,7 @@ class _SchnittMouseHandler(Rhino.UI.MouseCallback):
confirmed = bool(_update_linePts( confirmed = bool(_update_linePts(
doc, schnitt_id, new_p1, new_p2)) doc, schnitt_id, new_p1, new_p2))
except Exception as ex: except Exception as ex:
print("[SCHNITT_GRIPS] _start_drag:", ex) print("[SECTION-GRIPS] _start_drag:", ex)
finally: finally:
if not confirmed: if not confirmed:
for pid in hidden_clip_ids: for pid in hidden_clip_ids:
@@ -406,6 +406,6 @@ def install_handlers():
handler.Enabled = True handler.Enabled = True
sc.sticky[_STICKY_CONDUIT] = conduit sc.sticky[_STICKY_CONDUIT] = conduit
sc.sticky[_STICKY_HANDLER] = handler sc.sticky[_STICKY_HANDLER] = handler
print("[SCHNITT_GRIPS] Endpoint conduit + mouse handler active") print("[SECTION-GRIPS] Endpoint conduit + mouse handler active")
except Exception as ex: except Exception as ex:
print("[SCHNITT_GRIPS] install:", ex) print("[SECTION-GRIPS] install:", ex)
+23 -23
View File
@@ -127,9 +127,9 @@ def clear_schnitt_clipping(doc):
if doc.Objects.Delete(obj.Id, True): if doc.Objects.Delete(obj.Id, True):
n += 1 n += 1
except Exception as ex: except Exception as ex:
print("[SCHNITT] clear: {}".format(ex)) print("[SECTION] clear: {}".format(ex))
if n: if n:
print("[SCHNITT] {} Clipping-Plane(s) entfernt".format(n)) print("[SECTION] {} Clipping-Plane(s) entfernt".format(n))
def _add_clipping_plane(doc, plane, du, dv, vp_ids, role): def _add_clipping_plane(doc, plane, du, dv, vp_ids, role):
@@ -137,7 +137,7 @@ def _add_clipping_plane(doc, plane, du, dv, vp_ids, role):
try: try:
gid = doc.Objects.AddClippingPlane(plane, du, dv, vp_ids) gid = doc.Objects.AddClippingPlane(plane, du, dv, vp_ids)
if gid is None or gid == System.Guid.Empty: if gid is None or gid == System.Guid.Empty:
print("[SCHNITT] AddClippingPlane lieferte Empty Guid") print("[SECTION] AddClippingPlane lieferte Empty Guid")
return None return None
obj = doc.Objects.FindId(gid) obj = doc.Objects.FindId(gid)
if obj is None: return None if obj is None: return None
@@ -151,7 +151,7 @@ def _add_clipping_plane(doc, plane, du, dv, vp_ids, role):
doc.Objects.ModifyAttributes(obj, attrs, True) doc.Objects.ModifyAttributes(obj, attrs, True)
return obj return obj
except Exception as ex: except Exception as ex:
print("[SCHNITT] AddClippingPlane Fehler ({}):".format(role), ex) print("[SECTION] AddClippingPlane Fehler ({}):".format(role), ex)
return None return None
@@ -181,13 +181,13 @@ def activate_schnitt(doc, z, skip_view=False):
if z is None: return if z is None: return
pts = z.get("linePts") or [] pts = z.get("linePts") or []
if len(pts) < 2: if len(pts) < 2:
print("[SCHNITT] '{}' hat keine linePts".format(z.get("name"))) print("[SECTION] '{}' hat keine linePts".format(z.get("name")))
return return
try: try:
p1 = rg.Point3d(float(pts[0][0]), float(pts[0][1]), 0) p1 = rg.Point3d(float(pts[0][0]), float(pts[0][1]), 0)
p2 = rg.Point3d(float(pts[1][0]), float(pts[1][1]), 0) p2 = rg.Point3d(float(pts[1][0]), float(pts[1][1]), 0)
except Exception as ex: except Exception as ex:
print("[SCHNITT] linePts ungueltig:", ex) print("[SECTION] linePts ungueltig:", ex)
return return
dir_sign = 1 if int(z.get("dirSign", 1) or 1) >= 0 else -1 dir_sign = 1 if int(z.get("dirSign", 1) or 1) >= 0 else -1
depth_back = max(0.5, float(z.get("depthBack", 8.0) or 8.0)) depth_back = max(0.5, float(z.get("depthBack", 8.0) or 8.0))
@@ -199,7 +199,7 @@ def activate_schnitt(doc, z, skip_view=False):
line_dir, view_dir, mid = _line_vectors(p1, p2, dir_sign) line_dir, view_dir, mid = _line_vectors(p1, p2, dir_sign)
if line_dir is None: if line_dir is None:
print("[SCHNITT] '{}' hat zu kurze Linie".format(z.get("name"))) print("[SECTION] '{}' hat zu kurze Linie".format(z.get("name")))
return return
line_len = p1.DistanceTo(p2) line_len = p1.DistanceTo(p2)
@@ -214,7 +214,7 @@ def activate_schnitt(doc, z, skip_view=False):
vp_ids = _collect_viewport_ids(doc) vp_ids = _collect_viewport_ids(doc)
if not vp_ids: if not vp_ids:
print("[SCHNITT] keine Viewports — Plane wuerde nichts schneiden") print("[SECTION] keine Viewports — Plane wuerde nichts schneiden")
return return
n_planes = 0 n_planes = 0
@@ -316,10 +316,10 @@ def activate_schnitt(doc, z, skip_view=False):
vp.ZoomBoundingBox(bb) vp.ZoomBoundingBox(bb)
view.Redraw() view.Redraw()
except Exception as ex: except Exception as ex:
print("[SCHNITT] view setup:", ex) print("[SECTION] view setup:", ex)
kind = "Schnitt" if cut_at_line else "Ansicht" kind = "Schnitt" if cut_at_line else "Ansicht"
print("[SCHNITT] {} '{}' aktiviert: {} Plane(s), depthBack={:.1f}m".format( print("[SECTION] {} '{}' aktiviert: {} Plane(s), depthBack={:.1f}m".format(
kind, z.get("name"), n_planes, depth_back)) kind, z.get("name"), n_planes, depth_back))
@@ -365,7 +365,7 @@ def save_pre_schnitt_view(doc):
except Exception: key = _STICKY_PRE_VIEW + "_default" except Exception: key = _STICKY_PRE_VIEW + "_default"
sc.sticky[key] = snap sc.sticky[key] = snap
except Exception as ex: except Exception as ex:
print("[SCHNITT] save view:", ex) print("[SECTION] save view:", ex)
def restore_pre_schnitt_view(doc): def restore_pre_schnitt_view(doc):
@@ -393,10 +393,10 @@ def restore_pre_schnitt_view(doc):
view.Redraw() view.Redraw()
try: del sc.sticky[key] try: del sc.sticky[key]
except Exception: pass except Exception: pass
print("[SCHNITT] Pre-Schnitt-View restored") print("[SECTION] Pre-Schnitt-View restored")
return True return True
except Exception as ex: except Exception as ex:
print("[SCHNITT] restore view:", ex) print("[SECTION] restore view:", ex)
return False return False
@@ -449,7 +449,7 @@ def delete_schnitt_entry(doc, schnitt_id):
doc.Strings.SetString("dossier_zeichnungsebenen", doc.Strings.SetString("dossier_zeichnungsebenen",
json.dumps(new_lst, ensure_ascii=False)) json.dumps(new_lst, ensure_ascii=False))
except Exception as ex: except Exception as ex:
print("[SCHNITT] delete entry:", ex) print("[SECTION] delete entry:", ex)
return False return False
cleanup_schnitt_artifacts(doc, schnitt_id, active_id=active_id) cleanup_schnitt_artifacts(doc, schnitt_id, active_id=active_id)
return True return True
@@ -499,7 +499,7 @@ def create_schnitt_entry(doc, name, p1, p2, dir_sign=1, depth_back=8.0,
doc.Strings.SetString("dossier_zeichnungsebenen", doc.Strings.SetString("dossier_zeichnungsebenen",
json.dumps(lst, ensure_ascii=False)) json.dumps(lst, ensure_ascii=False))
except Exception as ex: except Exception as ex:
print("[SCHNITT] persist entry:", ex) print("[SECTION] persist entry:", ex)
return None return None
# 2D-Symbol auf Plan # 2D-Symbol auf Plan
@@ -513,7 +513,7 @@ def create_schnitt_entry(doc, name, p1, p2, dir_sign=1, depth_back=8.0,
attrs.SetUserString(_KEY_SCHNITT_ID, schnitt_id) attrs.SetUserString(_KEY_SCHNITT_ID, schnitt_id)
doc.Objects.AddCurve(crv, attrs) doc.Objects.AddCurve(crv, attrs)
except Exception as ex: except Exception as ex:
print("[SCHNITT] add symbol curve:", ex) print("[SECTION] add symbol curve:", ex)
return schnitt_id return schnitt_id
@@ -539,13 +539,13 @@ def activate_schnitt_by_id(doc, schnitt_id):
or sc.sticky.get("zeichnungsebenen_bridge_ref") or sc.sticky.get("zeichnungsebenen_bridge_ref")
if eb is None: if eb is None:
# Fallback: direkt aktivieren ohne broadcast # Fallback: direkt aktivieren ohne broadcast
print("[SCHNITT] keine EbenenBridge — direkt aktivieren") print("[SECTION] keine EbenenBridge — direkt aktivieren")
activate_schnitt(doc, z) activate_schnitt(doc, z)
return True return True
eb._set_active_zeichnungsebene(z) eb._set_active_zeichnungsebene(z)
return True return True
except Exception as ex: except Exception as ex:
print("[SCHNITT] activate_by_id:", ex) print("[SECTION] activate_by_id:", ex)
return False return False
@@ -577,7 +577,7 @@ class _SchnittDoubleClickHandler(Rhino.UI.MouseCallback):
return return
except Exception: pass except Exception: pass
except Exception as ex: except Exception as ex:
print("[SCHNITT] OnMouseDoubleClick:", ex) print("[SECTION] OnMouseDoubleClick:", ex)
def install_double_click_handler(): def install_double_click_handler():
@@ -593,9 +593,9 @@ def install_double_click_handler():
h = _SchnittDoubleClickHandler() h = _SchnittDoubleClickHandler()
h.Enabled = True h.Enabled = True
sc.sticky["_dossier_schnitt_dblclick_handler"] = h sc.sticky["_dossier_schnitt_dblclick_handler"] = h
print("[SCHNITT] Double-click handler active") print("[SECTION] Double-click handler active")
except Exception as ex: except Exception as ex:
print("[SCHNITT] install_double_click_handler:", ex) print("[SECTION] install_double_click_handler:", ex)
def pick_schnitt_interactive(doc, defaults=None): def pick_schnitt_interactive(doc, defaults=None):
@@ -642,7 +642,7 @@ def pick_schnitt_interactive(doc, defaults=None):
p2 = rg.Point3d(p2.X, p2.Y, 0) p2 = rg.Point3d(p2.X, p2.Y, 0)
if p1.DistanceTo(p2) < 0.01: if p1.DistanceTo(p2) < 0.01:
print("[SCHNITT] Linie zu kurz") print("[SECTION] Linie zu kurz")
return None return None
# Pick Blickrichtung (welche Seite ist "hinten") # Pick Blickrichtung (welche Seite ist "hinten")
@@ -687,7 +687,7 @@ def pick_schnitt_interactive(doc, defaults=None):
sym_path = _el._layer_path_schnittlinie(doc, geschoss["name"]) sym_path = _el._layer_path_schnittlinie(doc, geschoss["name"])
symbol_layer_idx = _el._ensure_layer(doc, sym_path) symbol_layer_idx = _el._ensure_layer(doc, sym_path)
except Exception as ex: except Exception as ex:
print("[SCHNITT] symbol-layer resolve:", ex) print("[SECTION] symbol-layer resolve:", ex)
sid = create_schnitt_entry(doc, auto_name, p1, p2, sid = create_schnitt_entry(doc, auto_name, p1, p2,
dir_sign=dir_sign, depth_back=depth_back, dir_sign=dir_sign, depth_back=depth_back,
+73 -73
View File
@@ -50,7 +50,7 @@ def _sync_plot_color_to_display(attrs):
else: else:
attrs.PlotColorSource = _PLOT_FROM_LAYER attrs.PlotColorSource = _PLOT_FROM_LAYER
except Exception as ex: except Exception as ex:
print("[GESTALTUNG] sync plot-color:", ex) print("[STYLES] sync plot-color:", ex)
_FILL_KEY = "ebenen_fill_hatch_id" _FILL_KEY = "ebenen_fill_hatch_id"
_FILL_SOURCE_KEY = "ebenen_fill_source" # "layer" oder "object" _FILL_SOURCE_KEY = "ebenen_fill_source" # "layer" oder "object"
@@ -101,7 +101,7 @@ def _save_pending_hatch(curve_id, hatch_obj):
"timestamp": time.time(), "timestamp": time.time(),
} }
except Exception as ex: except Exception as ex:
print("[GESTALTUNG] save pending-hatch err:", ex) print("[STYLES] save pending-hatch err:", ex)
return return
m = sc.sticky.get("gestaltung_pending_hatch") m = sc.sticky.get("gestaltung_pending_hatch")
if not isinstance(m, dict): if not isinstance(m, dict):
@@ -130,7 +130,7 @@ def _restore_hatch_from_pending(doc, obj, meta):
new_hatches = rg.Hatch.Create(geom, new_hatches = rg.Hatch.Create(geom,
meta["pattern_idx"], meta["rotation"], meta["scale"], 0.0) meta["pattern_idx"], meta["rotation"], meta["scale"], 0.0)
except Exception as ex: except Exception as ex:
print("[GESTALTUNG] restore Hatch.Create:", ex) print("[STYLES] restore Hatch.Create:", ex)
return False return False
if not new_hatches or len(new_hatches) == 0: return False if not new_hatches or len(new_hatches) == 0: return False
new_attrs = Rhino.DocObjects.ObjectAttributes() new_attrs = Rhino.DocObjects.ObjectAttributes()
@@ -150,7 +150,7 @@ def _restore_hatch_from_pending(doc, obj, meta):
try: try:
hatch_id = doc.Objects.AddHatch(new_hatches[0], new_attrs) hatch_id = doc.Objects.AddHatch(new_hatches[0], new_attrs)
except Exception as ex: except Exception as ex:
print("[GESTALTUNG] restore AddHatch:", ex) print("[STYLES] restore AddHatch:", ex)
return False return False
if hatch_id == System.Guid.Empty: return False if hatch_id == System.Guid.Empty: return False
try: try:
@@ -173,7 +173,7 @@ def _color_to_hex(c):
try: try:
return "#{:02x}{:02x}{:02x}".format(int(c.R), int(c.G), int(c.B)) return "#{:02x}{:02x}{:02x}".format(int(c.R), int(c.G), int(c.B))
except Exception as ex: except Exception as ex:
print("[GESTALTUNG] color-hex Fehler:", ex) print("[STYLES] color-hex Fehler:", ex)
return None return None
@@ -291,17 +291,17 @@ def _ebene_fill_for_layer(doc, layer):
except Exception: except Exception:
code = None code = None
if not code: if not code:
print("[GESTALTUNG] _ebene_fill_for_layer: kein dossier_code auf Layer idx={}".format( print("[STYLES] _ebene_fill_for_layer: kein dossier_code auf Layer idx={}".format(
getattr(layer, "LayerIndex", "?"))) getattr(layer, "LayerIndex", "?")))
return None return None
raw = doc.Strings.GetValue("dossier_ebenen") raw = doc.Strings.GetValue("dossier_ebenen")
if not raw: if not raw:
print("[GESTALTUNG] _ebene_fill_for_layer: dossier_ebenen leer in doc.Strings") print("[STYLES] _ebene_fill_for_layer: dossier_ebenen leer in doc.Strings")
return None return None
try: try:
ebenen = json.loads(raw) ebenen = json.loads(raw)
except Exception as ex: except Exception as ex:
print("[GESTALTUNG] _ebene_fill_for_layer: json-Fehler:", ex) print("[STYLES] _ebene_fill_for_layer: json-Fehler:", ex)
return None return None
if not isinstance(ebenen, list): return None if not isinstance(ebenen, list): return None
# Rekursiv durch Tree — Sub-Ebenen sind in children verschachtelt # Rekursiv durch Tree — Sub-Ebenen sind in children verschachtelt
@@ -320,7 +320,7 @@ def _ebene_fill_for_layer(doc, layer):
if True: if True:
f = e.get("fill") f = e.get("fill")
if not isinstance(f, dict): if not isinstance(f, dict):
print("[GESTALTUNG] _ebene_fill_for_layer: Ebene code={} has NO fill field".format(code)) print("[STYLES] _ebene_fill_for_layer: Ebene code={} has NO fill field".format(code))
return None return None
# lw: Strichstaerke der Hatch-Linien in mm. None = "wie Stift der Ebene" # lw: Strichstaerke der Hatch-Linien in mm. None = "wie Stift der Ebene"
# (ColorSource/PlotWeightSource bleibt auf FromLayer). # (ColorSource/PlotWeightSource bleibt auf FromLayer).
@@ -340,9 +340,9 @@ def _ebene_fill_for_layer(doc, layer):
"rotation": float(f.get("rotation", 0)) if f.get("rotation") is not None else 0.0, "rotation": float(f.get("rotation", 0)) if f.get("rotation") is not None else 0.0,
"lw": lw_val, "lw": lw_val,
} }
print("[GESTALTUNG] _ebene_fill_for_layer code={} -> {}".format(code, result)) print("[STYLES] _ebene_fill_for_layer code={} -> {}".format(code, result))
return result return result
print("[GESTALTUNG] _ebene_fill_for_layer: code={} nicht in dossier_ebenen gefunden".format(code)) print("[STYLES] _ebene_fill_for_layer: code={} nicht in dossier_ebenen gefunden".format(code))
return None return None
@@ -400,7 +400,7 @@ def _apply_ebene_fill(doc, obj):
try: try:
hatches = rg.Hatch.Create(geom, pattern_idx, rot_rad, scale_v, 0.0) hatches = rg.Hatch.Create(geom, pattern_idx, rot_rad, scale_v, 0.0)
except Exception as ex: except Exception as ex:
print("[GESTALTUNG] Auto-Fill Hatch.Create:", ex) print("[STYLES] Auto-Fill Hatch.Create:", ex)
return False return False
if not hatches or len(hatches) == 0: return False if not hatches or len(hatches) == 0: return False
@@ -429,7 +429,7 @@ def _apply_ebene_fill(doc, obj):
try: try:
hatch_id = doc.Objects.AddHatch(hatches[0], new_attrs) hatch_id = doc.Objects.AddHatch(hatches[0], new_attrs)
except Exception as ex: except Exception as ex:
print("[GESTALTUNG] Auto-Fill AddHatch:", ex) print("[STYLES] Auto-Fill AddHatch:", ex)
return False return False
if hatch_id == System.Guid.Empty: return False if hatch_id == System.Guid.Empty: return False
@@ -440,7 +440,7 @@ def _apply_ebene_fill(doc, obj):
if h_obj is not None: if h_obj is not None:
massstab.post_create_hatch_scale(doc, h_obj, float(fill["scale"]) or 1.0) massstab.post_create_hatch_scale(doc, h_obj, float(fill["scale"]) or 1.0)
except Exception as ex: except Exception as ex:
print("[GESTALTUNG] post_create_hatch_scale (auto-fill):", ex) print("[STYLES] post_create_hatch_scale (auto-fill):", ex)
try: try:
ca = obj.Attributes.Duplicate() ca = obj.Attributes.Duplicate()
@@ -449,7 +449,7 @@ def _apply_ebene_fill(doc, obj):
try: doc.Objects.ModifyAttributes(obj, ca, True) try: doc.Objects.ModifyAttributes(obj, ca, True)
finally: _processing.discard(obj.Id) finally: _processing.discard(obj.Id)
except Exception as ex: except Exception as ex:
print("[GESTALTUNG] Auto-Fill UserString:", ex) print("[STYLES] Auto-Fill UserString:", ex)
_link_curve_hatch(obj.Id, hatch_id) _link_curve_hatch(obj.Id, hatch_id)
return True return True
@@ -533,7 +533,7 @@ def refresh_layer_fills(doc):
targets.append((obj, owner)) targets.append((obj, owner))
owner_ids.add(str(owner.Id)) owner_ids.add(str(owner.Id))
except Exception as ex: except Exception as ex:
print("[GESTALTUNG] refresh_layer_fills scan:", ex) print("[STYLES] refresh_layer_fills scan:", ex)
return 0 return 0
updated = 0 updated = 0
@@ -602,9 +602,9 @@ def refresh_layer_fills(doc):
if h_obj is not None: if h_obj is not None:
_ms.post_create_hatch_scale(doc, h_obj, scale_v) _ms.post_create_hatch_scale(doc, h_obj, scale_v)
except Exception as _ex: except Exception as _ex:
print("[GESTALTUNG] post_create_hatch_scale (refresh):", _ex) print("[STYLES] post_create_hatch_scale (refresh):", _ex)
except Exception as ex: except Exception as ex:
print("[GESTALTUNG] refresh rebuild:", ex) print("[STYLES] refresh rebuild:", ex)
# (2) Farb-Sync — Hatch mit source=='layer' folgt der Ebenen-Definition # (2) Farb-Sync — Hatch mit source=='layer' folgt der Ebenen-Definition
try: try:
@@ -641,7 +641,7 @@ def refresh_layer_fills(doc):
_processing.discard(refreshed.Id) _processing.discard(refreshed.Id)
color_updated += 1 color_updated += 1
except Exception as ex: except Exception as ex:
print("[GESTALTUNG] refresh color-sync:", ex) print("[STYLES] refresh color-sync:", ex)
# (3) Hatch-PlotWeight an fill.lw anpassen (None = wieder ByLayer) # (3) Hatch-PlotWeight an fill.lw anpassen (None = wieder ByLayer)
try: try:
@@ -683,7 +683,7 @@ def refresh_layer_fills(doc):
finally: finally:
_processing.discard(refreshed.Id) _processing.discard(refreshed.Id)
except Exception as ex: except Exception as ex:
print("[GESTALTUNG] refresh lw-sync:", ex) print("[STYLES] refresh lw-sync:", ex)
# --- 3) Auto-Fill nachziehen fuer Kurven ohne Hatch --- # --- 3) Auto-Fill nachziehen fuer Kurven ohne Hatch ---
added = 0 added = 0
@@ -731,13 +731,13 @@ def refresh_layer_fills(doc):
if _apply_ebene_fill(doc, obj): if _apply_ebene_fill(doc, obj):
added += 1 added += 1
except Exception as ex: except Exception as ex:
print("[GESTALTUNG] refresh auto-fill:", ex) print("[STYLES] refresh auto-fill:", ex)
except Exception as ex: except Exception as ex:
print("[GESTALTUNG] refresh auto-fill scan:", ex) print("[STYLES] refresh auto-fill scan:", ex)
if updated or color_updated or added: if updated or color_updated or added:
doc.Views.Redraw() doc.Views.Redraw()
print("[GESTALTUNG] refresh_layer_fills: pattern={}, farbe={}, neu={}, unchanged={}".format( print("[STYLES] refresh_layer_fills: pattern={}, farbe={}, neu={}, unchanged={}".format(
updated, color_updated, added, skipped)) updated, color_updated, added, skipped))
return updated + color_updated + added return updated + color_updated + added
@@ -791,13 +791,13 @@ def repair_plot_colors(doc):
_processing.discard(obj.Id) _processing.discard(obj.Id)
fixed += 1 fixed += 1
except Exception as ex: except Exception as ex:
print("[GESTALTUNG] repair_plot_colors entry:", ex) print("[STYLES] repair_plot_colors entry:", ex)
except Exception as ex: except Exception as ex:
print("[GESTALTUNG] repair_plot_colors scan:", ex) print("[STYLES] repair_plot_colors scan:", ex)
return 0 return 0
if fixed: if fixed:
doc.Views.Redraw() doc.Views.Redraw()
print("[GESTALTUNG] repair_plot_colors: {} Objekte repariert (von {} mit Eigenfarbe gescannt)".format(fixed, scanned)) print("[STYLES] repair_plot_colors: {} Objekte repariert (von {} mit Eigenfarbe gescannt)".format(fixed, scanned))
return fixed return fixed
@@ -1137,7 +1137,7 @@ def _selection_summary(doc):
"fillRotation": single(fill_rots), "fillRotation": single(fill_rots),
"hatchPatterns": _all_hatch_patterns(doc), "hatchPatterns": _all_hatch_patterns(doc),
}) })
print("[GESTALTUNG] sel: n={} colorSrc={} color={} layerColor={}".format( print("[STYLES] sel: n={} colorSrc={} color={} layerColor={}".format(
result.get("count"), result.get("colorSource"), result.get("count"), result.get("colorSource"),
result.get("color"), result.get("layerColor"))) result.get("color"), result.get("layerColor")))
return result return result
@@ -1153,7 +1153,7 @@ class GestaltungBridge(panel_base.BaseBridge):
before = doc.Linetypes.Count before = doc.Linetypes.Count
ok = _force_load_linetypes(doc) ok = _force_load_linetypes(doc)
after = doc.Linetypes.Count after = doc.Linetypes.Count
print("[GESTALTUNG] Linetypes before: {}, nach LoadDefaults({}): {}".format(before, ok, after)) print("[STYLES] Linetypes before: {}, nach LoadDefaults({}): {}".format(before, ok, after))
entries = [] entries = []
for i in range(after): for i in range(after):
lt = doc.Linetypes[i] lt = doc.Linetypes[i]
@@ -1163,15 +1163,15 @@ class GestaltungBridge(panel_base.BaseBridge):
try: nm = lt.Name try: nm = lt.Name
except Exception: nm = "?" except Exception: nm = "?"
entries.append("[{}] {} ({})".format(i, nm, flags)) entries.append("[{}] {} ({})".format(i, nm, flags))
print("[GESTALTUNG] {}".format(" | ".join(entries))) print("[STYLES] {}".format(" | ".join(entries)))
except Exception as ex: except Exception as ex:
print("[GESTALTUNG] Linetype-Diagnose:", ex) print("[STYLES] Linetype-Diagnose:", ex)
# One-Shot Repair: aeltere Hatches (vor dem PlotColor-Fix angelegt) # One-Shot Repair: aeltere Hatches (vor dem PlotColor-Fix angelegt)
# bekommen ihre Print-Attribute mit Display synchronisiert. # bekommen ihre Print-Attribute mit Display synchronisiert.
try: try:
repair_plot_colors(doc) repair_plot_colors(doc)
except Exception as ex: except Exception as ex:
print("[GESTALTUNG] repair on ready:", ex) print("[STYLES] repair on ready:", ex)
self._send_selection() self._send_selection()
def handle(self, data): def handle(self, data):
@@ -1222,7 +1222,7 @@ class GestaltungBridge(panel_base.BaseBridge):
try: try:
self.send("SELECTION", _selection_summary(doc)) self.send("SELECTION", _selection_summary(doc))
except Exception as ex: except Exception as ex:
print("[GESTALTUNG] Selection:", ex) print("[STYLES] Selection:", ex)
# ---- Attribute-Setter ------------------------------------------------ # ---- Attribute-Setter ------------------------------------------------
@@ -1294,7 +1294,7 @@ class GestaltungBridge(panel_base.BaseBridge):
applied = True applied = True
break break
except Exception as ex: except Exception as ex:
print("[GESTALTUNG] attr {} fehler: {}".format(prop, ex)) print("[STYLES] attr {} fehler: {}".format(prop, ex))
# Versuch 2: direkt auf RhinoObject # Versuch 2: direkt auf RhinoObject
if not applied: if not applied:
for prop in ("LinetypePatternLengthScale", "LinetypeScale"): for prop in ("LinetypePatternLengthScale", "LinetypeScale"):
@@ -1304,14 +1304,14 @@ class GestaltungBridge(panel_base.BaseBridge):
applied = True applied = True
break break
except Exception as ex: except Exception as ex:
print("[GESTALTUNG] obj {} fehler: {}".format(prop, ex)) print("[STYLES] obj {} fehler: {}".format(prop, ex))
if applied: if applied:
ok += 1 ok += 1
doc.Views.Redraw() doc.Views.Redraw()
if ok == 0: if ok == 0:
print("[GESTALTUNG] Linetype-Scale nicht unterstuetzt (Rhino-Version?)") print("[STYLES] Linetype-Scale nicht unterstuetzt (Rhino-Version?)")
else: else:
print("[GESTALTUNG] Linetype-Scale auf {} Objekt(e) applied".format(ok)) print("[STYLES] Linetype-Scale auf {} Objekt(e) applied".format(ok))
self._send_selection() self._send_selection()
def _set_linetype_source(self, source, name): def _set_linetype_source(self, source, name):
@@ -1387,7 +1387,7 @@ class GestaltungBridge(panel_base.BaseBridge):
try: doc.Objects.ModifyAttributes(obj, ca, True) try: doc.Objects.ModifyAttributes(obj, ca, True)
finally: _processing.discard(obj.Id) finally: _processing.discard(obj.Id)
except Exception as ex: except Exception as ex:
print("[GESTALTUNG] _set_fill follow-layer empty:", ex) print("[STYLES] _set_fill follow-layer empty:", ex)
continue continue
else: else:
pattern_idx = doc.HatchPatterns.Find(fill["pattern"], True) pattern_idx = doc.HatchPatterns.Find(fill["pattern"], True)
@@ -1460,7 +1460,7 @@ class GestaltungBridge(panel_base.BaseBridge):
if h_obj is not None: if h_obj is not None:
_ms2.post_create_hatch_scale(doc, h_obj, scale_v) _ms2.post_create_hatch_scale(doc, h_obj, scale_v)
except Exception as _ex: except Exception as _ex:
print("[GESTALTUNG] post_create_hatch_scale (replace):", _ex) print("[STYLES] post_create_hatch_scale (replace):", _ex)
# Farbe / Source / FILL_SOURCE-Marker aktualisieren # Farbe / Source / FILL_SOURCE-Marker aktualisieren
refreshed = doc.Objects.FindId(existing_hatch.Id) or existing_hatch refreshed = doc.Objects.FindId(existing_hatch.Id) or existing_hatch
ha = refreshed.Attributes.Duplicate() ha = refreshed.Attributes.Duplicate()
@@ -1510,7 +1510,7 @@ class GestaltungBridge(panel_base.BaseBridge):
if h_obj is not None: if h_obj is not None:
_ms.post_create_hatch_scale(doc, h_obj, scale_v) _ms.post_create_hatch_scale(doc, h_obj, scale_v)
except Exception as _ex: except Exception as _ex:
print("[GESTALTUNG] post_create_hatch_scale (set_fill):", _ex) print("[STYLES] post_create_hatch_scale (set_fill):", _ex)
else: else:
if existing_hatch is not None and not existing_hatch.IsDeleted: if existing_hatch is not None and not existing_hatch.IsDeleted:
_processing.add(existing_hatch.Id) _processing.add(existing_hatch.Id)
@@ -1545,7 +1545,7 @@ class GestaltungBridge(panel_base.BaseBridge):
doc = Rhino.RhinoDoc.ActiveDoc doc = Rhino.RhinoDoc.ActiveDoc
objs = list(doc.Objects.GetSelectedObjects(False, False)) objs = list(doc.Objects.GetSelectedObjects(False, False))
is_layer_source = (source == "layer") is_layer_source = (source == "layer")
print("[GESTALTUNG] _set_section_style: source={} enabled={} pattern={}".format( print("[STYLES] _set_section_style: source={} enabled={} pattern={}".format(
source, enabled, pattern_name)) source, enabled, pattern_name))
# SectionStyle-Klasse + Source-Enum holen. # SectionStyle-Klasse + Source-Enum holen.
@@ -1557,28 +1557,28 @@ class GestaltungBridge(panel_base.BaseBridge):
try: try:
SS = Rhino.DocObjects.SectionStyle SS = Rhino.DocObjects.SectionStyle
except Exception as ex: except Exception as ex:
print("[GESTALTUNG] SectionStyle-Klasse fehlt:", ex) print("[STYLES] SectionStyle-Klasse fehlt:", ex)
return return
SAS = None SAS = None
for cls_name in ("ObjectSectionAttributesSource", "SectionAttributesSource"): for cls_name in ("ObjectSectionAttributesSource", "SectionAttributesSource"):
try: try:
SAS = getattr(Rhino.DocObjects, cls_name) SAS = getattr(Rhino.DocObjects, cls_name)
if SAS is not None: if SAS is not None:
print("[GESTALTUNG] Source-Enum: Rhino.DocObjects.{}".format(cls_name)) print("[STYLES] Source-Enum: Rhino.DocObjects.{}".format(cls_name))
break break
except Exception: pass except Exception: pass
if SAS is None: if SAS is None:
print("[GESTALTUNG] WARNUNG: kein Source-Enum gefunden") print("[STYLES] WARNUNG: kein Source-Enum gefunden")
if objs and not getattr(self, "_ss_api_logged", False): if objs and not getattr(self, "_ss_api_logged", False):
o = objs[0] o = objs[0]
for meth in ("SetCustomSectionStyle", "RemoveCustomSectionStyle", for meth in ("SetCustomSectionStyle", "RemoveCustomSectionStyle",
"HasCustomSectionStyle", "GetCustomSectionStyle"): "HasCustomSectionStyle", "GetCustomSectionStyle"):
print("[GESTALTUNG] RhinoObject.{}: {}".format( print("[STYLES] RhinoObject.{}: {}".format(
meth, hasattr(o, meth))) meth, hasattr(o, meth)))
try: try:
a = o.Attributes a = o.Attributes
for meth in ("SetCustomSectionStyle", "RemoveCustomSectionStyle"): for meth in ("SetCustomSectionStyle", "RemoveCustomSectionStyle"):
print("[GESTALTUNG] Attributes.{}: {}".format( print("[STYLES] Attributes.{}: {}".format(
meth, hasattr(a, meth))) meth, hasattr(a, meth)))
except Exception: pass except Exception: pass
self._ss_api_logged = True self._ss_api_logged = True
@@ -1616,13 +1616,13 @@ class GestaltungBridge(panel_base.BaseBridge):
try: try:
a.SectionAttributesSource = SAS.FromObject a.SectionAttributesSource = SAS.FromObject
except Exception as ex: except Exception as ex:
print("[GESTALTUNG] set Source.FromObject fail:", ex) print("[STYLES] set Source.FromObject fail:", ex)
ok_modify = doc.Objects.ModifyAttributes(obj, a, True) ok_modify = doc.Objects.ModifyAttributes(obj, a, True)
_log_post(obj, "Attributes.SetCustomSectionStyle+FromObject", _log_post(obj, "Attributes.SetCustomSectionStyle+FromObject",
ok_modify) ok_modify)
return "Attributes.SetCustomSectionStyle" return "Attributes.SetCustomSectionStyle"
except Exception as ex: except Exception as ex:
print("[GESTALTUNG] attr.SetCustomSectionStyle fail:", ex) print("[STYLES] attr.SetCustomSectionStyle fail:", ex)
return None return None
def _log_post(obj, via, ok_modify=None): def _log_post(obj, via, ok_modify=None):
@@ -1643,10 +1643,10 @@ class GestaltungBridge(panel_base.BaseBridge):
got = "HatchIndex={}".format(getattr(css, "HatchIndex", "?")) got = "HatchIndex={}".format(getattr(css, "HatchIndex", "?"))
except Exception as ex: except Exception as ex:
got = "get-err: {}".format(ex) got = "get-err: {}".format(ex)
print("[GESTALTUNG] post via {} (modify_ok={}): Source={} Got={}".format( print("[STYLES] post via {} (modify_ok={}): Source={} Got={}".format(
via, ok_modify, src, got)) via, ok_modify, src, got))
except Exception as ex: except Exception as ex:
print("[GESTALTUNG] post-check:", ex) print("[STYLES] post-check:", ex)
def _remove_custom(obj): def _remove_custom(obj):
"""Entfernt Custom-SectionStyle + schaltet Source auf FromLayer """Entfernt Custom-SectionStyle + schaltet Source auf FromLayer
@@ -1659,11 +1659,11 @@ class GestaltungBridge(panel_base.BaseBridge):
try: try:
a.SectionAttributesSource = SAS.FromLayer a.SectionAttributesSource = SAS.FromLayer
except Exception as ex: except Exception as ex:
print("[GESTALTUNG] set Source.FromLayer fail:", ex) print("[STYLES] set Source.FromLayer fail:", ex)
doc.Objects.ModifyAttributes(obj, a, True) doc.Objects.ModifyAttributes(obj, a, True)
return "Attributes.RemoveCustomSectionStyle+FromLayer" return "Attributes.RemoveCustomSectionStyle+FromLayer"
except Exception as ex: except Exception as ex:
print("[GESTALTUNG] attr.RemoveCustomSectionStyle fail:", ex) print("[STYLES] attr.RemoveCustomSectionStyle fail:", ex)
return None return None
n_ok = 0 n_ok = 0
@@ -1674,7 +1674,7 @@ class GestaltungBridge(panel_base.BaseBridge):
if is_layer_source: if is_layer_source:
# Custom entfernen → Layer-SectionStyle wird wirksam # Custom entfernen → Layer-SectionStyle wird wirksam
via = _remove_custom(obj) via = _remove_custom(obj)
print("[GESTALTUNG] obj {}: remove custom via {}".format( print("[STYLES] obj {}: remove custom via {}".format(
str(obj.Id)[:8], via)) str(obj.Id)[:8], via))
if via: n_ok += 1 if via: n_ok += 1
continue continue
@@ -1691,7 +1691,7 @@ class GestaltungBridge(panel_base.BaseBridge):
except Exception as ex: except Exception as ex:
obj_col = None obj_col = None
obj_col_src = "fail:{}".format(ex) obj_col_src = "fail:{}".format(ex)
print("[GESTALTUNG] obj {} color src={} val={}".format( print("[STYLES] obj {} color src={} val={}".format(
str(obj.Id)[:8], obj_col_src, obj_col)) str(obj.Id)[:8], obj_col_src, obj_col))
# Per-Object: frischen SectionStyle bauen wie in layer_builder # Per-Object: frischen SectionStyle bauen wie in layer_builder
style = SS() style = SS()
@@ -1746,11 +1746,11 @@ class GestaltungBridge(panel_base.BaseBridge):
break break
except Exception: pass except Exception: pass
via = _apply_custom(obj, style) via = _apply_custom(obj, style)
print("[GESTALTUNG] obj {}: set custom via {} (hatch_idx={})".format( print("[STYLES] obj {}: set custom via {} (hatch_idx={})".format(
str(obj.Id)[:8], via, pat_idx)) str(obj.Id)[:8], via, pat_idx))
if via: n_ok += 1 if via: n_ok += 1
print("[GESTALTUNG] SectionStyle auf {} Objekt(e) appliziert".format(n_ok)) print("[STYLES] SectionStyle auf {} Objekt(e) appliziert".format(n_ok))
doc.Views.Redraw() doc.Views.Redraw()
self._send_selection() self._send_selection()
@@ -1766,7 +1766,7 @@ def _install_selection_listener(bridge):
# Selection-Refresh wird via Idle-Event debounced: # Selection-Refresh wird via Idle-Event debounced:
# Rhino feuert pro Object-Select/Deselect einzeln. Bei mass-Delete von # Rhino feuert pro Object-Select/Deselect einzeln. Bei mass-Delete von
# 327 Objekten = 327 refresh-Calls → 327 IPC-Sends in den WebView → # 327 Objekten = 327 refresh-Calls → 327 IPC-Sends in den WebView →
# UI haengt + Command-History wird mit '[GESTALTUNG] sel: n=N' # UI haengt + Command-History wird mit '[STYLES] sel: n=N'
# zugemuellt. Wir setzen nur ein Dirty-Flag und feuern EINMAL beim # zugemuellt. Wir setzen nur ein Dirty-Flag und feuern EINMAL beim
# naechsten Idle-Tick. # naechsten Idle-Tick.
def refresh(*args): def refresh(*args):
@@ -1793,7 +1793,7 @@ def _install_selection_listener(bridge):
Rhino.RhinoApp.Idle += on_idle_flush Rhino.RhinoApp.Idle += on_idle_flush
sc.sticky["_gestaltung_idle_attached"] = True sc.sticky["_gestaltung_idle_attached"] = True
except Exception as ex: except Exception as ex:
print("[GESTALTUNG] Idle-Hook fail:", ex) print("[STYLES] Idle-Hook fail:", ex)
def on_replace(sender, args): def on_replace(sender, args):
"""Sync Curve↔Hatch bei Move/Replace: """Sync Curve↔Hatch bei Move/Replace:
@@ -1838,7 +1838,7 @@ def _install_selection_listener(bridge):
try: try:
new_curves = new_obj.Geometry.Get3dCurves(True) new_curves = new_obj.Geometry.Get3dCurves(True)
except Exception as ex: except Exception as ex:
print("[GESTALTUNG] hatch.Get3dCurves:", ex) print("[STYLES] hatch.Get3dCurves:", ex)
return return
if not new_curves or len(new_curves) == 0: if not new_curves or len(new_curves) == 0:
return return
@@ -1847,14 +1847,14 @@ def _install_selection_listener(bridge):
try: try:
doc2.Objects.Replace(owner_id, new_curve) doc2.Objects.Replace(owner_id, new_curve)
except Exception as ex: except Exception as ex:
print("[GESTALTUNG] hatch→curve replace:", ex) print("[STYLES] hatch→curve replace:", ex)
finally: finally:
_processing.discard(owner_id) _processing.discard(owner_id)
return return
hatch_id_str = a.GetUserString(_FILL_KEY) hatch_id_str = a.GetUserString(_FILL_KEY)
if not hatch_id_str: if not hatch_id_str:
return return
print("[GESTALTUNG] on_replace fuer Curve mit Fill") print("[STYLES] on_replace fuer Curve mit Fill")
try: try:
hatch_id = System.Guid(hatch_id_str) hatch_id = System.Guid(hatch_id_str)
except Exception: except Exception:
@@ -1885,7 +1885,7 @@ def _install_selection_listener(bridge):
try: try:
doc.Objects.Replace(hatch_id, new_hatches[0]) doc.Objects.Replace(hatch_id, new_hatches[0])
except Exception as ex: except Exception as ex:
print("[GESTALTUNG] Hatch-Update:", ex) print("[STYLES] Hatch-Update:", ex)
finally: finally:
_processing.discard(hatch_id) _processing.discard(hatch_id)
@@ -1927,7 +1927,7 @@ def _install_selection_listener(bridge):
hatch_id_str = _lookup_hatch_for_curve(obj.Id) hatch_id_str = _lookup_hatch_for_curve(obj.Id)
if not hatch_id_str: if not hatch_id_str:
return return
print("[GESTALTUNG] on_delete: hatch via sticky map gefunden") print("[STYLES] on_delete: hatch via sticky map gefunden")
# Pfad A: geloeschte Curve hatte eine Hatch -> Hatch mitloeschen # Pfad A: geloeschte Curve hatte eine Hatch -> Hatch mitloeschen
if hatch_id_str: if hatch_id_str:
@@ -1944,10 +1944,10 @@ def _install_selection_listener(bridge):
_processing.add(hatch_id) _processing.add(hatch_id)
try: try:
ok = doc.Objects.Delete(hatch_id, True) ok = doc.Objects.Delete(hatch_id, True)
print("[GESTALTUNG] Curve geloescht -> Hatch {} ({})".format( print("[STYLES] Curve geloescht -> Hatch {} ({})".format(
"weg" if ok else "konnte nicht geloescht werden", hatch_id)) "weg" if ok else "konnte nicht geloescht werden", hatch_id))
except Exception as ex: except Exception as ex:
print("[GESTALTUNG] Hatch-Loeschen:", ex) print("[STYLES] Hatch-Loeschen:", ex)
finally: finally:
_processing.discard(hatch_id) _processing.discard(hatch_id)
_unlink_curve(obj.Id) _unlink_curve(obj.Id)
@@ -1971,7 +1971,7 @@ def _install_selection_listener(bridge):
finally: finally:
_processing.discard(owner_id) _processing.discard(owner_id)
except Exception as ex: except Exception as ex:
print("[GESTALTUNG] Curve-Verweis aufraeumen:", ex) print("[STYLES] Curve-Verweis aufraeumen:", ex)
def on_add(sender, args): def on_add(sender, args):
"""Auto-Fill bzw. Drag-Recovery: neues Objekt -> ggf. Hatch erzeugen. """Auto-Fill bzw. Drag-Recovery: neues Objekt -> ggf. Hatch erzeugen.
@@ -1998,10 +1998,10 @@ def _install_selection_listener(bridge):
try: try:
ok = _restore_hatch_from_pending(doc, obj, pending) ok = _restore_hatch_from_pending(doc, obj, pending)
except Exception as ex: except Exception as ex:
print("[GESTALTUNG] on_add restore Exception:", ex) print("[STYLES] on_add restore Exception:", ex)
ok = False ok = False
if ok: if ok:
print("[GESTALTUNG] Drag-Recovery: Hatch wiederhergestellt fuer {}".format(obj.Id)) print("[STYLES] Drag-Recovery: Hatch wiederhergestellt fuer {}".format(obj.Id))
b = sc.sticky.get("gestaltung_bridge") b = sc.sticky.get("gestaltung_bridge")
if b is not None: if b is not None:
try: b._send_selection() try: b._send_selection()
@@ -2015,7 +2015,7 @@ def _install_selection_listener(bridge):
try: try:
ok = _apply_ebene_fill(doc, obj) ok = _apply_ebene_fill(doc, obj)
except Exception as ex: except Exception as ex:
print("[GESTALTUNG] on_add Exception:", ex) print("[STYLES] on_add Exception:", ex)
return return
if ok: if ok:
b = sc.sticky.get("gestaltung_bridge") b = sc.sticky.get("gestaltung_bridge")
@@ -2060,7 +2060,7 @@ def _install_selection_listener(bridge):
finally: finally:
_processing.discard(obj.Id) _processing.discard(obj.Id)
except Exception as ex: except Exception as ex:
print("[GESTALTUNG] on_modify_attrs plot-sync:", ex) print("[STYLES] on_modify_attrs plot-sync:", ex)
# --- (1) Layer-Wechsel -> Hatch mitziehen --- # --- (1) Layer-Wechsel -> Hatch mitziehen ---
if old_lyr == new_lyr: if old_lyr == new_lyr:
@@ -2089,16 +2089,16 @@ def _install_selection_listener(bridge):
doc.Objects.ModifyAttributes(hatch_obj, ha, True) doc.Objects.ModifyAttributes(hatch_obj, ha, True)
finally: finally:
_processing.discard(hatch_id) _processing.discard(hatch_id)
print("[GESTALTUNG] Curve {} Layer geaendert -> Hatch mitgezogen".format(obj.Id)) print("[STYLES] Curve {} Layer geaendert -> Hatch mitgezogen".format(obj.Id))
except Exception as ex: except Exception as ex:
print("[GESTALTUNG] on_modify_attrs:", ex) print("[STYLES] on_modify_attrs:", ex)
return return
# Falls die neue Ebene andere Fill-Settings hat (Pattern/Skala/Drehung), # Falls die neue Ebene andere Fill-Settings hat (Pattern/Skala/Drehung),
# die Hatch entsprechend an die neue Layer-Definition angleichen. # die Hatch entsprechend an die neue Layer-Definition angleichen.
try: try:
refresh_layer_fills(doc) refresh_layer_fills(doc)
except Exception as ex: except Exception as ex:
print("[GESTALTUNG] on_modify_attrs refresh:", ex) print("[STYLES] on_modify_attrs refresh:", ex)
Rhino.RhinoDoc.SelectObjects += refresh Rhino.RhinoDoc.SelectObjects += refresh
Rhino.RhinoDoc.DeselectObjects += refresh Rhino.RhinoDoc.DeselectObjects += refresh
@@ -2108,7 +2108,7 @@ def _install_selection_listener(bridge):
Rhino.RhinoDoc.AddRhinoObject += on_add Rhino.RhinoDoc.AddRhinoObject += on_add
Rhino.RhinoDoc.ModifyObjectAttributes += on_modify_attrs Rhino.RhinoDoc.ModifyObjectAttributes += on_modify_attrs
sc.sticky[flag] = True sc.sticky[flag] = True
print("[GESTALTUNG] Listener active (Selection + Hatch-Live-Update + Ebene-Auto-Fill + Layer-Sync)") print("[STYLES] Listener active (Selection + Hatch-Live-Update + Ebene-Auto-Fill + Layer-Sync)")
def _bridge_factory(): def _bridge_factory():
+134 -134
View File
@@ -33,7 +33,7 @@ def _run(cmd):
try: try:
Rhino.RhinoApp.RunScript(cmd, False) Rhino.RhinoApp.RunScript(cmd, False)
except Exception as ex: except Exception as ex:
print("[OBERLEISTE] RunScript-Fehler ({}): {}".format(cmd, ex)) print("[TOOLBAR] RunScript-Fehler ({}): {}".format(cmd, ex))
# --- Window-Layout-Management + App-Settings ------------------------------- # --- Window-Layout-Management + App-Settings -------------------------------
@@ -74,7 +74,7 @@ def _settings_load():
data["windowLayout"] = data.get("defaultLayout") or "" data["windowLayout"] = data.get("defaultLayout") or ""
return data return data
except Exception as ex: except Exception as ex:
print("[OBERLEISTE] settings_load ({}):".format(p), ex) print("[TOOLBAR] settings_load ({}):".format(p), ex)
return {} return {}
@@ -89,7 +89,7 @@ def _settings_save(data):
.encode("utf-8")) .encode("utf-8"))
return True return True
except Exception as ex: except Exception as ex:
print("[OBERLEISTE] settings_save:", ex) print("[TOOLBAR] settings_save:", ex)
return False return False
@@ -133,7 +133,7 @@ def _apply_viewport_colors(cfg):
try: try:
appset = Rhino.ApplicationSettings.AppearanceSettings appset = Rhino.ApplicationSettings.AppearanceSettings
except Exception as ex: except Exception as ex:
print("[OBERLEISTE] AppearanceSettings not available:", ex) print("[TOOLBAR] AppearanceSettings not available:", ex)
return False return False
applied = [] applied = []
for key, attr in _VIEWPORT_COLOR_ATTRS: for key, attr in _VIEWPORT_COLOR_ATTRS:
@@ -144,13 +144,13 @@ def _apply_viewport_colors(cfg):
setattr(appset, attr, col) setattr(appset, attr, col)
applied.append(key) applied.append(key)
except Exception as ex: except Exception as ex:
print("[OBERLEISTE] view-color {} -> {}: {}".format(key, attr, ex)) print("[TOOLBAR] view-color {} -> {}: {}".format(key, attr, ex))
if applied: if applied:
# Redraw aller Viewports damit die neuen Farben sofort sichtbar werden. # Redraw aller Viewports damit die neuen Farben sofort sichtbar werden.
try: try:
for v in Rhino.RhinoDoc.ActiveDoc.Views: v.Redraw() for v in Rhino.RhinoDoc.ActiveDoc.Views: v.Redraw()
except Exception: pass except Exception: pass
print("[OBERLEISTE] Viewport-Colors applied:", applied) print("[TOOLBAR] Viewport-Colors applied:", applied)
return bool(applied) return bool(applied)
@@ -162,20 +162,20 @@ def _import_display_modes(paths):
try: try:
DMD = Rhino.Display.DisplayModeDescription DMD = Rhino.Display.DisplayModeDescription
except Exception as ex: except Exception as ex:
print("[OBERLEISTE] DisplayModeDescription not available:", ex) print("[TOOLBAR] DisplayModeDescription not available:", ex)
return 0 return 0
for p in paths: for p in paths:
try: try:
if not os.path.isfile(p): if not os.path.isfile(p):
print("[OBERLEISTE] Display-Mode-Pfad fehlt:", p); continue print("[TOOLBAR] Display-Mode-Pfad fehlt:", p); continue
res = DMD.ImportFromFile(p) res = DMD.ImportFromFile(p)
if res: if res:
count += 1 count += 1
print("[OBERLEISTE] Display-Mode importiert:", p) print("[TOOLBAR] Display-Mode importiert:", p)
else: else:
print("[OBERLEISTE] Display-Mode-Import lieferte False:", p) print("[TOOLBAR] Display-Mode-Import lieferte False:", p)
except Exception as ex: except Exception as ex:
print("[OBERLEISTE] Display-Mode-Import-Fehler ({}): {}".format(p, ex)) print("[TOOLBAR] Display-Mode-Import-Fehler ({}): {}".format(p, ex))
if count: if count:
# Cache invalidieren damit das Display-Dropdown die Neuen aufnimmt. # Cache invalidieren damit das Display-Dropdown die Neuen aufnimmt.
try: try:
@@ -222,7 +222,7 @@ def _apply_dossier_plan_attrs(dmd):
and ("idden" in n or "ngent" in n or "ilho" in n and ("idden" in n or "ngent" in n or "ilho" in n
or "ire" in n or "soc" in n or "dge" in n or "ire" in n or "soc" in n or "dge" in n
or "ech" in n or "hade" in n or "ection" in n)]) or "ech" in n or "hade" in n or "ection" in n)])
print("[OBERLEISTE] Plan-Mode Attrs-Inventar:", ", ".join(relevant)) print("[TOOLBAR] Plan-Mode Attrs-Inventar:", ", ".join(relevant))
# Sub-Objekt-Settings sind in Rhino 8 oft eigene Klassen # Sub-Objekt-Settings sind in Rhino 8 oft eigene Klassen
for sub in ("CurveSettings", "ObjectSettings", "ShadingSettings", for sub in ("CurveSettings", "ObjectSettings", "ShadingSettings",
"MeshSpecificAttributes"): "MeshSpecificAttributes"):
@@ -234,10 +234,10 @@ def _apply_dossier_plan_attrs(dmd):
or "soc" in n or "ire" in n or "soc" in n or "ire" in n
or "dge" in n)]) or "dge" in n)])
if sub_props: if sub_props:
print("[OBERLEISTE] Plan-Mode {}:".format(sub), print("[TOOLBAR] Plan-Mode {}:".format(sub),
", ".join(sub_props)) ", ".join(sub_props))
except Exception as ex: except Exception as ex:
print("[OBERLEISTE] Plan-Mode inspect:", ex) print("[TOOLBAR] Plan-Mode inspect:", ex)
_apply_dossier_plan_attrs._props_logged = True _apply_dossier_plan_attrs._props_logged = True
# Surfaces gefuellt + weiss + kein Shading # Surfaces gefuellt + weiss + kein Shading
try: attrs.ShadingEnabled = False try: attrs.ShadingEnabled = False
@@ -282,7 +282,7 @@ def _apply_dossier_plan_attrs(dmd):
attrs.MeshSpecificAttributes.ShowMeshWires = False attrs.MeshSpecificAttributes.ShowMeshWires = False
attrs.MeshSpecificAttributes.ShowMeshVertices = False attrs.MeshSpecificAttributes.ShowMeshVertices = False
except Exception as ex: except Exception as ex:
print("[OBERLEISTE] Plan-Mode MeshSpecificAttributes:", ex) print("[TOOLBAR] Plan-Mode MeshSpecificAttributes:", ex)
# Section-Styles MUESSEN aktiv sein damit Custom-Section-Styles # Section-Styles MUESSEN aktiv sein damit Custom-Section-Styles
# (per-Layer oder per-Object) tatsaechlich gerendert werden. Default # (per-Layer oder per-Object) tatsaechlich gerendert werden. Default
# ist False — d.h. Section-Hatches werden zugewiesen aber nicht angezeigt. # ist False — d.h. Section-Hatches werden zugewiesen aber nicht angezeigt.
@@ -294,10 +294,10 @@ def _apply_dossier_plan_attrs(dmd):
except Exception: pass except Exception: pass
try: attrs.UseSectionStyles = True try: attrs.UseSectionStyles = True
except Exception as ex: except Exception as ex:
print("[OBERLEISTE] Plan-Mode UseSectionStyles set:", ex) print("[TOOLBAR] Plan-Mode UseSectionStyles set:", ex)
try: post_uss = bool(attrs.UseSectionStyles) try: post_uss = bool(attrs.UseSectionStyles)
except Exception: post_uss = None except Exception: post_uss = None
print("[OBERLEISTE] Plan-Mode UseSectionStyles pre={} post={}".format( print("[TOOLBAR] Plan-Mode UseSectionStyles pre={} post={}".format(
pre_uss, post_uss)) pre_uss, post_uss))
# Clipping-Edges + Fills sichtbar # Clipping-Edges + Fills sichtbar
try: attrs.ShowClippingEdges = True try: attrs.ShowClippingEdges = True
@@ -314,7 +314,7 @@ def _apply_dossier_plan_attrs(dmd):
try: try:
DisplayModeDescription.UpdateDisplayMode(dmd) DisplayModeDescription.UpdateDisplayMode(dmd)
except Exception as ex: except Exception as ex:
print("[OBERLEISTE] Plan-Mode update:", ex) print("[TOOLBAR] Plan-Mode update:", ex)
_TEMPLATES_DIR = os.path.join(_HERE, "templates") _TEMPLATES_DIR = os.path.join(_HERE, "templates")
@@ -336,11 +336,11 @@ def _ensure_dossier_display_mode(target_name, target_guid, template_basename,
template_basename: 'dossier_plan.ini' / 'dossier_3d.ini' template_basename: 'dossier_plan.ini' / 'dossier_3d.ini'
fallback_base_name: 'Technical' / 'Shaded' Mode zum Klonen fallback_base_name: 'Technical' / 'Shaded' Mode zum Klonen
""" """
print("[OBERLEISTE] {}: check...".format(target_name)) print("[TOOLBAR] {}: check...".format(target_name))
try: try:
from Rhino.Display import DisplayModeDescription from Rhino.Display import DisplayModeDescription
except Exception as ex: except Exception as ex:
print("[OBERLEISTE] {}: DMD not available: {}".format(target_name, ex)) print("[TOOLBAR] {}: DMD not available: {}".format(target_name, ex))
return False return False
import re import re
template_ini_path = os.path.join(_TEMPLATES_DIR, template_basename) template_ini_path = os.path.join(_TEMPLATES_DIR, template_basename)
@@ -353,7 +353,7 @@ def _ensure_dossier_display_mode(target_name, target_guid, template_basename,
# benutzen — wir nur neu importieren wenn sich die Template-Datei # benutzen — wir nur neu importieren wenn sich die Template-Datei
# geaendert hat. # geaendert hat.
template_exists = os.path.isfile(template_ini_path) template_exists = os.path.isfile(template_ini_path)
print("[OBERLEISTE] {} template: {}".format(target_name, print("[TOOLBAR] {} template: {}".format(target_name,
"found at " + template_ini_path if template_exists else "missing")) "found at " + template_ini_path if template_exists else "missing"))
# Fallback-Clone nur fuer "Dossier Plan" erlauben. Bei anderen Modes # Fallback-Clone nur fuer "Dossier Plan" erlauben. Bei anderen Modes
# ohne Template skippen — sonst klonen wir z.B. den Raytraced-Mode mit # ohne Template skippen — sonst klonen wir z.B. den Raytraced-Mode mit
@@ -361,7 +361,7 @@ def _ensure_dossier_display_mode(target_name, target_guid, template_basename,
# und ALLE Modes nach Restart verschwinden lassen kann. User soll den # und ALLE Modes nach Restart verschwinden lassen kann. User soll den
# Mode in Rhino bauen + per "Save As" -> templates/<basename> exportieren. # Mode in Rhino bauen + per "Save As" -> templates/<basename> exportieren.
if not template_exists and target_name != "Dossier Plan": if not template_exists and target_name != "Dossier Plan":
print("[OBERLEISTE] {}: no template → skip (in Rhino bauen, " print("[TOOLBAR] {}: no template → skip (in Rhino bauen, "
"Display-Mode -> Save As -> {})".format( "Display-Mode -> Save As -> {})".format(
target_name, template_ini_path)) target_name, template_ini_path))
return False return False
@@ -380,7 +380,7 @@ def _ensure_dossier_display_mode(target_name, target_guid, template_basename,
# loeschen + reloaden wenn er das Template neu laden will. # loeschen + reloaden wenn er das Template neu laden will.
# Vermeidet delete-loop wenn das Template ini-Werte hat die mein # Vermeidet delete-loop wenn das Template ini-Werte hat die mein
# alter check als "falsch" einstufte. # alter check als "falsch" einstufte.
print("[OBERLEISTE] Display mode: existing found, no action (delete manually to refresh)") print("[TOOLBAR] Display mode: existing found, no action (delete manually to refresh)")
return True return True
# Sonst kein existing → vor dem Import alle Orphan-Modes mit unserer # Sonst kein existing → vor dem Import alle Orphan-Modes mit unserer
# Guid ODER Namen "Dossier Plan" wegputzen (alte kaputte Versionen # Guid ODER Namen "Dossier Plan" wegputzen (alte kaputte Versionen
@@ -401,14 +401,14 @@ def _ensure_dossier_display_mode(target_name, target_guid, template_basename,
DisplayModeDescription.DeleteDisplayMode(dm.Id) DisplayModeDescription.DeleteDisplayMode(dm.Id)
cleanup_count += 1 cleanup_count += 1
except Exception as ex: except Exception as ex:
print("[OBERLEISTE] Plan-Mode cleanup delete fail:", ex) print("[TOOLBAR] Plan-Mode cleanup delete fail:", ex)
if cleanup_count > 0: if cleanup_count > 0:
print("[OBERLEISTE] Plan-Mode: {} Orphan-Mode(s) entfernt vor Import".format( print("[TOOLBAR] Plan-Mode: {} Orphan-Mode(s) entfernt vor Import".format(
cleanup_count)) cleanup_count))
except Exception as ex: except Exception as ex:
print("[OBERLEISTE] Plan-Mode cleanup:", ex) print("[TOOLBAR] Plan-Mode cleanup:", ex)
except Exception as ex: except Exception as ex:
print("[OBERLEISTE] Plan-Mode list:", ex) print("[TOOLBAR] Plan-Mode list:", ex)
return False return False
# ---------------------------------------------------------------- # ----------------------------------------------------------------
# SOURCE: Template-ini bevorzugt (User hat den Mode manuell gebaut + # SOURCE: Template-ini bevorzugt (User hat den Mode manuell gebaut +
@@ -422,10 +422,10 @@ def _ensure_dossier_display_mode(target_name, target_guid, template_basename,
try: try:
with open(template_ini_path, "r", encoding="utf-8", errors="ignore") as f: with open(template_ini_path, "r", encoding="utf-8", errors="ignore") as f:
content = f.read() content = f.read()
print("[OBERLEISTE] {}: Template geladen ({} bytes)".format( print("[TOOLBAR] {}: Template geladen ({} bytes)".format(
target_name, len(content))) target_name, len(content)))
except Exception as ex: except Exception as ex:
print("[OBERLEISTE] {} Template read: {}".format(target_name, ex)) print("[TOOLBAR] {} Template read: {}".format(target_name, ex))
return False return False
else: else:
# Fallback: einen Base-Mode exportieren + patchen # Fallback: einen Base-Mode exportieren + patchen
@@ -440,21 +440,21 @@ def _ensure_dossier_display_mode(target_name, target_guid, template_basename,
except Exception: pass except Exception: pass
if base is not None: break if base is not None: break
if base is None: if base is None:
print("[OBERLEISTE] Plan-Mode: kein Basis-Modus gefunden") print("[TOOLBAR] Plan-Mode: kein Basis-Modus gefunden")
return False return False
try: try:
ok_export = False ok_export = False
try: try:
ok_export = bool(DisplayModeDescription.ExportToFile(base, tmp_path)) ok_export = bool(DisplayModeDescription.ExportToFile(base, tmp_path))
except Exception as ex: except Exception as ex:
print("[OBERLEISTE] Plan-Mode ExportToFile:", ex) print("[TOOLBAR] Plan-Mode ExportToFile:", ex)
if not ok_export: if not ok_export:
print("[OBERLEISTE] Plan-Mode: ExportToFile failed") print("[TOOLBAR] Plan-Mode: ExportToFile failed")
return False return False
with open(tmp_path, "r", encoding="utf-8", errors="ignore") as f: with open(tmp_path, "r", encoding="utf-8", errors="ignore") as f:
content = f.read() content = f.read()
except Exception as ex: except Exception as ex:
print("[OBERLEISTE] Plan-Mode fallback read ini:", ex) print("[TOOLBAR] Plan-Mode fallback read ini:", ex)
return False return False
try: try:
@@ -479,10 +479,10 @@ def _ensure_dossier_display_mode(target_name, target_guid, template_basename,
content = content.replace(old_guid.upper(), content = content.replace(old_guid.upper(),
target_guid.upper()) target_guid.upper())
else: else:
print("[OBERLEISTE] {}: kein DisplayMode-Section-Header " print("[TOOLBAR] {}: kein DisplayMode-Section-Header "
"gefunden — Mode-Guid nicht ersetzt".format(target_name)) "gefunden — Mode-Guid nicht ersetzt".format(target_name))
except Exception as ex: except Exception as ex:
print("[OBERLEISTE] {} Guid-Replace: {}".format(target_name, ex)) print("[TOOLBAR] {} Guid-Replace: {}".format(target_name, ex))
# Plan-Mode-Settings in der ini patchen — Rhino-DisplayMode-ini hat # Plan-Mode-Settings in der ini patchen — Rhino-DisplayMode-ini hat
# nested Sections wie [DisplayMode\<guid>\Objects\Surfaces]. Wir # nested Sections wie [DisplayMode\<guid>\Objects\Surfaces]. Wir
# patchen nur EXISTIERENDE Keys (Rhino's Parser stripped unbekannte # patchen nur EXISTIERENDE Keys (Rhino's Parser stripped unbekannte
@@ -518,27 +518,27 @@ def _ensure_dossier_display_mode(target_name, target_guid, template_basename,
try: try:
content, found = _ini_replace(content, key, val) content, found = _ini_replace(content, key, val)
if found: if found:
print("[OBERLEISTE] Plan-Mode ini {}={}".format(key, val)) print("[TOOLBAR] Plan-Mode ini {}={}".format(key, val))
except Exception as ex: except Exception as ex:
print("[OBERLEISTE] Plan-Mode ini-set {}={} fail: {}".format( print("[TOOLBAR] Plan-Mode ini-set {}={} fail: {}".format(
key, val, ex)) key, val, ex))
try: try:
with open(tmp_path, "w", encoding="utf-8") as f: with open(tmp_path, "w", encoding="utf-8") as f:
f.write(content) f.write(content)
except Exception as ex: except Exception as ex:
print("[OBERLEISTE] Plan-Mode write ini:", ex) print("[TOOLBAR] Plan-Mode write ini:", ex)
return False return False
# Import # Import
try: try:
ok_import = bool(DisplayModeDescription.ImportFromFile(tmp_path)) ok_import = bool(DisplayModeDescription.ImportFromFile(tmp_path))
except Exception as ex: except Exception as ex:
print("[OBERLEISTE] Plan-Mode ImportFromFile:", ex) print("[TOOLBAR] Plan-Mode ImportFromFile:", ex)
return False return False
if not ok_import: if not ok_import:
print("[OBERLEISTE] Plan-Mode: ImportFromFile gab False") print("[TOOLBAR] Plan-Mode: ImportFromFile gab False")
return False return False
except Exception as ex: except Exception as ex:
print("[OBERLEISTE] Plan-Mode clone:", ex) print("[TOOLBAR] Plan-Mode clone:", ex)
return False return False
# Neu importierten Mode holen + tweaken # Neu importierten Mode holen + tweaken
try: try:
@@ -553,14 +553,14 @@ def _ensure_dossier_display_mode(target_name, target_guid, template_basename,
dmd = dm; break dmd = dm; break
except Exception: pass except Exception: pass
if dmd is None: if dmd is None:
print("[OBERLEISTE] Plan-Mode: nach Import not found") print("[TOOLBAR] Plan-Mode: nach Import not found")
return False return False
# KEIN _apply_dossier_plan_attrs() hier — der wuerde # KEIN _apply_dossier_plan_attrs() hier — der wuerde
# UpdateDisplayMode() aufrufen und die ini-Werte (ClipSectionUsage, # UpdateDisplayMode() aufrufen und die ini-Werte (ClipSectionUsage,
# TechnicalMask) mit den Python-Default-Attrs ueberschreiben. # TechnicalMask) mit den Python-Default-Attrs ueberschreiben.
# Die ini hat schon alle richtigen Werte. # Die ini hat schon alle richtigen Werte.
src = "Template" if template_exists else (base.EnglishName if base else "?") src = "Template" if template_exists else (base.EnglishName if base else "?")
print("[OBERLEISTE] Display-Mode 'Dossier Plan' angelegt (Basis: {})".format(src)) print("[TOOLBAR] Display-Mode 'Dossier Plan' angelegt (Basis: {})".format(src))
# Sanity-Check: liste alle Display-Modes auf damit wir sehen ob unser # Sanity-Check: liste alle Display-Modes auf damit wir sehen ob unser
# Mode wirklich registriert ist (und mit welchem Namen). # Mode wirklich registriert ist (und mit welchem Namen).
try: try:
@@ -569,7 +569,7 @@ def _ensure_dossier_display_mode(target_name, target_guid, template_basename,
try: try:
names.append(dm_check.EnglishName) names.append(dm_check.EnglishName)
except Exception: pass except Exception: pass
print("[OBERLEISTE] Plan-Mode: alle registrierten Modes: {}".format( print("[TOOLBAR] Plan-Mode: alle registrierten Modes: {}".format(
", ".join(names))) ", ".join(names)))
except Exception: pass except Exception: pass
# Cache invalidieren damit das Dropdown ihn sieht # Cache invalidieren damit das Dropdown ihn sieht
@@ -579,7 +579,7 @@ def _ensure_dossier_display_mode(target_name, target_guid, template_basename,
except Exception: pass except Exception: pass
return True return True
except Exception as ex: except Exception as ex:
print("[OBERLEISTE] Plan-Mode tweak:", ex) print("[TOOLBAR] Plan-Mode tweak:", ex)
return False return False
@@ -600,24 +600,24 @@ def _save_thumbnail(doc):
import System.Drawing as _sd import System.Drawing as _sd
size = _sd.Size(int(w), int(h)) size = _sd.Size(int(w), int(h))
except Exception as ex: except Exception as ex:
print("[OBERLEISTE] thumb size:", ex); return print("[TOOLBAR] thumb size:", ex); return
try: try:
bmp = view.CaptureToBitmap(size) bmp = view.CaptureToBitmap(size)
except Exception as ex: except Exception as ex:
print("[OBERLEISTE] CaptureToBitmap:", ex); return print("[TOOLBAR] CaptureToBitmap:", ex); return
if bmp is None: return if bmp is None: return
thumb_path = doc_path + ".thumb.png" thumb_path = doc_path + ".thumb.png"
try: try:
import System.Drawing.Imaging as _imaging import System.Drawing.Imaging as _imaging
bmp.Save(thumb_path, _imaging.ImageFormat.Png) bmp.Save(thumb_path, _imaging.ImageFormat.Png)
print("[OBERLEISTE] Thumb gespeichert:", thumb_path) print("[TOOLBAR] Thumb gespeichert:", thumb_path)
except Exception as ex: except Exception as ex:
print("[OBERLEISTE] Thumb-Save:", ex) print("[TOOLBAR] Thumb-Save:", ex)
finally: finally:
try: bmp.Dispose() try: bmp.Dispose()
except Exception: pass except Exception: pass
except Exception as ex: except Exception as ex:
print("[OBERLEISTE] _save_thumbnail Fehler:", ex) print("[TOOLBAR] _save_thumbnail Fehler:", ex)
def _launch_dossier_app(): def _launch_dossier_app():
@@ -637,17 +637,17 @@ def _launch_dossier_app():
if os.path.isdir(ap): if os.path.isdir(ap):
try: try:
_subprocess.Popen(["open", ap]) _subprocess.Popen(["open", ap])
print("[OBERLEISTE] Dossier-Launcher gestartet:", ap) print("[TOOLBAR] Dossier-Launcher gestartet:", ap)
return True return True
except Exception as ex: except Exception as ex:
print("[OBERLEISTE] open Dossier-App ({}):".format(ap), ex) print("[TOOLBAR] open Dossier-App ({}):".format(ap), ex)
# Letzter Versuch: per App-Name (sucht in /Applications) # Letzter Versuch: per App-Name (sucht in /Applications)
try: try:
_subprocess.Popen(["open", "-a", "Dossier"]) _subprocess.Popen(["open", "-a", "Dossier"])
print("[OBERLEISTE] Dossier via 'open -a Dossier' gestartet") print("[TOOLBAR] Dossier via 'open -a Dossier' gestartet")
return True return True
except Exception as ex: except Exception as ex:
print("[OBERLEISTE] open -a Dossier:", ex) print("[TOOLBAR] open -a Dossier:", ex)
return False return False
@@ -685,7 +685,7 @@ def _list_window_layouts():
for n in names: for n in names:
if n and n not in out: out.append(str(n)) if n and n not in out: out.append(str(n))
if out: if out:
print("[OBERLEISTE] Layouts via API.{}: {}".format(attr, out)) print("[TOOLBAR] Layouts via API.{}: {}".format(attr, out))
return out return out
except Exception: continue except Exception: continue
except Exception: pass except Exception: pass
@@ -706,9 +706,9 @@ def _list_window_layouts():
name = _extract_layout_name_from_xml(content) name = _extract_layout_name_from_xml(content)
if name and name not in out: out.append(name) if name and name not in out: out.append(name)
if out: if out:
print("[OBERLEISTE] {} Layouts via XML gefunden".format(len(out))) print("[TOOLBAR] {} Layouts via XML gefunden".format(len(out)))
except Exception as ex: except Exception as ex:
print("[OBERLEISTE] workspaces-scan:", ex) print("[TOOLBAR] workspaces-scan:", ex)
# 3) Legacy .rwl-Pfade (Windows + ggf. aeltere Rhino-Versionen) # 3) Legacy .rwl-Pfade (Windows + ggf. aeltere Rhino-Versionen)
candidate_dirs = [ candidate_dirs = [
@@ -731,7 +731,7 @@ def _list_window_layouts():
except Exception: continue except Exception: continue
if not out: if not out:
print("[OBERLEISTE] Keine Layouts gefunden.") print("[TOOLBAR] Keine Layouts gefunden.")
return out return out
@@ -756,7 +756,7 @@ def _layout_name_to_guid(name):
if xn and xn.strip().lower() == target: if xn and xn.strip().lower() == target:
return os.path.splitext(fn)[0] return os.path.splitext(fn)[0]
except Exception as ex: except Exception as ex:
print("[OBERLEISTE] name_to_guid:", ex) print("[TOOLBAR] name_to_guid:", ex)
return None return None
@@ -786,7 +786,7 @@ def _rhino_last_restored_layout_guid():
txt) txt)
if m: return m.group(1).strip().lower() if m: return m.group(1).strip().lower()
except Exception as ex: except Exception as ex:
print("[OBERLEISTE] last-restored read:", ex) print("[TOOLBAR] last-restored read:", ex)
return None return None
@@ -806,7 +806,7 @@ def _is_layout_recently_applied(name, max_age_sec=600):
except Exception: return False except Exception: return False
return 0 <= age <= max_age_sec return 0 <= age <= max_age_sec
except Exception as ex: except Exception as ex:
print("[OBERLEISTE] layout-marker read:", ex) print("[TOOLBAR] layout-marker read:", ex)
return False return False
@@ -824,7 +824,7 @@ def _mark_layout_applied(name):
"appliedAt": _t.time(), "appliedAt": _t.time(),
}, ensure_ascii=False).encode("utf-8")) }, ensure_ascii=False).encode("utf-8"))
except Exception as ex: except Exception as ex:
print("[OBERLEISTE] layout-marker write:", ex) print("[TOOLBAR] layout-marker write:", ex)
def _apply_window_layout(name): def _apply_window_layout(name):
@@ -836,7 +836,7 @@ def _apply_window_layout(name):
(siehe _is_layout_recently_applied). (siehe _is_layout_recently_applied).
""" """
if not name: if not name:
print("[OBERLEISTE] apply_window_layout: leerer Name") print("[TOOLBAR] apply_window_layout: leerer Name")
return False return False
# KEIN Content-Skip mehr: Mac Rhino's Auto-Restore aus LastRestoredWindow # KEIN Content-Skip mehr: Mac Rhino's Auto-Restore aus LastRestoredWindow
# Layout dockt Eto-WebView-Panels NICHT korrekt — sie spawnen floating in # Layout dockt Eto-WebView-Panels NICHT korrekt — sie spawnen floating in
@@ -859,7 +859,7 @@ def _apply_window_layout(name):
def _apply_window_layout_impl(name): def _apply_window_layout_impl(name):
guid = _layout_name_to_guid(name) guid = _layout_name_to_guid(name)
print("[OBERLEISTE] apply_window_layout: name='{}' guid='{}'".format( print("[TOOLBAR] apply_window_layout: name='{}' guid='{}'".format(
name, guid)) name, guid))
# 1) Direkt ueber Rhino.UI-API per Reflection. Wir loggen WAS gefunden # 1) Direkt ueber Rhino.UI-API per Reflection. Wir loggen WAS gefunden
@@ -877,10 +877,10 @@ def _apply_window_layout_impl(name):
if meth is not None: if meth is not None:
api_candidates.append((cls_name, meth_name, meth)) api_candidates.append((cls_name, meth_name, meth))
if api_candidates: if api_candidates:
print("[OBERLEISTE] API-Kandidaten gefunden:", len(api_candidates), print("[TOOLBAR] API-Kandidaten gefunden:", len(api_candidates),
[(c, m) for c, m, _ in api_candidates]) [(c, m) for c, m, _ in api_candidates])
else: else:
print("[OBERLEISTE] No Rhino.UI API candidates (Mac Rhino " print("[TOOLBAR] No Rhino.UI API candidates (Mac Rhino "
"exposed das nicht statisch). Falling back to scripted commands.") "exposed das nicht statisch). Falling back to scripted commands.")
# Args zum Probieren: GUID zuerst (falls present) dann Name. # Args zum Probieren: GUID zuerst (falls present) dann Name.
# Beide als 1-arg Tuple. Doppelte Klammern haben in der alten Version # Beide als 1-arg Tuple. Doppelte Klammern haben in der alten Version
@@ -892,13 +892,13 @@ def _apply_window_layout_impl(name):
for arg in arg_variants: for arg in arg_variants:
try: try:
res = meth(*arg) res = meth(*arg)
print("[OBERLEISTE] apply via Rhino.UI.{}.{}({!r}) -> {}".format( print("[TOOLBAR] apply via Rhino.UI.{}.{}({!r}) -> {}".format(
cls_name, meth_name, arg[0], res)) cls_name, meth_name, arg[0], res))
return True return True
except Exception: except Exception:
continue continue
except Exception as ex: except Exception as ex:
print("[OBERLEISTE] API-Path Fehler:", ex) print("[TOOLBAR] API-Path Fehler:", ex)
# 2) Scripted Rhino-Commands. STOP on success — RunScript liefert bool. # 2) Scripted Rhino-Commands. STOP on success — RunScript liefert bool.
# Beobachtung aus Mac Rhino 8 Logs: _-WindowLayout "<name>" _Enter wirft # Beobachtung aus Mac Rhino 8 Logs: _-WindowLayout "<name>" _Enter wirft
@@ -915,10 +915,10 @@ def _apply_window_layout_impl(name):
try: Rhino.RhinoApp.SendKeystrokes("\x1b", False) try: Rhino.RhinoApp.SendKeystrokes("\x1b", False)
except Exception: pass except Exception: pass
res = Rhino.RhinoApp.RunScript(cmd, False) res = Rhino.RhinoApp.RunScript(cmd, False)
print("[OBERLEISTE] RunScript({!r}) -> {}".format(cmd, res)) print("[TOOLBAR] RunScript({!r}) -> {}".format(cmd, res))
return bool(res) return bool(res)
except Exception as ex: except Exception as ex:
print("[OBERLEISTE] RunScript-Fehler ({}): {}".format(cmd, ex)) print("[TOOLBAR] RunScript-Fehler ({}): {}".format(cmd, ex))
return False return False
quoted = '"{}"'.format(name.replace('"', '')) quoted = '"{}"'.format(name.replace('"', ''))
@@ -930,10 +930,10 @@ def _apply_window_layout_impl(name):
] ]
for cmd in cmd_candidates: for cmd in cmd_candidates:
if _try_cmd(cmd): if _try_cmd(cmd):
print("[OBERLEISTE] Command succeeded, stopping.") print("[TOOLBAR] Command succeeded, stopping.")
return True return True
print("[OBERLEISTE] apply_window_layout: kein Weg hat funktioniert. " print("[TOOLBAR] apply_window_layout: kein Weg hat funktioniert. "
"Wenn das Layout im Rhino-UI bekannt ist aber hier nicht greift, " "Wenn das Layout im Rhino-UI bekannt ist aber hier nicht greift, "
"manuell via Window-Menue zu wechseln.") "manuell via Window-Menue zu wechseln.")
return False return False
@@ -948,7 +948,7 @@ def open_settings_dialog():
import Eto.Forms as _ef import Eto.Forms as _ef
import Eto.Drawing as _ed import Eto.Drawing as _ed
except Exception as ex: except Exception as ex:
print("[OBERLEISTE] Eto-Import failed:", ex); return print("[TOOLBAR] Eto-Import failed:", ex); return
cfg = _settings_load() cfg = _settings_load()
layouts = _list_window_layouts() layouts = _list_window_layouts()
@@ -1072,7 +1072,7 @@ def open_settings_dialog():
dlg.Content = layout dlg.Content = layout
try: dlg.Show() try: dlg.Show()
except Exception as ex: except Exception as ex:
print("[OBERLEISTE] Settings-Dialog Show:", ex) print("[TOOLBAR] Settings-Dialog Show:", ex)
def _get_active_viewport_name(): def _get_active_viewport_name():
@@ -1121,7 +1121,7 @@ def _list_all_command_names():
"Properties","Layer","Snap","Ortho","Planar","Save","SaveAs"): "Properties","Layer","Snap","Ortho","Planar","Save","SaveAs"):
names.add(n) names.add(n)
out = sorted(names) out = sorted(names)
print("[OBERLEISTE] {} Rhino commands enumerated for autocomplete".format(len(out))) print("[TOOLBAR] {} Rhino commands enumerated for autocomplete".format(len(out)))
return out return out
@@ -1188,7 +1188,7 @@ def _list_display_modes():
except Exception: except Exception:
continue continue
except Exception as ex: except Exception as ex:
print("[OBERLEISTE] _list_display_modes:", ex) print("[TOOLBAR] _list_display_modes:", ex)
_display_modes_cache = out _display_modes_cache = out
return out return out
@@ -1202,10 +1202,10 @@ def _set_display_mode(name):
if dm.LocalName == name or dm.EnglishName == name: if dm.LocalName == name or dm.EnglishName == name:
v.ActiveViewport.DisplayMode = dm v.ActiveViewport.DisplayMode = dm
v.Redraw() v.Redraw()
print("[OBERLEISTE] Display-Mode: {}".format(name)) print("[TOOLBAR] Display-Mode: {}".format(name))
return True return True
except Exception as ex: except Exception as ex:
print("[OBERLEISTE] _set_display_mode:", ex) print("[TOOLBAR] _set_display_mode:", ex)
return False return False
@@ -1251,7 +1251,7 @@ def _set_osnap_mode(key, enabled):
new = (cur | flag_i) if enabled else (cur & ~flag_i) new = (cur | flag_i) if enabled else (cur & ~flag_i)
s.OsnapModes = Rhino.ApplicationSettings.OsnapModes(new) s.OsnapModes = Rhino.ApplicationSettings.OsnapModes(new)
except Exception as ex: except Exception as ex:
print("[OBERLEISTE] _set_osnap_mode:", ex) print("[TOOLBAR] _set_osnap_mode:", ex)
def _is_grid_visible(): def _is_grid_visible():
@@ -1306,14 +1306,14 @@ def _set_ortho(v):
try: try:
Rhino.ApplicationSettings.ModelAidSettings.Ortho = bool(v) Rhino.ApplicationSettings.ModelAidSettings.Ortho = bool(v)
except Exception as ex: except Exception as ex:
print("[OBERLEISTE] _set_ortho:", ex) print("[TOOLBAR] _set_ortho:", ex)
def _set_grid_snap(v): def _set_grid_snap(v):
try: try:
Rhino.ApplicationSettings.ModelAidSettings.GridSnap = bool(v) Rhino.ApplicationSettings.ModelAidSettings.GridSnap = bool(v)
except Exception as ex: except Exception as ex:
print("[OBERLEISTE] _set_grid_snap:", ex) print("[TOOLBAR] _set_grid_snap:", ex)
def _set_osnap_master(v): def _set_osnap_master(v):
@@ -1326,7 +1326,7 @@ def _set_osnap_master(v):
setattr(s, attr, bool(v)) setattr(s, attr, bool(v))
return return
except Exception as ex: except Exception as ex:
print("[OBERLEISTE] _set_osnap_master:", ex) print("[TOOLBAR] _set_osnap_master:", ex)
# --- Bridge ----------------------------------------------------------------- # --- Bridge -----------------------------------------------------------------
@@ -1358,7 +1358,7 @@ class OberleisteBridge(panel_base.BaseBridge):
try: try:
self._all_commands = _list_all_command_names() self._all_commands = _list_all_command_names()
except Exception as ex: except Exception as ex:
print("[OBERLEISTE] command-enum:", ex) print("[TOOLBAR] command-enum:", ex)
self._all_commands = [] self._all_commands = []
# Sofort an UI pushen (Autocomplete wird live) # Sofort an UI pushen (Autocomplete wird live)
try: try:
@@ -1368,7 +1368,7 @@ class OberleisteBridge(panel_base.BaseBridge):
except Exception: pass except Exception: pass
try: Rhino.RhinoApp.Idle += _load_once try: Rhino.RhinoApp.Idle += _load_once
except Exception as ex: except Exception as ex:
print("[OBERLEISTE] schedule command-load:", ex) print("[TOOLBAR] schedule command-load:", ex)
self._commands_loading = False self._commands_loading = False
def _on_ready(self): def _on_ready(self):
@@ -1401,7 +1401,7 @@ class OberleisteBridge(panel_base.BaseBridge):
if _apply_viewport_colors(cfg): if _apply_viewport_colors(cfg):
sc.sticky["_dossier_view_colors_applied"] = True sc.sticky["_dossier_view_colors_applied"] = True
except Exception as ex: except Exception as ex:
print("[OBERLEISTE] auto-apply (layout/colors):", ex) print("[TOOLBAR] auto-apply (layout/colors):", ex)
# Splash-Screen (falls noch offen) jetzt wegmachen — Layout-Apply ist # Splash-Screen (falls noch offen) jetzt wegmachen — Layout-Apply ist
# durch, Panels sind in finaler Position. hide() dispatcht intern # durch, Panels sind in finaler Position. hide() dispatcht intern
# auf Main-Thread via Rhino.Idle (Mac-safe). # auf Main-Thread via Rhino.Idle (Mac-safe).
@@ -1409,7 +1409,7 @@ class OberleisteBridge(panel_base.BaseBridge):
import _startup_splash as _ss import _startup_splash as _ss
_ss.hide() _ss.hide()
except Exception as ex: except Exception as ex:
print("[OBERLEISTE] splash hide:", ex) print("[TOOLBAR] splash hide:", ex)
self._send_state(force=True) self._send_state(force=True)
def handle(self, data): def handle(self, data):
@@ -1449,7 +1449,7 @@ class OberleisteBridge(panel_base.BaseBridge):
try: try:
self._sync_referenz_for_print(doc, enabled) self._sync_referenz_for_print(doc, enabled)
except Exception as ex: except Exception as ex:
print("[OBERLEISTE] sync referenz for print:", ex) print("[TOOLBAR] sync referenz for print:", ex)
self._send_state(force=True) self._send_state(force=True)
elif t == "SET_DPI": elif t == "SET_DPI":
doc, _ = massstab._active_vp() doc, _ = massstab._active_vp()
@@ -1472,19 +1472,19 @@ class OberleisteBridge(panel_base.BaseBridge):
try: try:
import kamera import kamera
kamera.set_top_view(vp); handled = True kamera.set_top_view(vp); handled = True
except Exception as ex: print("[OBERLEISTE] top:", ex) except Exception as ex: print("[TOOLBAR] top:", ex)
elif v == "Perspective": elif v == "Perspective":
_run("_-{} _Enter".format(v)); handled = True _run("_-{} _Enter".format(v)); handled = True
elif v == "Iso": elif v == "Iso":
try: try:
import kamera import kamera
kamera._set_iso(vp, "NE"); handled = True kamera._set_iso(vp, "NE"); handled = True
except Exception as ex: print("[OBERLEISTE] iso:", ex) except Exception as ex: print("[TOOLBAR] iso:", ex)
elif v in ("N", "O", "S", "W"): elif v in ("N", "O", "S", "W"):
try: try:
import kamera import kamera
kamera.set_cardinal_view(vp, v); handled = True kamera.set_cardinal_view(vp, v); handled = True
except Exception as ex: print("[OBERLEISTE] cardinal:", ex) except Exception as ex: print("[TOOLBAR] cardinal:", ex)
elif v in ("Front", "Right", "Left", "Back", "Bottom"): elif v in ("Front", "Right", "Left", "Back", "Bottom"):
_run("_-{} _Enter".format(v)); handled = True _run("_-{} _Enter".format(v)); handled = True
if handled: if handled:
@@ -1497,7 +1497,7 @@ class OberleisteBridge(panel_base.BaseBridge):
import kamera import kamera
kamera.open_as_window() kamera.open_as_window()
except Exception as ex: except Exception as ex:
print("[OBERLEISTE] open kamera:", ex) print("[TOOLBAR] open kamera:", ex)
# --- About-Fenster ---------------------------------------------- # --- About-Fenster ----------------------------------------------
elif t == "OPEN_ABOUT": elif t == "OPEN_ABOUT":
@@ -1505,7 +1505,7 @@ class OberleisteBridge(panel_base.BaseBridge):
import about import about
about.open_as_window() about.open_as_window()
except Exception as ex: except Exception as ex:
print("[OBERLEISTE] open about:", ex) print("[TOOLBAR] open about:", ex)
# --- Cheatsheet (Shortcuts-Uebersicht) -------------------------- # --- Cheatsheet (Shortcuts-Uebersicht) --------------------------
elif t == "OPEN_CHEATSHEET": elif t == "OPEN_CHEATSHEET":
@@ -1513,7 +1513,7 @@ class OberleisteBridge(panel_base.BaseBridge):
import welcome import welcome
welcome.show_cheatsheet() welcome.show_cheatsheet()
except Exception as ex: except Exception as ex:
print("[OBERLEISTE] open cheatsheet:", ex) print("[TOOLBAR] open cheatsheet:", ex)
# --- Text-Erstellung (Floating-Input) --------------------------- # --- Text-Erstellung (Floating-Input) ---------------------------
elif t == "CREATE_TEXT": elif t == "CREATE_TEXT":
@@ -1521,7 +1521,7 @@ class OberleisteBridge(panel_base.BaseBridge):
import text_create import text_create
text_create.create_text() text_create.create_text()
except Exception as ex: except Exception as ex:
print("[OBERLEISTE] create text:", ex) print("[TOOLBAR] create text:", ex)
elif t == "SET_TEXT_SETTINGS": elif t == "SET_TEXT_SETTINGS":
try: try:
import text_create import text_create
@@ -1530,7 +1530,7 @@ class OberleisteBridge(panel_base.BaseBridge):
text_create.save_settings(doc, patch) text_create.save_settings(doc, patch)
text_create.apply_settings_to_selection(doc, patch) text_create.apply_settings_to_selection(doc, patch)
except Exception as ex: except Exception as ex:
print("[OBERLEISTE] text settings:", ex) print("[TOOLBAR] text settings:", ex)
self._send_state(force=True) self._send_state(force=True)
elif t == "APPLY_TEXT_STYLE": elif t == "APPLY_TEXT_STYLE":
try: try:
@@ -1538,7 +1538,7 @@ class OberleisteBridge(panel_base.BaseBridge):
text_create.apply_style( text_create.apply_style(
Rhino.RhinoDoc.ActiveDoc, p.get("id")) Rhino.RhinoDoc.ActiveDoc, p.get("id"))
except Exception as ex: except Exception as ex:
print("[OBERLEISTE] apply text style:", ex) print("[TOOLBAR] apply text style:", ex)
self._send_state(force=True) self._send_state(force=True)
elif t == "SAVE_TEXT_STYLE": elif t == "SAVE_TEXT_STYLE":
try: try:
@@ -1547,7 +1547,7 @@ class OberleisteBridge(panel_base.BaseBridge):
sid = text_create.save_style(doc, p.get("name") or "Stil") sid = text_create.save_style(doc, p.get("name") or "Stil")
if sid: text_create.set_active_style_id(doc, sid) if sid: text_create.set_active_style_id(doc, sid)
except Exception as ex: except Exception as ex:
print("[OBERLEISTE] save text style:", ex) print("[TOOLBAR] save text style:", ex)
self._send_state(force=True) self._send_state(force=True)
elif t == "DELETE_TEXT_STYLE": elif t == "DELETE_TEXT_STYLE":
try: try:
@@ -1555,7 +1555,7 @@ class OberleisteBridge(panel_base.BaseBridge):
text_create.delete_style( text_create.delete_style(
Rhino.RhinoDoc.ActiveDoc, p.get("id")) Rhino.RhinoDoc.ActiveDoc, p.get("id"))
except Exception as ex: except Exception as ex:
print("[OBERLEISTE] delete text style:", ex) print("[TOOLBAR] delete text style:", ex)
self._send_state(force=True) self._send_state(force=True)
# --- Masse (Mass-Style) ----------------------------------------- # --- Masse (Mass-Style) -----------------------------------------
@@ -1566,30 +1566,30 @@ class OberleisteBridge(panel_base.BaseBridge):
mass_style.set_active_id(doc, p.get("id")) mass_style.set_active_id(doc, p.get("id"))
mass_style.regen_all_rooms(doc) mass_style.regen_all_rooms(doc)
except Exception as ex: except Exception as ex:
print("[OBERLEISTE] masse active:", ex) print("[TOOLBAR] masse active:", ex)
self._send_state(force=True) self._send_state(force=True)
elif t == "OPEN_MASSE_SETTINGS": elif t == "OPEN_MASSE_SETTINGS":
try: try:
import masse_settings import masse_settings
masse_settings.open_as_window() masse_settings.open_as_window()
except Exception as ex: except Exception as ex:
print("[OBERLEISTE] open masse:", ex) print("[TOOLBAR] open masse:", ex)
elif t == "OPEN_PROJECT_SETTINGS": elif t == "OPEN_PROJECT_SETTINGS":
# Delegiert an EBENEN-Bridge (sie haelt die Satellite-Logik fuer # Delegiert an EBENEN-Bridge (sie haelt die Satellite-Logik fuer
# Projekt-Settings + Library). # Projekt-Settings + Library).
try: try:
eb = sc.sticky.get("ebenen_bridge_ref") eb = sc.sticky.get("ebenen_bridge_ref")
if eb is not None: eb._open_project_settings() if eb is not None: eb._open_project_settings()
else: print("[OBERLEISTE] open project-settings: ebenen_bridge_ref nicht da") else: print("[TOOLBAR] open project-settings: ebenen_bridge_ref nicht da")
except Exception as ex: except Exception as ex:
print("[OBERLEISTE] open project-settings:", ex) print("[TOOLBAR] open project-settings:", ex)
elif t == "OPEN_LIBRARY": elif t == "OPEN_LIBRARY":
try: try:
eb = sc.sticky.get("ebenen_bridge_ref") eb = sc.sticky.get("ebenen_bridge_ref")
if eb is not None: eb._open_library() if eb is not None: eb._open_library()
else: print("[OBERLEISTE] open library: ebenen_bridge_ref nicht da") else: print("[TOOLBAR] open library: ebenen_bridge_ref nicht da")
except Exception as ex: except Exception as ex:
print("[OBERLEISTE] open library:", ex) print("[TOOLBAR] open library:", ex)
# --- Darstellung (SIA-400 LoD globaler Override) ----------------- # --- Darstellung (SIA-400 LoD globaler Override) -----------------
elif t == "SET_DARSTELLUNG": elif t == "SET_DARSTELLUNG":
@@ -1600,7 +1600,7 @@ class OberleisteBridge(panel_base.BaseBridge):
elemente.set_aktive_darstellung(doc, new_v) elemente.set_aktive_darstellung(doc, new_v)
elemente.regenerate_all_oeffnungen(doc) elemente.regenerate_all_oeffnungen(doc)
except Exception as ex: except Exception as ex:
print("[OBERLEISTE] set darstellung:", ex) print("[TOOLBAR] set darstellung:", ex)
self._send_state(force=True) self._send_state(force=True)
# --- Display-Mode ----------------------------------------------- # --- Display-Mode -----------------------------------------------
@@ -1646,7 +1646,7 @@ class OberleisteBridge(panel_base.BaseBridge):
if b is not None: if b is not None:
b._send_state() b._send_state()
except Exception as ex: except Exception as ex:
print("[OBERLEISTE] notify overrides:", ex) print("[TOOLBAR] notify overrides:", ex)
elif t == "SAVE_OVERRIDES_PRESET": elif t == "SAVE_OVERRIDES_PRESET":
# Quick-Save direkt aus der Topbar: aktuelle Doc-Rules unter # Quick-Save direkt aus der Topbar: aktuelle Doc-Rules unter
# gegebenem Namen ablegen und sofort als activePreset markieren. # gegebenem Namen ablegen und sofort als activePreset markieren.
@@ -1667,13 +1667,13 @@ class OberleisteBridge(panel_base.BaseBridge):
if b is not None: if b is not None:
b._send_state() b._send_state()
except Exception as ex: except Exception as ex:
print("[OBERLEISTE] notify overrides:", ex) print("[TOOLBAR] notify overrides:", ex)
elif t == "OPEN_OVERRIDES_PANEL": elif t == "OPEN_OVERRIDES_PANEL":
try: try:
import overrides_panel import overrides_panel
overrides_panel.open_as_window() overrides_panel.open_as_window()
except Exception as ex: except Exception as ex:
print("[OBERLEISTE] open_as_window Overrides:", ex) print("[TOOLBAR] open_as_window Overrides:", ex)
# --- Ebenenkombinationen ---------------------------------------- # --- Ebenenkombinationen ----------------------------------------
elif t == "PICK_LAYER_COMBINATION": elif t == "PICK_LAYER_COMBINATION":
@@ -1701,7 +1701,7 @@ class OberleisteBridge(panel_base.BaseBridge):
elif t == "OPEN_LAYER_COMBINATIONS_DIALOG": elif t == "OPEN_LAYER_COMBINATIONS_DIALOG":
try: rhinopanel.open_layer_combinations_window() try: rhinopanel.open_layer_combinations_window()
except Exception as ex: except Exception as ex:
print("[OBERLEISTE] open layer-combinations:", ex) print("[TOOLBAR] open layer-combinations:", ex)
# --- Referenzlinien-Sichtbarkeit togglen ------------------------ # --- Referenzlinien-Sichtbarkeit togglen ------------------------
# Shortcut fuer die Layer-Sichtbarkeit der Referenzlinien-Ebene # Shortcut fuer die Layer-Sichtbarkeit der Referenzlinien-Ebene
@@ -1713,7 +1713,7 @@ class OberleisteBridge(panel_base.BaseBridge):
doc = Rhino.RhinoDoc.ActiveDoc doc = Rhino.RhinoDoc.ActiveDoc
if doc is None: return if doc is None: return
want_visible = bool(p.get("visible")) want_visible = bool(p.get("visible"))
print("[OBERLEISTE] TOGGLE_REFERENZLINIEN -> {}".format(want_visible)) print("[TOOLBAR] TOGGLE_REFERENZLINIEN -> {}".format(want_visible))
# Keyword-driven: alle Ebenen mit Namen 'Referenz' im JSON # Keyword-driven: alle Ebenen mit Namen 'Referenz' im JSON
# finden (rekursiv), deren Codes sammeln, dann ALLE Rhino- # finden (rekursiv), deren Codes sammeln, dann ALLE Rhino-
@@ -1747,7 +1747,7 @@ class OberleisteBridge(panel_base.BaseBridge):
doc.Strings.SetString("dossier_ebenen", doc.Strings.SetString("dossier_ebenen",
_json.dumps(ebenen, ensure_ascii=False)) _json.dumps(ebenen, ensure_ascii=False))
except Exception: pass except Exception: pass
print("[OBERLEISTE] Referenz-Codes gefunden: {}".format(codes)) print("[TOOLBAR] Referenz-Codes gefunden: {}".format(codes))
# Rhino-Layer fuer jeden Code toggeln (Praefix-Match) # Rhino-Layer fuer jeden Code toggeln (Praefix-Match)
n_toggled = 0 n_toggled = 0
@@ -1763,7 +1763,7 @@ class OberleisteBridge(panel_base.BaseBridge):
doc.Layers.Modify(layer, i, True) doc.Layers.Modify(layer, i, True)
n_toggled += 1 n_toggled += 1
except Exception: pass except Exception: pass
print("[OBERLEISTE] {} Rhino-Layer getoggelt".format(n_toggled)) print("[TOOLBAR] {} Rhino-Layer getoggelt".format(n_toggled))
try: doc.Views.Redraw() try: doc.Views.Redraw()
except Exception: pass except Exception: pass
@@ -1771,7 +1771,7 @@ class OberleisteBridge(panel_base.BaseBridge):
rhinopanel._broadcast_state(doc) rhinopanel._broadcast_state(doc)
self._send_state(force=True) self._send_state(force=True)
except Exception as ex: except Exception as ex:
print("[OBERLEISTE] TOGGLE_REFERENZLINIEN:", ex) print("[TOOLBAR] TOGGLE_REFERENZLINIEN:", ex)
# --- Anordnen (DisplayOrder Z-Stack) ---------------------------- # --- Anordnen (DisplayOrder Z-Stack) ----------------------------
# Nutzt Rhinos native _BringToFront / _BringForward / _SendBackward # Nutzt Rhinos native _BringToFront / _BringForward / _SendBackward
@@ -1797,7 +1797,7 @@ class OberleisteBridge(panel_base.BaseBridge):
Rhino.RhinoApp.SendKeystrokes("\x1b", False) Rhino.RhinoApp.SendKeystrokes("\x1b", False)
Rhino.RhinoApp.RunScript(cmd, False) Rhino.RhinoApp.RunScript(cmd, False)
except Exception as ex: except Exception as ex:
print("[OBERLEISTE] arrange {}: {}".format(cmd, ex)) print("[TOOLBAR] arrange {}: {}".format(cmd, ex))
# --- Command-Line Integration ----------------------------------- # --- Command-Line Integration -----------------------------------
elif t == "RUN_COMMAND": elif t == "RUN_COMMAND":
@@ -1815,7 +1815,7 @@ class OberleisteBridge(panel_base.BaseBridge):
Rhino.RhinoApp.SendKeystrokes("\x1b", False) Rhino.RhinoApp.SendKeystrokes("\x1b", False)
Rhino.RhinoApp.RunScript(cmd, False) Rhino.RhinoApp.RunScript(cmd, False)
except Exception as ex: except Exception as ex:
print("[OBERLEISTE] RunScript-Fehler:", ex) print("[TOOLBAR] RunScript-Fehler:", ex)
elif t == "SEND_KEYS": elif t == "SEND_KEYS":
text = p.get("text") or "" text = p.get("text") or ""
append_enter = bool(p.get("enter", True)) append_enter = bool(p.get("enter", True))
@@ -1825,7 +1825,7 @@ class OberleisteBridge(panel_base.BaseBridge):
Rhino.RhinoApp.SendKeystrokes("\x1b", False) Rhino.RhinoApp.SendKeystrokes("\x1b", False)
Rhino.RhinoApp.SendKeystrokes(text, append_enter) Rhino.RhinoApp.SendKeystrokes(text, append_enter)
except Exception as ex: except Exception as ex:
print("[OBERLEISTE] SendKeystrokes-Fehler:", ex) print("[TOOLBAR] SendKeystrokes-Fehler:", ex)
elif t == "CANCEL_COMMAND": elif t == "CANCEL_COMMAND":
try: try:
# Doppel-ESC: einmal um Eingabe-Buffer zu clearen, einmal um # Doppel-ESC: einmal um Eingabe-Buffer zu clearen, einmal um
@@ -1927,7 +1927,7 @@ class OberleisteBridge(panel_base.BaseBridge):
sc.sticky[key] = snap sc.sticky[key] = snap
try: doc.Views.Redraw() try: doc.Views.Redraw()
except Exception: pass except Exception: pass
print("[OBERLEISTE] Print AN: {} Referenz-Layer ausgeblendet".format(len(snap))) print("[TOOLBAR] Print AN: {} Referenz-Layer ausgeblendet".format(len(snap)))
else: else:
# Restore # Restore
snap = sc.sticky.get(key) or {} snap = sc.sticky.get(key) or {}
@@ -1946,7 +1946,7 @@ class OberleisteBridge(panel_base.BaseBridge):
except Exception: pass except Exception: pass
try: doc.Views.Redraw() try: doc.Views.Redraw()
except Exception: pass except Exception: pass
print("[OBERLEISTE] Print AUS: {} Referenz-Layer-Sichtbarkeit restored".format(n)) print("[TOOLBAR] Print AUS: {} Referenz-Layer-Sichtbarkeit restored".format(n))
def _send_state(self, force=False): def _send_state(self, force=False):
doc, vp = massstab._active_vp() doc, vp = massstab._active_vp()
@@ -2116,10 +2116,10 @@ class OberleisteBridge(panel_base.BaseBridge):
# Re-Apply vom Launcher-Pending — sonst triggert es eine # Re-Apply vom Launcher-Pending — sonst triggert es eine
# zweite Re-Mount-Welle ALLER Panels. # zweite Re-Mount-Welle ALLER Panels.
if sc.sticky.get("_dossier_layout_applied"): if sc.sticky.get("_dossier_layout_applied"):
print("[OBERLEISTE] pendingApplyLayout '{}' — Cold-Start " print("[TOOLBAR] pendingApplyLayout '{}' — Cold-Start "
"hat in dieser Session bereits applied, skip".format(pend_layout)) "hat in dieser Session bereits applied, skip".format(pend_layout))
else: else:
print("[OBERLEISTE] pendingApplyLayout:", pend_layout) print("[TOOLBAR] pendingApplyLayout:", pend_layout)
_apply_window_layout(pend_layout) _apply_window_layout(pend_layout)
sc.sticky["_dossier_layout_applied"] = True sc.sticky["_dossier_layout_applied"] = True
cfg.pop("pendingApplyLayout", None) cfg.pop("pendingApplyLayout", None)
@@ -2127,14 +2127,14 @@ class OberleisteBridge(panel_base.BaseBridge):
if cfg.get("pendingApplyViewColors"): if cfg.get("pendingApplyViewColors"):
if _apply_viewport_colors(cfg): if _apply_viewport_colors(cfg):
print("[OBERLEISTE] pendingApplyViewColors: applied") print("[TOOLBAR] pendingApplyViewColors: applied")
cfg["pendingApplyViewColors"] = False cfg["pendingApplyViewColors"] = False
mutated = True mutated = True
modes = cfg.get("pendingImportDisplayModes") or [] modes = cfg.get("pendingImportDisplayModes") or []
if isinstance(modes, list) and modes: if isinstance(modes, list) and modes:
n = _import_display_modes(modes) n = _import_display_modes(modes)
print("[OBERLEISTE] pendingImportDisplayModes: {} importiert".format(n)) print("[TOOLBAR] pendingImportDisplayModes: {} importiert".format(n))
cfg["pendingImportDisplayModes"] = [] cfg["pendingImportDisplayModes"] = []
mutated = True mutated = True
@@ -2164,21 +2164,21 @@ class OberleisteBridge(panel_base.BaseBridge):
}) })
if clean: if clean:
cfg["layerSchema"] = clean cfg["layerSchema"] = clean
print("[OBERLEISTE] Ebenen-Export: {} Sublayer " print("[TOOLBAR] Ebenen-Export: {} Sublayer "
"ins Launcher-Schema geschrieben".format(len(clean))) "ins Launcher-Schema geschrieben".format(len(clean)))
else: else:
print("[OBERLEISTE] Ebenen-Export: doc.Strings hatte " print("[TOOLBAR] Ebenen-Export: doc.Strings hatte "
"keine gueltigen Ebenen") "keine gueltigen Ebenen")
else: else:
print("[OBERLEISTE] Ebenen-Export: doc.Strings ['dossier_ebenen'] leer") print("[TOOLBAR] Ebenen-Export: doc.Strings ['dossier_ebenen'] leer")
except Exception as ex: except Exception as ex:
print("[OBERLEISTE] Ebenen-Export Fehler:", ex) print("[TOOLBAR] Ebenen-Export Fehler:", ex)
cfg["pendingExportEbenen"] = False cfg["pendingExportEbenen"] = False
mutated = True mutated = True
if mutated: _settings_save(cfg) if mutated: _settings_save(cfg)
except Exception as ex: except Exception as ex:
print("[OBERLEISTE] check_pending_launcher_signals:", ex) print("[TOOLBAR] check_pending_launcher_signals:", ex)
def tick_idle(self): def tick_idle(self):
# Command-Prompt aendert sich oft schnell -> separater Pfad: wenn sich # Command-Prompt aendert sich oft schnell -> separater Pfad: wenn sich
@@ -2227,7 +2227,7 @@ def _open_dossier_settings_panel():
) )
sc.sticky["_dossier_settings_form"] = form sc.sticky["_dossier_settings_form"] = form
except Exception as ex: except Exception as ex:
print("[OBERLEISTE] open_dossier_settings_panel:", ex) print("[TOOLBAR] open_dossier_settings_panel:", ex)
def _reload_all_panel_langs(): def _reload_all_panel_langs():
@@ -2241,9 +2241,9 @@ def _reload_all_panel_langs():
try: try:
panel_base.load_inline(val._wv, val.mode) panel_base.load_inline(val._wv, val.mode)
except Exception as ex: except Exception as ex:
print("[OBERLEISTE] reload_lang ({}): {}".format(key, ex)) print("[TOOLBAR] reload_lang ({}): {}".format(key, ex))
except Exception as ex: except Exception as ex:
print("[OBERLEISTE] _reload_all_panel_langs:", ex) print("[TOOLBAR] _reload_all_panel_langs:", ex)
# --- Listener-Hookup -------------------------------------------------------- # --- Listener-Hookup --------------------------------------------------------
@@ -2273,14 +2273,14 @@ def _install_listeners(bridge):
doc = getattr(e, "Document", None) or Rhino.RhinoDoc.ActiveDoc doc = getattr(e, "Document", None) or Rhino.RhinoDoc.ActiveDoc
_save_thumbnail(doc) _save_thumbnail(doc)
except Exception as ex: except Exception as ex:
print("[OBERLEISTE] on_end_save:", ex) print("[TOOLBAR] on_end_save:", ex)
Rhino.RhinoApp.Idle += on_idle Rhino.RhinoApp.Idle += on_idle
Rhino.RhinoDoc.ActiveDocumentChanged += on_view_change Rhino.RhinoDoc.ActiveDocumentChanged += on_view_change
try: Rhino.RhinoDoc.EndSaveDocument += on_end_save try: Rhino.RhinoDoc.EndSaveDocument += on_end_save
except Exception as ex: print("[OBERLEISTE] EndSaveDocument-Hook:", ex) except Exception as ex: print("[TOOLBAR] EndSaveDocument-Hook:", ex)
sc.sticky[flag] = True sc.sticky[flag] = True
print("[OBERLEISTE] Listener active") print("[TOOLBAR] Listener active")
def _bridge_factory(): def _bridge_factory():
@@ -2299,7 +2299,7 @@ for _name, _guid, _tmpl, _fallback in _DOSSIER_DISPLAY_MODES:
try: try:
_ensure_dossier_display_mode(_name, _guid, _tmpl, _fallback) _ensure_dossier_display_mode(_name, _guid, _tmpl, _fallback)
except Exception as _ex: except Exception as _ex:
print("[OBERLEISTE] ensure {}: {}".format(_name, _ex)) print("[TOOLBAR] ensure {}: {}".format(_name, _ex))
try: try:
panel_base._t_mark("display_modes", "oberleiste", _t_dm_start) panel_base._t_mark("display_modes", "oberleiste", _t_dm_start)
except Exception: pass except Exception: pass
+3 -3
View File
@@ -45,11 +45,11 @@ class WerkzeugeBridge(panel_base.BaseBridge):
if cmd.startswith("_") and "\n" not in cmd and ";" not in cmd: if cmd.startswith("_") and "\n" not in cmd and ";" not in cmd:
try: try:
Rhino.RhinoApp.RunScript(cmd, False) Rhino.RhinoApp.RunScript(cmd, False)
print("[WERKZEUGE] {}".format(cmd)) print("[TOOLS] {}".format(cmd))
except Exception as ex: except Exception as ex:
print("[WERKZEUGE] RunScript-Fehler:", ex) print("[TOOLS] RunScript-Fehler:", ex)
else: else:
print("[WERKZEUGE] Befehl ignoriert (kein '_' Praefix oder unsicher):", cmd) print("[TOOLS] Befehl ignoriert (kein '_' Praefix oder unsicher):", cmd)
def _bridge_factory(): def _bridge_factory():
+3 -3
View File
@@ -96,7 +96,7 @@ class _TreppeEndpointConduit(rd.DisplayConduit):
try: e.Display.DrawDot(pt, "", _MARKER_FILL, _MARKER_BORDER) try: e.Display.DrawDot(pt, "", _MARKER_FILL, _MARKER_BORDER)
except Exception: pass except Exception: pass
except Exception as ex: except Exception as ex:
print("[TREPPE_GRIPS] DrawForeground:", ex) print("[STAIR-GRIPS] DrawForeground:", ex)
_STICKY_CONDUIT = "_dossier_treppe_grips_conduit" _STICKY_CONDUIT = "_dossier_treppe_grips_conduit"
@@ -113,6 +113,6 @@ def install_handlers():
conduit = _TreppeEndpointConduit() conduit = _TreppeEndpointConduit()
conduit.Enabled = True conduit.Enabled = True
sc.sticky[_STICKY_CONDUIT] = conduit sc.sticky[_STICKY_CONDUIT] = conduit
print("[TREPPE_GRIPS] Endpoint conduit active") print("[STAIR-GRIPS] Endpoint conduit active")
except Exception as ex: except Exception as ex:
print("[TREPPE_GRIPS] install:", ex) print("[STAIR-GRIPS] install:", ex)
+6 -6
View File
@@ -133,7 +133,7 @@ def _replace_axis_vertex(doc, axis_obj, vertex_idx, new_pt):
new_curve = rg.PolylineCurve(rg.Polyline(pts)) new_curve = rg.PolylineCurve(rg.Polyline(pts))
return doc.Objects.Replace(axis_obj.Id, new_curve) return doc.Objects.Replace(axis_obj.Id, new_curve)
except Exception as ex: except Exception as ex:
print("[WAND_GRIPS] replace vertex:", ex) print("[WALL-GRIPS] replace vertex:", ex)
return False return False
@@ -201,7 +201,7 @@ class _EndpointConduit(rd.DisplayConduit):
e.Display.DrawLine(line, _MARKER_HOVER, 2) e.Display.DrawLine(line, _MARKER_HOVER, 2)
except Exception: pass except Exception: pass
except Exception as ex: except Exception as ex:
print("[WAND_GRIPS] DrawForeground:", ex) print("[WALL-GRIPS] DrawForeground:", ex)
# --- Mouse-Handler -------------------------------------------------------- # --- Mouse-Handler --------------------------------------------------------
@@ -268,7 +268,7 @@ class _EndpointMouseHandler(Rhino.UI.MouseCallback):
axis, vidx, world_pt = hit axis, vidx, world_pt = hit
self._start_drag(view.Document, axis, vidx, world_pt) self._start_drag(view.Document, axis, vidx, world_pt)
except Exception as ex: except Exception as ex:
print("[WAND_GRIPS] OnMouseDown:", ex) print("[WALL-GRIPS] OnMouseDown:", ex)
def _start_drag(self, doc, axis, vertex_idx, anchor_pt): def _start_drag(self, doc, axis, vertex_idx, anchor_pt):
"""Startet eine Rhino-GetPoint-Interaktion um den Vertex zu """Startet eine Rhino-GetPoint-Interaktion um den Vertex zu
@@ -319,7 +319,7 @@ class _EndpointMouseHandler(Rhino.UI.MouseCallback):
new_pt = gp.Point() new_pt = gp.Point()
_replace_axis_vertex(doc, axis, vertex_idx, new_pt) _replace_axis_vertex(doc, axis, vertex_idx, new_pt)
except Exception as ex: except Exception as ex:
print("[WAND_GRIPS] _start_drag:", ex) print("[WALL-GRIPS] _start_drag:", ex)
finally: finally:
self.conduit.drag_key = None self.conduit.drag_key = None
self.conduit.drag_preview = None self.conduit.drag_preview = None
@@ -354,6 +354,6 @@ def install_handlers():
handler.Enabled = True handler.Enabled = True
sc.sticky[_STICKY_CONDUIT] = conduit sc.sticky[_STICKY_CONDUIT] = conduit
sc.sticky[_STICKY_HANDLER] = handler sc.sticky[_STICKY_HANDLER] = handler
print("[WAND_GRIPS] Endpoint conduit + mouse handler active") print("[WALL-GRIPS] Endpoint conduit + mouse handler active")
except Exception as ex: except Exception as ex:
print("[WAND_GRIPS] install:", ex) print("[WALL-GRIPS] install:", ex)