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:
+73
-73
@@ -50,7 +50,7 @@ def _sync_plot_color_to_display(attrs):
|
||||
else:
|
||||
attrs.PlotColorSource = _PLOT_FROM_LAYER
|
||||
except Exception as ex:
|
||||
print("[GESTALTUNG] sync plot-color:", ex)
|
||||
print("[STYLES] sync plot-color:", ex)
|
||||
|
||||
_FILL_KEY = "ebenen_fill_hatch_id"
|
||||
_FILL_SOURCE_KEY = "ebenen_fill_source" # "layer" oder "object"
|
||||
@@ -101,7 +101,7 @@ def _save_pending_hatch(curve_id, hatch_obj):
|
||||
"timestamp": time.time(),
|
||||
}
|
||||
except Exception as ex:
|
||||
print("[GESTALTUNG] save pending-hatch err:", ex)
|
||||
print("[STYLES] save pending-hatch err:", ex)
|
||||
return
|
||||
m = sc.sticky.get("gestaltung_pending_hatch")
|
||||
if not isinstance(m, dict):
|
||||
@@ -130,7 +130,7 @@ def _restore_hatch_from_pending(doc, obj, meta):
|
||||
new_hatches = rg.Hatch.Create(geom,
|
||||
meta["pattern_idx"], meta["rotation"], meta["scale"], 0.0)
|
||||
except Exception as ex:
|
||||
print("[GESTALTUNG] restore Hatch.Create:", ex)
|
||||
print("[STYLES] restore Hatch.Create:", ex)
|
||||
return False
|
||||
if not new_hatches or len(new_hatches) == 0: return False
|
||||
new_attrs = Rhino.DocObjects.ObjectAttributes()
|
||||
@@ -150,7 +150,7 @@ def _restore_hatch_from_pending(doc, obj, meta):
|
||||
try:
|
||||
hatch_id = doc.Objects.AddHatch(new_hatches[0], new_attrs)
|
||||
except Exception as ex:
|
||||
print("[GESTALTUNG] restore AddHatch:", ex)
|
||||
print("[STYLES] restore AddHatch:", ex)
|
||||
return False
|
||||
if hatch_id == System.Guid.Empty: return False
|
||||
try:
|
||||
@@ -173,7 +173,7 @@ def _color_to_hex(c):
|
||||
try:
|
||||
return "#{:02x}{:02x}{:02x}".format(int(c.R), int(c.G), int(c.B))
|
||||
except Exception as ex:
|
||||
print("[GESTALTUNG] color-hex Fehler:", ex)
|
||||
print("[STYLES] color-hex Fehler:", ex)
|
||||
return None
|
||||
|
||||
|
||||
@@ -291,17 +291,17 @@ def _ebene_fill_for_layer(doc, layer):
|
||||
except Exception:
|
||||
code = None
|
||||
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", "?")))
|
||||
return None
|
||||
raw = doc.Strings.GetValue("dossier_ebenen")
|
||||
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
|
||||
try:
|
||||
ebenen = json.loads(raw)
|
||||
except Exception as ex:
|
||||
print("[GESTALTUNG] _ebene_fill_for_layer: json-Fehler:", ex)
|
||||
print("[STYLES] _ebene_fill_for_layer: json-Fehler:", ex)
|
||||
return None
|
||||
if not isinstance(ebenen, list): return None
|
||||
# Rekursiv durch Tree — Sub-Ebenen sind in children verschachtelt
|
||||
@@ -320,7 +320,7 @@ def _ebene_fill_for_layer(doc, layer):
|
||||
if True:
|
||||
f = e.get("fill")
|
||||
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
|
||||
# lw: Strichstaerke der Hatch-Linien in mm. None = "wie Stift der Ebene"
|
||||
# (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,
|
||||
"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
|
||||
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
|
||||
|
||||
|
||||
@@ -400,7 +400,7 @@ def _apply_ebene_fill(doc, obj):
|
||||
try:
|
||||
hatches = rg.Hatch.Create(geom, pattern_idx, rot_rad, scale_v, 0.0)
|
||||
except Exception as ex:
|
||||
print("[GESTALTUNG] Auto-Fill Hatch.Create:", ex)
|
||||
print("[STYLES] Auto-Fill Hatch.Create:", ex)
|
||||
return False
|
||||
if not hatches or len(hatches) == 0: return False
|
||||
|
||||
@@ -429,7 +429,7 @@ def _apply_ebene_fill(doc, obj):
|
||||
try:
|
||||
hatch_id = doc.Objects.AddHatch(hatches[0], new_attrs)
|
||||
except Exception as ex:
|
||||
print("[GESTALTUNG] Auto-Fill AddHatch:", ex)
|
||||
print("[STYLES] Auto-Fill AddHatch:", ex)
|
||||
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:
|
||||
massstab.post_create_hatch_scale(doc, h_obj, float(fill["scale"]) or 1.0)
|
||||
except Exception as ex:
|
||||
print("[GESTALTUNG] post_create_hatch_scale (auto-fill):", ex)
|
||||
print("[STYLES] post_create_hatch_scale (auto-fill):", ex)
|
||||
|
||||
try:
|
||||
ca = obj.Attributes.Duplicate()
|
||||
@@ -449,7 +449,7 @@ def _apply_ebene_fill(doc, obj):
|
||||
try: doc.Objects.ModifyAttributes(obj, ca, True)
|
||||
finally: _processing.discard(obj.Id)
|
||||
except Exception as ex:
|
||||
print("[GESTALTUNG] Auto-Fill UserString:", ex)
|
||||
print("[STYLES] Auto-Fill UserString:", ex)
|
||||
|
||||
_link_curve_hatch(obj.Id, hatch_id)
|
||||
return True
|
||||
@@ -533,7 +533,7 @@ def refresh_layer_fills(doc):
|
||||
targets.append((obj, owner))
|
||||
owner_ids.add(str(owner.Id))
|
||||
except Exception as ex:
|
||||
print("[GESTALTUNG] refresh_layer_fills scan:", ex)
|
||||
print("[STYLES] refresh_layer_fills scan:", ex)
|
||||
return 0
|
||||
|
||||
updated = 0
|
||||
@@ -602,9 +602,9 @@ def refresh_layer_fills(doc):
|
||||
if h_obj is not None:
|
||||
_ms.post_create_hatch_scale(doc, h_obj, scale_v)
|
||||
except Exception as _ex:
|
||||
print("[GESTALTUNG] post_create_hatch_scale (refresh):", _ex)
|
||||
print("[STYLES] post_create_hatch_scale (refresh):", _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
|
||||
try:
|
||||
@@ -641,7 +641,7 @@ def refresh_layer_fills(doc):
|
||||
_processing.discard(refreshed.Id)
|
||||
color_updated += 1
|
||||
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)
|
||||
try:
|
||||
@@ -683,7 +683,7 @@ def refresh_layer_fills(doc):
|
||||
finally:
|
||||
_processing.discard(refreshed.Id)
|
||||
except Exception as ex:
|
||||
print("[GESTALTUNG] refresh lw-sync:", ex)
|
||||
print("[STYLES] refresh lw-sync:", ex)
|
||||
|
||||
# --- 3) Auto-Fill nachziehen fuer Kurven ohne Hatch ---
|
||||
added = 0
|
||||
@@ -731,13 +731,13 @@ def refresh_layer_fills(doc):
|
||||
if _apply_ebene_fill(doc, obj):
|
||||
added += 1
|
||||
except Exception as ex:
|
||||
print("[GESTALTUNG] refresh auto-fill:", ex)
|
||||
print("[STYLES] refresh auto-fill:", 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:
|
||||
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))
|
||||
return updated + color_updated + added
|
||||
|
||||
@@ -791,13 +791,13 @@ def repair_plot_colors(doc):
|
||||
_processing.discard(obj.Id)
|
||||
fixed += 1
|
||||
except Exception as ex:
|
||||
print("[GESTALTUNG] repair_plot_colors entry:", ex)
|
||||
print("[STYLES] repair_plot_colors entry:", ex)
|
||||
except Exception as ex:
|
||||
print("[GESTALTUNG] repair_plot_colors scan:", ex)
|
||||
print("[STYLES] repair_plot_colors scan:", ex)
|
||||
return 0
|
||||
if fixed:
|
||||
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
|
||||
|
||||
|
||||
@@ -1137,7 +1137,7 @@ def _selection_summary(doc):
|
||||
"fillRotation": single(fill_rots),
|
||||
"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("color"), result.get("layerColor")))
|
||||
return result
|
||||
@@ -1153,7 +1153,7 @@ class GestaltungBridge(panel_base.BaseBridge):
|
||||
before = doc.Linetypes.Count
|
||||
ok = _force_load_linetypes(doc)
|
||||
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 = []
|
||||
for i in range(after):
|
||||
lt = doc.Linetypes[i]
|
||||
@@ -1163,15 +1163,15 @@ class GestaltungBridge(panel_base.BaseBridge):
|
||||
try: nm = lt.Name
|
||||
except Exception: nm = "?"
|
||||
entries.append("[{}] {} ({})".format(i, nm, flags))
|
||||
print("[GESTALTUNG] {}".format(" | ".join(entries)))
|
||||
print("[STYLES] {}".format(" | ".join(entries)))
|
||||
except Exception as ex:
|
||||
print("[GESTALTUNG] Linetype-Diagnose:", ex)
|
||||
print("[STYLES] Linetype-Diagnose:", ex)
|
||||
# One-Shot Repair: aeltere Hatches (vor dem PlotColor-Fix angelegt)
|
||||
# bekommen ihre Print-Attribute mit Display synchronisiert.
|
||||
try:
|
||||
repair_plot_colors(doc)
|
||||
except Exception as ex:
|
||||
print("[GESTALTUNG] repair on ready:", ex)
|
||||
print("[STYLES] repair on ready:", ex)
|
||||
self._send_selection()
|
||||
|
||||
def handle(self, data):
|
||||
@@ -1222,7 +1222,7 @@ class GestaltungBridge(panel_base.BaseBridge):
|
||||
try:
|
||||
self.send("SELECTION", _selection_summary(doc))
|
||||
except Exception as ex:
|
||||
print("[GESTALTUNG] Selection:", ex)
|
||||
print("[STYLES] Selection:", ex)
|
||||
|
||||
# ---- Attribute-Setter ------------------------------------------------
|
||||
|
||||
@@ -1294,7 +1294,7 @@ class GestaltungBridge(panel_base.BaseBridge):
|
||||
applied = True
|
||||
break
|
||||
except Exception as ex:
|
||||
print("[GESTALTUNG] attr {} fehler: {}".format(prop, ex))
|
||||
print("[STYLES] attr {} fehler: {}".format(prop, ex))
|
||||
# Versuch 2: direkt auf RhinoObject
|
||||
if not applied:
|
||||
for prop in ("LinetypePatternLengthScale", "LinetypeScale"):
|
||||
@@ -1304,14 +1304,14 @@ class GestaltungBridge(panel_base.BaseBridge):
|
||||
applied = True
|
||||
break
|
||||
except Exception as ex:
|
||||
print("[GESTALTUNG] obj {} fehler: {}".format(prop, ex))
|
||||
print("[STYLES] obj {} fehler: {}".format(prop, ex))
|
||||
if applied:
|
||||
ok += 1
|
||||
doc.Views.Redraw()
|
||||
if ok == 0:
|
||||
print("[GESTALTUNG] Linetype-Scale nicht unterstuetzt (Rhino-Version?)")
|
||||
print("[STYLES] Linetype-Scale nicht unterstuetzt (Rhino-Version?)")
|
||||
else:
|
||||
print("[GESTALTUNG] Linetype-Scale auf {} Objekt(e) applied".format(ok))
|
||||
print("[STYLES] Linetype-Scale auf {} Objekt(e) applied".format(ok))
|
||||
self._send_selection()
|
||||
|
||||
def _set_linetype_source(self, source, name):
|
||||
@@ -1387,7 +1387,7 @@ class GestaltungBridge(panel_base.BaseBridge):
|
||||
try: doc.Objects.ModifyAttributes(obj, ca, True)
|
||||
finally: _processing.discard(obj.Id)
|
||||
except Exception as ex:
|
||||
print("[GESTALTUNG] _set_fill follow-layer empty:", ex)
|
||||
print("[STYLES] _set_fill follow-layer empty:", ex)
|
||||
continue
|
||||
else:
|
||||
pattern_idx = doc.HatchPatterns.Find(fill["pattern"], True)
|
||||
@@ -1460,7 +1460,7 @@ class GestaltungBridge(panel_base.BaseBridge):
|
||||
if h_obj is not None:
|
||||
_ms2.post_create_hatch_scale(doc, h_obj, scale_v)
|
||||
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
|
||||
refreshed = doc.Objects.FindId(existing_hatch.Id) or existing_hatch
|
||||
ha = refreshed.Attributes.Duplicate()
|
||||
@@ -1510,7 +1510,7 @@ class GestaltungBridge(panel_base.BaseBridge):
|
||||
if h_obj is not None:
|
||||
_ms.post_create_hatch_scale(doc, h_obj, scale_v)
|
||||
except Exception as _ex:
|
||||
print("[GESTALTUNG] post_create_hatch_scale (set_fill):", _ex)
|
||||
print("[STYLES] post_create_hatch_scale (set_fill):", _ex)
|
||||
else:
|
||||
if existing_hatch is not None and not existing_hatch.IsDeleted:
|
||||
_processing.add(existing_hatch.Id)
|
||||
@@ -1545,7 +1545,7 @@ class GestaltungBridge(panel_base.BaseBridge):
|
||||
doc = Rhino.RhinoDoc.ActiveDoc
|
||||
objs = list(doc.Objects.GetSelectedObjects(False, False))
|
||||
is_layer_source = (source == "layer")
|
||||
print("[GESTALTUNG] _set_section_style: source={} enabled={} pattern={}".format(
|
||||
print("[STYLES] _set_section_style: source={} enabled={} pattern={}".format(
|
||||
source, enabled, pattern_name))
|
||||
|
||||
# SectionStyle-Klasse + Source-Enum holen.
|
||||
@@ -1557,28 +1557,28 @@ class GestaltungBridge(panel_base.BaseBridge):
|
||||
try:
|
||||
SS = Rhino.DocObjects.SectionStyle
|
||||
except Exception as ex:
|
||||
print("[GESTALTUNG] SectionStyle-Klasse fehlt:", ex)
|
||||
print("[STYLES] SectionStyle-Klasse fehlt:", ex)
|
||||
return
|
||||
SAS = None
|
||||
for cls_name in ("ObjectSectionAttributesSource", "SectionAttributesSource"):
|
||||
try:
|
||||
SAS = getattr(Rhino.DocObjects, cls_name)
|
||||
if SAS is not None:
|
||||
print("[GESTALTUNG] Source-Enum: Rhino.DocObjects.{}".format(cls_name))
|
||||
print("[STYLES] Source-Enum: Rhino.DocObjects.{}".format(cls_name))
|
||||
break
|
||||
except Exception: pass
|
||||
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):
|
||||
o = objs[0]
|
||||
for meth in ("SetCustomSectionStyle", "RemoveCustomSectionStyle",
|
||||
"HasCustomSectionStyle", "GetCustomSectionStyle"):
|
||||
print("[GESTALTUNG] RhinoObject.{}: {}".format(
|
||||
print("[STYLES] RhinoObject.{}: {}".format(
|
||||
meth, hasattr(o, meth)))
|
||||
try:
|
||||
a = o.Attributes
|
||||
for meth in ("SetCustomSectionStyle", "RemoveCustomSectionStyle"):
|
||||
print("[GESTALTUNG] Attributes.{}: {}".format(
|
||||
print("[STYLES] Attributes.{}: {}".format(
|
||||
meth, hasattr(a, meth)))
|
||||
except Exception: pass
|
||||
self._ss_api_logged = True
|
||||
@@ -1616,13 +1616,13 @@ class GestaltungBridge(panel_base.BaseBridge):
|
||||
try:
|
||||
a.SectionAttributesSource = SAS.FromObject
|
||||
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)
|
||||
_log_post(obj, "Attributes.SetCustomSectionStyle+FromObject",
|
||||
ok_modify)
|
||||
return "Attributes.SetCustomSectionStyle"
|
||||
except Exception as ex:
|
||||
print("[GESTALTUNG] attr.SetCustomSectionStyle fail:", ex)
|
||||
print("[STYLES] attr.SetCustomSectionStyle fail:", ex)
|
||||
return None
|
||||
|
||||
def _log_post(obj, via, ok_modify=None):
|
||||
@@ -1643,10 +1643,10 @@ class GestaltungBridge(panel_base.BaseBridge):
|
||||
got = "HatchIndex={}".format(getattr(css, "HatchIndex", "?"))
|
||||
except Exception as 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))
|
||||
except Exception as ex:
|
||||
print("[GESTALTUNG] post-check:", ex)
|
||||
print("[STYLES] post-check:", ex)
|
||||
|
||||
def _remove_custom(obj):
|
||||
"""Entfernt Custom-SectionStyle + schaltet Source auf FromLayer
|
||||
@@ -1659,11 +1659,11 @@ class GestaltungBridge(panel_base.BaseBridge):
|
||||
try:
|
||||
a.SectionAttributesSource = SAS.FromLayer
|
||||
except Exception as ex:
|
||||
print("[GESTALTUNG] set Source.FromLayer fail:", ex)
|
||||
print("[STYLES] set Source.FromLayer fail:", ex)
|
||||
doc.Objects.ModifyAttributes(obj, a, True)
|
||||
return "Attributes.RemoveCustomSectionStyle+FromLayer"
|
||||
except Exception as ex:
|
||||
print("[GESTALTUNG] attr.RemoveCustomSectionStyle fail:", ex)
|
||||
print("[STYLES] attr.RemoveCustomSectionStyle fail:", ex)
|
||||
return None
|
||||
|
||||
n_ok = 0
|
||||
@@ -1674,7 +1674,7 @@ class GestaltungBridge(panel_base.BaseBridge):
|
||||
if is_layer_source:
|
||||
# Custom entfernen → Layer-SectionStyle wird wirksam
|
||||
via = _remove_custom(obj)
|
||||
print("[GESTALTUNG] obj {}: remove custom via {}".format(
|
||||
print("[STYLES] obj {}: remove custom via {}".format(
|
||||
str(obj.Id)[:8], via))
|
||||
if via: n_ok += 1
|
||||
continue
|
||||
@@ -1691,7 +1691,7 @@ class GestaltungBridge(panel_base.BaseBridge):
|
||||
except Exception as ex:
|
||||
obj_col = None
|
||||
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))
|
||||
# Per-Object: frischen SectionStyle bauen wie in layer_builder
|
||||
style = SS()
|
||||
@@ -1746,11 +1746,11 @@ class GestaltungBridge(panel_base.BaseBridge):
|
||||
break
|
||||
except Exception: pass
|
||||
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))
|
||||
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()
|
||||
self._send_selection()
|
||||
|
||||
@@ -1766,7 +1766,7 @@ def _install_selection_listener(bridge):
|
||||
# Selection-Refresh wird via Idle-Event debounced:
|
||||
# Rhino feuert pro Object-Select/Deselect einzeln. Bei mass-Delete von
|
||||
# 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
|
||||
# naechsten Idle-Tick.
|
||||
def refresh(*args):
|
||||
@@ -1793,7 +1793,7 @@ def _install_selection_listener(bridge):
|
||||
Rhino.RhinoApp.Idle += on_idle_flush
|
||||
sc.sticky["_gestaltung_idle_attached"] = True
|
||||
except Exception as ex:
|
||||
print("[GESTALTUNG] Idle-Hook fail:", ex)
|
||||
print("[STYLES] Idle-Hook fail:", ex)
|
||||
|
||||
def on_replace(sender, args):
|
||||
"""Sync Curve↔Hatch bei Move/Replace:
|
||||
@@ -1838,7 +1838,7 @@ def _install_selection_listener(bridge):
|
||||
try:
|
||||
new_curves = new_obj.Geometry.Get3dCurves(True)
|
||||
except Exception as ex:
|
||||
print("[GESTALTUNG] hatch.Get3dCurves:", ex)
|
||||
print("[STYLES] hatch.Get3dCurves:", ex)
|
||||
return
|
||||
if not new_curves or len(new_curves) == 0:
|
||||
return
|
||||
@@ -1847,14 +1847,14 @@ def _install_selection_listener(bridge):
|
||||
try:
|
||||
doc2.Objects.Replace(owner_id, new_curve)
|
||||
except Exception as ex:
|
||||
print("[GESTALTUNG] hatch→curve replace:", ex)
|
||||
print("[STYLES] hatch→curve replace:", ex)
|
||||
finally:
|
||||
_processing.discard(owner_id)
|
||||
return
|
||||
hatch_id_str = a.GetUserString(_FILL_KEY)
|
||||
if not hatch_id_str:
|
||||
return
|
||||
print("[GESTALTUNG] on_replace fuer Curve mit Fill")
|
||||
print("[STYLES] on_replace fuer Curve mit Fill")
|
||||
try:
|
||||
hatch_id = System.Guid(hatch_id_str)
|
||||
except Exception:
|
||||
@@ -1885,7 +1885,7 @@ def _install_selection_listener(bridge):
|
||||
try:
|
||||
doc.Objects.Replace(hatch_id, new_hatches[0])
|
||||
except Exception as ex:
|
||||
print("[GESTALTUNG] Hatch-Update:", ex)
|
||||
print("[STYLES] Hatch-Update:", ex)
|
||||
finally:
|
||||
_processing.discard(hatch_id)
|
||||
|
||||
@@ -1927,7 +1927,7 @@ def _install_selection_listener(bridge):
|
||||
hatch_id_str = _lookup_hatch_for_curve(obj.Id)
|
||||
if not hatch_id_str:
|
||||
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
|
||||
if hatch_id_str:
|
||||
@@ -1944,10 +1944,10 @@ def _install_selection_listener(bridge):
|
||||
_processing.add(hatch_id)
|
||||
try:
|
||||
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))
|
||||
except Exception as ex:
|
||||
print("[GESTALTUNG] Hatch-Loeschen:", ex)
|
||||
print("[STYLES] Hatch-Loeschen:", ex)
|
||||
finally:
|
||||
_processing.discard(hatch_id)
|
||||
_unlink_curve(obj.Id)
|
||||
@@ -1971,7 +1971,7 @@ def _install_selection_listener(bridge):
|
||||
finally:
|
||||
_processing.discard(owner_id)
|
||||
except Exception as ex:
|
||||
print("[GESTALTUNG] Curve-Verweis aufraeumen:", ex)
|
||||
print("[STYLES] Curve-Verweis aufraeumen:", ex)
|
||||
|
||||
def on_add(sender, args):
|
||||
"""Auto-Fill bzw. Drag-Recovery: neues Objekt -> ggf. Hatch erzeugen.
|
||||
@@ -1998,10 +1998,10 @@ def _install_selection_listener(bridge):
|
||||
try:
|
||||
ok = _restore_hatch_from_pending(doc, obj, pending)
|
||||
except Exception as ex:
|
||||
print("[GESTALTUNG] on_add restore Exception:", ex)
|
||||
print("[STYLES] on_add restore Exception:", ex)
|
||||
ok = False
|
||||
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")
|
||||
if b is not None:
|
||||
try: b._send_selection()
|
||||
@@ -2015,7 +2015,7 @@ def _install_selection_listener(bridge):
|
||||
try:
|
||||
ok = _apply_ebene_fill(doc, obj)
|
||||
except Exception as ex:
|
||||
print("[GESTALTUNG] on_add Exception:", ex)
|
||||
print("[STYLES] on_add Exception:", ex)
|
||||
return
|
||||
if ok:
|
||||
b = sc.sticky.get("gestaltung_bridge")
|
||||
@@ -2060,7 +2060,7 @@ def _install_selection_listener(bridge):
|
||||
finally:
|
||||
_processing.discard(obj.Id)
|
||||
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 ---
|
||||
if old_lyr == new_lyr:
|
||||
@@ -2089,16 +2089,16 @@ def _install_selection_listener(bridge):
|
||||
doc.Objects.ModifyAttributes(hatch_obj, ha, True)
|
||||
finally:
|
||||
_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:
|
||||
print("[GESTALTUNG] on_modify_attrs:", ex)
|
||||
print("[STYLES] on_modify_attrs:", ex)
|
||||
return
|
||||
# Falls die neue Ebene andere Fill-Settings hat (Pattern/Skala/Drehung),
|
||||
# die Hatch entsprechend an die neue Layer-Definition angleichen.
|
||||
try:
|
||||
refresh_layer_fills(doc)
|
||||
except Exception as ex:
|
||||
print("[GESTALTUNG] on_modify_attrs refresh:", ex)
|
||||
print("[STYLES] on_modify_attrs refresh:", ex)
|
||||
|
||||
Rhino.RhinoDoc.SelectObjects += refresh
|
||||
Rhino.RhinoDoc.DeselectObjects += refresh
|
||||
@@ -2108,7 +2108,7 @@ def _install_selection_listener(bridge):
|
||||
Rhino.RhinoDoc.AddRhinoObject += on_add
|
||||
Rhino.RhinoDoc.ModifyObjectAttributes += on_modify_attrs
|
||||
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():
|
||||
|
||||
Reference in New Issue
Block a user