Fix #7519: Hide depth attribute in Item Mode for elements with material layer sets

When editing representation items for elements with IfcMaterialLayerSetUsage
(LAYER2/LAYER3), the depth attribute is now hidden from the UI as it should
not be modified at the item level for these parametric elements.

The check is performed by accessing the parent element through the
representation_obj property in geometry props and checking its material
usage type.
This commit is contained in:
Ryan Schultz
2025-12-31 07:43:34 -06:00
parent 22dddea0e0
commit 99b162f712
@@ -399,6 +399,16 @@ class EditItemUI:
assert obj
mesh_props = tool.Geometry.get_mesh_props(obj.data)
# Get the parent element from representation_obj to check for layer set usage
has_layer_set_usage = False
props = tool.Geometry.get_geometry_props()
if props.representation_obj:
parent_element = tool.Ifc.get_entity(props.representation_obj)
if parent_element:
material_usage = tool.Model.get_usage_type(parent_element)
has_layer_set_usage = material_usage in ("LAYER2", "LAYER3")
if AuthoringData.data["is_representation_item_swept_solid"]:
# TODO: support EndSweptArea for IfcRevolvedAreaSolidTapered,
# will need to add second attribute for this.
@@ -412,8 +422,12 @@ class EditItemUI:
op.profile_id = int(mesh_props.item_profile)
for item_attribute in mesh_props.item_attributes:
# Skip depth attribute for objects with layer set usage
if has_layer_set_usage and item_attribute.name.lower() == "depth":
continue
row = cls.layout.row()
draw_attribute(item_attribute, cls.layout)
if len(mesh_props.item_attributes) or AuthoringData.data["is_representation_item_swept_solid"]:
row = cls.layout.row()
row.operator("bim.update_item_attributes", icon="FILE_REFRESH", text="")