mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-17 14:02:27 +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
|
# this is why we apply "font-size: 0;" to the text tag to remove those spaces
|
||||||
# and add clases to the tspan tags
|
# and add clases to the tspan tags
|
||||||
# ref: https://github.com/IfcOpenShell/IfcOpenShell/issues/2833#issuecomment-1471584960
|
# 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(
|
text_tag = self.svg.text(
|
||||||
"",
|
"",
|
||||||
**{
|
**{
|
||||||
|
|||||||
@@ -540,14 +540,8 @@ class Drawing(blenderbim.core.tool.Drawing):
|
|||||||
ifc_literal = cls.get_text_literal(obj)
|
ifc_literal = cls.get_text_literal(obj)
|
||||||
if not ifc_literal:
|
if not ifc_literal:
|
||||||
return
|
return
|
||||||
value = ifc_literal.Literal
|
|
||||||
product = cls.get_assigned_product(tool.Ifc.get_entity(obj))
|
product = cls.get_assigned_product(tool.Ifc.get_entity(obj))
|
||||||
if product:
|
props.value = cls.replace_text_literal_variables(ifc_literal.Literal, 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
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def update_text_size_pset(cls, obj):
|
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"])
|
b_tree = mathutils.bvhtree.BVHTree.FromPolygons(b_block["verts"], b_block["faces"])
|
||||||
return bool(a_tree.overlap(b_tree))
|
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
|
@classmethod
|
||||||
def sync_object_representation(cls, obj):
|
def sync_object_representation(cls, obj):
|
||||||
bpy.ops.bim.update_representation(obj=obj.name)
|
bpy.ops.bim.update_representation(obj=obj.name)
|
||||||
|
|||||||
Reference in New Issue
Block a user