mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-11 10:06:47 +00:00
Import BoxAlignment into alignment props on edit enable
When enabling text editing, align_vertical and align_horizontal were not populated from the existing IFC BoxAlignment value, causing them to revert to their Blender property defaults. Generated with the assistance of an AI coding tool.
This commit is contained in:
@@ -1185,7 +1185,7 @@ class Drawing(bonsai.core.tool.Drawing):
|
||||
|
||||
ifc_literals = cls.get_text_literal(obj, return_list=True)
|
||||
assert isinstance(ifc_literals, list)
|
||||
for ifc_literal in ifc_literals:
|
||||
for i, ifc_literal in enumerate(ifc_literals):
|
||||
literal_props = props.literals.add()
|
||||
bonsai.bim.helper.import_attributes(ifc_literal, literal_props.attributes)
|
||||
|
||||
@@ -1196,6 +1196,16 @@ class Drawing(bonsai.core.tool.Drawing):
|
||||
literal_props.box_alignment = box_alignment_mask # pyright: ignore[reportAttributeAccessIssue]
|
||||
literal_props.ifc_definition_id = ifc_literal.id()
|
||||
|
||||
if i == 0:
|
||||
if position_string == "center":
|
||||
props.align_vertical = "middle"
|
||||
props.align_horizontal = "middle"
|
||||
else:
|
||||
parts = position_string.split("-")
|
||||
if len(parts) == 2:
|
||||
props.align_vertical = parts[0]
|
||||
props.align_horizontal = parts[1]
|
||||
|
||||
from bonsai.bim.module.drawing.data import DecoratorData
|
||||
|
||||
text_data = DecoratorData.get_text_data(obj)
|
||||
|
||||
Reference in New Issue
Block a user