From 3391a5ea4b7d55aa73eb41278deed57d0eebf43b Mon Sep 17 00:00:00 2001 From: George Shuklin Date: Mon, 22 Oct 2018 23:48:28 +0300 Subject: [PATCH] Initial work, only text (no lines) --- src/Mod/Arch/ArchSectionPlane.py | 2 +- src/Mod/Draft/Draft.py | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/Mod/Arch/ArchSectionPlane.py b/src/Mod/Arch/ArchSectionPlane.py index 42d736237d..9f154c5c56 100644 --- a/src/Mod/Arch/ArchSectionPlane.py +++ b/src/Mod/Arch/ArchSectionPlane.py @@ -174,7 +174,7 @@ def getSVG(section, renderMode="Wireframe", allOn=False, showHidden=False, scale for o in objs: if Draft.getType(o) == "Space": spaces.append(o) - elif Draft.getType(o) in ["Dimension","Annotation"]: + elif Draft.getType(o) in ["Dimension","Annotation","Label"]: drafts.append(o) elif o.isDerivedFrom("Part::Part2DObject"): drafts.append(o) diff --git a/src/Mod/Draft/Draft.py b/src/Mod/Draft/Draft.py index 25af23d59f..5cfba2225b 100644 --- a/src/Mod/Draft/Draft.py +++ b/src/Mod/Draft/Draft.py @@ -2545,6 +2545,18 @@ def getSVG(obj,scale=1,linewidth=0.35,fontsize=12,fillstyle="shape color",direct tbase = getProj(prx.tbase) svg += getText(stroke,fontsize,obj.ViewObject.FontName,tangle,tbase,prx.string) + elif getType(obj) == "Label": + if gui: + if not obj.ViewObject: + print ("export of texts to SVG is only available in GUI mode") + else: + fontname = obj.ViewObject.TextFont + position = getProj(obj.Placement.Base) + rotation = obj.Placement.Rotation + justification = obj.ViewObject.TextAlignment + text = obj.Text + svg += getText(stroke, fontsize, fontname, rotation, position, text, linespacing, justification) + elif getType(obj) in ["Annotation","DraftText"]: "returns an svg representation of a document annotation" if gui: