mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
Python impl function
This commit is contained in:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user