From e26a9efae8f5e9c63cfe4d7ac274005de0164e00 Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Tue, 10 Nov 2020 19:14:06 +0100 Subject: [PATCH] Arch: Added Awming window preset --- src/Mod/Arch/ArchWindow.py | 2 +- src/Mod/Arch/ArchWindowPresets.py | 63 ++++++++++++++++++++----------- 2 files changed, 41 insertions(+), 24 deletions(-) diff --git a/src/Mod/Arch/ArchWindow.py b/src/Mod/Arch/ArchWindow.py index f61daf4742..f64e6da83b 100644 --- a/src/Mod/Arch/ArchWindow.py +++ b/src/Mod/Arch/ArchWindow.py @@ -475,7 +475,7 @@ class _CommandWindow: self.im.show() if i == 0: self.im.load(":/ui/ParametersWindowFixed.svg") - elif i == 1: + elif i in [1,8]: self.im.load(":/ui/ParametersWindowSimple.svg") elif i == 6: self.im.load(":/ui/ParametersDoorGlass.svg") diff --git a/src/Mod/Arch/ArchWindowPresets.py b/src/Mod/Arch/ArchWindowPresets.py index 6074a00d58..6fd3573bed 100644 --- a/src/Mod/Arch/ArchWindowPresets.py +++ b/src/Mod/Arch/ArchWindowPresets.py @@ -26,7 +26,7 @@ from draftutils.translate import translate WindowPresets = ["Fixed", "Open 1-pane", "Open 2-pane", "Sash 2-pane", - "Sliding 2-pane", "Simple door", "Glass door", "Sliding 4-pane"] + "Sliding 2-pane", "Simple door", "Glass door", "Sliding 4-pane", "Awming"] def makeWindowPreset(windowtype,width,height,h1,h2,h3,w1,w2,o1,o2,placement=None): @@ -86,6 +86,33 @@ def makeWindowPreset(windowtype,width,height,h1,h2,h3,w1,w2,o1,o2,placement=None s.addConstraint(Sketcher.Constraint('Vertical',idx+5)) s.addConstraint(Sketcher.Constraint('Vertical',idx+7)) + def simpleFrame(s,width,height,h1,h2,tol): + + "creates a simple frame with constraints" + + p1 = Vector(h1+tol,h1+tol,0) + p2 = Vector(width-(h1+tol),h1+tol,0) + p3 = Vector(width-(h1+tol),height-(h1+tol),0) + p4 = Vector(h1+tol,height-(h1+tol),0) + p5 = Vector(h1+h2,h1+h2,0) + p6 = Vector(width-(h1+h2),h1+h2,0) + p7 = Vector(width-(h1+h2),height-(h1+h2),0) + p8 = Vector(h1+h2,height-(h1+h2),0) + addFrame(s,p1,p2,p3,p4,p5,p6,p7,p8) + s.addConstraint(Sketcher.Constraint('DistanceX',8,1,12,1,h2)) + s.addConstraint(Sketcher.Constraint('DistanceY',8,1,12,1,h2)) + s.addConstraint(Sketcher.Constraint('DistanceX',14,1,10,1,h2)) + s.addConstraint(Sketcher.Constraint('DistanceY',14,1,10,1,h2)) + s.addConstraint(Sketcher.Constraint('DistanceX',4,1,8,1,tol)) + s.addConstraint(Sketcher.Constraint('DistanceY',4,1,8,1,tol)) + s.addConstraint(Sketcher.Constraint('DistanceX',10,1,6,1,tol)) + s.addConstraint(Sketcher.Constraint('DistanceY',10,1,6,1,tol)) + if h2 == h1: + s.renameConstraint(39,'Frame5') + s.renameConstraint(40,'Frame6') + s.renameConstraint(42,'Frame7') + s.renameConstraint(41,'Frame8') + def outerFrame(s,width,height,h1,w1,o1): p1 = Vector(0,0,0) @@ -145,28 +172,7 @@ def makeWindowPreset(windowtype,width,height,h1,h2,h3,w1,w2,o1,o2,placement=None elif windowtype == "Open 1-pane": wp = outerFrame(s,width,height,h1,w1,o1) - p1 = Vector(h1+tol,h1+tol,0) - p2 = Vector(width-(h1+tol),h1+tol,0) - p3 = Vector(width-(h1+tol),height-(h1+tol),0) - p4 = Vector(h1+tol,height-(h1+tol),0) - p5 = Vector(h1+h2,h1+h2,0) - p6 = Vector(width-(h1+h2),h1+h2,0) - p7 = Vector(width-(h1+h2),height-(h1+h2),0) - p8 = Vector(h1+h2,height-(h1+h2),0) - addFrame(s,p1,p2,p3,p4,p5,p6,p7,p8) - s.addConstraint(Sketcher.Constraint('DistanceX',8,1,12,1,h2)) - s.addConstraint(Sketcher.Constraint('DistanceY',8,1,12,1,h2)) - s.addConstraint(Sketcher.Constraint('DistanceX',14,1,10,1,h2)) - s.addConstraint(Sketcher.Constraint('DistanceY',14,1,10,1,h2)) - s.addConstraint(Sketcher.Constraint('DistanceX',4,1,8,1,tol)) - s.addConstraint(Sketcher.Constraint('DistanceY',4,1,8,1,tol)) - s.addConstraint(Sketcher.Constraint('DistanceX',10,1,6,1,tol)) - s.addConstraint(Sketcher.Constraint('DistanceY',10,1,6,1,tol)) - if h2 == h1: - s.renameConstraint(39,'Frame5') - s.renameConstraint(40,'Frame6') - s.renameConstraint(42,'Frame7') - s.renameConstraint(41,'Frame8') + simpleFrame(s,width,height,h1,h2,tol) fw = str(w2) if w2 == w1: fw = "0.00+V" @@ -430,6 +436,17 @@ def makeWindowPreset(windowtype,width,height,h1,h2,h3,w1,w2,o1,o2,placement=None wp.extend(["RightMostFrame","Frame","Wire8,Wire9",fw,str(o2)+"+V"]) wp.extend(["RightMostGlass","Glass panel","Wire9",str(w2/gla),str(o2+w2/2)+"+V"]) + elif windowtype == "Awming": + + wp = outerFrame(s,width,height,h1,w1,o1) + simpleFrame(s,width,height,h1,h2,tol) + fw = str(w2) + if w2 == w1: + fw = "0.00+V" + wp.extend(["InnerFrame","Frame","Wire2,Wire3,Edge7,Mode1",fw,str(o2)+"+V"]) + wp.extend(["InnerGlass","Glass panel","Wire3",str(w2/gla),str(o2+w2/2)+"+V"]) + + elif windowtype == "Simple door": wp = doorFrame(s,width,height,h1,w1,o1)