From 47765a18444882414d62c7be812c1897fe3efbf7 Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Sat, 4 Feb 2012 17:26:48 -0200 Subject: [PATCH] Added 2D displaymode to Arch walls --- src/Mod/Arch/ArchWall.py | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/Mod/Arch/ArchWall.py b/src/Mod/Arch/ArchWall.py index 2d7b0313d..c3e5ec85c 100644 --- a/src/Mod/Arch/ArchWall.py +++ b/src/Mod/Arch/ArchWall.py @@ -255,6 +255,10 @@ class _Wall(ArchComponent.Component): import Part from draftlibs import fcgeo + + flat = False + if hasattr(obj.ViewObject,"DisplayMode"): + flat = (obj.ViewObject.DisplayMode == "Flat 2D") def getbase(wire): "returns a full shape from a base wire" @@ -277,7 +281,7 @@ class _Wall(ArchComponent.Component): sh = fcgeo.bind(w1,w2) # fixing self-intersections sh.fix(0.1,0,1) - if height: + if height and (not flat): norm = Vector(normal).multiply(height) sh = sh.extrude(norm) return sh @@ -352,5 +356,19 @@ class _ViewProviderWall(ArchComponent.ViewProviderComponent): def getIcon(self): return ":/icons/Arch_Wall_Tree.svg" - + + def getDisplayModes(self,vobj): + return ["Flat 2D"] + + def setDisplayMode(self,mode): + self.Object.Proxy.createGeometry(self.Object) + if mode == "Flat 2D": + return "Flat Lines" + else: + return mode + + def attach(self,vobj): + self.Object = vobj.Object + return + FreeCADGui.addCommand('Arch_Wall',_CommandWall())