Arch: fixed rotation of space labels in techdraw
This commit is contained in:
parent
7338398540
commit
195ea429e6
|
@ -75,7 +75,7 @@ def makeSectionView(section,name="View"):
|
|||
return view
|
||||
|
||||
|
||||
def getSVG(section,allOn=False,renderMode="Wireframe",showHidden=False,showFill=False,scale=1,linewidth=1,fontsize=1,techdraw=False):
|
||||
def getSVG(section,allOn=False,renderMode="Wireframe",showHidden=False,showFill=False,scale=1,linewidth=1,fontsize=1,techdraw=False,rotation=0):
|
||||
"""getSVG(section,[allOn,renderMode,showHidden,showFill,scale,linewidth,fontsize]) :
|
||||
returns an SVG fragment from an Arch section plane. If
|
||||
allOn is True, all cut objects are shown, regardless if they are visible or not.
|
||||
|
@ -214,7 +214,6 @@ def getSVG(section,allOn=False,renderMode="Wireframe",showHidden=False,showFill=
|
|||
svgs = svgs.replace('stroke-width="0.35 px"','stroke-width="SWPlaceholder"')
|
||||
svgs = svgs.replace('stroke-width:0.35','stroke-width:SWPlaceholder')
|
||||
svg += svgs
|
||||
|
||||
scaledlinewidth = linewidth/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")
|
||||
|
@ -226,14 +225,17 @@ def getSVG(section,allOn=False,renderMode="Wireframe",showHidden=False,showFill=
|
|||
if not techdraw:
|
||||
svg += '<g transform="scale(1,-1)">'
|
||||
for d in drafts:
|
||||
svg += Draft.getSVG(d,scale=scale,linewidth=linewidth,fontsize=fontsize,direction=direction,techdraw=techdraw)
|
||||
svg += Draft.getSVG(d,scale=scale,linewidth=linewidth,fontsize=fontsize,direction=direction,techdraw=techdraw,rotation=rotation)
|
||||
if not techdraw:
|
||||
svg += '</g>'
|
||||
# filter out spaces not cut by the section plane
|
||||
if cutface and spaces:
|
||||
spaces = [s for s in spaces if s.Shape.BoundBox.intersect(cutface.BoundBox)]
|
||||
if spaces:
|
||||
if not techdraw:
|
||||
svg += '<g transform="scale(1,-1)">'
|
||||
for s in spaces:
|
||||
svg += Draft.getSVG(s,scale=scale,linewidth=linewidth,fontsize=fontsize,direction=direction,techdraw=techdraw)
|
||||
svg += Draft.getSVG(s,scale=scale,linewidth=linewidth,fontsize=fontsize,direction=direction,techdraw=techdraw,rotation=rotation)
|
||||
if not techdraw:
|
||||
svg += '</g>'
|
||||
#print "complete node:",svg
|
||||
|
|
|
@ -1723,7 +1723,7 @@ def getDXF(obj,direction=None):
|
|||
return result
|
||||
|
||||
|
||||
def getSVG(obj,scale=1,linewidth=0.35,fontsize=12,fillstyle="shape color",direction=None,linestyle=None,color=None,linespacing=None,techdraw=False):
|
||||
def getSVG(obj,scale=1,linewidth=0.35,fontsize=12,fillstyle="shape color",direction=None,linestyle=None,color=None,linespacing=None,techdraw=False,rotation=0):
|
||||
'''getSVG(object,[scale], [linewidth],[fontsize],[fillstyle],[direction],[linestyle],[color],[linespacing]):
|
||||
returns a string containing a SVG representation of the given object,
|
||||
with the given linewidth and fontsize (used if the given object contains
|
||||
|
@ -2253,6 +2253,8 @@ def getSVG(obj,scale=1,linewidth=0.35,fontsize=12,fillstyle="shape color",direct
|
|||
c = getrgb(obj.ViewObject.TextColor)
|
||||
n = obj.ViewObject.FontName
|
||||
a = 0
|
||||
if rotation != 0:
|
||||
a = -math.radians(rotation)
|
||||
t1 = obj.ViewObject.Proxy.text1.string.getValues()
|
||||
t2 = obj.ViewObject.Proxy.text2.string.getValues()
|
||||
scale = obj.ViewObject.FirstLine.Value/obj.ViewObject.FontSize.Value
|
||||
|
@ -2263,7 +2265,10 @@ def getSVG(obj,scale=1,linewidth=0.35,fontsize=12,fillstyle="shape color",direct
|
|||
j = obj.ViewObject.TextAlign
|
||||
svg += getText(c,f1,n,a,getProj(p1),t1,linespacing,j,flip=True)
|
||||
if t2:
|
||||
svg += getText(c,fontsize,n,a,getProj(p1).add(FreeCAD.Vector(0,lspc.Length,0)),t2,linespacing,j,flip=True)
|
||||
ofs = FreeCAD.Vector(0,lspc.Length,0)
|
||||
if a:
|
||||
ofs = FreeCAD.Rotation(FreeCAD.Vector(0,0,1),-rotation).multVec(ofs)
|
||||
svg += getText(c,fontsize,n,a,getProj(p1).add(ofs),t2,linespacing,j,flip=True)
|
||||
|
||||
elif obj.isDerivedFrom('Part::Feature'):
|
||||
if obj.Shape.isNull():
|
||||
|
|
|
@ -109,7 +109,8 @@ App::DocumentObjectExecReturn *DrawViewArch::execute(void)
|
|||
<< ",scale=" << Scale.getValue()
|
||||
<< ",linewidth=" << LineWidth.getValue()
|
||||
<< ",fontsize=" << FontSize.getValue()
|
||||
<< ",techdraw=True";
|
||||
<< ",techdraw=True"
|
||||
<< ",rotation=" << Rotation.getValue();
|
||||
|
||||
Base::Interpreter().runString("import ArchSectionPlane");
|
||||
Base::Interpreter().runStringArg("svgBody = ArchSectionPlane.getSVG(App.activeDocument().%s %s)",
|
||||
|
|
Loading…
Reference in New Issue
Block a user