Some quick and dirty #1560

This commit is contained in:
Thomas Krijnen
2021-07-10 21:43:27 +02:00
committed by GitHub
parent cf48661a35
commit d320c1dac1
@@ -48,7 +48,7 @@ class entity_instance(object):
>>> #423=IfcProductDefinitionShape($,$,(#409,#421))
"""
def __init__(self, e, file):
def __init__(self, e, file=None):
if isinstance(e, tuple):
e = ifcopenshell_wrapper.new_IfcBaseClass(*e)
super(entity_instance, self).__setattr__("wrapped_data", e)
@@ -126,7 +126,7 @@ class entity_instance(object):
return entity_instance.wrap_value(self.wrapped_data.get_argument(key), self.wrapped_data.file)
def __setitem__(self, idx, value):
if self.wrapped_data.file.transaction:
if self.wrapped_data.file and self.wrapped_data.file.transaction:
self.wrapped_data.file.transaction.store_edit(self, idx, value)
attr_type = real_attr_type = self.attribute_type(idx).title().replace(" ", "")