Fix #1288 - error when importing consecutive files.

This commit is contained in:
Dion Moult
2021-02-03 17:30:19 +11:00
parent 2f2b4e7dc2
commit 9717d6b1eb
18 changed files with 115 additions and 1 deletions
@@ -15,6 +15,16 @@ def loadIfcStore(scene):
{k: bpy.data.objects.get(v) for k, v in json.loads(props.guid_map).items()} if props.id_map else {}
)
# Purge data cache
from blenderbim.bim import modules
for module in modules.values():
if not module:
continue
try:
getattr(getattr(module, 'data'), 'Data').purge()
except AttributeError:
pass
@persistent
def storeIdMap(scene):
@@ -4,6 +4,10 @@ from blenderbim.bim.ifc import IfcStore
class Data:
products = {}
@classmethod
def purge(cls):
cls.products = {}
@classmethod
def load(cls, product_id):
file = IfcStore.get_file()
@@ -5,6 +5,10 @@ from blenderbim.bim.ifc import IfcStore
class Data:
products = {}
@classmethod
def purge(cls):
cls.products = {}
@classmethod
def load(cls, product_id):
file = IfcStore.get_file()
@@ -12,6 +12,16 @@ class Data:
library_classifications = {}
library_references = {}
@classmethod
def purge(cls):
cls.is_loaded = False
cls.products = {}
cls.classifications = {}
cls.references = {}
cls.library_file = None
cls.library_classifications = {}
cls.library_references = {}
@classmethod
def load(cls, product_id=None):
cls._file = IfcStore.get_file()
@@ -9,6 +9,12 @@ class Data:
products = {}
objectives = {}
@classmethod
def purge(cls):
cls.is_loaded = False
cls.products = {}
cls.objectives = {}
@classmethod
def load(cls, product_id=None):
cls._file = IfcStore.get_file()
@@ -28,7 +34,7 @@ class Data:
for association in product.HasAssociations:
if association.is_a("IfcRelAssociatesConstraint"):
if not association.RelatingConstraint.is_a("IfcObjective"):
continue # not yet implemented
continue # not yet implemented
cls.products[product_id].append(association.RelatingConstraint.id())
@classmethod
@@ -5,6 +5,11 @@ class Data:
is_loaded = False
contexts = {}
@classmethod
def purge(cls):
cls.is_loaded = False
cls.contexts = {}
@classmethod
def load(cls):
file = IfcStore.get_file()
@@ -10,6 +10,13 @@ class Data:
references = {}
information = {}
@classmethod
def purge(cls):
cls.is_loaded = False
cls.products = {}
cls.references = {}
cls.information = {}
@classmethod
def load(cls, product_id=None):
cls._file = IfcStore.get_file()
@@ -5,6 +5,11 @@ class Data:
products = {}
representations = {}
@classmethod
def purge(cls):
cls.products = False
cls.representations = {}
@classmethod
def load(cls, product_id):
file = IfcStore.get_file()
@@ -6,6 +6,12 @@ class Data:
map_conversion = {}
projected_crs = {}
@classmethod
def purge(cls):
cls.is_loaded = False
cls.map_conversion = {}
cls.projected_crs = {}
@classmethod
def load(cls):
file = IfcStore.get_file()
@@ -9,6 +9,12 @@ class Data:
items = {}
layers = {}
@classmethod
def purge(cls):
cls.is_loaded = False
cls.items = {}
cls.layers = {}
@classmethod
def load(cls, item_id=None):
cls._file = IfcStore.get_file()
@@ -15,6 +15,20 @@ class Data:
products = {}
_file = None
@classmethod
def purge(cls):
cls.is_loaded = False
cls.materials = {}
cls.constituent_sets = {}
cls.constituents = {}
cls.layer_sets = {}
cls.layers = {}
cls.profile_sets = {}
cls.profiles = {}
cls.lists = {}
cls.products = {}
cls._file = None
@classmethod
def load(cls, product_id=None):
cls._file = IfcStore.get_file()
@@ -8,6 +8,14 @@ class Data:
addresses = {}
roles = {}
@classmethod
def purge(cls):
cls.is_loaded = False
cls.people = {}
cls.organisations = {}
cls.addresses = {}
cls.roles = {}
@classmethod
def load(cls):
file = IfcStore.get_file()
@@ -8,6 +8,12 @@ class Data:
psets = {}
qtos = {}
@classmethod
def purge(cls):
cls.products = {}
cls.psets = {}
cls.qtos = {}
@classmethod
def load(cls, product_id):
file = IfcStore.get_file()
@@ -4,6 +4,10 @@ from blenderbim.bim.ifc import IfcStore
class Data:
products = {}
@classmethod
def purge(cls):
cls.products = {}
@classmethod
def load(cls, product_id):
file = IfcStore.get_file()
@@ -4,6 +4,10 @@ from blenderbim.bim.ifc import IfcStore
class Data:
products = {}
@classmethod
def purge(cls):
cls.products = {}
@classmethod
def load(cls, product_id):
file = IfcStore.get_file()
@@ -4,6 +4,10 @@ from blenderbim.bim.ifc import IfcStore
class Data:
products = {}
@classmethod
def purge(cls):
cls.products = {}
@classmethod
def load(cls, product_id):
file = IfcStore.get_file()
@@ -5,6 +5,11 @@ class Data:
is_loaded = False
units = {}
@classmethod
def purge(cls):
cls.is_loaded = False
cls.units = {}
@classmethod
def load(cls):
file = IfcStore.get_file()
@@ -6,6 +6,12 @@ class Data:
openings = {}
fillings = {}
@classmethod
def purge(cls):
cls.products = {}
cls.openings = {}
cls.fillings = {}
@classmethod
def load(cls, product_id):
file = IfcStore.get_file()