mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-27 02:31:09 +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()
|
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")
|
IfcStore.cache_path = os.path.join(bpy.context.scene.BIMProperties.data_dir, "cache", f"{ifc_hash}.h5")
|
||||||
cache_settings = ifcopenshell.geom.settings()
|
cache_settings = ifcopenshell.geom.settings()
|
||||||
|
serializer_settings = ifcopenshell.geom.serializer_settings()
|
||||||
try:
|
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:
|
except:
|
||||||
if os.path.exists(IfcStore.cache_path):
|
if os.path.exists(IfcStore.cache_path):
|
||||||
os.remove(IfcStore.cache_path)
|
os.remove(IfcStore.cache_path)
|
||||||
try:
|
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:
|
except:
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -113,8 +113,9 @@ class BlenderImporter:
|
|||||||
|
|
||||||
def get_cache(self):
|
def get_cache(self):
|
||||||
cache_settings = ifcopenshell.geom.settings()
|
cache_settings = ifcopenshell.geom.settings()
|
||||||
|
serializer_settings = ifcopenshell.geom.serializer_settings()
|
||||||
try:
|
try:
|
||||||
return ifcopenshell.geom.serializers.hdf5(self.cache_path, cache_settings)
|
return ifcopenshell.geom.serializers.hdf5(self.cache_path, cache_settings, serializer_settings)
|
||||||
except:
|
except:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|||||||
@@ -109,7 +109,8 @@ def main(
|
|||||||
)
|
)
|
||||||
|
|
||||||
if settings.cache:
|
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:
|
for it in iterators:
|
||||||
it.set_cache(cache)
|
it.set_cache(cache)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user