Initial work, only text (no lines)

This commit is contained in:
George Shuklin
2018-10-22 23:48:28 +03:00
committed by Yorik van Havre
parent 76590be8ac
commit 3391a5ea4b
2 changed files with 13 additions and 1 deletions

View File

@@ -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)

View File

@@ -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: