Finished implementing RFE 510 - Arch Axes

Arch axes are now printable on a Drawing sheet with the Draft tool
This commit is contained in:
Yorik van Havre
2012-03-13 11:41:04 -03:00
parent a72f1552f7
commit 11dfd41b94
2 changed files with 42 additions and 4 deletions

View File

@@ -1227,6 +1227,46 @@ def getSVG(obj,modifier=100,textmodifier=100,linestyle="continuous",fillstyle="s
svg += '<tspan>'+l+'</tspan>\n'
svg += '</text>\n'
elif getType(obj) == "Axis":
"returns the SVG representation of an Arch Axis system"
color = getrgb(obj.ViewObject.LineColor)
# setting linetype
if linestyle == "dashed":
lorig = "0.09,0.05"
elif linestyle == "dashdotted":
lorig = "0.09,0.05,0.02,0.05"
elif linestyle == "dotted":
lorig = "0.02,0.02"
else:
lorig = "none"
name = obj.Name
stroke = getrgb(obj.ViewObject.LineColor)
width = obj.ViewObject.LineWidth/modifier
fill = 'none'
invpl = obj.Placement.inverse()
n = 0
for e in obj.Shape.Edges:
lstyle = lorig
svg += getPath([e])
p1 = invpl.multVec(e.Vertexes[0].Point)
p2 = invpl.multVec(e.Vertexes[1].Point)
dv = p2.sub(p1)
dv.normalize()
rad = obj.ViewObject.BubbleSize
center = p2.add(dv.scale(rad,rad,rad))
lstyle = "none"
svg += getCircle(Part.makeCircle(rad,center))
svg += '<text fill="' + color + '" '
svg += 'font-size="' + str(rad) + '" '
svg += 'style="text-anchor:middle;'
svg += 'text-align:center;'
svg += 'font-family: Arial,sans;" '
svg += 'transform="translate(' + str(center.x+rad/4) + ',' + str(center.y-rad/3) + ') '
svg += 'scale(1,-1)"> '
svg += '<tspan>' + obj.ViewObject.Proxy.getNumber(n) + '</tspan>\n'
svg += '</text>\n'
n += 1
elif obj.isDerivedFrom('Part::Feature'):
if obj.Shape.isNull(): return ''
color = getrgb(obj.ViewObject.LineColor)