smart_join: UserString-Key war FALSCH ("dossier_type" statt "dossier_element_type")
Bug: in _walls_and_curves_from_sel + safety check + diagnostic wurde "dossier_type" als UserString-Key gelesen, aber der echte Key (definiert in elemente.py via _KEY_TYPE) ist "dossier_element_type". Effekt: kein einziges Objekt wurde als wand_axis/wand_volume erkannt. ALLES landete im "elif t == '':" Branch (= generic curves). Solid L-Join funktionierte per ZUFALL: bei Solid-Wand (axis + outline + volume) sind nur 1 Curve open (axis); outline ist closed rectangle. Bei 2 Solid-Waenden waren also 2 offene Curves in generic → L-Join fand die 2 vermeintlich generic Curves (= eigentlich Achsen). Bei Layered scheiterte es: 2 Achsen + 2 Centerlines = 4 offene Curves im generic. L-Join Bedingung "len(generic) == 2" nicht erfuellt → silent return → Fallthrough zu _Join. Fix: alle 4 Vorkommen auf "dossier_element_type" gefixt. Jetzt erkennt smart_join Waende richtig, dedupliziert per wall_id, und T-Join/L-Join/ Safety-Check funktionieren wie geplant.
This commit is contained in:
@@ -94,11 +94,11 @@ def _walls_and_curves_from_sel(doc, sel):
|
|||||||
# Pre-Index wand_axis by wall_id fuer schnelles Lookup
|
# Pre-Index wand_axis by wall_id fuer schnelles Lookup
|
||||||
axis_by_id = {}
|
axis_by_id = {}
|
||||||
for o in doc.Objects:
|
for o in doc.Objects:
|
||||||
if o.Attributes.GetUserString("dossier_type") == "wand_axis":
|
if o.Attributes.GetUserString("dossier_element_type") == "wand_axis":
|
||||||
wid = o.Attributes.GetUserString("dossier_element_id") or ""
|
wid = o.Attributes.GetUserString("dossier_element_id") or ""
|
||||||
if wid: axis_by_id[wid] = o
|
if wid: axis_by_id[wid] = o
|
||||||
for obj in sel:
|
for obj in sel:
|
||||||
t = obj.Attributes.GetUserString("dossier_type") or ""
|
t = obj.Attributes.GetUserString("dossier_element_type") or ""
|
||||||
wid = obj.Attributes.GetUserString("dossier_element_id") or ""
|
wid = obj.Attributes.GetUserString("dossier_element_id") or ""
|
||||||
if t == "wand_axis" and wid and wid not in seen_walls:
|
if t == "wand_axis" and wid and wid not in seen_walls:
|
||||||
axes.append(obj); seen_walls.add(wid)
|
axes.append(obj); seen_walls.add(wid)
|
||||||
@@ -243,11 +243,30 @@ def _run():
|
|||||||
# L-Join: beide Endpunkte werden zum Schnittpunkt der verlaengerten Linien
|
# L-Join: beide Endpunkte werden zum Schnittpunkt der verlaengerten Linien
|
||||||
# gezogen. T zuerst probieren (= spezifischer), dann L als Fallback.
|
# gezogen. T zuerst probieren (= spezifischer), dann L als Fallback.
|
||||||
if len(sel) >= 2:
|
if len(sel) >= 2:
|
||||||
|
# Diagnostic: was sieht smart_join in der Selection?
|
||||||
|
axes_dbg, generic_dbg = _walls_and_curves_from_sel(doc, sel)
|
||||||
|
type_counts = {}
|
||||||
|
for o in sel:
|
||||||
|
try:
|
||||||
|
t = o.Attributes.GetUserString("dossier_element_type") or "<none>"
|
||||||
|
wid_raw = o.Attributes.GetUserString("dossier_element_id") or ""
|
||||||
|
geom_kind = type(o.Geometry).__name__
|
||||||
|
key = "{}|{}|wid={}".format(t, geom_kind,
|
||||||
|
"yes" if wid_raw else "no")
|
||||||
|
type_counts[key] = type_counts.get(key, 0) + 1
|
||||||
|
except Exception: pass
|
||||||
|
print("[SMART-JOIN] sel-detect: {} Wand-Achsen, {} generische Curves "
|
||||||
|
"(sel total: {})".format(len(axes_dbg), len(generic_dbg), len(sel)))
|
||||||
|
for k, n in type_counts.items():
|
||||||
|
print("[SMART-JOIN] {} × {}".format(n, k))
|
||||||
try:
|
try:
|
||||||
if _t_join_attempt(doc, sel):
|
if _t_join_attempt(doc, sel):
|
||||||
doc.Views.Redraw()
|
doc.Views.Redraw()
|
||||||
print("[SMART-JOIN] T-Join: Endpunkt auf Achse gesnappt")
|
print("[SMART-JOIN] T-Join: Endpunkt auf Achse gesnappt")
|
||||||
return
|
return
|
||||||
|
else:
|
||||||
|
print("[SMART-JOIN] T-Join: kein passender Kandidat (zu weit "
|
||||||
|
"weg oder am Endpunkt → L-Join Territory)")
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
print("[SMART-JOIN] T-Join error:", ex)
|
print("[SMART-JOIN] T-Join error:", ex)
|
||||||
try:
|
try:
|
||||||
@@ -255,6 +274,9 @@ def _run():
|
|||||||
doc.Views.Redraw()
|
doc.Views.Redraw()
|
||||||
print("[SMART-JOIN] L-Join: 2 Curves zu L verbunden")
|
print("[SMART-JOIN] L-Join: 2 Curves zu L verbunden")
|
||||||
return
|
return
|
||||||
|
else:
|
||||||
|
print("[SMART-JOIN] L-Join: konnte nicht ausfuehren (parallel, "
|
||||||
|
"schon verbunden, oder Geometrie ungueltig)")
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
print("[SMART-JOIN] L-Join error:", ex)
|
print("[SMART-JOIN] L-Join error:", ex)
|
||||||
|
|
||||||
@@ -262,7 +284,7 @@ def _run():
|
|||||||
# — das wuerde mehrere Achsen zu einer Curve zusammenkleben und die Wand-
|
# — das wuerde mehrere Achsen zu einer Curve zusammenkleben und die Wand-
|
||||||
# Verknuepfung zerstoeren (Source-Duplikat-Listener kapert die alte ID).
|
# Verknuepfung zerstoeren (Source-Duplikat-Listener kapert die alte ID).
|
||||||
has_wand_axis = any(
|
has_wand_axis = any(
|
||||||
obj.Attributes.GetUserString("dossier_type") == "wand_axis"
|
obj.Attributes.GetUserString("dossier_element_type") == "wand_axis"
|
||||||
for obj in sel)
|
for obj in sel)
|
||||||
if has_wand_axis:
|
if has_wand_axis:
|
||||||
print("[SMART-JOIN] Wand-Achsen selektiert: T-Join/L-Join hat nicht "
|
print("[SMART-JOIN] Wand-Achsen selektiert: T-Join/L-Join hat nicht "
|
||||||
|
|||||||
Reference in New Issue
Block a user