mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 17:58:20 +00:00
bonsai - fix error removing non-linked styles
including non-ifcsurfacestyle ifcpresentationstyles
This commit is contained in:
@@ -50,6 +50,7 @@ class StylesData:
|
||||
materials: dict[bpy.types.PropertyGroup, Union[str, None]] = {}
|
||||
for style in props.styles:
|
||||
material = tool.Ifc.get_object(ifc_file.by_id(style.ifc_definition_id))
|
||||
# Material will be None if it's either unlinked or if it's not IfcSurfaceStyle.
|
||||
materials[style] = material.name if material is not None else None
|
||||
return materials
|
||||
|
||||
|
||||
@@ -70,7 +70,8 @@ def remove_style(
|
||||
style_type = style_tool.get_active_style_type()
|
||||
ifc.unlink(element=style)
|
||||
ifc.run("style.remove_style", style=style)
|
||||
style_tool.delete_object(obj)
|
||||
if obj:
|
||||
style_tool.delete_object(obj)
|
||||
if reload_styles_ui and style_tool.is_editing_styles():
|
||||
style_tool.import_presentation_styles(style_type)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user