From 98fc92e05ae4c5159b17daee4aca71bcd4a173e3 Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Tue, 21 Feb 2012 17:45:49 -0200 Subject: [PATCH] Fixed dimension text height bug in Draft DXF import --- src/Mod/Draft/importDXF.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/Mod/Draft/importDXF.py b/src/Mod/Draft/importDXF.py index 5754feaff..2ff051287 100644 --- a/src/Mod/Draft/importDXF.py +++ b/src/Mod/Draft/importDXF.py @@ -104,6 +104,17 @@ def locateLayer(wantedLayer): layers.append(newLayer) return newLayer +def getdimheight(style): + "returns the dimension text height from the given dimstyle" + for t in drawing.tables.data: + if t.name == 'dimstyle': + for a in t.data: + if hasattr(a,"type"): + if a.type == "dimstyle": + if rawValue(a,2) == style: + return rawValue(a,140) + return None + def calcBulge(v1,bulge,v2): ''' calculates intermediary vertex for curved segments. @@ -966,6 +977,11 @@ def processdxf(document,filename): dim.layer = layer dim.color_index = 256 fmt.formatObject (newob,dim) + if fmt.stdSize: + newob.ViewObject.FontSize = FreeCADGui.draftToolBar.fontsize + else: + st = rawValue(dim,3) + newob.ViewObject.FontSize = float(getdimheight(st)) else: FreeCAD.Console.PrintMessage("skipping dimensions...\n")