diff --git a/src/Mod/Arch/ArchSectionPlane.py b/src/Mod/Arch/ArchSectionPlane.py
index 140e86e87..ad7c8f0be 100644
--- a/src/Mod/Arch/ArchSectionPlane.py
+++ b/src/Mod/Arch/ArchSectionPlane.py
@@ -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):
+def getSVG(section,allOn=False,renderMode="Wireframe",showHidden=False,showFill=False,scale=1,linewidth=1,fontsize=1,techdraw=False):
"""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.
@@ -91,12 +91,17 @@ def getSVG(section,allOn=False,renderMode="Wireframe",showHidden=False,showFill=
objs = Draft.getGroupContents(section.Objects,walls=True,addgroups=True)
if not allOn:
objs = Draft.removeHidden(objs)
- # separate spaces
+ # separate spaces and Draft objects
spaces = []
nonspaces = []
+ drafts = []
for o in objs:
if Draft.getType(o) == "Space":
spaces.append(o)
+ elif Draft.getType(o) in ["Dimension","Annotation"]:
+ drafts.append(o)
+ elif o.isDerivedFrom("Part::Part2DObject"):
+ drafts.append(o)
else:
nonspaces.append(o)
objs = nonspaces
@@ -191,11 +196,13 @@ def getSVG(section,allOn=False,renderMode="Wireframe",showHidden=False,showFill=
if sshapes:
svgs = ""
if showFill:
- svgs += fillpattern
+ #svgs += fillpattern
svgs += '\n'
for s in sshapes:
if s.Edges:
- f = Draft.getSVG(s,direction=direction.negative(),linewidth=0,fillstyle="sectionfill",color=(0,0,0))
+ #f = Draft.getSVG(s,direction=direction.negative(),linewidth=0,fillstyle="sectionfill",color=(0,0,0))
+ # temporarily disabling fill patterns
+ f = Draft.getSVG(s,direction=direction.negative(),linewidth=0,fillstyle="#aaaaaa",color=(0,0,0))
svgs += f
svgs += "\n"
sshapes = Part.makeCompound(sshapes)
@@ -208,19 +215,28 @@ def getSVG(section,allOn=False,renderMode="Wireframe",showHidden=False,showFill=
svgs = svgs.replace('stroke-width:0.35','stroke-width:SWPlaceholder')
svg += svgs
- linewidth = linewidth/scale
+ 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")
da = da.replace(" ","")
- svg = svg.replace('LWPlaceholder', str(linewidth) + 'px')
- svg = svg.replace('SWPlaceholder', str(linewidth*st) + 'px')
+ svg = svg.replace('LWPlaceholder', str(scaledlinewidth) + 'px')
+ svg = svg.replace('SWPlaceholder', str(scaledlinewidth*st) + 'px')
svg = svg.replace('DAPlaceholder', str(da))
- if spaces and round(direction.getAngle(FreeCAD.Vector(0,0,1)),Draft.precision()) in [0,round(math.pi,Draft.precision())]:
- svg += ''
+ if drafts:
+ if not techdraw:
+ svg += ''
+ for d in drafts:
+ svg += Draft.getSVG(d,scale=scale,linewidth=linewidth,fontsize=fontsize,direction=direction,techdraw=techdraw)
+ if not techdraw:
+ svg += ''
+ if spaces:
+ if not techdraw:
+ svg += ''
for s in spaces:
- svg += Draft.getSVG(s,scale=scale,fontsize=fontsize,direction=direction)
- svg += ''
- # print "complete node:",svg
+ svg += Draft.getSVG(s,scale=scale,linewidth=linewidth,fontsize=fontsize,direction=direction,techdraw=techdraw)
+ if not techdraw:
+ svg += ''
+ #print "complete node:",svg
return svg
diff --git a/src/Mod/Draft/Draft.py b/src/Mod/Draft/Draft.py
index 955e30883..d75522ede 100644
--- a/src/Mod/Draft/Draft.py
+++ b/src/Mod/Draft/Draft.py
@@ -1731,11 +1731,12 @@ def getSVG(obj,scale=1,linewidth=0.35,fontsize=12,fillstyle="shape color",direct
scale parameter allows to scale linewidths down, so they are resolution-independant.'''
# if this is a group, gather all the svg views of its children
- if obj.isDerivedFrom("App::DocumentObjectGroup"):
- svg = ""
- for child in obj.Group:
- svg += getSVG(child,scale,linewidth,fontsize,fillstyle,direction,linestyle,color,linespacing,techdraw)
- return svg
+ if hasattr(obj,"isDerivedFrom"):
+ if obj.isDerivedFrom("App::DocumentObjectGroup"):
+ svg = ""
+ for child in obj.Group:
+ svg += getSVG(child,scale,linewidth,fontsize,fillstyle,direction,linestyle,color,linespacing,techdraw)
+ return svg
import Part, DraftGeomUtils
pathdata = []
@@ -2019,9 +2020,9 @@ def getSVG(obj,scale=1,linewidth=0.35,fontsize=12,fillstyle="shape color",direct
svg += 'font-family:'+ fontname +'" '
svg += 'transform="rotate('+str(math.degrees(angle))
svg += ','+ str(base.x) + ',' + str(base.y+linespacing*i) + ') '
- svg += 'translate(' + str(base.x) + ',' + str(base.y+linespacing*i) + ') '
- svg += '" freecad:skip="1"'
- svg += '>\n' + text[i] + '\n'
+ svg += 'translate(' + str(base.x) + ',' + str(base.y+linespacing*i) + ')" '
+ #svg += '" freecad:skip="1"'
+ svg += '>\n' + text[i] + '\n'
else:
svg = '\n'
if len(text) == 1:
@@ -2065,7 +2066,12 @@ def getSVG(obj,scale=1,linewidth=0.35,fontsize=12,fillstyle="shape color",direct
pass
elif isinstance(obj,Part.Shape):
- fill = 'url(#'+fillstyle+')'
+ if "#" in fillstyle:
+ fill = fillstyle
+ elif fillstyle == "shape color":
+ fill = "#888888"
+ else:
+ fill = 'url(#'+fillstyle+')'
lstyle = getLineStyle()
svg += getPath(obj.Edges,pathname="")
diff --git a/src/Mod/TechDraw/App/DrawViewArch.cpp b/src/Mod/TechDraw/App/DrawViewArch.cpp
index c8da5f1d7..289480ff2 100644
--- a/src/Mod/TechDraw/App/DrawViewArch.cpp
+++ b/src/Mod/TechDraw/App/DrawViewArch.cpp
@@ -106,8 +106,11 @@ App::DocumentObjectExecReturn *DrawViewArch::execute(void)
<< ",renderMode=\"" << RenderMode.getValue() << "\""
<< ",showHidden=" << (ShowHidden.getValue() ? "True" : "False")
<< ",showFill=" << (ShowFill.getValue() ? "True" : "False")
+ << ",scale=" << Scale.getValue()
<< ",linewidth=" << LineWidth.getValue()
- << ",fontsize=" << FontSize.getValue();
+ << ",fontsize=" << FontSize.getValue()
+ << ",techdraw=True";
+
Base::Interpreter().runString("import ArchSectionPlane");
Base::Interpreter().runStringArg("svgBody = ArchSectionPlane.getSVG(App.activeDocument().%s %s)",
SourceName.c_str(),paramStr.str().c_str());