mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 09:21:46 +00:00
Fix #2883. Regression in text in drawings.
This commit is contained in:
@@ -664,7 +664,8 @@ class SvgWriter:
|
||||
# this is why we apply "font-size: 0;" to the text tag to remove those spaces
|
||||
# and add clases to the tspan tags
|
||||
# ref: https://github.com/IfcOpenShell/IfcOpenShell/issues/2833#issuecomment-1471584960
|
||||
text = text_obj.BIMTextProperties.value
|
||||
product = tool.Drawing.get_assigned_product(element)
|
||||
text = tool.Drawing.replace_text_literal_variables(text_literal.Literal, product)
|
||||
text_tag = self.svg.text(
|
||||
"",
|
||||
**{
|
||||
|
||||
@@ -540,14 +540,8 @@ class Drawing(blenderbim.core.tool.Drawing):
|
||||
ifc_literal = cls.get_text_literal(obj)
|
||||
if not ifc_literal:
|
||||
return
|
||||
value = ifc_literal.Literal
|
||||
product = cls.get_assigned_product(tool.Ifc.get_entity(obj))
|
||||
if product:
|
||||
for variable in re.findall("{{.*?}}", value):
|
||||
value = value.replace(
|
||||
variable, str(ifcopenshell.util.selector.get_element_value(product, variable[2:-2]) or "")
|
||||
)
|
||||
props.value = value
|
||||
props.value = cls.replace_text_literal_variables(ifc_literal.Literal, product)
|
||||
|
||||
@classmethod
|
||||
def update_text_size_pset(cls, obj):
|
||||
@@ -959,6 +953,16 @@ class Drawing(blenderbim.core.tool.Drawing):
|
||||
b_tree = mathutils.bvhtree.BVHTree.FromPolygons(b_block["verts"], b_block["faces"])
|
||||
return bool(a_tree.overlap(b_tree))
|
||||
|
||||
@classmethod
|
||||
def replace_text_literal_variables(cls, text, product):
|
||||
if not product:
|
||||
return text
|
||||
for variable in re.findall("{{.*?}}", text):
|
||||
text = text.replace(
|
||||
variable, str(ifcopenshell.util.selector.get_element_value(product, variable[2:-2]) or "")
|
||||
)
|
||||
return text
|
||||
|
||||
@classmethod
|
||||
def sync_object_representation(cls, obj):
|
||||
bpy.ops.bim.update_representation(obj=obj.name)
|
||||
|
||||
Reference in New Issue
Block a user