mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 01:41:57 +00:00
@@ -131,6 +131,13 @@ class entity_instance(object):
|
||||
"""
|
||||
self.wrapped_data.file = None
|
||||
|
||||
@property
|
||||
def file(self):
|
||||
# ugh circular imports, name collisions
|
||||
from . import file
|
||||
|
||||
return file.file.from_pointer(self.wrapped_data.file_pointer())
|
||||
|
||||
def __getattr__(self, name):
|
||||
INVALID, FORWARD, INVERSE = range(3)
|
||||
attr_cat = self.wrapped_data.get_attribute_category(name)
|
||||
|
||||
@@ -176,6 +176,9 @@ class Transaction:
|
||||
pass
|
||||
|
||||
|
||||
file_dict = {}
|
||||
|
||||
|
||||
class file(object):
|
||||
"""Base class for containing IFC files.
|
||||
|
||||
@@ -249,6 +252,8 @@ class file(object):
|
||||
self.future = []
|
||||
self.transaction = None
|
||||
|
||||
file_dict[self.file_pointer()] = self
|
||||
|
||||
def set_history_size(self, size):
|
||||
self.history_size = size
|
||||
while len(self.history) > self.history_size:
|
||||
@@ -543,10 +548,18 @@ class file(object):
|
||||
unzipped_path = path.with_suffix(format)
|
||||
path.rename(unzipped_path)
|
||||
with zipfile.ZipFile(path, "w") as zip_file:
|
||||
zip_file.write(unzipped_path, unzipped_path.name, compress_type=zipfile.ZIP_DEFLATED)
|
||||
zip_file.write(
|
||||
unzipped_path,
|
||||
unzipped_path.name,
|
||||
compress_type=zipfile.ZIP_DEFLATED,
|
||||
)
|
||||
unzipped_path.unlink()
|
||||
return
|
||||
|
||||
@staticmethod
|
||||
def from_string(s):
|
||||
return file(ifcopenshell_wrapper.read(s))
|
||||
|
||||
@staticmethod
|
||||
def from_pointer(v):
|
||||
return file_dict.get(v)
|
||||
|
||||
Reference in New Issue
Block a user