mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-19 06:39:13 +00:00
Fix schema passing to file creation
This commit is contained in:
@@ -893,12 +893,22 @@ class file_mixin:
|
|||||||
unzipped_path.unlink()
|
unzipped_path.unlink()
|
||||||
return
|
return
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def from_string(s: str) -> file:
|
|
||||||
return file(ifcopenshell_wrapper.read(s))
|
|
||||||
|
|
||||||
def to_string(self) -> str:
|
def to_string(self) -> str:
|
||||||
return self.to_string()
|
return self.to_string()
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def _determine_schema_identifier(
|
||||||
|
schema: Optional[ifcopenshell.util.schema.IFC_SCHEMA] = None,
|
||||||
|
schema_version: Optional[tuple[int, int, int, int]] = None,
|
||||||
|
):
|
||||||
|
if schema_version:
|
||||||
|
prefixes = ("IFC", "X", "_ADD", "_TC")
|
||||||
|
schema = "".join("".join(map(str, t)) if t[1] else "" for t in zip(prefixes, schema_version))
|
||||||
|
elif schema:
|
||||||
|
schema = {"IFC4X3": "IFC4X3_ADD2"}.get(schema, schema)
|
||||||
|
else:
|
||||||
|
schema = "IFC4"
|
||||||
|
return schema
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def storage(self) -> Optional[rocksdb_file_storage]:
|
def storage(self) -> Optional[rocksdb_file_storage]:
|
||||||
|
|||||||
@@ -326,13 +326,17 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
%pythoncode %{
|
%pythoncode %{
|
||||||
|
@staticmethod
|
||||||
|
def from_string(s: str) -> 'file':
|
||||||
|
return read(s)
|
||||||
|
|
||||||
schema = property(schema_name)
|
schema = property(schema_name)
|
||||||
header = property(header)
|
header = property(header)
|
||||||
_registry = {}
|
_registry = {}
|
||||||
|
|
||||||
_old_init = __init__
|
_old_init = __init__
|
||||||
def __init__(self, schema=None, schema_version=None):
|
def __init__(self, schema=None, schema_version=None):
|
||||||
self._old_init(*filter(None, (schema, schema_version)))
|
self._old_init(self._determine_schema_identifier(schema=schema, schema_version=schema_version))
|
||||||
|
|
||||||
def __setattr__(self, k, v):
|
def __setattr__(self, k, v):
|
||||||
object.__setattr__(self, k, v)
|
object.__setattr__(self, k, v)
|
||||||
|
|||||||
Reference in New Issue
Block a user