Allow text annotation formatting functions

This commit is contained in:
Dion Moult
2020-05-06 21:10:39 +10:00
parent 4ed3517c47
commit 0af8902dde
3 changed files with 14 additions and 12 deletions
@@ -219,7 +219,13 @@ class IfcCutter:
for variable in text_obj.data.BIMTextProperties.variables:
element = self.get_ifc_element(variable.global_id)
if element:
text_obj_data[variable.name] = self.ifc_attribute_extractor.get_element_key(element, variable.prop_key)
if '{{' in variable.prop_key:
prop_key = variable.prop_key.split('{{')[1].split('}}')[0]
prop_value = self.ifc_attribute_extractor.get_element_key(element, prop_key)
variable_value = eval(variable.prop_key.replace('{{' + prop_key + '}}', str(prop_value)))
else:
variable_value = self.ifc_attribute_extractor.get_element_key(element, variable.prop_key)
text_obj_data[variable.name] = variable_value
if text_obj_data:
data[text_obj.name] = text_obj_data
@@ -939,7 +939,6 @@ class IfcImporter():
and getattr(association.RelatingDocument, value):
setattr(reference, key, getattr(association.RelatingDocument, value))
def place_objects_in_spatial_tree(self):
for global_id, obj in self.added_data.items():
self.place_object_in_spatial_tree(self.file.by_guid(global_id), obj)
+7 -10
View File
@@ -176,16 +176,13 @@ class IfcAttributeExtractor():
return getattr(element, key)
elif '.' not in key:
return None
elif key[0:3] == 'Qto':
qto_name, prop = key.split('.')
qto = IfcAttributeExtractor.get_element_qto(element, qto_name)
if qto:
return IfcAttributeExtractor.get_qto_property(qto, prop)
else:
pset_name, prop = key.split('.')
pset = IfcAttributeExtractor.get_element_pset(element, pset_name)
if pset:
return IfcAttributeExtractor.get_pset_property(pset, prop)
pset_name, prop = key.split('.')
pset = IfcAttributeExtractor.get_element_pset(element, pset_name)
if pset:
return IfcAttributeExtractor.get_pset_property(pset, prop)
qto = IfcAttributeExtractor.get_element_qto(element, pset_name)
if qto:
return IfcAttributeExtractor.get_qto_property(qto, prop)
return None
@staticmethod