mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-11 18:16:40 +00:00
ifc2x3 tests
This commit is contained in:
@@ -45,22 +45,25 @@ def remove_surface_style(file: ifcopenshell.file, style: ifcopenshell.entity_ins
|
||||
# Remove the shading item
|
||||
ifcopenshell.api.run("style.remove_surface_style", model, style=shading)
|
||||
"""
|
||||
settings = {"style": style}
|
||||
|
||||
to_delete = set()
|
||||
if settings["style"].is_a("IfcSurfaceStyleWithTextures"):
|
||||
for texture in settings["style"].Textures or []:
|
||||
if texture.IsMappedBy:
|
||||
for coordinate in texture.IsMappedBy:
|
||||
to_delete.add(coordinate)
|
||||
else:
|
||||
to_delete.add(texture)
|
||||
if style.is_a("IfcSurfaceStyleWithTextures"):
|
||||
textures = style.Textures
|
||||
if file.schema == "IFC2X3":
|
||||
to_delete.update(textures)
|
||||
else:
|
||||
for texture in textures:
|
||||
if coords := texture.IsMappedBy:
|
||||
for coordinate in coords:
|
||||
to_delete.add(coordinate)
|
||||
else:
|
||||
to_delete.add(texture)
|
||||
|
||||
for attribute in settings["style"]:
|
||||
for attribute in style:
|
||||
if isinstance(attribute, ifcopenshell.entity_instance) and attribute.id():
|
||||
to_delete.add(attribute)
|
||||
|
||||
file.remove(settings["style"])
|
||||
file.remove(style)
|
||||
|
||||
for element in to_delete:
|
||||
ifcopenshell.util.element.remove_deep2(file, element)
|
||||
|
||||
Reference in New Issue
Block a user