smal core.material.unassign_material refactor

This commit is contained in:
Andrej730
2024-07-05 17:09:00 +05:00
parent a6951d1a6d
commit 7a89d8f5ed
+10 -6
View File
@@ -119,14 +119,18 @@ def unassign_material(ifc: tool.Ifc, material_tool: tool.Material, objects: list
if element: if element:
material = material_tool.get_material(element, should_inherit=False) material = material_tool.get_material(element, should_inherit=False)
inherited_material = material_tool.get_material(element, should_inherit=True) inherited_material = material_tool.get_material(element, should_inherit=True)
if material and "Usage" in material.is_a(): if material:
if "Usage" in material.is_a():
element_type = material_tool.get_type(element)
ifc.run("material.unassign_material", products=[element_type])
else:
ifc.run("material.unassign_material", products=[element])
elif inherited_material:
element_type = material_tool.get_type(element) element_type = material_tool.get_type(element)
ifc.run("material.unassign_material", products=[element_type]) ifc.run("material.unassign_material", products=[element_type])
elif not material and inherited_material: else:
element_type = material_tool.get_type(element) # Has no material and has no inherited material, nothing to unassign.
ifc.run("material.unassign_material", products=[element_type]) pass
elif material:
ifc.run("material.unassign_material", products=[element])
def patch_non_parametric_mep_segment( def patch_non_parametric_mep_segment(