Draft: small fix in SVG generation

This commit is contained in:
Yorik van Havre 2015-01-26 17:38:30 -02:00
parent 2ef086a028
commit 8628a6e0e0

View File

@ -1752,16 +1752,16 @@ def getSVG(obj,scale=1,linewidth=0.35,fontsize=12,fillstyle="shape color",direct
for w in wires: for w in wires:
w1=w.copy() w1=w.copy()
w1.fixWire() w1.fixWire()
egroups.append(w1.Edges) egroups.append(DraftGeomUtils.sortEdges(w1.Edges))
for egroupindex, edges in enumerate(egroups): for egroupindex, edges in enumerate(egroups):
vs=() #skipped for the first edge vs=() #skipped for the first edge
for edgeindex,e in enumerate(edges): for edgeindex,e in enumerate(edges):
previousvs = vs previousvs = vs
# vertexes of an edge (corrected for the orientation) # vertexes of an edge (reversed if needed)
if e.Orientation == "Forward": vs = e.Vertexes
vs = e.Vertexes if previousvs:
else: if (vs[0].Point-previousvs[-1].Point).Length > 1e-6:
vs = e.Vertexes[::-1] vs.reverse()
if edgeindex == 0: if edgeindex == 0:
v = getProj(vs[0].Point) v = getProj(vs[0].Point)
svg += 'M '+ str(v.x) +' '+ str(v.y) + ' ' svg += 'M '+ str(v.x) +' '+ str(v.y) + ' '