diff --git a/src/blenderbim/blenderbim/tool/drawing.py b/src/blenderbim/blenderbim/tool/drawing.py index bea490ba72..f9965d42b2 100644 --- a/src/blenderbim/blenderbim/tool/drawing.py +++ b/src/blenderbim/blenderbim/tool/drawing.py @@ -1391,8 +1391,9 @@ class Drawing(blenderbim.core.tool.Drawing): original_command = command for variable in re.findall("{{.*?}}", command): value = ifcopenshell.util.selector.get_element_value(product, variable[2:-2]) - command = command.replace(variable, repr(value)) - text = text.replace(original_command, str(eval(command[2:-2]))) + value = '"' + str(value).replace('"', '\\"') + '"' + command = command.replace(variable, value) + text = text.replace(original_command, ifcopenshell.util.selector.format(command[2:-2])) for variable in re.findall("{{.*?}}", text): value = ifcopenshell.util.selector.get_element_value(product, variable[2:-2]) diff --git a/src/ifccsv/ifccsv.py b/src/ifccsv/ifccsv.py index 1f72bf6c54..08ef8c6e5e 100755 --- a/src/ifccsv/ifccsv.py +++ b/src/ifccsv/ifccsv.py @@ -238,7 +238,7 @@ class IfcCsv: if row[index] == null: continue if not isinstance(row[index], str): - row[index] = '"' + str(row[index]) + '"' + row[index] = '"' + str(row[index]).replace('"', '\\"') + '"' row[index] = ifcopenshell.util.selector.format(format_query.replace("{{value}}", row[index])) def sort_results(self, sort, attributes, include_global_id):