Audit-Cleanup: doppelte Brüstungs-Mitnahme entfernt + dead files raus
elemente.py: - Idle-Pfad Brüstungs-Mitnahme entfernt — war Duplikat zur CommandEnd-Logik und konnte je nach Reihenfolge entweder doppelt anwenden oder gar nicht (race condition mit `_elemente_wand_z_delta` Sticky-Reset). - `float(z_delta)` mit try/except für ValueError/TypeError gewrapped — vorher konnte ein korruptes Sticky-Tuple den Idle/CommandEnd-Pass crashen. - `_elemente_replace_selected_ids` wird nach Migrate consumiert (auf None gesetzt). Sonst blieb eine stale Liste hängen und beeinflusste spätere unverwandte Migrations. - Einrückung im CommandEnd-Brüstungs-Block normalisiert. Dead Files: - `rhino/startup.py3` entfernt — veraltetes Backup ohne Marker-Code für den Launcher-Splash. `rhino/startup.py` ist die aktuelle Version. - `rhino/__pycache__` aufgeräumt (war eh in .gitignore). Kein funktionales Verhalten geändert. Audit-Findings HIGH/MEDIUM bereinigt. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
+30
-51
@@ -7056,7 +7056,11 @@ def _migrate_openings_to_new_axis(wall_id, old_geom, new_geom):
|
||||
|
||||
# Selected-Snapshot vom Replace-Handler — nicht live IsSelected, weil
|
||||
# op_obj im laufenden Move-Event evtl. schon stale ist.
|
||||
# Snapshot der vom User selektierten IDs vom Replace-Handler ziehen UND
|
||||
# gleich consumen — sonst bleibt eine stale Liste im sticky und wirkt sich
|
||||
# auf spaetere unverwandte Migrations aus.
|
||||
skip_ids = sc.sticky.get("_elemente_replace_selected_ids") or set()
|
||||
sc.sticky["_elemente_replace_selected_ids"] = None
|
||||
_was_busy = sc.sticky.get(_REGEN_BUSY, False)
|
||||
sc.sticky[_REGEN_BUSY] = True
|
||||
try:
|
||||
@@ -7504,33 +7508,6 @@ def _on_idle_selection(sender, e):
|
||||
ids = list(pending)
|
||||
pending.clear()
|
||||
sc.sticky[_REGEN_BUSY] = True
|
||||
# Wand-Z-Drag-Mitnahme: Bruestungen der Oeffnungen um delta_z
|
||||
# anpassen BEVOR die Wand regen wird. Hier passiert's NACH Rhinos
|
||||
# User-Move-Operation (im Idle), daher kollidiert es nicht mehr.
|
||||
z_delta_entry = sc.sticky.get("_elemente_wand_z_delta")
|
||||
if isinstance(z_delta_entry, tuple) and len(z_delta_entry) == 2:
|
||||
wand_id, z_delta = z_delta_entry
|
||||
sc.sticky["_elemente_wand_z_delta"] = None
|
||||
if abs(float(z_delta)) >= 1e-6:
|
||||
try:
|
||||
for op_obj, op_meta in _find_openings_for_wall(doc, wand_id):
|
||||
cur_b = op_meta.get("oeff_brueest")
|
||||
try:
|
||||
cur_b_val = float(cur_b) if cur_b not in (None, "") else 0.0
|
||||
except (ValueError, TypeError):
|
||||
cur_b_val = 0.0
|
||||
new_b = max(0.0, cur_b_val + float(z_delta))
|
||||
attrs = op_obj.Attributes.Duplicate()
|
||||
attrs.SetUserString(_KEY_OEFF_BRUEST,
|
||||
"{:.6f}".format(new_b))
|
||||
doc.Objects.ModifyAttributes(op_obj.Id, attrs, True)
|
||||
pt_geom = op_obj.Geometry
|
||||
if hasattr(pt_geom, "Location"):
|
||||
pt = pt_geom.Location
|
||||
doc.Objects.Replace(op_obj.Id,
|
||||
rg.Point(rg.Point3d(pt.X, pt.Y, new_b)))
|
||||
except Exception as ex:
|
||||
print("[ELEMENTE] idle z-delta apply:", ex)
|
||||
# Bulk-Performance: ein einziger Undo-Record fuer alle queued
|
||||
# Regens + Redraw nur am Ende (statt einem pro AddBrep/Delete).
|
||||
undo_serial = doc.BeginUndoRecord(
|
||||
@@ -7804,35 +7781,37 @@ def _on_command_end(sender, e):
|
||||
_migrate_openings_to_new_axis(m["id"], old_line, geom)
|
||||
except Exception as ex:
|
||||
print("[ELEMENTE] post-cmd migrate:", ex)
|
||||
# Z-Drag detect + Brüstungs-Mitnahme (= setzt sticky-delta
|
||||
# den der Idle-Pfad spaeter applied — aber wir koennen
|
||||
# gleich hier syncen)
|
||||
# Z-Drag detect + Brüstungs-Mitnahme. Constraint setzt
|
||||
# sticky-delta wenn Z geaendert; wir consumen es direkt.
|
||||
_apply_wand_z_drag_constraint(obj, m)
|
||||
z_entry = sc.sticky.get("_elemente_wand_z_delta")
|
||||
z_delta = 0.0
|
||||
if isinstance(z_entry, tuple) and len(z_entry) == 2 \
|
||||
and z_entry[0] == m["id"]:
|
||||
z_delta = float(z_entry[1])
|
||||
try: z_delta = float(z_entry[1])
|
||||
except (ValueError, TypeError): z_delta = 0.0
|
||||
sc.sticky["_elemente_wand_z_delta"] = None
|
||||
# Brüstungen aller Öffnungen mit anpassen
|
||||
if abs(z_delta) >= 1e-6:
|
||||
for op_obj, op_meta in _find_openings_for_wall(doc, m["id"]):
|
||||
cur_b = op_meta.get("oeff_brueest")
|
||||
try:
|
||||
cur_b_val = float(cur_b) if cur_b not in (None, "") else 0.0
|
||||
except (ValueError, TypeError): cur_b_val = 0.0
|
||||
new_b = max(0.0, cur_b_val + z_delta)
|
||||
try:
|
||||
attrs = op_obj.Attributes.Duplicate()
|
||||
attrs.SetUserString(_KEY_OEFF_BRUEST,
|
||||
"{:.6f}".format(new_b))
|
||||
doc.Objects.ModifyAttributes(op_obj.Id, attrs, True)
|
||||
pt_geom = op_obj.Geometry
|
||||
if hasattr(pt_geom, "Location"):
|
||||
pt = pt_geom.Location
|
||||
doc.Objects.Replace(op_obj.Id,
|
||||
rg.Point(rg.Point3d(pt.X, pt.Y, new_b)))
|
||||
except Exception as ex:
|
||||
print("[ELEMENTE] post-cmd brueest:", ex)
|
||||
if abs(z_delta) >= 1e-6:
|
||||
# Brüstungen aller Öffnungen der Wand um delta mitnehmen
|
||||
for op_obj, op_meta in _find_openings_for_wall(doc, m["id"]):
|
||||
cur_b = op_meta.get("oeff_brueest")
|
||||
try:
|
||||
cur_b_val = float(cur_b) if cur_b not in (None, "") else 0.0
|
||||
except (ValueError, TypeError):
|
||||
cur_b_val = 0.0
|
||||
new_b = max(0.0, cur_b_val + z_delta)
|
||||
try:
|
||||
attrs = op_obj.Attributes.Duplicate()
|
||||
attrs.SetUserString(_KEY_OEFF_BRUEST,
|
||||
"{:.6f}".format(new_b))
|
||||
doc.Objects.ModifyAttributes(op_obj.Id, attrs, True)
|
||||
pt_geom = op_obj.Geometry
|
||||
if hasattr(pt_geom, "Location"):
|
||||
pt = pt_geom.Location
|
||||
doc.Objects.Replace(op_obj.Id,
|
||||
rg.Point(rg.Point3d(pt.X, pt.Y, new_b)))
|
||||
except Exception as ex:
|
||||
print("[ELEMENTE] post-cmd brueest:", ex)
|
||||
affected_walls.add(m["id"])
|
||||
elif t == "oeffnung_point":
|
||||
op_pos = old.get("pos")
|
||||
|
||||
Reference in New Issue
Block a user