Work on python wrapper

This commit is contained in:
Thomas Krijnen
2017-12-31 12:20:13 +01:00
parent 05e6f56911
commit e2f79ec1ba
12 changed files with 94 additions and 72 deletions
+8 -3
View File
@@ -55,11 +55,16 @@ class file(object):
print(products[0] == ifc_file[122] == ifc_file['2XQ$n5SLP5MBLyL442paFx'])
>>> True
"""
def __init__(self, f=None):
self.wrapped_data = f or ifcopenshell_wrapper.file()
def __init__(self, f=None, schema=None):
if f is not None:
self.wrapped_data = f
else:
args = filter(None, [schema])
args = map(ifcopenshell_wrapper.schema_by_name, args)
self.wrapped_data = ifcopenshell_wrapper.file(*args)
def create_entity(self, type, *args, **kwargs):
e = entity_instance(type)
e = entity_instance((self.schema, type))
self.wrapped_data.add(e.wrapped_data)
e.wrapped_data.this.disown()
attrs = list(enumerate(args)) + \