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
+44 -44
View File
@@ -104,7 +104,7 @@ def _detect_dpi():
try:
from System.Diagnostics import Process, ProcessStartInfo
except Exception as ex:
print("[MASSSTAB] auto-detect: .NET Process not available:", ex)
print("[SCALE] auto-detect: .NET Process not available:", ex)
return None
if not os.path.isfile("/usr/bin/osascript"):
# Vermutlich nicht macOS -> nichts zu detecten
@@ -137,10 +137,10 @@ def _detect_dpi():
if not finished:
try: p.Kill()
except Exception: pass
print("[MASSSTAB] auto-detect: osascript timeout")
print("[SCALE] auto-detect: osascript timeout")
return None
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
import json as _json
data = _json.loads((out or "").strip())
@@ -154,15 +154,15 @@ def _detect_dpi():
return None
dpi = px * 25.4 / mm
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
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),
mm, float(data.get("mh") or 0),
lpx, float(data.get("lpy") or 0)))
return dpi
except Exception as ex:
print("[MASSSTAB] auto-detect failed:", ex)
print("[SCALE] auto-detect failed:", ex)
return None
finally:
if script_path:
@@ -188,7 +188,7 @@ def _read_config():
if isinstance(data, dict):
cfg = data
except Exception as ex:
print("[MASSSTAB] config lesen:", ex)
print("[SCALE] config lesen:", ex)
_config_cache = cfg
return cfg
@@ -204,7 +204,7 @@ def _write_config(cfg):
_config_cache = cfg # Cache mit dem geschriebenen Stand aktualisieren
return True
except Exception as ex:
print("[MASSSTAB] config schreiben:", ex)
print("[SCALE] config schreiben:", ex)
return False
@@ -266,7 +266,7 @@ def _set_dpi(doc, value, source="manual"):
cfg["dpi_source"] = source
if not _write_config(cfg):
return False
print("[MASSSTAB] DPI={:.1f} ({}) -> {}".format(v, source, _CONFIG_PATH))
print("[SCALE] DPI={:.1f} ({}) -> {}".format(v, source, _CONFIG_PATH))
return True
@@ -421,9 +421,9 @@ def _apply_scaled_lineweights(doc, enabled, scale_n):
layer.PlotWeight = new
n_layer += 1
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:
print("[MASSSTAB] LW scale layers:", ex)
print("[SCALE] LW scale layers:", ex)
# -- Objekte -------------------------------------------------------------
try:
@@ -451,11 +451,11 @@ def _apply_scaled_lineweights(doc, enabled, scale_n):
except Exception:
pass
except Exception as ex:
print("[MASSSTAB] LW scale objects:", ex)
print("[SCALE] LW scale objects:", ex)
try: doc.Views.Redraw()
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))
# Diagnose: zeige die ersten paar Layer mit ihren echten PlotWeights
try:
@@ -463,7 +463,7 @@ def _apply_scaled_lineweights(doc, enabled, scale_n):
for layer in doc.Layers:
if layer.IsDeleted or not layer.PlotWeight: continue
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))
shown += 1
if shown >= 5: break
@@ -499,7 +499,7 @@ def write_plotweight(doc, target, value):
try:
target.PlotWeight = v * factor
except Exception as ex:
print("[MASSSTAB] write_plotweight set:", ex)
print("[SCALE] write_plotweight set:", ex)
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):
n_scaled += 1
except Exception as ex:
print("[MASSSTAB] hatch set PatternScale:", ex)
print("[SCALE] hatch set PatternScale:", ex)
except Exception as ex:
print("[MASSSTAB] hatch iter:", ex)
print("[SCALE] hatch iter:", ex)
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))
try: doc.Views.Redraw()
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))
doc.Objects.ModifyAttributes(hatch_obj, a, True)
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)
scale_n = _read_user_scale(doc, default=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
doc.Objects.Replace(h2.Id, new_g)
except Exception as ex:
print("[MASSSTAB] post_create_hatch_scale rescale:", ex)
print("[SCALE] post_create_hatch_scale rescale:", ex)
def read_plotweight(target):
@@ -656,7 +656,7 @@ def _set_lineweights_enabled(doc, enabled):
try:
doc.Strings.SetString(_LW_KEY, flag)
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
on_off = "_On" if enabled else "_Off"
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)
_apply_scaled_lineweights(doc, enabled, scale_n)
except Exception as ex:
print("[MASSSTAB] PlotWeight-Scale:", ex)
print("[SCALE] PlotWeight-Scale:", ex)
try:
for v in doc.Views: v.Redraw()
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
@@ -702,7 +702,7 @@ def _write_user_scale(doc, ratio):
try:
doc.Strings.SetString(_DOC_USER_SCALE_KEY, "{:.6f}".format(float(ratio)))
except Exception as ex:
print("[MASSSTAB] _write_user_scale:", ex)
print("[SCALE] _write_user_scale:", ex)
def _ensure_user_scales_loaded(doc):
@@ -723,7 +723,7 @@ def _ensure_user_scales_loaded(doc):
except Exception:
pass
except Exception as ex:
print("[MASSSTAB] _ensure_user_scales_loaded:", ex)
print("[SCALE] _ensure_user_scales_loaded:", ex)
_user_set_scales_loaded = True
@@ -733,7 +733,7 @@ def _write_user_scales(doc):
doc.Strings.SetString(_DOC_USER_SCALES_KEY,
json.dumps(_user_set_scales, ensure_ascii=False))
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):
@@ -778,7 +778,7 @@ def _rescale_doc_patterns(doc, factor):
doc.Objects.Replace(obj.Id, g2)
n_h += 1
except Exception as ex:
print("[MASSSTAB] hatch rescale:", ex)
print("[SCALE] hatch rescale:", ex)
# Per-Objekt Linetype-Scale (Rhino 8 Attribut)
try:
a = obj.Attributes
@@ -796,7 +796,7 @@ def _rescale_doc_patterns(doc, factor):
except Exception:
pass
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.
# Property-Namen variieren je nach Version — wir probieren.
@@ -815,7 +815,7 @@ def _rescale_doc_patterns(doc, factor):
pass
try: doc.Views.Redraw()
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 ""))
@@ -833,7 +833,7 @@ def _apply_scale(doc, vp, ratio):
if vp is None or doc is None: return False
try:
if not vp.IsParallelProjection:
print("[MASSSTAB] Viewport ist nicht parallel — Skala nicht setzbar")
print("[SCALE] Viewport ist nicht parallel — Skala nicht setzbar")
return False
except Exception:
return False
@@ -856,7 +856,7 @@ def _apply_scale(doc, vp, ratio):
# factor > 1 zoomt rein (kleineres Frustum). factor = cur_w / new_w.
factor = cur_w / new_frustum_u
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
applied = False
# 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)
applied = True
except Exception as ex3:
print("[MASSSTAB] _apply_scale alle Varianten failed:",
print("[SCALE] _apply_scale alle Varianten failed:",
ex1, ex2, ex3)
if not applied:
return False
@@ -884,12 +884,12 @@ def _apply_scale(doc, vp, ratio):
if _get_lineweights_enabled(doc):
_apply_scaled_lineweights(doc, True, float(ratio))
except Exception as ex:
print("[MASSSTAB] LW-Rescale:", ex)
print("[SCALE] LW-Rescale:", ex)
# Hatches mit sqrt(N) skalieren — moderate Anpassung.
try:
apply_scaled_hatches(doc, float(ratio))
except Exception as ex:
print("[MASSSTAB] Hatch-Rescale:", ex)
print("[SCALE] Hatch-Rescale:", ex)
# Neuen Wert ZUERST persistieren — sowohl per-Viewport (fuer das
# Dropdown, damit jeder Viewport seinen eigenen Massstab behaelt) als
# auch als globaler "letzter Wert". WICHTIG: vor dem Raumstempel-
@@ -899,22 +899,22 @@ def _apply_scale(doc, vp, ratio):
try:
_set_applied_scale_for_vp(doc, vp.Name, float(ratio))
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.
try:
import elemente as _el
n_regen = _el.regen_masstab_raeume(doc)
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:
print("[MASSSTAB] Raumstempel-Regen:", ex)
print("[SCALE] Raumstempel-Regen:", ex)
try: doc.Views.Redraw()
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)))
return True
except Exception as ex:
print("[MASSSTAB] _apply_scale:", ex)
print("[SCALE] _apply_scale:", ex)
return False
@@ -924,7 +924,7 @@ def _zoom_extents(doc, vp, selected_only=False):
if selected_only:
objs = list(doc.Objects.GetSelectedObjects(False, False))
if not objs:
print("[MASSSTAB] Keine Selektion fuer Zoom-Selection")
print("[SCALE] Keine Selektion fuer Zoom-Selection")
return False
bbox = Rhino.Geometry.BoundingBox.Empty
for o in objs:
@@ -957,7 +957,7 @@ def _zoom_extents(doc, vp, selected_only=False):
except Exception: pass
return True
except Exception as ex:
print("[MASSSTAB] _zoom_extents:", ex)
print("[SCALE] _zoom_extents:", ex)
return False
@@ -972,7 +972,7 @@ class MassstabBridge(panel_base.BaseBridge):
def _on_ready(self):
# Einmalige Bootstrap-Detection falls noch keine DPI in der Config.
try: _bootstrap_dpi()
except Exception as ex: print("[MASSSTAB] bootstrap:", ex)
except Exception as ex: print("[SCALE] bootstrap:", ex)
self._send_state(force=True)
def handle(self, data):
@@ -1014,7 +1014,7 @@ class MassstabBridge(panel_base.BaseBridge):
elif t == "DETECT_DPI":
v = _force_redetect_dpi()
if v is None:
print("[MASSSTAB] Auto-Detect: keine Bildschirminfo verfuegbar")
print("[SCALE] Auto-Detect: keine Bildschirminfo verfuegbar")
self._send_state(force=True)
elif t == "SET_LINEWEIGHTS":
doc, _ = _active_vp()
@@ -1061,7 +1061,7 @@ def _install_listeners(bridge):
Rhino.RhinoApp.Idle += on_idle
Rhino.RhinoDoc.ActiveDocumentChanged += on_view_change
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():