mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-18 22:33:33 +00:00
smal core.material.unassign_material refactor
This commit is contained in:
@@ -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(
|
||||||
|
|||||||
Reference in New Issue
Block a user