Clear IfcStore when you load a new file. See #1222.

This commit is contained in:
Dion Moult
2021-01-26 21:28:54 +11:00
parent bbde897113
commit b71febab0d
4 changed files with 15 additions and 1 deletions
@@ -1,5 +1,6 @@
from bpy.types import Panel
from blenderbim.bim.module.aggregate.data import Data
from blenderbim.bim.ifc import IfcStore
class BIM_PT_aggregate(Panel):
@@ -15,6 +16,8 @@ class BIM_PT_aggregate(Panel):
props = context.active_object.BIMObjectProperties
if not props.ifc_definition_id:
return False
if not IfcStore.get_file().by_id(props.ifc_definition_id).is_a("IfcObjectDefinition"):
return False
if props.ifc_definition_id not in Data.products:
Data.load(props.ifc_definition_id)
if not Data.products[props.ifc_definition_id]:
@@ -27,7 +27,12 @@ class BIM_PT_object_material(Panel):
@classmethod
def poll(cls, context):
return bool(context.active_object.BIMObjectProperties.ifc_definition_id)
props = context.active_object.BIMObjectProperties
if not props.ifc_definition_id:
return False
if not hasattr(IfcStore.get_file().by_id(props.ifc_definition_id), "HasAssociations"):
return False
return True
def draw(self, context):
self.file = IfcStore.get_file()