mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
Fix bug where you couldn't unassign inherited materials.
This commit is contained in:
@@ -249,7 +249,14 @@ class UnassignMaterial(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
element = tool.Ifc.get_entity(obj)
|
element = tool.Ifc.get_entity(obj)
|
||||||
if element:
|
if element:
|
||||||
material = ifcopenshell.util.element.get_material(element, should_inherit=False)
|
material = ifcopenshell.util.element.get_material(element, should_inherit=False)
|
||||||
if "Usage" not in material.is_a():
|
inherited_material = ifcopenshell.util.element.get_material(element, should_inherit=True)
|
||||||
|
if "Usage" in material.is_a():
|
||||||
|
element_type = ifcopenshell.util.element.get_type(element)
|
||||||
|
ifcopenshell.api.run("material.unassign_material", tool.Ifc.get(), product=element_type)
|
||||||
|
elif not material and inherited_material:
|
||||||
|
element_type = ifcopenshell.util.element.get_type(element)
|
||||||
|
ifcopenshell.api.run("material.unassign_material", tool.Ifc.get(), product=element_type)
|
||||||
|
elif material:
|
||||||
ifcopenshell.api.run("material.unassign_material", tool.Ifc.get(), product=element)
|
ifcopenshell.api.run("material.unassign_material", tool.Ifc.get(), product=element)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user