Arch: Enabled section filling in Arch drawing views
This commit is contained in:
@@ -1742,9 +1742,12 @@ def getSVG(obj,scale=1,linewidth=0.35,fontsize=12,fillstyle="shape color",direct
|
||||
|
||||
def getPath(edges=[],wires=[],pathname=None):
|
||||
import DraftGeomUtils
|
||||
svg = "<path "
|
||||
if pathname is None:
|
||||
pathname = obj.Name
|
||||
svg ='<path id="%s" d="' % pathname
|
||||
svg += 'id="%s" ' % obj.Name
|
||||
elif pathname != "":
|
||||
svg += 'id="%s" ' % pathname
|
||||
svg += ' d="'
|
||||
if not wires:
|
||||
egroups = (DraftGeomUtils.sortEdges(edges),)
|
||||
else:
|
||||
@@ -1813,6 +1816,7 @@ def getSVG(obj,scale=1,linewidth=0.35,fontsize=12,fillstyle="shape color",direct
|
||||
(str(rx),str(ry),str(rot),\
|
||||
str(int(flag_large_arc)),\
|
||||
str(int(flag_sweep)),str(v.x),str(v.y))
|
||||
print svg
|
||||
elif DraftGeomUtils.geomType(e) == "Line":
|
||||
v = getProj(vs[-1].Point)
|
||||
svg += 'L '+ str(v.x) +' '+ str(v.y) + ' '
|
||||
@@ -1963,7 +1967,13 @@ def getSVG(obj,scale=1,linewidth=0.35,fontsize=12,fillstyle="shape color",direct
|
||||
|
||||
if not obj:
|
||||
pass
|
||||
|
||||
|
||||
elif isinstance(obj,Part.Shape):
|
||||
fill = 'url(#'+fillstyle+')'
|
||||
lstyle = getLineStyle()
|
||||
svg += getPath(obj.Edges,pathname="")
|
||||
|
||||
|
||||
elif getType(obj) == "Dimension":
|
||||
if obj.ViewObject.Proxy:
|
||||
if hasattr(obj.ViewObject.Proxy,"p1"):
|
||||
|
||||
@@ -662,6 +662,8 @@ def sortEdges(edges):
|
||||
# Build a dictionary of edges according to their end points.
|
||||
# Each entry is a set of edges that starts, or ends, at the
|
||||
# given vertex hash.
|
||||
if len(edges) < 2:
|
||||
return edges
|
||||
sdict = dict()
|
||||
edict = dict()
|
||||
nedges = []
|
||||
@@ -670,6 +672,9 @@ def sortEdges(edges):
|
||||
sdict.setdefault( e.Vertexes[0].hashCode(), [] ).append(e)
|
||||
edict.setdefault( e.Vertexes[-1].hashCode(),[] ).append(e)
|
||||
nedges.append(e)
|
||||
if not nedges:
|
||||
print "DraftGeomUtils.sortEdges: zero-length edges"
|
||||
return edges
|
||||
# Find the start of the path. The start is the vertex that appears
|
||||
# in the sdict dictionary but not in the edict dictionary, and has
|
||||
# only one edge ending there.
|
||||
@@ -719,7 +724,7 @@ def sortEdges(edges):
|
||||
eh = e.hashCode()
|
||||
e = invert(e)
|
||||
except KeyError:
|
||||
print("DraftGeomUtils.sortEdges failed - running old version:")
|
||||
print("DraftGeomUtils.sortEdges failed - running old version")
|
||||
return sortEdgesOld(edges)
|
||||
ret.append(e)
|
||||
# All done.
|
||||
|
||||
Reference in New Issue
Block a user