diff --git a/src/Mod/Arch/ArchAxis.py b/src/Mod/Arch/ArchAxis.py index 2101cefc7b..16d808f6a4 100644 --- a/src/Mod/Arch/ArchAxis.py +++ b/src/Mod/Arch/ArchAxis.py @@ -361,6 +361,7 @@ class _ViewProviderAxis: self.bubbles = None self.bubbletexts = [] + self.bubbledata = [] sep = coin.SoSeparator() self.mat = coin.SoMaterial() self.linestyle = coin.SoDrawStyle() @@ -445,6 +446,7 @@ class _ViewProviderAxis: self.bubbles.addChild(self.bubblestyle) import Part,Draft self.bubbletexts = [] + self.bubbledata = [] pos = ["Start"] if hasattr(vobj,"BubblePosition"): if vobj.BubblePosition in ["Both","Arrow left","Arrow right","Bar left","Bar right"]: @@ -501,6 +503,9 @@ class _ViewProviderAxis: coords.point.setValues(0,len(pts),pts) line = coin.SoFaceSet() line.numVertices.setValue(-1) + cir = Part.makePolygon(pts) + cir.Placement = vobj.Object.Placement + self.bubbledata.append(cir) elif arrow == False: p3 = p2.add(Vector(chord).multiply(rad/2)) if vobj.BubblePosition.startswith("Arrow"): @@ -518,8 +523,12 @@ class _ViewProviderAxis: coords.point.setValues(0,len(pts),pts) line = coin.SoFaceSet() line.numVertices.setValue(-1) + cir = Part.makePolygon(pts) + cir.Placement = vobj.Object.Placement + self.bubbledata.append(cir) else: - buf = Part.makeCircle(rad,center).writeInventor() + cir = Part.makeCircle(rad,center) + buf = cir.writeInventor() try: cin = coin.SoInput() cin.setBuffer(buf) @@ -541,6 +550,8 @@ class _ViewProviderAxis: else: coords = cob.getChild(1).getChild(0).getChild(2) line = cob.getChild(1).getChild(0).getChild(3) + cir.Placement = vobj.Object.Placement + self.bubbledata.append(cir) self.bubbles.addChild(coords) self.bubbles.addChild(line) st = coin.SoSeparator() @@ -548,7 +559,8 @@ class _ViewProviderAxis: fs = rad*1.5 if hasattr(vobj,"FontSize"): fs = vobj.FontSize.Value - tr.translation.setValue((center.x,center.y-fs/2.5,center.z)) + txpos = FreeCAD.Vector(center.x,center.y-fs/2.5,center.z) + tr.translation.setValue(tuple(txpos)) fo = coin.SoFont() fn = Draft.getParam("textfont","Arial,Sans") if hasattr(vobj,"FontName"): @@ -561,7 +573,7 @@ class _ViewProviderAxis: fo.size = fs tx = coin.SoAsciiText() tx.justification = coin.SoText2.CENTER - self.bubbletexts.append(tx) + self.bubbletexts.append((tx,vobj.Object.Placement.multVec(center))) st.addChild(tr) st.addChild(fo) st.addChild(tx) @@ -578,7 +590,7 @@ class _ViewProviderAxis: num = vobj.StartNumber-1 alt = False for t in self.bubbletexts: - t.string = self.getNumber(vobj,num) + t[0].string = self.getNumber(vobj,num) num += 1 if hasattr(vobj,"BubblePosition"): if vobj.BubblePosition in ["Both","Arrow left","Arrow right","Bar left","Bar right"]: @@ -685,6 +697,14 @@ class _ViewProviderAxis: else: return str(num+1) + def getTextData(self): + + return [(t[0].string.getValues()[0],t[1]) for t in self.bubbletexts] + + def getShapeData(self): + + return self.bubbledata + def setEdit(self,vobj,mode=0): taskd = _AxisTaskPanel() @@ -711,6 +731,8 @@ class _ViewProviderAxis: return None + + class _AxisTaskPanel: '''The editmode TaskPanel for Axis objects''' diff --git a/src/Mod/Draft/draftfunctions/svg.py b/src/Mod/Draft/draftfunctions/svg.py index 9dab09aab3..7ad4c43980 100644 --- a/src/Mod/Draft/draftfunctions/svg.py +++ b/src/Mod/Draft/draftfunctions/svg.py @@ -684,55 +684,32 @@ def get_svg(obj, if App.GuiUp: vobj = obj.ViewObject - lorig = lstyle + fn = obj.ViewObject.FontName fill = 'none' rad = vobj.BubbleSize.Value/2 n = 0 for e in obj.Shape.Edges: - lstyle = lorig svg += get_path(obj, plane, fill, pathdata, stroke, linewidth, lstyle, fill_opacity=None, edges=[e]) - lstyle = "none" - pos = ["Start"] - if hasattr(vobj, "BubblePosition"): - if vobj.BubblePosition == "Both": - pos = ["Start", "End"] - else: - pos = [vobj.BubblePosition] - for p in pos: - if p == "Start": - p1 = e.Vertexes[0].Point - p2 = e.Vertexes[1].Point - else: - p1 = e.Vertexes[1].Point - p2 = e.Vertexes[0].Point - dv = p2.sub(p1) - dv.normalize() - center = p2.add(dv.scale(rad, rad, rad)) + for t in obj.ViewObject.Proxy.getTextData(): + pos = t[1].add(App.Vector(0,-fontsize/2,0)) + svg += svgtext.get_text(plane, techdraw, + tstroke, fontsize, fn, + 0.0, pos, t[0], + 1.0, "center") + for b in obj.ViewObject.Proxy.getShapeData(): + if hasattr(b,"Curve") and isinstance(b.Curve,Part.Circle): svg += get_circle(plane, - fill, stroke, linewidth, lstyle, - Part.makeCircle(rad, center)) - if (hasattr(vobj.Proxy, "bubbletexts") - and len(vobj.Proxy.bubbletexts) >= n): - bubb = vobj.Proxy.bubbletexts - svg += '