diff --git a/src/Mod/Arch/ArchSectionPlane.py b/src/Mod/Arch/ArchSectionPlane.py
index 282211589..3a7238603 100644
--- a/src/Mod/Arch/ArchSectionPlane.py
+++ b/src/Mod/Arch/ArchSectionPlane.py
@@ -35,6 +35,7 @@ else:
def QT_TRANSLATE_NOOP(ctxt,txt):
return txt
+
def makeSectionPlane(objectslist=None,name="Section"):
"""makeSectionPlane([objectslist]) : Creates a Section plane objects including the
given objects. If no object is given, the whole document will be considered."""
@@ -53,6 +54,7 @@ def makeSectionPlane(objectslist=None,name="Section"):
obj.Objects = g
return obj
+
def makeSectionView(section,name="View"):
"""makeSectionView(section) : Creates a Drawing view of the given Section Plane
in the active Page object (a new page will be created if none exists"""
@@ -72,6 +74,156 @@ def makeSectionView(section,name="View"):
view.Label = translate("Arch","View of")+" "+section.Name
return view
+
+def getSVG(section,allOn=False,renderMode="Wireframe",showHidden=False,showFill=False,scale=1,linewidth=1,fontsize=1):
+ """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.
+ renderMode can be Wireframe (default) or Solid to use the Arch solid renderer. If
+ showHidden is True, the hidden geometry above the section plane is shown in dashed line.
+ If showFill is True, the cut areas get filled with a pattern"""
+
+ if not section.Objects:
+ return
+ import DraftGeomUtils
+ p = FreeCAD.Placement(section.Placement)
+ direction = p.Rotation.multVec(FreeCAD.Vector(0,0,1))
+ objs = Draft.getGroupContents(section.Objects,walls=True,addgroups=True)
+ if not allOn:
+ objs = Draft.removeHidden(objs)
+ # separate spaces
+ spaces = []
+ nonspaces = []
+ for o in objs:
+ if Draft.getType(o) == "Space":
+ spaces.append(o)
+ else:
+ nonspaces.append(o)
+ objs = nonspaces
+ svg = ''
+ fillpattern = ''
+ fillpattern += ''
+ fillpattern += ''
+
+ # generating SVG
+ if renderMode == "Solid":
+ # render using the Arch Vector Renderer
+ import ArchVRM, WorkingPlane
+ wp = WorkingPlane.plane()
+ wp.setFromPlacement(section.Placement)
+ #wp.inverse()
+ render = ArchVRM.Renderer()
+ render.setWorkingPlane(wp)
+ render.addObjects(objs)
+ if showHidden:
+ render.cut(section.Shape,showHidden)
+ else:
+ render.cut(section.Shape)
+ svg += '\n'
+ svg += render.getViewSVG(linewidth="LWPlaceholder")
+ svg += fillpattern
+ svg += render.getSectionSVG(linewidth="SWPlaceholder",fillpattern="sectionfill")
+ if showHidden:
+ svg += render.getHiddenSVG(linewidth="LWPlaceholder")
+ svg += '\n'
+ # print render.info()
+
+ else:
+ # render using the Drawing module
+ import Drawing, Part
+ shapes = []
+ hshapes = []
+ sshapes = []
+ for o in objs:
+ if o.isDerivedFrom("Part::Feature"):
+ if o.Shape.isNull():
+ pass
+ elif o.Shape.isValid():
+ if section.OnlySolids:
+ shapes.extend(o.Shape.Solids)
+ else:
+ shapes.append(o.Shape)
+ else:
+ FreeCAD.Console.PrintWarning(translate("Arch","Skipping invalid object: ")+o.Name)
+ cutface,cutvolume,invcutvolume = ArchCommands.getCutVolume(section.Shape.copy(),shapes)
+ if cutvolume:
+ nsh = []
+ for sh in shapes:
+ for sol in sh.Solids:
+ if sol.Volume < 0:
+ sol.reverse()
+ c = sol.cut(cutvolume)
+ s = sol.section(cutface)
+ try:
+ wires = DraftGeomUtils.findWires(s.Edges)
+ for w in wires:
+ f = Part.Face(w)
+ sshapes.append(f)
+ #s = Part.Wire(s.Edges)
+ #s = Part.Face(s)
+ except Part.OCCError:
+ #print "ArchDrawingView: unable to get a face"
+ sshapes.append(s)
+ nsh.extend(c.Solids)
+ #sshapes.append(s)
+ if showHidden:
+ c = sol.cut(invcutvolume)
+ hshapes.append(c)
+ shapes = nsh
+ if shapes:
+ baseshape = Part.makeCompound(shapes)
+ svgf = Drawing.projectToSVG(baseshape,direction)
+ if svgf:
+ svgf = svgf.replace('stroke-width="0.35"','stroke-width="LWPlaceholder"')
+ svgf = svgf.replace('stroke-width="1"','stroke-width="LWPlaceholder"')
+ svgf = svgf.replace('stroke-width:0.01','stroke-width:LWPlaceholder')
+ svg += svgf
+ if hshapes:
+ hshapes = Part.makeCompound(hshapes)
+ svgh = Drawing.projectToSVG(hshapes,direction)
+ if svgh:
+ svgh = svgh.replace('stroke-width="0.35"','stroke-width="LWPlaceholder"')
+ svgh = svgh.replace('stroke-width="1"','stroke-width="LWPlaceholder"')
+ svgh = svgh.replace('stroke-width:0.01','stroke-width:LWPlaceholder')
+ svgh = svgh.replace('fill="none"','fill="none"\nstroke-dasharray="DAPlaceholder"')
+ svg += svgh
+ if sshapes:
+ svgs = ""
+ if showFill:
+ 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))
+ svgs += f
+ svgs += "\n"
+ sshapes = Part.makeCompound(sshapes)
+ svgs += Drawing.projectToSVG(sshapes,direction)
+ if svgs:
+ svgs = svgs.replace('stroke-width="0.35"','stroke-width="SWPlaceholder"')
+ svgs = svgs.replace('stroke-width="1"','stroke-width="SWPlaceholder"')
+ svgs = svgs.replace('stroke-width:0.01','stroke-width:SWPlaceholder')
+ svgs = svgs.replace('stroke-width="0.35 px"','stroke-width="SWPlaceholder"')
+ svgs = svgs.replace('stroke-width:0.35','stroke-width:SWPlaceholder')
+ svg += svgs
+
+ linewidth = 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('DAPlaceholder', str(da))
+ if spaces and round(direction.getAngle(FreeCAD.Vector(0,0,1)),Draft.precision()) in [0,round(math.pi,Draft.precision())]:
+ svg += ''
+ for s in spaces:
+ svg += Draft.getSVG(s,scale=scale,fontsize=fontsize,direction=direction)
+ svg += ''
+ # print "complete node:",svg
+ return svg
+
+
class _CommandSectionPlane:
"the Arch SectionPlane command definition"
def GetResources(self):
@@ -99,8 +251,11 @@ class _CommandSectionPlane:
FreeCAD.ActiveDocument.commitTransaction()
FreeCAD.ActiveDocument.recompute()
+
class _SectionPlane:
+
"A section plane object"
+
def __init__(self,obj):
obj.Proxy = self
obj.addProperty("App::PropertyPlacement","Placement","Base",QT_TRANSLATE_NOOP("App::Property","The placement of this object"))
@@ -142,6 +297,7 @@ class _SectionPlane:
if state:
self.Type = state
+
class _ViewProviderSectionPlane:
"A View Provider for Section Planes"
def __init__(self,vobj):
@@ -309,6 +465,7 @@ class _ViewProviderSectionPlane:
def doubleClicked(self,vobj):
self.setEdit(vobj,None)
+
class _ArchDrawingView:
def __init__(self, obj):
obj.addProperty("App::PropertyLink","Source","Base",QT_TRANSLATE_NOOP("App::Property","The linked object"))
@@ -329,183 +486,18 @@ class _ArchDrawingView:
def execute(self, 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 ''
- if not hasattr(self,"direction"):
- p = FreeCAD.Placement(obj.Source.Placement)
- self.direction = p.Rotation.multVec(FreeCAD.Vector(0,0,1))
- 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 self.spaces and round(self.direction.getAngle(FreeCAD.Vector(0,0,1)),Draft.precision()) in [0,round(math.pi,Draft.precision())]:
- svg += ''
- for s in self.spaces:
- svg += Draft.getSVG(s,scale=obj.Scale,fontsize=obj.FontSize.Value,direction=self.direction)
- svg += ''
- result = ''
- result += '\n'
- result += svg
- result += '\n'
- # print "complete node:",result
- obj.ViewResult = result
-
- def onChanged(self, obj, prop):
- if prop in ["Source","RenderingMode","ShowCut"]:
- import Part, DraftGeomUtils
- if hasattr(obj,"Source"):
- if obj.Source:
- if hasattr(obj.Source,"Objects"):
- if obj.Source.Objects:
- objs = Draft.getGroupContents(obj.Source.Objects,walls=True,addgroups=True)
- if hasattr(obj,"AlwaysOn"):
- if not obj.AlwaysOn:
- objs = Draft.removeHidden(objs)
- else:
- objs = Draft.removeHidden(objs)
- # separate spaces
- self.spaces = []
- os = []
- for o in objs:
- if Draft.getType(o) == "Space":
- self.spaces.append(o)
- else:
- os.append(o)
- objs = os
- self.svg = ''
- fillpattern = ''
- fillpattern += ''
- fillpattern += ''
-
- # generating SVG
- if obj.RenderingMode == "Solid":
- # render using the Arch Vector Renderer
- import ArchVRM, WorkingPlane
- wp = WorkingPlane.plane()
- wp.setFromPlacement(obj.Source.Placement)
- #wp.inverse()
- render = ArchVRM.Renderer()
- render.setWorkingPlane(wp)
- render.addObjects(objs)
- if hasattr(obj,"ShowCut"):
- render.cut(obj.Source.Shape,obj.ShowCut)
- else:
- render.cut(obj.Source.Shape)
- self.svg += '\n'
- self.svg += render.getViewSVG(linewidth="LWPlaceholder")
- self.svg += fillpattern
- self.svg += render.getSectionSVG(linewidth="SWPlaceholder",fillpattern="sectionfill")
- if hasattr(obj,"ShowCut"):
- if obj.ShowCut:
- self.svg += render.getHiddenSVG(linewidth="LWPlaceholder")
- self.svg += '\n'
- # print render.info()
-
- else:
- # render using the Drawing module
- import Drawing, Part
- shapes = []
- hshapes = []
- sshapes = []
- p = FreeCAD.Placement(obj.Source.Placement)
- self.direction = p.Rotation.multVec(FreeCAD.Vector(0,0,1))
- for o in objs:
- if o.isDerivedFrom("Part::Feature"):
- if o.Shape.isNull():
- pass
- #FreeCAD.Console.PrintWarning(translate("Arch","Skipping empty object: ")+o.Name)
- elif o.Shape.isValid():
- if hasattr(obj.Source,"OnlySolids"):
- if obj.Source.OnlySolids:
- shapes.extend(o.Shape.Solids)
- else:
- shapes.append(o.Shape)
- else:
- shapes.extend(o.Shape.Solids)
- else:
- FreeCAD.Console.PrintWarning(translate("Arch","Skipping invalid object: ")+o.Name)
- cutface,cutvolume,invcutvolume = ArchCommands.getCutVolume(obj.Source.Shape.copy(),shapes)
- if cutvolume:
- nsh = []
- for sh in shapes:
- for sol in sh.Solids:
- if sol.Volume < 0:
- sol.reverse()
- c = sol.cut(cutvolume)
- s = sol.section(cutface)
- try:
- wires = DraftGeomUtils.findWires(s.Edges)
- for w in wires:
- f = Part.Face(w)
- sshapes.append(f)
- #s = Part.Wire(s.Edges)
- #s = Part.Face(s)
- except Part.OCCError:
- #print "ArchDrawingView: unable to get a face"
- sshapes.append(s)
- nsh.extend(c.Solids)
- #sshapes.append(s)
- if hasattr(obj,"ShowCut"):
- if obj.ShowCut:
- c = sol.cut(invcutvolume)
- hshapes.append(c)
- shapes = nsh
- if shapes:
- self.shapes = shapes
- self.baseshape = Part.makeCompound(shapes)
- svgf = Drawing.projectToSVG(self.baseshape,self.direction)
- if svgf:
- svgf = svgf.replace('stroke-width="0.35"','stroke-width="LWPlaceholder"')
- svgf = svgf.replace('stroke-width="1"','stroke-width="LWPlaceholder"')
- svgf = svgf.replace('stroke-width:0.01','stroke-width:LWPlaceholder')
- self.svg += svgf
- if hshapes:
- hshapes = Part.makeCompound(hshapes)
- self.hiddenshape = hshapes
- svgh = Drawing.projectToSVG(hshapes,self.direction)
- if svgh:
- svgh = svgh.replace('stroke-width="0.35"','stroke-width="LWPlaceholder"')
- svgh = svgh.replace('stroke-width="1"','stroke-width="LWPlaceholder"')
- svgh = svgh.replace('stroke-width:0.01','stroke-width:LWPlaceholder')
- svgh = svgh.replace('fill="none"','fill="none"\nstroke-dasharray="DAPlaceholder"')
- self.svg += svgh
- if sshapes:
- svgs = ""
- if hasattr(obj,"ShowFill"):
- if obj.ShowFill:
- svgs += fillpattern
- svgs += '\n'
- for s in sshapes:
- if s.Edges:
- f = Draft.getSVG(s,direction=self.direction.negative(),linewidth=0,fillstyle="sectionfill",color=(0,0,0))
- svgs += f
- svgs += "\n"
- sshapes = Part.makeCompound(sshapes)
- self.sectionshape = sshapes
- svgs += Drawing.projectToSVG(sshapes,self.direction)
- if svgs:
- svgs = svgs.replace('stroke-width="0.35"','stroke-width="SWPlaceholder"')
- svgs = svgs.replace('stroke-width="1"','stroke-width="SWPlaceholder"')
- svgs = svgs.replace('stroke-width:0.01','stroke-width:SWPlaceholder')
- svgs = svgs.replace('stroke-width="0.35 px"','stroke-width="SWPlaceholder"')
- svgs = svgs.replace('stroke-width:0.35','stroke-width:SWPlaceholder')
- self.svg += svgs
-
+ svgbody = getSVG(obj.Source,obj.AlwaysOn,obj.RenderingMode,obj.ShowCut,obj.ShowFill,obj.Scale,obj.LineWidth,obj.FontSize)
+ if svgbody:
+ result = '\n'
+ result += svgbody
+ result += '\n'
+ obj.ViewResult = result
+
def __getstate__(self):
return self.Type
@@ -540,6 +532,7 @@ class _ArchDrawingView:
result.append(Drawing.projectToDXF(self.hiddenshape,self.direction))
return result
+
class SectionPlaneTaskPanel:
'''A TaskPanel for all the section plane object'''
def __init__(self):
diff --git a/src/Mod/TechDraw/App/AppTechDraw.cpp b/src/Mod/TechDraw/App/AppTechDraw.cpp
index 90512398d..eb455d8f3 100644
--- a/src/Mod/TechDraw/App/AppTechDraw.cpp
+++ b/src/Mod/TechDraw/App/AppTechDraw.cpp
@@ -32,6 +32,7 @@
#include "DrawViewClip.h"
#include "DrawHatch.h"
#include "DrawViewDraft.h"
+#include "DrawViewArch.h"
#include "DrawViewSpreadsheet.h"
namespace TechDraw {
@@ -77,6 +78,7 @@ PyMODINIT_FUNC initTechDraw()
TechDraw::DrawViewClip ::init();
TechDraw::DrawHatch ::init();
TechDraw::DrawViewDraft ::init();
+ TechDraw::DrawViewArch ::init();
// Python Types
TechDraw::DrawViewPython ::init();
diff --git a/src/Mod/TechDraw/App/CMakeLists.txt b/src/Mod/TechDraw/App/CMakeLists.txt
index 10d07dea4..92a75ed4d 100644
--- a/src/Mod/TechDraw/App/CMakeLists.txt
+++ b/src/Mod/TechDraw/App/CMakeLists.txt
@@ -77,6 +77,8 @@ SET(Draw_SRCS
DrawHatch.h
DrawViewDraft.cpp
DrawViewDraft.h
+ DrawViewArch.cpp
+ DrawViewArch.h
)
SET(TechDraw_SRCS
diff --git a/src/Mod/TechDraw/App/DrawViewArch.cpp b/src/Mod/TechDraw/App/DrawViewArch.cpp
new file mode 100644
index 000000000..c8da5f1d7
--- /dev/null
+++ b/src/Mod/TechDraw/App/DrawViewArch.cpp
@@ -0,0 +1,132 @@
+/***************************************************************************
+ * Copyright (c) York van Havre 2016 yorik@uncreated.net *
+ * *
+ * This file is part of the FreeCAD CAx development system. *
+ * *
+ * This library is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU Library General Public *
+ * License as published by the Free Software Foundation; either *
+ * version 2 of the License, or (at your option) any later version. *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU Library General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Library General Public *
+ * License along with this library; see the file COPYING.LIB. If not, *
+ * write to the Free Software Foundation, Inc., 59 Temple Place, *
+ * Suite 330, Boston, MA 02111-1307, USA *
+ * *
+ ***************************************************************************/
+
+
+#include "PreCompiled.h"
+
+#ifndef _PreComp_
+# include
+#endif
+
+#include
+
+#include
+#include
+#include
+#include
+
+#include "DrawViewArch.h"
+
+using namespace TechDraw;
+using namespace std;
+
+
+//===========================================================================
+// DrawViewArch
+//===========================================================================
+
+PROPERTY_SOURCE(TechDraw::DrawViewArch, TechDraw::DrawViewSymbol)
+
+const char* DrawViewArch::RenderModeEnums[]= {"Wireframe",
+ "Solid",
+ NULL};
+
+DrawViewArch::DrawViewArch(void)
+{
+ static const char *group = "Arch view";
+
+ ADD_PROPERTY_TYPE(Source ,(0),group,App::Prop_None,"Section Plane object for this view");
+ ADD_PROPERTY_TYPE(AllOn ,(false),group,App::Prop_None,"If hidden objects must be shown or not");
+ RenderMode.setEnums(RenderModeEnums);
+ ADD_PROPERTY_TYPE(RenderMode, ((long)0),group,App::Prop_None,"The render mode to use");
+ ADD_PROPERTY_TYPE(ShowHidden ,(false),group,App::Prop_None,"If the hidden geometry behind the section plane is shown or not");
+ ADD_PROPERTY_TYPE(ShowFill ,(false),group,App::Prop_None,"If cut areas must be filled with a hatch pattern or not");
+ ADD_PROPERTY_TYPE(LineWidth,(0.35),group,App::Prop_None,"Line width of this view");
+ ADD_PROPERTY_TYPE(FontSize,(12.0),group,App::Prop_None,"Text size for this view");
+ ScaleType.setValue("Custom");
+}
+
+DrawViewArch::~DrawViewArch()
+{
+}
+
+void DrawViewArch::onChanged(const App::Property* prop)
+{
+ if (!isRestoring()) {
+ if (prop == &Source ||
+ prop == &AllOn ||
+ prop == &RenderMode ||
+ prop == &ShowHidden ||
+ prop == &ShowFill ||
+ prop == &LineWidth ||
+ prop == &FontSize) {
+ try {
+ App::DocumentObjectExecReturn *ret = recompute();
+ delete ret;
+ }
+ catch (...) {
+ }
+ }
+ }
+ TechDraw::DrawViewSymbol::onChanged(prop);
+}
+
+App::DocumentObjectExecReturn *DrawViewArch::execute(void)
+{
+ App::DocumentObject* sourceObj = Source.getValue();
+ if (sourceObj) {
+ std::string svgFrag;
+ std::string svgHead = getSVGHead();
+ std::string svgTail = getSVGTail();
+ std::string FeatName = getNameInDocument();
+ std::string SourceName = sourceObj->getNameInDocument();
+ // ArchSectionPlane.getSVG(section,allOn=False,renderMode="Wireframe",showHidden=False,showFill=False,scale=1,linewidth=1,fontsize=1):
+
+ std::stringstream paramStr;
+ paramStr << ",allOn=" << (AllOn.getValue() ? "True" : "False")
+ << ",renderMode=\"" << RenderMode.getValue() << "\""
+ << ",showHidden=" << (ShowHidden.getValue() ? "True" : "False")
+ << ",showFill=" << (ShowFill.getValue() ? "True" : "False")
+ << ",linewidth=" << LineWidth.getValue()
+ << ",fontsize=" << FontSize.getValue();
+ Base::Interpreter().runString("import ArchSectionPlane");
+ Base::Interpreter().runStringArg("svgBody = ArchSectionPlane.getSVG(App.activeDocument().%s %s)",
+ SourceName.c_str(),paramStr.str().c_str());
+ Base::Interpreter().runStringArg("App.activeDocument().%s.Symbol = '%s' + svgBody + '%s'",
+ FeatName.c_str(),svgHead.c_str(),svgTail.c_str());
+ }
+ return DrawView::execute();
+}
+
+std::string DrawViewArch::getSVGHead(void)
+{
+ std::string head = std::string("";
+ return tail;
+}
diff --git a/src/Mod/TechDraw/App/DrawViewArch.h b/src/Mod/TechDraw/App/DrawViewArch.h
new file mode 100644
index 000000000..856bf2447
--- /dev/null
+++ b/src/Mod/TechDraw/App/DrawViewArch.h
@@ -0,0 +1,77 @@
+/***************************************************************************
+ * Copyright (c) York van Havre 2016 yorik@uncreated.net *
+ * *
+ * This file is part of the FreeCAD CAx development system. *
+ * *
+ * This library is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU Library General Public *
+ * License as published by the Free Software Foundation; either *
+ * version 2 of the License, or (at your option) any later version. *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU Library General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Library General Public *
+ * License along with this library; see the file COPYING.LIB. If not, *
+ * write to the Free Software Foundation, Inc., 59 Temple Place, *
+ * Suite 330, Boston, MA 02111-1307, USA *
+ * *
+ ***************************************************************************/
+
+#ifndef _DrawViewArch_h_
+#define _DrawViewArch_h_
+
+#include
+#include
+#include
+#include
+
+#include "DrawViewSymbol.h"
+
+namespace TechDraw
+{
+
+class TechDrawExport DrawViewArch : public TechDraw::DrawViewSymbol
+{
+ PROPERTY_HEADER(TechDraw::DrawViewArch);
+
+public:
+ /// Constructor
+ DrawViewArch(void);
+ virtual ~DrawViewArch();
+
+ App::PropertyLink Source;
+ App::PropertyBool AllOn;
+ App::PropertyEnumeration RenderMode; // "Wireframe","Solid"
+ App::PropertyBool ShowHidden;
+ App::PropertyBool ShowFill;
+ App::PropertyFloat LineWidth;
+ App::PropertyFloat FontSize;
+
+ /** @name methods overide Feature */
+ //@{
+ /// recalculate the Feature
+ virtual App::DocumentObjectExecReturn *execute(void);
+ //@}
+
+ /// returns the type name of the ViewProvider
+ virtual const char* getViewProviderName(void) const {
+ return "TechDrawGui::ViewProviderArch";
+ }
+
+protected:
+ virtual void onChanged(const App::Property* prop);
+ Base::BoundBox3d bbox;
+ std::string getSVGHead(void);
+ std::string getSVGTail(void);
+
+private:
+ static const char* RenderModeEnums[];
+};
+
+} //namespace TechDraw
+
+
+#endif
diff --git a/src/Mod/TechDraw/Gui/AppTechDrawGui.cpp b/src/Mod/TechDraw/Gui/AppTechDrawGui.cpp
index 327a6d780..dfb5ba097 100644
--- a/src/Mod/TechDraw/Gui/AppTechDrawGui.cpp
+++ b/src/Mod/TechDraw/Gui/AppTechDrawGui.cpp
@@ -97,6 +97,7 @@ void TechDrawGuiExport initTechDrawGui()
TechDrawGui::ViewProviderAnnotation::init();
TechDrawGui::ViewProviderSymbol::init();
TechDrawGui::ViewProviderDraft::init();
+ TechDrawGui::ViewProviderArch::init();
TechDrawGui::ViewProviderHatch::init();
TechDrawGui::ViewProviderSpreadsheet::init();
diff --git a/src/Mod/TechDraw/Gui/Command.cpp b/src/Mod/TechDraw/Gui/Command.cpp
index b57734f66..d64253320 100644
--- a/src/Mod/TechDraw/Gui/Command.cpp
+++ b/src/Mod/TechDraw/Gui/Command.cpp
@@ -789,6 +789,63 @@ bool CmdTechDrawDraftView::isActive(void)
return DrawGuiUtil::needPage(this);
}
+//===========================================================================
+// TechDraw_ArchView
+//===========================================================================
+
+DEF_STD_CMD_A(CmdTechDrawArchView);
+
+CmdTechDrawArchView::CmdTechDrawArchView()
+ : Command("TechDraw_ArchView")
+{
+ // setting the Gui eye-candy
+ sGroup = QT_TR_NOOP("TechDraw");
+ sMenuText = QT_TR_NOOP("Insert an ArchView");
+ sToolTipText = QT_TR_NOOP("Inserts a view of an Arch Section Plane into the active drawing");
+ sWhatsThis = "TechDraw_ArchView";
+ sStatusTip = QT_TR_NOOP("Inserts a view of an Arch Section Plane into the active drawing");
+ sPixmap = "actions/techdraw-arch-view";
+}
+
+void CmdTechDrawArchView::activated(int iMsg)
+{
+ Q_UNUSED(iMsg);
+ TechDraw::DrawPage* page = DrawGuiUtil::findPage(this);
+ if (!page) {
+ return;
+ }
+
+ std::vector objects = getSelection().getObjectsOfType(App::DocumentObject::getClassTypeId());
+ if (objects.size() != 1) {
+ QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"),
+ QObject::tr("Select exactly one Arch Section Plane object."));
+ return;
+ }
+ App::Property* prop1 = objects[0]->getPropertyByName("Objects");
+ App::Property* prop2 = objects[0]->getPropertyByName("OnlySolids");
+ if ( (!prop1) || (!prop2) ) {
+ QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"),
+ QObject::tr("The selected object is not an Arch Section Plane."));
+ return;
+ }
+
+ std::string PageName = page->getNameInDocument();
+
+ std::string FeatName = getUniqueObjectName("ArchView");
+ std::string SourceName = objects[0]->getNameInDocument();
+ openCommand("Create ArchView");
+ doCommand(Doc,"App.activeDocument().addObject('TechDraw::DrawViewArch','%s')",FeatName.c_str());
+ doCommand(Doc,"App.activeDocument().%s.Source = App.activeDocument().%s",FeatName.c_str(),SourceName.c_str());
+ doCommand(Doc,"App.activeDocument().%s.addView(App.activeDocument().%s)",PageName.c_str(),FeatName.c_str());
+ updateActive();
+ commitCommand();
+}
+
+bool CmdTechDrawArchView::isActive(void)
+{
+ return DrawGuiUtil::needPage(this);
+}
+
//===========================================================================
// TechDraw_Spreadheet
//===========================================================================
@@ -910,5 +967,6 @@ void CreateTechDrawCommands(void)
rcCmdMgr.addCommand(new CmdTechDrawSymbol());
rcCmdMgr.addCommand(new CmdTechDrawExportPage());
rcCmdMgr.addCommand(new CmdTechDrawDraftView());
+ rcCmdMgr.addCommand(new CmdTechDrawArchView());
rcCmdMgr.addCommand(new CmdTechDrawSpreadsheet());
}
diff --git a/src/Mod/TechDraw/Gui/Resources/TechDraw.qrc b/src/Mod/TechDraw/Gui/Resources/TechDraw.qrc
index ad141145f..f18104557 100644
--- a/src/Mod/TechDraw/Gui/Resources/TechDraw.qrc
+++ b/src/Mod/TechDraw/Gui/Resources/TechDraw.qrc
@@ -38,6 +38,7 @@
icons/actions/techdraw-clipminus.svg
icons/actions/techdraw-symbol.svg
icons/actions/techdraw-draft-view.svg
+ icons/actions/techdraw-arch-view.svg
icons/actions/techdraw-saveSVG.svg
icons/actions/techdraw-viewsection.svg
icons/actions/techdraw-hatch.svg
diff --git a/src/Mod/TechDraw/Gui/Resources/icons/actions/techdraw-arch-view.svg b/src/Mod/TechDraw/Gui/Resources/icons/actions/techdraw-arch-view.svg
new file mode 100644
index 000000000..f026ad268
--- /dev/null
+++ b/src/Mod/TechDraw/Gui/Resources/icons/actions/techdraw-arch-view.svg
@@ -0,0 +1,564 @@
+
+
+
+
diff --git a/src/Mod/TechDraw/Gui/ViewProviderSymbol.cpp b/src/Mod/TechDraw/Gui/ViewProviderSymbol.cpp
index 827fb051a..69a469ff5 100644
--- a/src/Mod/TechDraw/Gui/ViewProviderSymbol.cpp
+++ b/src/Mod/TechDraw/Gui/ViewProviderSymbol.cpp
@@ -99,3 +99,18 @@ ViewProviderDraft::ViewProviderDraft()
ViewProviderDraft::~ViewProviderDraft()
{
}
+
+//**************************************************************************
+// Arch view
+
+PROPERTY_SOURCE(TechDrawGui::ViewProviderArch, TechDrawGui::ViewProviderSymbol)
+
+
+ViewProviderArch::ViewProviderArch()
+{
+ sPixmap = "actions/techdraw-arch-view.svg";
+}
+
+ViewProviderArch::~ViewProviderArch()
+{
+}
diff --git a/src/Mod/TechDraw/Gui/ViewProviderSymbol.h b/src/Mod/TechDraw/Gui/ViewProviderSymbol.h
index ffc081e4a..8f6eb4d32 100644
--- a/src/Mod/TechDraw/Gui/ViewProviderSymbol.h
+++ b/src/Mod/TechDraw/Gui/ViewProviderSymbol.h
@@ -65,6 +65,17 @@ public:
virtual ~ViewProviderDraft();
};
+class TechDrawGuiExport ViewProviderArch : public ViewProviderSymbol
+{
+ PROPERTY_HEADER(TechDrawGui::ViewProviderArch);
+
+public:
+ /// constructor
+ ViewProviderArch();
+ /// destructor
+ virtual ~ViewProviderArch();
+};
+
} // namespace TechDrawGui
diff --git a/src/Mod/TechDraw/Gui/Workbench.cpp b/src/Mod/TechDraw/Gui/Workbench.cpp
index 0c38c2443..0e8045500 100644
--- a/src/Mod/TechDraw/Gui/Workbench.cpp
+++ b/src/Mod/TechDraw/Gui/Workbench.cpp
@@ -73,6 +73,7 @@ Gui::MenuItem* Workbench::setupMenuBar() const
*draw << "TechDraw_ClipMinus";
*draw << "TechDraw_NewDimension";
*draw << "TechDraw_DraftView";
+ *draw << "TechDraw_ArchView";
*draw << "TechDraw_ExportPage";
//*draw << "TechDraw_Open";
//*part << "TechDraw_NewA3Landscape";
@@ -99,6 +100,7 @@ Gui::ToolBarItem* Workbench::setupToolBars() const
*views << "TechDraw_NewViewSection";
*views << "TechDraw_Annotation";
*views << "TechDraw_DraftView";
+ *views << "TechDraw_ArchView";
*views << "TechDraw_Spreadsheet";
Gui::ToolBarItem *clips = new Gui::ToolBarItem(root);