Compare commits

...

2 Commits

Author SHA1 Message Date
Petru Conduraru 0ee86ac25e Bonsai: plain-language message for Extend To Underside guard (#7454)
Per the reporter's follow-up on #7454, replace the LAYER2 jargon error
with a message that names walls as the supported selection and states
that extending columns or similar elements is not implemented yet. Also
drop the explanatory inline comment block per project comment standards;
the guard exists so an invalid selection (e.g. column plus slab with no
wall) reports a clean error instead of re-raising the nested operator's
CANCELLED as a Python traceback.

Refs #7454

Generated with the assistance of an AI coding tool.
2026-07-23 11:05:01 +03:00
Petru Conduraru 7e79f9911d Bonsai: clean error instead of a traceback for Extend To Underside (#7454)
Selecting a non-wall pair (e.g. a column and a slab) and pressing Shift+E
surfaced a developer Python traceback. Hotkey.hotkey_S_E's catch-all else
branch unconditionally called bpy.ops.bim.extend_walls_to_underside(); when
the selection contains no path-connectable wall, that nested operator
reports an ERROR and returns CANCELLED, which - invoked via bpy.ops from
inside the outer operator - raises RuntimeError as an unhandled exception,
so the user saw a full traceback.

Guard the selection with the operator's own predicate
(tool.Parametric.is_path_connectable_wall): dispatch to
extend_walls_to_underside only when at least one wall and one other element
are selected, otherwise report a clean end-user error. Mirrors the pattern
already used by hotkey_S_X (align). The valid wall + target path is
unchanged.

This hardens the reported crash. It does not implement extending a column
to a slab underside, which is a separate feature request in the same issue.

Verified live in headless Blender: a column + slab selection produced the
reported traceback before and now yields a single clean error message with
no workspace.py / extend_walls_to_underside frames.

Generated with the assistance of an AI coding tool.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-12 09:55:19 +03:00
@@ -1280,7 +1280,20 @@ class Hotkey(bpy.types.Operator, tool.Ifc.Operator):
bpy.ops.bim.extend_profile(join_type="T")
else:
bpy.ops.bim.extend_walls_to_underside()
walls = [
obj
for obj in bpy.context.selected_objects
if (element := tool.Ifc.get_entity(obj)) and tool.Parametric.is_path_connectable_wall(element)
]
if walls and len(bpy.context.selected_objects) > len(walls):
bpy.ops.bim.extend_walls_to_underside()
else:
self.report(
{"ERROR"},
"Extend to underside works with layered walls (LAYER2): "
"select at least one wall plus the target element. "
"Extending columns or similar elements is not supported yet.",
)
def hotkey_S_F(self):
if not bpy.context.selected_objects: