dWall: Aufbau-Toggle (Solid/Mehrschichtig) + gefilterte Stil-Liste

Cluster-Dispatch: is_layered_meta Check zurueck — layered + non-linear (T,
Verzweigung) ist geometrisch sinnlos via per-Layer-Union (Schichten orthogonal
zwischen perpendikulaeren Waenden). Faellt zu Solo+Miter durch.

dWall-Prompt:
- Neue Option 'Aufbau' (Solid|Mehrschichtig)
- Stil-Liste gefiltert auf den gewaehlten Aufbau-Typ
- Beim Toggle: erster Style des neuen Typs uebernommen + dicke/referenz
- Default-Aufbau aus dem zuletzt verwendeten Style
This commit is contained in:
2026-05-31 00:26:51 +02:00
parent f011e2ca94
commit 0171785b42
+47 -7
View File
@@ -8225,7 +8225,12 @@ def _regenerate_element_body(doc, element_id, src_obj, meta, geom, geschoss_name
cluster_ids = _find_wall_cluster(doc, element_id)
except Exception as ex:
print("[ELEMENTE] cluster detect:", ex)
if (len(cluster_ids) > 1
# Cluster-Path (Boolean-Union): nur fuer SOLID + non-linear (T, branched).
# Layered + non-linear: per-Layer-Union ist geometrisch unsinnig weil
# die Schichten zwischen perpendikulaeren Waenden orthogonal stehen.
# → Layered T faellt zu Solo+Miter durch, layered L durch zu Chain.
is_layered_meta = bool(meta.get("wand_layered", False))
if (len(cluster_ids) > 1 and not is_layered_meta
and not _is_linear_chain(doc, cluster_ids)):
anchor = sorted(cluster_ids)[0]
if anchor != element_id:
@@ -9861,15 +9866,26 @@ class ElementeBridge(panel_base.BaseBridge):
# Style-Setup — dann faellt's auf Legacy loose-Parameter zurueck).
# Rhino's AddOptionList akzeptiert nur Single-Word-Labels (keine
# Spaces/Spezialzeichen) — daher sanitizen wir die Anzeigenamen.
styles = _get_all_wand_styles(doc)
all_styles = _get_all_wand_styles(doc)
def _sanitize_opt_label(s):
import re
return re.sub(r'[^a-zA-Z0-9_-]', '', s or "") or "?"
# style_labels = Rhino-Option-compatible (no spaces). style_names = human-readable.
# Aufbau-Filter: solid ODER layered. Stil-Picker zeigt nur passende Stile.
last_style_id = _last("wand_style_id",
all_styles[0]["id"] if all_styles else "")
# Last-Used Style bestimmt initialen Aufbau (solid vs layered)
is_layered_mode = False
for s in all_styles:
if s.get("id") == last_style_id:
is_layered_mode = bool(s.get("layered", False))
break
def _filter_styles():
return [s for s in all_styles
if bool(s.get("layered", False)) == is_layered_mode]
styles = _filter_styles()
style_names = [s.get("name", s.get("id", "?")) for s in styles]
style_labels = [_sanitize_opt_label(n) for n in style_names]
# Last-Used Style: id oder Index. Default: erster Style oder ""
last_style_id = _last("wand_style_id", styles[0]["id"] if styles else "")
# style_idx innerhalb der gefilterten Liste finden
style_idx = 0
for i, s in enumerate(styles):
if s.get("id") == last_style_id:
@@ -9894,11 +9910,15 @@ class ElementeBridge(panel_base.BaseBridge):
try: ref_idx = ref_codes.index(referenz)
except ValueError: ref_idx = 0
aufbau_labels = ["Solid", "Mehrschichtig"]
def _build_prompt(base):
aufbau_part = " Aufbau={}".format(aufbau_labels[1 if is_layered_mode else 0])
style_part = (" Stil={}".format(style_names[style_idx])
if styles else "")
return "{} [Modus={}{}, Referenz={}, Dicke={:.3f}]".format(
base, modus, style_part, ref_labels[ref_idx], dicke)
return "{} [Modus={}{}{}, Referenz={}, Dicke={:.3f}]".format(
base, modus, aufbau_part, style_part,
ref_labels[ref_idx], dicke)
first_pt = None
try:
@@ -9906,6 +9926,8 @@ class ElementeBridge(panel_base.BaseBridge):
gp = ric.GetPoint()
gp.SetCommandPrompt(_build_prompt("Wand: Startpunkt"))
opt_modus = gp.AddOptionList("Modus", modi, modi.index(modus))
opt_aufbau = gp.AddOptionList(
"Aufbau", aufbau_labels, 1 if is_layered_mode else 0)
opt_style = -1
if styles:
opt_style = gp.AddOptionList("Stil", style_labels, style_idx)
@@ -9916,6 +9938,24 @@ class ElementeBridge(panel_base.BaseBridge):
if gp.OptionIndex() == opt_modus:
try: modus = modi[gp.Option().CurrentListOptionIndex]
except Exception: pass
elif gp.OptionIndex() == opt_aufbau:
try:
is_layered_mode = (
gp.Option().CurrentListOptionIndex == 1)
styles = _filter_styles()
style_names = [s.get("name", s.get("id", "?"))
for s in styles]
style_labels = [_sanitize_opt_label(n)
for n in style_names]
style_idx = 0
if styles:
s_active = styles[0]
dicke = float(s_active.get("dicke", dicke))
new_ref = s_active.get("referenz", referenz)
if new_ref in ref_codes:
ref_idx = ref_codes.index(new_ref)
except Exception as ex:
print("[ELEMENTE] Aufbau toggle:", ex)
elif styles and gp.OptionIndex() == opt_style:
try:
style_idx = gp.Option().CurrentListOptionIndex