mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-14 03:14:23 +00:00
Fix errors initializing hdf5 cache #4832
This commit is contained in:
@@ -118,13 +118,18 @@ class IfcStore:
|
||||
ifc_hash = hashlib.md5(ifc_key.encode("utf-8")).hexdigest()
|
||||
IfcStore.cache_path = os.path.join(bpy.context.scene.BIMProperties.data_dir, "cache", f"{ifc_hash}.h5")
|
||||
cache_settings = ifcopenshell.geom.settings()
|
||||
serializer_settings = ifcopenshell.geom.serializer_settings()
|
||||
try:
|
||||
IfcStore.cache = ifcopenshell.geom.serializers.hdf5(IfcStore.cache_path, cache_settings)
|
||||
IfcStore.cache = ifcopenshell.geom.serializers.hdf5(
|
||||
IfcStore.cache_path, cache_settings, serializer_settings
|
||||
)
|
||||
except:
|
||||
if os.path.exists(IfcStore.cache_path):
|
||||
os.remove(IfcStore.cache_path)
|
||||
try:
|
||||
IfcStore.cache = ifcopenshell.geom.serializers.hdf5(IfcStore.cache_path, cache_settings)
|
||||
IfcStore.cache = ifcopenshell.geom.serializers.hdf5(
|
||||
IfcStore.cache_path, cache_settings, serializer_settings
|
||||
)
|
||||
except:
|
||||
return
|
||||
else:
|
||||
|
||||
@@ -113,8 +113,9 @@ class BlenderImporter:
|
||||
|
||||
def get_cache(self):
|
||||
cache_settings = ifcopenshell.geom.settings()
|
||||
serializer_settings = ifcopenshell.geom.serializer_settings()
|
||||
try:
|
||||
return ifcopenshell.geom.serializers.hdf5(self.cache_path, cache_settings)
|
||||
return ifcopenshell.geom.serializers.hdf5(self.cache_path, cache_settings, serializer_settings)
|
||||
except:
|
||||
return
|
||||
|
||||
|
||||
@@ -109,7 +109,8 @@ def main(
|
||||
)
|
||||
|
||||
if settings.cache:
|
||||
cache = ifcopenshell.geom.serializers.hdf5("cache.h5", geom_settings)
|
||||
serializer_settings = ifcopenshell.geom.serializer_settings()
|
||||
cache = ifcopenshell.geom.serializers.hdf5("cache.h5", geom_settings, serializer_settings)
|
||||
for it in iterators:
|
||||
it.set_cache(cache)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user