Ifc text tweaks (#2431)

* added 3"=1'-0" scale (a common scale), and corrected 6"=1'-0" scale

* Allow float point values in smart tags, and avoid breaking when no assigned product See #2340, #2349
This commit is contained in:
Ryan Schultz
2022-09-24 05:07:32 -05:00
committed by GitHub
parent e024e9e622
commit 54da579891
2 changed files with 4 additions and 3 deletions
@@ -528,8 +528,9 @@ class SvgWriter:
product = tool.Drawing.get_assigned_product(element)
selector = ifcopenshell.util.selector.Selector
variables = {}
for variable in re.findall("{{.*?}}", literal):
literal = literal.replace(variable, selector.get_element_value(product, variable[2:-2]) or "")
if product != None:
for variable in re.findall("{{.*?}}", literal):
literal = literal.replace(variable, str(selector.get_element_value(product, variable[2:-2]) or ""))
for line_number, text_line in enumerate(literal.replace("\\n", "\n").split("\n")):
self.svg.add(
+1 -1
View File
@@ -422,7 +422,7 @@ class Drawing(blenderbim.core.tool.Drawing):
selector = ifcopenshell.util.selector.Selector()
variables = {}
for variable in re.findall("{{.*?}}", value):
value = value.replace(variable, selector.get_element_value(product, variable[2:-2]) or "")
value = value.replace(variable, str(selector.get_element_value(product, variable[2:-2]) or ""))
obj.BIMTextProperties.value = value
# TODO below this point is highly experimental prototype code with no tests