Add id() and is_a() functions to entity_instance class Make filename argument to open() function optional

This commit is contained in:
Thomas Krijnen
2014-07-19 13:57:47 +02:00
parent f7adeb9cc1
commit d4e4ca3a2a
4 changed files with 19 additions and 4 deletions
+6 -4
View File
@@ -43,12 +43,14 @@ class entity_instance:
self.wrapped_data.set_argument(idx, entity_instance.map_value(value))
def __len__(self): return len(self.wrapped_data)
def __repr__(self): return repr(self.wrapped_data)
def is_a(self, *args): return self.wrapped_data.is_a(*args)
def id(self): return self.wrapped_data.id()
class file:
instances = []
def __init__(self, f):
self.wrapped_data = f
def __init__(self, f=None):
self.wrapped_data = f or ifc_wrapper.file()
def create_entity(self,type,*args,**kwargs):
e = entity_instance(ifc_wrapper.entity_instance(type))
attrs = list(enumerate(args)) + \
@@ -94,8 +96,8 @@ class guid:
return '{%s-%s-%s-%s-%s}'%(g[:8], g[8:12], g[12:16], g[16:20], g[20:])
def open(fn):
return file(ifc_wrapper.open(fn))
def open(fn=None):
return file(ifc_wrapper.open(fn)) if fn else file()
def create_shape(inst, settings): return ifc_wrapper.create_shape(inst.wrapped_data, settings)