mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-12 18:43:26 +00:00
IsVentilated now defaults to False (#7819)
* IsVantillated now defaults to false * IsVentilated now defaults to False --------- Co-authored-by: Parag Debnath <paragforwork@gmail.com>
This commit is contained in:
@@ -717,7 +717,11 @@ class EnableEditingMaterialSetItem(bpy.types.Operator):
|
||||
self.props.material_set_item_material = str(material_set_item.Material.id())
|
||||
|
||||
self.props.material_set_item_attributes.clear()
|
||||
bonsai.bim.helper.import_attributes(material_set_item, self.props.material_set_item_attributes)
|
||||
bonsai.bim.helper.import_attributes(
|
||||
material_set_item,
|
||||
self.props.material_set_item_attributes,
|
||||
callback=self.import_attributes_callback,
|
||||
)
|
||||
|
||||
if material_set_item.is_a("IfcMaterialProfile"):
|
||||
if material_set_item.Profile and material_set_item.Profile.ProfileName:
|
||||
@@ -725,6 +729,29 @@ class EnableEditingMaterialSetItem(bpy.types.Operator):
|
||||
|
||||
return {"FINISHED"}
|
||||
|
||||
def import_attributes_callback(
|
||||
self, name: str, prop: Union["Attribute", None], data: dict[str, Any]
|
||||
) -> None | Literal[True]:
|
||||
if data["type"] != "IfcMaterialLayer" or name != "IsVentilated" or not prop:
|
||||
return None
|
||||
|
||||
# Keep null semantics unchanged on export, but avoid an empty UI selection.
|
||||
prop.data_type = "enum"
|
||||
prop.special_type = "LOGICAL"
|
||||
prop.enum_items = json.dumps(("TRUE", "FALSE", "UNKNOWN"))
|
||||
|
||||
value = data[name]
|
||||
if value == "UNKNOWN":
|
||||
prop.enum_value = "UNKNOWN"
|
||||
elif value is None:
|
||||
# Keep visible default as FALSE, but preserve null semantics on save.
|
||||
prop.enum_value = "FALSE"
|
||||
prop.is_null = True
|
||||
else:
|
||||
prop.enum_value = "TRUE" if value else "FALSE"
|
||||
|
||||
return True
|
||||
|
||||
|
||||
class DisableEditingMaterialSetItem(bpy.types.Operator):
|
||||
bl_idname = "bim.disable_editing_material_set_item"
|
||||
|
||||
@@ -422,6 +422,24 @@ Scenario: Enable editing material set item
|
||||
When I press "bim.enable_editing_material_set_item(material_set_item={material_profile})"
|
||||
Then nothing happens
|
||||
|
||||
Scenario: Edit layer item defaults null IsVentilated to FALSE in UI
|
||||
Given an empty IFC project
|
||||
And I add a cube
|
||||
And the object "Cube" is selected
|
||||
And I look at the "Class" panel
|
||||
And I set the "Products" property to "IfcElement"
|
||||
And I set the "Class" property to "IfcWall"
|
||||
And I click "Assign IFC Class"
|
||||
And I press "bim.add_material()"
|
||||
And I set "active_object.BIMObjectMaterialProperties.material_type" to "IfcMaterialLayerSet"
|
||||
And I press "bim.assign_material"
|
||||
And I press "bim.enable_editing_assigned_material"
|
||||
And the variable "layer" is "{ifc}.by_type('IfcMaterialLayer')[0].id()"
|
||||
And I press "bim.enable_editing_material_set_item(material_set_item={layer})"
|
||||
When I evaluate expression "attrs = bpy.context.active_object.BIMObjectMaterialProperties.material_set_item_attributes; is_vent = next(a for a in attrs if a.name == 'IsVentilated'); assert is_vent.enum_value == 'FALSE'; assert is_vent.is_null is True"
|
||||
And I press "bim.edit_material_set_item(material_set_item={layer})"
|
||||
Then I evaluate expression "assert {ifc}.by_id({layer}).IsVentilated is None"
|
||||
|
||||
Scenario: Add material set layer
|
||||
Given an empty IFC project
|
||||
And I add a cube
|
||||
|
||||
Reference in New Issue
Block a user