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:
+47
-7
@@ -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)
|
cluster_ids = _find_wall_cluster(doc, element_id)
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
print("[ELEMENTE] cluster detect:", 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)):
|
and not _is_linear_chain(doc, cluster_ids)):
|
||||||
anchor = sorted(cluster_ids)[0]
|
anchor = sorted(cluster_ids)[0]
|
||||||
if anchor != element_id:
|
if anchor != element_id:
|
||||||
@@ -9861,15 +9866,26 @@ class ElementeBridge(panel_base.BaseBridge):
|
|||||||
# Style-Setup — dann faellt's auf Legacy loose-Parameter zurueck).
|
# Style-Setup — dann faellt's auf Legacy loose-Parameter zurueck).
|
||||||
# Rhino's AddOptionList akzeptiert nur Single-Word-Labels (keine
|
# Rhino's AddOptionList akzeptiert nur Single-Word-Labels (keine
|
||||||
# Spaces/Spezialzeichen) — daher sanitizen wir die Anzeigenamen.
|
# 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):
|
def _sanitize_opt_label(s):
|
||||||
import re
|
import re
|
||||||
return re.sub(r'[^a-zA-Z0-9_-]', '', s or "") or "?"
|
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_names = [s.get("name", s.get("id", "?")) for s in styles]
|
||||||
style_labels = [_sanitize_opt_label(n) for n in style_names]
|
style_labels = [_sanitize_opt_label(n) for n in style_names]
|
||||||
# Last-Used Style: id oder Index. Default: erster Style oder ""
|
# style_idx innerhalb der gefilterten Liste finden
|
||||||
last_style_id = _last("wand_style_id", styles[0]["id"] if styles else "")
|
|
||||||
style_idx = 0
|
style_idx = 0
|
||||||
for i, s in enumerate(styles):
|
for i, s in enumerate(styles):
|
||||||
if s.get("id") == last_style_id:
|
if s.get("id") == last_style_id:
|
||||||
@@ -9894,11 +9910,15 @@ class ElementeBridge(panel_base.BaseBridge):
|
|||||||
try: ref_idx = ref_codes.index(referenz)
|
try: ref_idx = ref_codes.index(referenz)
|
||||||
except ValueError: ref_idx = 0
|
except ValueError: ref_idx = 0
|
||||||
|
|
||||||
|
aufbau_labels = ["Solid", "Mehrschichtig"]
|
||||||
|
|
||||||
def _build_prompt(base):
|
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])
|
style_part = (" Stil={}".format(style_names[style_idx])
|
||||||
if styles else "")
|
if styles else "")
|
||||||
return "{} [Modus={}{}, Referenz={}, Dicke={:.3f}]".format(
|
return "{} [Modus={}{}{}, Referenz={}, Dicke={:.3f}]".format(
|
||||||
base, modus, style_part, ref_labels[ref_idx], dicke)
|
base, modus, aufbau_part, style_part,
|
||||||
|
ref_labels[ref_idx], dicke)
|
||||||
|
|
||||||
first_pt = None
|
first_pt = None
|
||||||
try:
|
try:
|
||||||
@@ -9906,6 +9926,8 @@ class ElementeBridge(panel_base.BaseBridge):
|
|||||||
gp = ric.GetPoint()
|
gp = ric.GetPoint()
|
||||||
gp.SetCommandPrompt(_build_prompt("Wand: Startpunkt"))
|
gp.SetCommandPrompt(_build_prompt("Wand: Startpunkt"))
|
||||||
opt_modus = gp.AddOptionList("Modus", modi, modi.index(modus))
|
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
|
opt_style = -1
|
||||||
if styles:
|
if styles:
|
||||||
opt_style = gp.AddOptionList("Stil", style_labels, style_idx)
|
opt_style = gp.AddOptionList("Stil", style_labels, style_idx)
|
||||||
@@ -9916,6 +9938,24 @@ class ElementeBridge(panel_base.BaseBridge):
|
|||||||
if gp.OptionIndex() == opt_modus:
|
if gp.OptionIndex() == opt_modus:
|
||||||
try: modus = modi[gp.Option().CurrentListOptionIndex]
|
try: modus = modi[gp.Option().CurrentListOptionIndex]
|
||||||
except Exception: pass
|
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:
|
elif styles and gp.OptionIndex() == opt_style:
|
||||||
try:
|
try:
|
||||||
style_idx = gp.Option().CurrentListOptionIndex
|
style_idx = gp.Option().CurrentListOptionIndex
|
||||||
|
|||||||
Reference in New Issue
Block a user