diff --git a/src/ifcopenshell-python/ifcopenshell/__init__.py b/src/ifcopenshell-python/ifcopenshell/__init__.py index cfb4b87299..5bb478268a 100644 --- a/src/ifcopenshell-python/ifcopenshell/__init__.py +++ b/src/ifcopenshell-python/ifcopenshell/__init__.py @@ -291,11 +291,31 @@ def guess_format(path: Path) -> Literal[".ifc", ".ifcZIP", ".ifcXML", ".ifcJSON" def stream2(path: Union[Path, str]): + """Streams the content of a file path from disk, yielding each instance + as a dictionary. + + Args: + path (Union[Path, str]): _description_ + + Yields: + _type_: _description_ + """ streamer = ifcopenshell_wrapper.InstanceStreamer(str(path)) while streamer: if inst := streamer.read_instance_py(): yield inst +def convert_path_to_rocksdb(ifcspf_path: Union[Path, str], rocksdb_path: Union[Path, str]): + """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. + + Args: + ifcspf_path (Union[Path, str]): Input file path - needs to exist + rocksdb_path (Union[Path, str]): RocksDB file path (directory) - may exist, but result may then be invalid + """ + ser = ifcopenshell_wrapper.RocksDbSerializer(str(ifcspf_path), str(rocksdb_path), True) + ser.finalize() version_core = ifcopenshell_wrapper.version() __version__ = version = "0.0.0"