mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-11 18:16:40 +00:00
Add a stream2_from_string() (mostly for wasm)
This commit is contained in:
@@ -301,10 +301,10 @@ def stream2(path: Union[Path, str]):
|
||||
as a dictionary.
|
||||
|
||||
Args:
|
||||
path (Union[Path, str]): _description_
|
||||
path (Union[Path, str]): input file path
|
||||
|
||||
Yields:
|
||||
_type_: _description_
|
||||
dict: entity instance dictionaries
|
||||
"""
|
||||
streamer = ifcopenshell_wrapper.InstanceStreamer(str(path))
|
||||
while streamer:
|
||||
@@ -312,6 +312,22 @@ def stream2(path: Union[Path, str]):
|
||||
yield inst
|
||||
|
||||
|
||||
def stream2_from_string(data: str):
|
||||
"""Streams the content of a file path from string, yielding each instance
|
||||
as a dictionary.
|
||||
|
||||
Args:
|
||||
data (str): input data
|
||||
|
||||
Yields:
|
||||
dict: entity instance dictionaries
|
||||
"""
|
||||
streamer = ifcopenshell_wrapper.stream_from_string(data)
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user