MCPcopy Create free account
hub / github.com/IfcOpenShell/IfcOpenShell / remove_style

Function remove_style

src/bonsai/bonsai/core/style.py:62–85  ·  view source on GitHub ↗

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,
)

Source from the content-addressed store, hash-verified

60
61
62def 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
88def update_style_colours(

Callers

nothing calls this directly

Calls 10

get_objectMethod · 0.45
is_editing_styleMethod · 0.45
disable_editingMethod · 0.45
get_active_style_typeMethod · 0.45
unlinkMethod · 0.45
runMethod · 0.45
delete_objectMethod · 0.45
is_editing_stylesMethod · 0.45

Tested by

no test coverage detected