mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-11 02:02:22 +00:00
Merge remote-tracking branch 'origin/ifcviewer' into datamodel-v1.0
This commit is contained in:
@@ -93,6 +93,11 @@ except Exception:
|
||||
from . import guid
|
||||
from .ifcopenshell_wrapper import entity_instance, file
|
||||
from .file import rocksdb_lazy_instance
|
||||
# Hacks!
|
||||
from .entity_instance import _patch_swig_comparisons
|
||||
_patch_swig_comparisons()
|
||||
del _patch_swig_comparisons
|
||||
# End hacks!
|
||||
from .sql import sqlite, sqlite_entity
|
||||
|
||||
# explicitly specify available imported symbols
|
||||
@@ -388,15 +393,24 @@ def stream2_from_string(data: str) -> Generator[dict]:
|
||||
yield inst
|
||||
|
||||
|
||||
def convert_path_to_rocksdb(ifcspf_path: Union[Path, str], rocksdb_path: Union[Path, str]) -> None:
|
||||
def convert_path_to_rocksdb(
|
||||
ifcspf_path: Union[Path, str],
|
||||
rocksdb_path: Union[Path, str],
|
||||
skip_supertypes: Optional[list[str]] = None,
|
||||
) -> None:
|
||||
"""Converts an IFC-SPF file on disk to the IfcOpenShell-specific
|
||||
RocksDB encoding. RocksDB is an embedded key-value store that allows
|
||||
partial reads and is therefore more memory efficient with larger files.
|
||||
|
||||
:param ifcspf_path: Input file path - needs to exist
|
||||
:param rocksdb_path: RocksDB file path (directory) - may exist, but result may then be invalid
|
||||
:param skip_supertypes: Optional list of entity type names. Any instance
|
||||
whose declaration is-a (or subclasses) one of these names will be
|
||||
omitted from the resulting RocksDB. Note: references to skipped
|
||||
instances become dangling - reads that walk into them will fail.
|
||||
"""
|
||||
ser = ifcopenshell_wrapper.RocksDbSerializer(str(ifcspf_path), str(rocksdb_path), True)
|
||||
skip = list(skip_supertypes) if skip_supertypes else []
|
||||
ser = ifcopenshell_wrapper.RocksDbSerializer(str(ifcspf_path), str(rocksdb_path), True, skip)
|
||||
ser.finalize()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user