Arch: Added preference setting to control linewidth of Draft objects seen by Arch Section Planes

This commit is contained in:
Yorik van Havre 2016-11-03 16:40:12 -02:00
parent 6951705835
commit c465ca261c
3 changed files with 60 additions and 11 deletions

View File

@ -219,6 +219,7 @@ def getSVG(section,allOn=False,renderMode="Wireframe",showHidden=False,showFill=
svg += svgs
scaledlinewidth = linewidth/scale
st = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch").GetFloat("CutLineThickness",2)
yt = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch").GetFloat("SymbolLineThickness",0.6)
da = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch").GetString("archHiddenPattern","30,10")
da = da.replace(" ","")
svg = svg.replace('LWPlaceholder', str(scaledlinewidth) + 'px')
@ -228,7 +229,7 @@ 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,rotation=rotation)
svg += Draft.getSVG(d,scale=scale,linewidth=linewidth*yt,fontsize=fontsize,direction=direction,techdraw=techdraw,rotation=rotation)
if not techdraw:
svg += '</g>'
# filter out spaces not cut by the section plane
@ -238,7 +239,7 @@ def getSVG(section,allOn=False,renderMode="Wireframe",showHidden=False,showFill=
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,rotation=rotation)
svg += Draft.getSVG(s,scale=scale,linewidth=linewidth*yt,fontsize=fontsize,direction=direction,techdraw=techdraw,rotation=rotation)
if not techdraw:
svg += '</g>'
# add additional edge symbols from windows
@ -263,7 +264,7 @@ def getSVG(section,allOn=False,renderMode="Wireframe",showHidden=False,showFill=
if not techdraw:
svg += '<g transform="scale(1,-1)">'
for s in sh:
svg += Draft.getSVG(s,scale=scale,linewidth=linewidth,fontsize=fontsize,fillstyle="none",direction=direction,techdraw=techdraw,rotation=rotation)
svg += Draft.getSVG(s,scale=scale,linewidth=linewidth*yt,fontsize=fontsize,fillstyle="none",direction=direction,techdraw=techdraw,rotation=rotation)
if not techdraw:
svg += '</g>'

View File

@ -366,6 +366,59 @@
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_16">
<item>
<spacer name="horizontalSpacer_8">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_6">
<property name="text">
<string>Symbol line thickness ratio</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="Gui::PrefDoubleSpinBox" name="doubleSpinBox_2">
<property name="value">
<double>0.600000000000000</double>
</property>
<property name="prefEntry" stdset="0">
<cstring>SymbolLineThickness</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Arch</cstring>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>

View File

@ -2023,14 +2023,9 @@ def getSVG(obj,scale=1,linewidth=0.35,fontsize=12,fillstyle="shape color",direct
t = text[i]
if not isinstance(t,unicode):
t = t.decode("utf8")
# temporary workaround for unsupported UTF8 in techdraw
try:
import unicodedata
except:
t = ""
print "Draft.getSVG: unicodedata not available"
else:
t = u"".join([c for c in unicodedata.normalize("NFKD",t) if not unicodedata.combining(c)]).encode("utf8")
# possible workaround if UTF8 is unsupported
# import unicodedata
# t = u"".join([c for c in unicodedata.normalize("NFKD",t) if not unicodedata.combining(c)]).encode("utf8")
svg += '<text fill="' + color +'" font-size="' + str(fontsize) + '" '
svg += 'style="text-anchor:'+anchor+';text-align:'+align.lower()+';'
svg += 'font-family:'+ fontname +'" '