Add has_underside_connection method to Model class and update wall regeneration logic

This commit is contained in:
falken10vdl
2026-05-20 08:53:57 +02:00
committed by Ryan Schultz
parent d6662e5c56
commit bfb4312906
3 changed files with 8 additions and 7 deletions
@@ -1294,10 +1294,7 @@ class Hotkey(bpy.types.Operator, tool.Ifc.Operator):
bpy.ops.bim.generate_space()
return
if self.active_material_usage == "LAYER2":
if element and any(
rel.is_a("IfcRelConnectsElements") and rel.Description == "TOP"
for rel in element.ConnectedFrom
):
if element and tool.Model.has_underside_connection(element):
bpy.ops.bim.regenerate_wall_to_underside()
else:
bpy.ops.bim.recalculate_wall()
+1
View File
@@ -683,6 +683,7 @@ class Model:
def get_extrusion(cls, representation): pass
def get_connected_slab_objs(cls, wall): pass
def get_connected_wall_objs(cls, slab): pass
def has_underside_connection(cls, element): pass
def get_manual_booleans(cls, element): pass
def get_material_layer_parameters(cls, element): pass
def get_slab_clipping_bmesh(cls, obj): pass
+6 -3
View File
@@ -867,6 +867,11 @@ class Model(bonsai.core.tool.Model):
result.append(wall_obj)
return result
@classmethod
def has_underside_connection(cls, element: ifcopenshell.entity_instance) -> bool:
"""Return True if element has an IfcRelConnectsElements(TOP) relationship."""
return any(rel.is_a("IfcRelConnectsElements") and rel.Description == "TOP" for rel in element.ConnectedFrom)
@classmethod
def remove_wall_to_underside_booleans(cls, wall: ifcopenshell.entity_instance) -> None:
"""Remove all IfcBooleanResult items previously added by extend_walls_to_underside."""
@@ -2706,9 +2711,7 @@ class Model(bonsai.core.tool.Model):
if operands:
body_repr = ifcopenshell.util.representation.get_representation(wall, "Model", "Body", "MODEL_VIEW")
booleans = ifcopenshell.api.geometry.add_boolean(
ifc_file, first_item=extrusion, second_items=operands
)
booleans = ifcopenshell.api.geometry.add_boolean(ifc_file, first_item=extrusion, second_items=operands)
tool.Model.mark_manual_booleans(wall, booleans)
@classmethod