diff --git a/src/Mod/Arch/ArchSectionPlane.py b/src/Mod/Arch/ArchSectionPlane.py index 570278e1694b..816bd0feeb95 100644 --- a/src/Mod/Arch/ArchSectionPlane.py +++ b/src/Mod/Arch/ArchSectionPlane.py @@ -253,13 +253,145 @@ def __init__(self, obj): obj.FontSize = 12 def execute(self, obj): - if obj.Source: - obj.ViewResult = self.updateSVG(obj) + if hasattr(obj,"Source"): + if obj.Source: + if not hasattr(self,"svg"): + self.onChanged(obj,"Source") + else: + if not self.svg: + self.onChanged(obj,"Source") + if not hasattr(self,"svg"): + return '' + linewidth = obj.LineWidth/obj.Scale + st = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch").GetFloat("CutLineThickness",2) + da = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch").GetString("archHiddenPattern","30,10") + da =da.replace(" ","") + svg = self.svg.replace('LWPlaceholder', str(linewidth) + 'px') + svg = svg.replace('SWPlaceholder', str(linewidth*st) + 'px') + svg = svg.replace('DAPlaceholder', str(da)) + if hasattr(self,"spaces"): + if round(self.direction.getAngle(FreeCAD.Vector(0,0,1)),Draft.precision()) in [0,round(math.pi,Draft.precision())]: + for s in self.spaces: + svg += Draft.getSVG(s,scale=obj.Scale,fontsize=obj.FontSize.Value,direction=self.direction) + result = '' + result += ' + + + + + + Qt::Horizontal + + + QSizePolicy::Preferred + + + + 20 + 20 + + + + + + + + Hidden geomety pattern + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + This is the SVG stroke-dasharray property to apply to projections of hidden objects. + + + 30, 10 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + archHiddenPattern + + + Mod/Arch + + + + + @@ -310,6 +369,11 @@ QCheckBox
Gui/PrefWidgets.h
+ + Gui::PrefLineEdit + QLineEdit +
Gui/PrefWidgets.h
+
Gui::PrefDoubleSpinBox QDoubleSpinBox diff --git a/src/Mod/Draft/Draft.py b/src/Mod/Draft/Draft.py index f364afa38b32..15240c471d8d 100644 --- a/src/Mod/Draft/Draft.py +++ b/src/Mod/Draft/Draft.py @@ -1774,7 +1774,10 @@ def getText(color,fontsize,fontname,angle,base,text,linespacing=0.5,align="cente svg += 'font-family:'+ fontname +'" ' svg += 'transform="rotate('+str(math.degrees(angle)) svg += ','+ str(base.x) + ',' + str(base.y) + ') ' - svg += 'translate(' + str(base.x) + ',' + str(base.y) + ') ' + if flip: + svg += 'translate(' + str(base.x) + ',' + str(base.y) + ') ' + else: + svg += 'translate(' + str(base.x) + ',' + str(-base.y) + ') ' #svg += 'scale('+str(tmod/2000)+',-'+str(tmod/2000)+') ' if flip: svg += 'scale(1,-1) ' @@ -1818,7 +1821,10 @@ def getText(color,fontsize,fontname,angle,base,text,linespacing=0.5,align="cente p3 = getProj(prx.p3) p4 = getProj(prx.p4) tbase = getProj(prx.tbase) - angle = -DraftVecUtils.angle(p3.sub(p2)) + r = prx.textpos.rotation.getValue().getValue() + rv = FreeCAD.Rotation(r[0],r[1],r[2],r[3]).multVec(FreeCAD.Vector(1,0,0)) + angle = -DraftVecUtils.angle(getProj(rv)) + #angle = -DraftVecUtils.angle(p3.sub(p2)) # drawing lines svg = ' math.pi/2: tangle = tangle-math.pi - elif (tangle <= -math.pi/2) or (tangle > math.pi/2): - tangle = tangle+math.pi + #elif (tangle <= -math.pi/2) or (tangle > math.pi/2): + # tangle = tangle+math.pi #tbase = tbase.add(DraftVecUtils.rotate(Vector(0,2/scale,0),tangle)) svg += 'd="M '+str(p1.x)+' '+str(p1.y)+' ' svg += 'L '+str(p2.x)+' '+str(p2.y)+' ' @@ -1958,11 +1964,15 @@ def getText(color,fontsize,fontname,angle,base,text,linespacing=0.5,align="cente a = 0 t1 = obj.ViewObject.Proxy.text1.string.getValues() t2 = obj.ViewObject.Proxy.text2.string.getValues() - t = t1 + t2 - p = FreeCAD.Vector(obj.ViewObject.Proxy.coords.translation.getValue().getValue()) + scale = obj.ViewObject.FirstLine.Value/obj.ViewObject.FontSize.Value + f1 = fontsize*scale + p2 = FreeCAD.Vector(obj.ViewObject.Proxy.coords.translation.getValue().getValue()) + p1 = p2.add(FreeCAD.Vector(obj.ViewObject.Proxy.header.translation.getValue().getValue())) l = obj.ViewObject.LineSpacing/2 j = obj.ViewObject.TextAlign - svg += getText(c,fontsize,n,a,getProj(p),t,l,j,flip=False) + svg += getText(c,f1,n,a,getProj(p1),t1,l,j,flip=False) + if t2: + svg += getText(c,fontsize,n,a,getProj(p2),t2,l,j,flip=False) elif obj.isDerivedFrom('Part::Feature'): if obj.Shape.isNull():