From 2a23bd13ce8928d46b66e85d22fab3e32e428b98 Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Tue, 13 Mar 2012 11:41:04 -0300 Subject: [PATCH] Finished implementing RFE 510 - Arch Axes Arch axes are now printable on a Drawing sheet with the Draft tool --- src/Mod/Arch/ArchAxis.py | 6 ++---- src/Mod/Draft/Draft.py | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 4 deletions(-) diff --git a/src/Mod/Arch/ArchAxis.py b/src/Mod/Arch/ArchAxis.py index dc9cca650..aac12dc0a 100644 --- a/src/Mod/Arch/ArchAxis.py +++ b/src/Mod/Arch/ArchAxis.py @@ -102,16 +102,14 @@ class _ViewProviderAxis: def __init__(self,vobj): vobj.addProperty("App::PropertyLength","BubbleSize","Base", "The size of the axis bubbles") vobj.addProperty("App::PropertyEnumeration","NumerationStyle","Base", "The numeration style") - vobj.addProperty("App::PropertyEnumeration","DrawStyle","Base", "The representation style") vobj.NumerationStyle = ["1,2,3","01,02,03","001,002,003","A,B,C","a,b,c","I,II,III","L0,L1,L2"] - vobj.DrawStyle = ["solid","dotted","dashed","dashdot"] vobj.Proxy = self self.Object = vobj.Object self.ViewObject = vobj vobj.BubbleSize = .1 vobj.LineWidth = 1 vobj.LineColor = (0.13,0.15,0.37) - vobj.DrawStyle = "dashdot" + vobj.DrawStyle = "Dashdot" def getIcon(self): return ":/icons/Arch_Axis_Tree.svg" @@ -203,7 +201,7 @@ class _ViewProviderAxis: self.bubbles.addChild(li) st = coin.SoSeparator() tr = coin.SoTransform() - tr.translation.setValue((center.x,center.y,center.z)) + tr.translation.setValue((center.x,center.y-rad/4,center.z)) fo = coin.SoFont() fo.name = "Arial,Sans" fo.size = rad*100 diff --git a/src/Mod/Draft/Draft.py b/src/Mod/Draft/Draft.py index 5bd391bb8..f82ba9922 100644 --- a/src/Mod/Draft/Draft.py +++ b/src/Mod/Draft/Draft.py @@ -1227,6 +1227,46 @@ def getSVG(obj,modifier=100,textmodifier=100,linestyle="continuous",fillstyle="s svg += ''+l+'\n' svg += '\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 += '\n' + svg += '\n' + n += 1 + elif obj.isDerivedFrom('Part::Feature'): if obj.Shape.isNull(): return '' color = getrgb(obj.ViewObject.LineColor)