Arch: Add "Opening only" preset to Arch_Window
As discussed on the forum: https://forum.freecad.org/viewtopic.php?p=734920#p734920
This commit is contained in:
@@ -94,7 +94,7 @@ def makeWindow(baseobj=None,width=None,height=None,parts=None,name=None):
|
||||
if baseobj:
|
||||
obj.Normal = baseobj.Placement.Rotation.multVec(FreeCAD.Vector(0,0,-1))
|
||||
obj.Base = baseobj
|
||||
if parts:
|
||||
if parts is not None:
|
||||
obj.WindowParts = parts
|
||||
else:
|
||||
if baseobj:
|
||||
@@ -512,40 +512,41 @@ class _CommandWindow:
|
||||
self.im.load(":/ui/ParametersWindowFixed.svg")
|
||||
elif i in [1,8]:
|
||||
self.im.load(":/ui/ParametersWindowSimple.svg")
|
||||
elif i == 6:
|
||||
self.im.load(":/ui/ParametersDoorGlass.svg")
|
||||
elif i in [2,4,7]:
|
||||
self.im.load(":/ui/ParametersWindowDouble.svg")
|
||||
elif i == 3:
|
||||
self.im.load(":/ui/ParametersWindowStash.svg")
|
||||
elif i == 5:
|
||||
self.im.load(":/ui/ParametersDoorSimple.svg")
|
||||
elif i == 6:
|
||||
self.im.load(":/ui/ParametersDoorGlass.svg")
|
||||
elif i == 9:
|
||||
self.im.load(":/ui/ParametersOpening.svg")
|
||||
else:
|
||||
if i >= len(WindowPresets):
|
||||
# From Library
|
||||
self.im.hide()
|
||||
path = self.librarypresets[i-len(WindowPresets)][1]
|
||||
if path.lower().endswith(".fcstd"):
|
||||
try:
|
||||
import tempfile
|
||||
import zipfile
|
||||
except Exception:
|
||||
pass
|
||||
else:
|
||||
zfile = zipfile.ZipFile(path)
|
||||
files = zfile.namelist()
|
||||
# check for meta-file if it's really a FreeCAD document
|
||||
if files[0] == "Document.xml":
|
||||
image="thumbnails/Thumbnail.png"
|
||||
if image in files:
|
||||
image = zfile.read(image)
|
||||
thumbfile = tempfile.mkstemp(suffix='.png')[1]
|
||||
thumb = open(thumbfile,"wb")
|
||||
thumb.write(image)
|
||||
thumb.close()
|
||||
im = QtGui.QPixmap(thumbfile)
|
||||
self.pic.setPixmap(im)
|
||||
self.pic.show()
|
||||
else:
|
||||
self.im.load(":/ui/ParametersWindowDouble.svg")
|
||||
# From Library
|
||||
self.im.hide()
|
||||
path = self.librarypresets[i-len(WindowPresets)][1]
|
||||
if path.lower().endswith(".fcstd"):
|
||||
try:
|
||||
import tempfile
|
||||
import zipfile
|
||||
except Exception:
|
||||
pass
|
||||
else:
|
||||
zfile = zipfile.ZipFile(path)
|
||||
files = zfile.namelist()
|
||||
# check for meta-file if it's really a FreeCAD document
|
||||
if files[0] == "Document.xml":
|
||||
image="thumbnails/Thumbnail.png"
|
||||
if image in files:
|
||||
image = zfile.read(image)
|
||||
thumbfile = tempfile.mkstemp(suffix='.png')[1]
|
||||
thumb = open(thumbfile,"wb")
|
||||
thumb.write(image)
|
||||
thumb.close()
|
||||
im = QtGui.QPixmap(thumbfile)
|
||||
self.pic.setPixmap(im)
|
||||
self.pic.show()
|
||||
#for param in self.wparams:
|
||||
# getattr(self,"val"+param).setEnabled(True)
|
||||
else:
|
||||
@@ -912,7 +913,7 @@ class _Window(ArchComponent.Component):
|
||||
if shapes:
|
||||
base = Part.makeCompound(shapes)
|
||||
elif not obj.WindowParts:
|
||||
if not obj.Base.Shape.isNull():
|
||||
if obj.Base.Shape.Solids:
|
||||
base = obj.Base.Shape.copy()
|
||||
# obj placement is already added by applyShape() below
|
||||
#if not DraftGeomUtils.isNull(pl):
|
||||
@@ -941,6 +942,8 @@ class _Window(ArchComponent.Component):
|
||||
#base = Part.makeCompound([base]+self.sshapes+self.vshapes)
|
||||
self.applyShape(obj,base,pl,allowinvalid=True,allownosolid=True)
|
||||
obj.Placement = pl
|
||||
else:
|
||||
obj.Shape = Part.Shape()
|
||||
if hasattr(obj,"Area"):
|
||||
obj.Area = obj.Width.Value * obj.Height.Value
|
||||
|
||||
|
||||
@@ -25,8 +25,8 @@ from FreeCAD import Vector
|
||||
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", "Awning"]
|
||||
WindowPresets = ["Fixed", "Open 1-pane", "Open 2-pane", "Sash 2-pane", "Sliding 2-pane",
|
||||
"Simple door", "Glass door", "Sliding 4-pane", "Awning", "Opening only"]
|
||||
|
||||
def makeWindowPreset(windowtype,width,height,h1,h2,h3,w1,w2,o1,o2,placement=None):
|
||||
|
||||
@@ -62,9 +62,9 @@ def makeWindowPreset(windowtype,width,height,h1,h2,h3,w1,w2,o1,o2,placement=None
|
||||
gla = 10
|
||||
s = FreeCAD.ActiveDocument.addObject('Sketcher::SketchObject','Sketch')
|
||||
|
||||
def addFrame(s,p1,p2,p3,p4,p5,p6,p7,p8):
|
||||
def addRectangle(s,p1,p2,p3,p4):
|
||||
|
||||
"adds two rectangles to the given sketch"
|
||||
"adds a rectangle to the given sketch"
|
||||
|
||||
idx = s.GeometryCount
|
||||
s.addGeometry(Part.LineSegment(p1,p2))
|
||||
@@ -79,18 +79,13 @@ def makeWindowPreset(windowtype,width,height,h1,h2,h3,w1,w2,o1,o2,placement=None
|
||||
s.addConstraint(Sketcher.Constraint('Horizontal',idx+2))
|
||||
s.addConstraint(Sketcher.Constraint('Vertical',idx+1))
|
||||
s.addConstraint(Sketcher.Constraint('Vertical',idx+3))
|
||||
s.addGeometry(Part.LineSegment(p5,p6))
|
||||
s.addGeometry(Part.LineSegment(p6,p7))
|
||||
s.addGeometry(Part.LineSegment(p7,p8))
|
||||
s.addGeometry(Part.LineSegment(p8,p5))
|
||||
s.addConstraint(Sketcher.Constraint('Coincident',idx+4,2,idx+5,1))
|
||||
s.addConstraint(Sketcher.Constraint('Coincident',idx+5,2,idx+6,1))
|
||||
s.addConstraint(Sketcher.Constraint('Coincident',idx+6,2,idx+7,1))
|
||||
s.addConstraint(Sketcher.Constraint('Coincident',idx+7,2,idx+4,1))
|
||||
s.addConstraint(Sketcher.Constraint('Horizontal',idx+4))
|
||||
s.addConstraint(Sketcher.Constraint('Horizontal',idx+6))
|
||||
s.addConstraint(Sketcher.Constraint('Vertical',idx+5))
|
||||
s.addConstraint(Sketcher.Constraint('Vertical',idx+7))
|
||||
|
||||
def addFrame(s,p1,p2,p3,p4,p5,p6,p7,p8):
|
||||
|
||||
"adds two rectangles to the given sketch"
|
||||
|
||||
addRectangle(s,p1,p2,p3,p4)
|
||||
addRectangle(s,p5,p6,p7,p8)
|
||||
|
||||
def simpleFrame(s,width,height,h1,h2,tol):
|
||||
|
||||
@@ -489,6 +484,20 @@ def makeWindowPreset(windowtype,width,height,h1,h2,h3,w1,w2,o1,o2,placement=None
|
||||
wp.extend(["InnerFrame","Frame","Wire2,Wire3,Edge8,Mode1",fw,str(o2)+"+V"])
|
||||
wp.extend(["InnerGlass","Glass panel","Wire3",str(w2/gla),str(o2+w2/2)+"+V"])
|
||||
|
||||
elif windowtype == "Opening only":
|
||||
|
||||
wp = []
|
||||
p1 = Vector(0,0,0)
|
||||
p2 = Vector(width,0,0)
|
||||
p3 = Vector(width,height,0)
|
||||
p4 = Vector(0,height,0)
|
||||
addRectangle(s,p1,p2,p3,p4)
|
||||
s.addConstraint(Sketcher.Constraint('Coincident',0,1,-1,1))
|
||||
s.addConstraint(Sketcher.Constraint('DistanceX',0,width))
|
||||
s.addConstraint(Sketcher.Constraint('DistanceY',1,height))
|
||||
s.renameConstraint(9,'Width')
|
||||
s.renameConstraint(10,'Height')
|
||||
|
||||
return (s,wp)
|
||||
|
||||
if windowtype in WindowPresets:
|
||||
@@ -504,9 +513,12 @@ def makeWindowPreset(windowtype,width,height,h1,h2,h3,w1,w2,o1,o2,placement=None
|
||||
obj.Frame = w2
|
||||
obj.Offset = o1
|
||||
obj.Placement = FreeCAD.Placement() # unable to find where this bug comes from...
|
||||
if "door" in windowtype:
|
||||
if "door" in windowtype.lower():
|
||||
obj.IfcType = "Door"
|
||||
obj.Label = translate("Arch","Door")
|
||||
elif "opening" in windowtype.lower():
|
||||
obj.IfcType = "Opening Element"
|
||||
obj.Label = translate("Arch","Opening")
|
||||
FreeCAD.ActiveDocument.recompute()
|
||||
return obj
|
||||
|
||||
|
||||
126
src/Mod/Arch/Resources/ui/ParametersOpening.svg
Normal file
126
src/Mod/Arch/Resources/ui/ParametersOpening.svg
Normal file
@@ -0,0 +1,126 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
width="200"
|
||||
height="120"
|
||||
id="svg2"
|
||||
version="1.1"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/">
|
||||
<defs
|
||||
id="defs4" />
|
||||
<metadata
|
||||
id="metadata7">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
id="layer1"
|
||||
transform="translate(0,-932.36218)">
|
||||
<rect
|
||||
style="color:#000000;fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
|
||||
id="rect2985"
|
||||
width="79.137207"
|
||||
height="79.288902"
|
||||
x="111.37582"
|
||||
y="941.89978" />
|
||||
<rect
|
||||
style="color:#000000;fill:#909090;fill-opacity:1;stroke:none;stroke-width:1px;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
|
||||
id="rect4365-5"
|
||||
width="37.170662"
|
||||
height="6.8184896"
|
||||
x="14.409538"
|
||||
y="-941.07379"
|
||||
transform="scale(1,-1)" />
|
||||
<path
|
||||
style="color:#000000;fill:none;stroke:#000000;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
|
||||
d="m 14.490515,941.28831 37.60019,0 0,-7.04665"
|
||||
id="path4095-1" />
|
||||
<rect
|
||||
style="color:#000000;fill:#909090;fill-opacity:1;stroke:none;stroke-width:1px;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
|
||||
id="rect4365"
|
||||
width="36.36549"
|
||||
height="13.131983"
|
||||
x="14.818529"
|
||||
y="1021.6157" />
|
||||
<path
|
||||
style="fill:#ff0000;stroke:#ff0000;stroke-width:0.98996162px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="m 93.07632,938.51389 0,86.62721"
|
||||
id="path3865" />
|
||||
<path
|
||||
style="fill:none;stroke:#ff0000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="m 101.29061,942.27388 -12.14286,0"
|
||||
id="path3867" />
|
||||
<path
|
||||
style="fill:none;stroke:#ff0000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="m 101.29061,1021.0239 -12.14286,0"
|
||||
id="path3867-8" />
|
||||
<path
|
||||
style="color:#000000;fill:none;stroke:#ff0000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
|
||||
d="m 105.68728,1046.2411 89.2943,0"
|
||||
id="path3865-5" />
|
||||
<path
|
||||
style="fill:none;stroke:#ff0000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="m 111.39191,1038.0268 0,12.1429"
|
||||
id="path3867-0" />
|
||||
<path
|
||||
style="fill:none;stroke:#ff0000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="m 190.14182,1038.0268 0,12.1429"
|
||||
id="path3867-8-7" />
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-style:normal;font-weight:normal;line-height:0%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#ff0000;fill-opacity:1;stroke:none"
|
||||
x="133.08107"
|
||||
y="1044.5293"
|
||||
id="text4070"><tspan
|
||||
id="tspan4072"
|
||||
x="133.08107"
|
||||
y="1044.5293"
|
||||
style="font-weight:bold;font-size:10px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'Sans Bold'">WIDTH</tspan></text>
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-style:normal;font-weight:normal;line-height:0%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#ff0000;fill-opacity:1;stroke:none"
|
||||
x="-1003.166"
|
||||
y="90.64502"
|
||||
id="text4070-5"
|
||||
transform="rotate(-90)"><tspan
|
||||
id="tspan4072-7"
|
||||
x="-1003.166"
|
||||
y="90.64502"
|
||||
style="font-weight:bold;font-size:10px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'Sans Bold'">HEIGHT</tspan></text>
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
|
||||
d="m 14.897753,1021.2025 36.785714,0 0,13.5714"
|
||||
id="path4095" />
|
||||
<path
|
||||
style="color:#000000;fill:none;stroke:#ff0000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
|
||||
id="path4150-5"
|
||||
d="m 40.342969,54.416866 a 1.7046324,1.7046324 0 1 1 -3.409265,0 1.7046324,1.7046324 0 1 1 3.409265,0 z"
|
||||
transform="translate(54.61656,887.85702)" />
|
||||
<path
|
||||
style="color:#000000;fill:none;stroke:#ff0000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
|
||||
id="path4150-7"
|
||||
d="m 40.342969,54.416866 a 1.7046324,1.7046324 0 1 1 -3.409265,0 1.7046324,1.7046324 0 1 1 3.409265,0 z"
|
||||
transform="translate(54.43799,966.42845)" />
|
||||
<path
|
||||
style="color:#000000;fill:none;stroke:#ff0000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
|
||||
id="path4150-87"
|
||||
d="m 40.342969,54.416866 a 1.7046324,1.7046324 0 1 1 -3.409265,0 1.7046324,1.7046324 0 1 1 3.409265,0 z"
|
||||
transform="translate(72.759417,991.76773)" />
|
||||
<path
|
||||
style="color:#000000;fill:none;stroke:#ff0000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
|
||||
id="path4150-63"
|
||||
d="m 40.342969,54.416866 a 1.7046324,1.7046324 0 1 1 -3.409265,0 1.7046324,1.7046324 0 1 1 3.409265,0 z"
|
||||
transform="translate(151.59871,991.76773)" />
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 6.6 KiB |
Reference in New Issue
Block a user