From c0567a59906357236cfaaafb242013987433c71e Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Tue, 27 Nov 2018 16:10:42 -0200 Subject: [PATCH] Draft: Fixed DXF import of texts --- src/Mod/Draft/importDXF.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Mod/Draft/importDXF.py b/src/Mod/Draft/importDXF.py index 9b4e071892..72baae990f 100644 --- a/src/Mod/Draft/importDXF.py +++ b/src/Mod/Draft/importDXF.py @@ -977,10 +977,9 @@ def addText(text,attrib=False): hgt = vec(text.height) if val: if attrib: - newob = doc.addObject("App::Annotation","Attribute") + name = "Attribute" else: - newob = doc.addObject("App::Annotation","Text") - lay.addObject(newob) + name = "Text" val = deformat(val) # the following stores text as Latin1 in annotations, which # displays ok in coin texts, but causes errors later on. @@ -992,6 +991,8 @@ def addText(text,attrib=False): # val = val.encode("latin1") # except: # pass + newob = Draft.makeText(val.split("\n")) + lay.addObject(newob) rx = rawValue(text,11) ry = rawValue(text,21) rz = rawValue(text,31) @@ -1013,7 +1014,6 @@ def addText(text,attrib=False): attrot = rawValue(text,50) if attrot: Draft.rotate(newob,attrot) - newob.LabelText = val.split("\n") if gui and draftui and dxfUseStandardSize: fsize = draftui.fontsize else: @@ -1027,7 +1027,7 @@ def addText(text,attrib=False): elif text.alignment in [4,5,6]: sup = DraftVecUtils.scaleTo(yv,fsize/(2*TEXTSCALING)).negative() pos = pos.add(sup) - newob.Position = pos + newob.Placement.Base = pos if gui: newob.ViewObject.FontSize = fsize if hasattr(text,"alignment"): @@ -1035,7 +1035,7 @@ def addText(text,attrib=False): newob.ViewObject.Justification = "Center" elif text.alignment in [3,6,9]: newob.ViewObject.Justification = "Right" - newob.ViewObject.DisplayMode = "World" + #newob.ViewObject.DisplayMode = "World" formatObject(newob,text) def addToBlock(obj,layer):