Fixed error loading .ifc and activating view for drawing with underlay

This commit is contained in:
Andrej730
2023-05-22 15:47:28 +05:00
parent 1b2ab4e3f0
commit 628b6830db
2 changed files with 5 additions and 1 deletions
@@ -1342,6 +1342,8 @@ class ActivateDrawing(bpy.types.Operator):
dprops = bpy.context.scene.DocProperties
core.activate_drawing_view(tool.Ifc, tool.Drawing, drawing=drawing)
dprops.active_drawing_id = self.drawing
# reset DrawingsData to reload_drawing_styles work correctly
DrawingsData.is_loaded = False
dprops.drawing_styles.clear()
if ifcopenshell.util.element.get_pset(drawing, "EPset_Drawing", "HasUnderlay"):
bpy.ops.bim.reload_drawing_styles()
@@ -1423,6 +1425,7 @@ class ReloadDrawingStyles(bpy.types.Operator):
bl_idname = "bim.reload_drawing_styles"
bl_label = "Reload Drawing Styles"
bl_options = {"REGISTER", "UNDO"}
bl_description = "Reload drawing styles for the active camera"
def execute(self, context):
if not DrawingsData.is_loaded:
@@ -178,7 +178,8 @@ def update_schedule_name(self, context):
def update_has_underlay(self, context):
update_layer(self, context, "HasUnderlay", self.has_underlay)
if self.has_underlay:
# making sure that camera is active
if self.has_underlay and (context.active_object and context.active_object.data == self.id_data):
bpy.ops.bim.reload_drawing_styles()
bpy.ops.bim.activate_drawing_style()