Remove IfcPresentationStyle and associated Blender material. :param reload_styles_ui: Whether to reload Styles UI after removal. Useful to disable if you plan to remove many styles and want to avoid unnecessary reloads.
(
ifc: type[tool.Ifc],
style_tool: type[tool.Style],
style: ifcopenshell.entity_instance,
reload_styles_ui: bool = False,
)
| 60 | |
| 61 | |
| 62 | def remove_style( |
| 63 | ifc: type[tool.Ifc], |
| 64 | style_tool: type[tool.Style], |
| 65 | style: ifcopenshell.entity_instance, |
| 66 | reload_styles_ui: bool = False, |
| 67 | ) -> None: |
| 68 | """Remove IfcPresentationStyle and associated Blender material. |
| 69 | |
| 70 | :param reload_styles_ui: Whether to reload Styles UI after removal. |
| 71 | Useful to disable if you plan to remove many styles and want to |
| 72 | avoid unnecessary reloads. |
| 73 | """ |
| 74 | obj = ifc.get_object(style) |
| 75 | if style_tool.is_editing_style() and obj == style_tool.get_currently_edited_material(): |
| 76 | style_tool.disable_editing() |
| 77 | # Get style_type before removing object as later StylesData might fail to load |
| 78 | # due object not yet removed completely. |
| 79 | style_type = style_tool.get_active_style_type() |
| 80 | ifc.unlink(element=style) |
| 81 | ifc.run("style.remove_style", style=style) |
| 82 | if obj: |
| 83 | style_tool.delete_object(obj) |
| 84 | if reload_styles_ui and style_tool.is_editing_styles(): |
| 85 | style_tool.import_presentation_styles(style_type) |
| 86 | |
| 87 | |
| 88 | def update_style_colours( |
nothing calls this directly
no test coverage detected