Arch Change default value
Comment some print
This commit is contained in:
parent
2dca1ffc39
commit
e37cdf15cf
|
@ -35,7 +35,7 @@ __title__="FreeCAD Roof"
|
||||||
__author__ = "Yorik van Havre", "Jonathan Wiedemann"
|
__author__ = "Yorik van Havre", "Jonathan Wiedemann"
|
||||||
__url__ = "http://www.freecadweb.org"
|
__url__ = "http://www.freecadweb.org"
|
||||||
|
|
||||||
def makeRoof(baseobj=None,facenr=0, angles=[45.,], run = [], idrel = [0,],thickness = [1.,], overhang=[2.,], name="Roof"):
|
def makeRoof(baseobj=None,facenr=0, angles=[45.,], run = [], idrel = [0,],thickness = [50.,], overhang=[100.,], name="Roof"):
|
||||||
'''makeRoof(baseobj,[facenr],[angle],[name]) : Makes a roof based on a closed wire.
|
'''makeRoof(baseobj,[facenr],[angle],[name]) : Makes a roof based on a closed wire.
|
||||||
face from an existing object. You can provide a list of angles, run, idrel, thickness,
|
face from an existing object. You can provide a list of angles, run, idrel, thickness,
|
||||||
overhang for each edges in the wire to define the roof shape. The default for angle is 45
|
overhang for each edges in the wire to define the roof shape. The default for angle is 45
|
||||||
|
@ -76,7 +76,8 @@ def makeRoof(baseobj=None,facenr=0, angles=[45.,], run = [], idrel = [0,],thickn
|
||||||
lr = len(run)
|
lr = len(run)
|
||||||
rlist = run
|
rlist = run
|
||||||
for i in range(l-lr):
|
for i in range(l-lr):
|
||||||
rlist.append(w.Edges[i].Length/2.)
|
#rlist.append(w.Edges[i].Length/2.)
|
||||||
|
rlist.append(250.)
|
||||||
obj.Runs = rlist
|
obj.Runs = rlist
|
||||||
|
|
||||||
lidrel = len(idrel)
|
lidrel = len(idrel)
|
||||||
|
@ -184,7 +185,7 @@ class _Roof(ArchComponent.Component):
|
||||||
perpendicular[0] = abs(perpendicular[0])
|
perpendicular[0] = abs(perpendicular[0])
|
||||||
perpendicular[1] = abs(perpendicular[1])*-1
|
perpendicular[1] = abs(perpendicular[1])*-1
|
||||||
else:
|
else:
|
||||||
print("Angle inconnue")
|
print("Unknown Angle")
|
||||||
perpendicular[2] = abs(perpendicular[2])
|
perpendicular[2] = abs(perpendicular[2])
|
||||||
perpendicular.normalize()
|
perpendicular.normalize()
|
||||||
perpendicular = perpendicular.multiply(l)
|
perpendicular = perpendicular.multiply(l)
|
||||||
|
@ -261,7 +262,253 @@ class _Roof(ArchComponent.Component):
|
||||||
eave = DraftGeomUtils.edg(FreeCAD.Vector(pt0Eave1[0]),FreeCAD.Vector(pt1Eave1[0]))
|
eave = DraftGeomUtils.edg(FreeCAD.Vector(pt0Eave1[0]),FreeCAD.Vector(pt1Eave1[0]))
|
||||||
self.profilsDico[i]["eave"] = eave
|
self.profilsDico[i]["eave"] = eave
|
||||||
|
|
||||||
def createProfilShape (self, points, midpoint, rot, vec, run, d, shapesList, f):
|
def findProfil(self, idx):
|
||||||
|
#print("base " + str(idx))
|
||||||
|
if 0<=idx<len(self.profilsDico):
|
||||||
|
profil = self.profilsDico[idx]
|
||||||
|
else:
|
||||||
|
idx = abs(abs(idx) - len(self.profilsDico))
|
||||||
|
#print("change " + str(idx))
|
||||||
|
profil = self.profilsDico[idx]
|
||||||
|
return profil
|
||||||
|
|
||||||
|
def nextPignon(self, i):
|
||||||
|
import DraftGeomUtils
|
||||||
|
#print("Next : pignon")
|
||||||
|
profilCurrent = self.findProfil(i)
|
||||||
|
profilNext1 = self.findProfil(i+1)
|
||||||
|
profilNext2 = self.findProfil(i+2)
|
||||||
|
point = DraftGeomUtils.findIntersection(profilCurrent["eave"],profilNext1["eave"],infinite1=True,infinite2=True,)
|
||||||
|
#print "a ",FreeCAD.Vector(point[0])
|
||||||
|
self.ptsPaneProject.append(FreeCAD.Vector(point[0]))
|
||||||
|
pt1 = DraftGeomUtils.findIntersection(profilCurrent["edge"],profilNext1["eave"],infinite1=True,infinite2=True,)
|
||||||
|
pt2 = DraftGeomUtils.findIntersection(profilNext2["edge"],profilNext1["eave"],infinite1=True,infinite2=True,)
|
||||||
|
eaveWithoutOverhang = DraftGeomUtils.edg(pt1[0],pt2[0])
|
||||||
|
if profilCurrent["run"]+profilNext2["run"] != eaveWithoutOverhang.Length :
|
||||||
|
points = [FreeCAD.Vector(0.0,0.0,0.0),]
|
||||||
|
points.append(FreeCAD.Vector(profilCurrent["run"],profilCurrent["height"],0.0))
|
||||||
|
rampantCurrent = DraftGeomUtils.edg(points[0],points[1])
|
||||||
|
points = [FreeCAD.Vector(eaveWithoutOverhang.Length,0.0,0.0),]
|
||||||
|
points.append(FreeCAD.Vector(eaveWithoutOverhang.Length-profilNext2["run"],profilNext2["height"],0.0))
|
||||||
|
rampantNext2 = DraftGeomUtils.edg(points[0],points[1])
|
||||||
|
point = DraftGeomUtils.findIntersection(rampantCurrent,rampantNext2,infinite1=True,infinite2=True,)
|
||||||
|
ridgeCurrent = DraftGeomUtils.offset(profilCurrent["edge"],self.getPerpendicular(profilCurrent["vec"],profilCurrent["rot"],point[0].x))
|
||||||
|
point = DraftGeomUtils.findIntersection(ridgeCurrent,profilNext1["eave"],infinite1=True,infinite2=True,)
|
||||||
|
else:
|
||||||
|
point = DraftGeomUtils.findIntersection(profilCurrent["ridge"],profilNext1["eaveD"],infinite1=True,infinite2=True,)
|
||||||
|
#print "b ",FreeCAD.Vector(point[0])
|
||||||
|
self.ptsPaneProject.append(FreeCAD.Vector(point[0]))
|
||||||
|
|
||||||
|
def backPignon(self, i):
|
||||||
|
import DraftGeomUtils
|
||||||
|
#print("Back : pignon")
|
||||||
|
profilCurrent = self.findProfil(i)
|
||||||
|
profilBack1 = self.findProfil(i-1)
|
||||||
|
profilBack2 = self.findProfil(i-2)
|
||||||
|
pt1 = DraftGeomUtils.findIntersection(profilCurrent["edge"],profilBack1["eave"],infinite1=True,infinite2=True,)
|
||||||
|
pt2 = DraftGeomUtils.findIntersection(profilBack2["edge"],profilBack1["eave"],infinite1=True,infinite2=True,)
|
||||||
|
eaveWithoutOverhang = DraftGeomUtils.edg(pt1[0],pt2[0])
|
||||||
|
if profilCurrent["run"]+profilBack2["run"] != eaveWithoutOverhang.Length :
|
||||||
|
points = [FreeCAD.Vector(0.0,0.0,0.0),]
|
||||||
|
points.append(FreeCAD.Vector(profilCurrent["run"],profilCurrent["height"],0.0))
|
||||||
|
rampantCurrent = DraftGeomUtils.edg(points[0],points[1])
|
||||||
|
points = [FreeCAD.Vector(eaveWithoutOverhang.Length,0.0,0.0),]
|
||||||
|
points.append(FreeCAD.Vector(eaveWithoutOverhang.Length-profilBack2["run"],profilBack2["height"],0.0))
|
||||||
|
rampantBack2 = DraftGeomUtils.edg(points[0],points[1])
|
||||||
|
point = DraftGeomUtils.findIntersection(rampantCurrent,rampantBack2,infinite1=True,infinite2=True,)
|
||||||
|
ridgeCurrent = DraftGeomUtils.offset(profilCurrent["edge"],self.getPerpendicular(profilCurrent["vec"],profilCurrent["rot"],point[0].x))
|
||||||
|
point = DraftGeomUtils.findIntersection(ridgeCurrent,profilBack1["eave"],infinite1=True,infinite2=True,)
|
||||||
|
else:
|
||||||
|
point = DraftGeomUtils.findIntersection(profilCurrent["ridge"],profilBack1["eave"],infinite1=True,infinite2=True,)
|
||||||
|
#print "a ", FreeCAD.Vector(point[0])
|
||||||
|
#print "b ", FreeCAD.Vector(profilCurrent["eave"].Vertexes[0].Point[0])
|
||||||
|
self.ptsPaneProject.append(FreeCAD.Vector(point[0]))
|
||||||
|
point = DraftGeomUtils.findIntersection(profilCurrent["eave"],profilBack1["eave"],infinite1=True,infinite2=True,)
|
||||||
|
#print "b ",FreeCAD.Vector(point[0])
|
||||||
|
self.ptsPaneProject.append(FreeCAD.Vector(point[0]))
|
||||||
|
#self.ptsPaneProject.append(FreeCAD.Vector(profilCurrent["eave"].Vertexes[0].Point[0]))
|
||||||
|
|
||||||
|
def nextSameHeight(self, i):
|
||||||
|
import DraftGeomUtils
|
||||||
|
#print("Next : ht1 = ht2")
|
||||||
|
profilCurrent = self.findProfil(i)
|
||||||
|
profilNext1 = self.findProfil(i+1)
|
||||||
|
ptInterRidges = DraftGeomUtils.findIntersection(profilCurrent["ridge"],profilNext1["ridge"],infinite1=True,infinite2=True,)
|
||||||
|
edgeHip = DraftGeomUtils.edg(FreeCAD.Vector(ptInterRidges[0]),profilCurrent["edge"].Vertexes[-1].Point)
|
||||||
|
ptInterHipEave = DraftGeomUtils.findIntersection(edgeHip,profilCurrent["eave"],infinite1=True,infinite2=False,)
|
||||||
|
if ptInterHipEave:
|
||||||
|
#print "a ",FreeCAD.Vector(ptInterHipEave[0])
|
||||||
|
self.ptsPaneProject.append(FreeCAD.Vector(ptInterHipEave[0]))
|
||||||
|
else:
|
||||||
|
ptInterHipEave = DraftGeomUtils.findIntersection(edgeHip,profilNext1["eaveD"],infinite1=True,infinite2=True,)
|
||||||
|
#print "b ",FreeCAD.Vector(profilCurrent["eave"].Vertexes[-1].Point)
|
||||||
|
#print "c ",FreeCAD.Vector(ptInterHipEave[0])
|
||||||
|
self.ptsPaneProject.append(FreeCAD.Vector(profilCurrent["eave"].Vertexes[-1].Point))
|
||||||
|
self.ptsPaneProject.append(FreeCAD.Vector(ptInterHipEave[0]))
|
||||||
|
#print "d ",FreeCAD.Vector(ptInterRidges[0])
|
||||||
|
self.ptsPaneProject.append(FreeCAD.Vector(ptInterRidges[0]))
|
||||||
|
|
||||||
|
def backSameHeight(self, i):
|
||||||
|
import DraftGeomUtils
|
||||||
|
#print("Back : ht1 = ht0")
|
||||||
|
profilCurrent = self.findProfil(i)
|
||||||
|
profilBack1 = self.findProfil(i-1)
|
||||||
|
ptInterRidges = DraftGeomUtils.findIntersection(profilCurrent["ridge"],profilBack1["ridge"],infinite1=True,infinite2=True,)
|
||||||
|
#print "a ",FreeCAD.Vector(ptInterRidges[0])
|
||||||
|
self.ptsPaneProject.append(FreeCAD.Vector(ptInterRidges[0]))
|
||||||
|
edgeHip = DraftGeomUtils.edg(FreeCAD.Vector(ptInterRidges[0]),profilCurrent["edge"].Vertexes[0].Point)
|
||||||
|
ptInterHipEave = DraftGeomUtils.findIntersection(edgeHip,profilCurrent["eave"],infinite1=True,infinite2=False,)
|
||||||
|
if ptInterHipEave:
|
||||||
|
#print "b ",FreeCAD.Vector(ptInterHipEave[0])
|
||||||
|
self.ptsPaneProject.append(FreeCAD.Vector(ptInterHipEave[0]))
|
||||||
|
else:
|
||||||
|
ptInterHipEave = DraftGeomUtils.findIntersection(edgeHip,profilBack1["eaveD"],infinite1=True,infinite2=True,)
|
||||||
|
#print "c ",FreeCAD.Vector(ptInterHipEave[0])
|
||||||
|
#print "d ",FreeCAD.Vector(profilCurrent["eave"].Vertexes[0].Point)
|
||||||
|
self.ptsPaneProject.append(FreeCAD.Vector(ptInterHipEave[0]))
|
||||||
|
self.ptsPaneProject.append(FreeCAD.Vector(profilCurrent["eave"].Vertexes[0].Point))
|
||||||
|
|
||||||
|
def nextHigher(self, i):
|
||||||
|
import DraftGeomUtils
|
||||||
|
#print("Next : ht2 > ht1")
|
||||||
|
profilCurrent = self.findProfil(i)
|
||||||
|
profilNext1 = self.findProfil(i+1)
|
||||||
|
dec = profilCurrent["height"]/math.tan(math.radians(profilNext1["angle"]))
|
||||||
|
edgeRidgeOnPane = DraftGeomUtils.offset(profilNext1["edge"],self.getPerpendicular(profilNext1["vec"],profilNext1["rot"],dec))
|
||||||
|
ptInter = DraftGeomUtils.findIntersection(profilCurrent["ridge"],edgeRidgeOnPane,infinite1=True,infinite2=True,)
|
||||||
|
edgeHip = DraftGeomUtils.edg(FreeCAD.Vector(ptInter[0]),profilCurrent["edge"].Vertexes[-1].Point)
|
||||||
|
ptInterHipEave = DraftGeomUtils.findIntersection(edgeHip,profilCurrent["eave"],infinite1=True,infinite2=False,)
|
||||||
|
if ptInterHipEave:
|
||||||
|
#print "a ",FreeCAD.Vector(ptInterHipEave[0])
|
||||||
|
self.ptsPaneProject.append(FreeCAD.Vector(ptInterHipEave[0]))
|
||||||
|
else:
|
||||||
|
ptInterHipEave = DraftGeomUtils.findIntersection(edgeHip,profilNext1["eaveD"],infinite1=True,infinite2=True,)
|
||||||
|
#print "b ",FreeCAD.Vector(profilCurrent["eave"].Vertexes[-1].Point[0])
|
||||||
|
#print "c ",FreeCAD.Vector(ptInterHipEave[0])
|
||||||
|
self.ptsPaneProject.append(FreeCAD.Vector(profilCurrent["eave"].Vertexes[-1].Point[0]))
|
||||||
|
self.ptsPaneProject.append(FreeCAD.Vector(ptInterHipEave[0]))
|
||||||
|
#print "d ",FreeCAD.Vector(ptInter[0])
|
||||||
|
self.ptsPaneProject.append(FreeCAD.Vector(ptInter[0]))
|
||||||
|
ptInterRidges = DraftGeomUtils.findIntersection(profilCurrent["ridge"],profilNext1["ridge"],infinite1=True,infinite2=True,)
|
||||||
|
#print "e ",FreeCAD.Vector(ptInterRidges[0])
|
||||||
|
self.ptsPaneProject.append(FreeCAD.Vector(ptInterRidges[0]))
|
||||||
|
|
||||||
|
def backHigher(self, i):
|
||||||
|
import DraftGeomUtils
|
||||||
|
#print("Back : ht1 < ht0")
|
||||||
|
profilCurrent = self.findProfil(i)
|
||||||
|
profilBack1 = self.findProfil(i-1)
|
||||||
|
dec = profilCurrent["height"]/math.tan(math.radians(profilBack1["angle"]))
|
||||||
|
edgeRidgeOnPane = DraftGeomUtils.offset(profilBack1["edge"],self.getPerpendicular(profilBack1["vec"],profilBack1["rot"],dec))
|
||||||
|
ptInterRidges = DraftGeomUtils.findIntersection(edgeRidgeOnPane,profilCurrent["ridge"],infinite1=True,infinite2=True,)
|
||||||
|
#print "a ",FreeCAD.Vector(ptInterRidges[0])
|
||||||
|
self.ptsPaneProject.append(FreeCAD.Vector(ptInterRidges[0]))
|
||||||
|
edgeHip = DraftGeomUtils.edg(FreeCAD.Vector(ptInterRidges[0]),profilCurrent["edge"].Vertexes[0].Point)
|
||||||
|
ptInterHipEave = DraftGeomUtils.findIntersection(edgeHip,profilCurrent["eave"],infinite1=True,infinite2=False,)
|
||||||
|
if ptInterHipEave:
|
||||||
|
#print "b ",FreeCAD.Vector(ptInterHipEave[0])
|
||||||
|
self.ptsPaneProject.append(FreeCAD.Vector(ptInterHipEave[0]))
|
||||||
|
else:
|
||||||
|
ptInterHipEave = DraftGeomUtils.findIntersection(edgeHip,profilBack1["eaveD"],infinite1=True,infinite2=True,)
|
||||||
|
#print "c ",FreeCAD.Vector(ptInterHipEave[0])
|
||||||
|
#print "d ",FreeCAD.Vector(profilCurrent["eave"].Vertexes[0].Point[0])
|
||||||
|
self.ptsPaneProject.append(FreeCAD.Vector(ptInterHipEave[0]))
|
||||||
|
self.ptsPaneProject.append(FreeCAD.Vector(profilCurrent["eave"].Vertexes[0].Point[0]))
|
||||||
|
|
||||||
|
|
||||||
|
def nextSmaller(self, i):
|
||||||
|
import DraftGeomUtils
|
||||||
|
#print("Next : ht2 < ht1")
|
||||||
|
profilCurrent = self.findProfil(i)
|
||||||
|
profilNext1 = self.findProfil(i+1)
|
||||||
|
dec = profilNext1["height"]/math.tan(math.radians(profilCurrent["angle"]))
|
||||||
|
edgeRidgeOnPane = DraftGeomUtils.offset(profilCurrent["edge"],self.getPerpendicular(profilCurrent["vec"],profilCurrent["rot"],dec))
|
||||||
|
ptInter = DraftGeomUtils.findIntersection(profilNext1["ridge"],edgeRidgeOnPane,infinite1=True,infinite2=True,)
|
||||||
|
edgeHip = DraftGeomUtils.edg(FreeCAD.Vector(ptInter[0]),profilCurrent["edge"].Vertexes[-1].Point)
|
||||||
|
ptInterHipEave = DraftGeomUtils.findIntersection(edgeHip,profilCurrent["eave"],infinite1=True,infinite2=False,)
|
||||||
|
if ptInterHipEave:
|
||||||
|
#print "a ",FreeCAD.Vector(ptInterHipEave[0])
|
||||||
|
self.ptsPaneProject.append(FreeCAD.Vector(ptInterHipEave[0]))
|
||||||
|
else:
|
||||||
|
ptInterHipEave = DraftGeomUtils.findIntersection(edgeHip,profilNext1["eaveD"],infinite1=True,infinite2=True,)
|
||||||
|
#print "b ",FreeCAD.Vector(profilCurrent["eave"].Vertexes[-1].Point[0])
|
||||||
|
#print "c ",FreeCAD.Vector(ptInterHipEave[0])
|
||||||
|
self.ptsPaneProject.append(FreeCAD.Vector(profilCurrent["eave"].Vertexes[-1].Point[0]))
|
||||||
|
self.ptsPaneProject.append(FreeCAD.Vector(ptInterHipEave[0]))
|
||||||
|
#print "d ",FreeCAD.Vector(ptInter[0])
|
||||||
|
self.ptsPaneProject.append(FreeCAD.Vector(ptInter[0]))
|
||||||
|
ptInter = edgeHip.Vertexes[0].Point
|
||||||
|
vecInterRidges = DraftGeomUtils.findPerpendicular(ptInter, [profilCurrent["ridge"].Edges[0],], force=0)
|
||||||
|
ptInterRidges = ptInter.add(vecInterRidges[0])
|
||||||
|
#print "e ",FreeCAD.Vector(ptInterRidges)
|
||||||
|
self.ptsPaneProject.append(FreeCAD.Vector(ptInterRidges))
|
||||||
|
|
||||||
|
def backSmaller(self, i):
|
||||||
|
import DraftGeomUtils
|
||||||
|
#print("Back : ht0 < ht1")
|
||||||
|
profilCurrent = self.findProfil(i)
|
||||||
|
profilBack1 = self.findProfil(i-1)
|
||||||
|
dec = profilBack1["height"]/math.tan(math.radians(profilCurrent["angle"]))
|
||||||
|
edgeRidgeOnPane = DraftGeomUtils.offset(profilCurrent["edge"],self.getPerpendicular(profilCurrent["vec"],profilCurrent["rot"],dec))
|
||||||
|
ptInter1 = DraftGeomUtils.findIntersection(edgeRidgeOnPane,profilBack1["ridge"],infinite1=True,infinite2=True,)
|
||||||
|
edgeHip = DraftGeomUtils.edg(FreeCAD.Vector(ptInter1[0]),profilCurrent["edge"].Vertexes[0].Point)
|
||||||
|
ptInter2 = edgeHip.Vertexes[0].Point
|
||||||
|
vecInterRidges = DraftGeomUtils.findPerpendicular(ptInter2, [profilCurrent["ridge"].Edges[0],], force=0)
|
||||||
|
ptInterRidges = ptInter2.add(vecInterRidges[0])
|
||||||
|
#print "a ",FreeCAD.Vector(ptInterRidges)
|
||||||
|
#print "b ",FreeCAD.Vector(ptInter1[0])
|
||||||
|
self.ptsPaneProject.append(FreeCAD.Vector(ptInterRidges))
|
||||||
|
self.ptsPaneProject.append(FreeCAD.Vector(ptInter1[0]))
|
||||||
|
ptInterHipEave = DraftGeomUtils.findIntersection(edgeHip,profilCurrent["eave"],infinite1=True,infinite2=False,)
|
||||||
|
if ptInterHipEave:
|
||||||
|
#print "c ",FreeCAD.Vector(ptInterHipEave[0])
|
||||||
|
self.ptsPaneProject.append(FreeCAD.Vector(ptInterHipEave[0]))
|
||||||
|
else:
|
||||||
|
ptInterHipEave = DraftGeomUtils.findIntersection(edgeHip,profilBack1["eaveD"],infinite1=True,infinite2=True,)
|
||||||
|
#print "d ",FreeCAD.Vector(ptInterHipEave[0])
|
||||||
|
#print "e ",FreeCAD.Vector(profilCurrent["eave"].Vertexes[0].Point[0])
|
||||||
|
self.ptsPaneProject.append(FreeCAD.Vector(ptInterHipEave[0]))
|
||||||
|
self.ptsPaneProject.append(FreeCAD.Vector(profilCurrent["eave"].Vertexes[0].Point[0]))
|
||||||
|
|
||||||
|
def getRoofPaneProject(self, i):
|
||||||
|
self.ptsPaneProject=[]
|
||||||
|
profilCurrent = self.findProfil(i)
|
||||||
|
profilBack1 = self.findProfil(i-1)
|
||||||
|
profilNext1 = self.findProfil(i+1)
|
||||||
|
|
||||||
|
#print("PROFIL " + str(i) + " : Start calculs")
|
||||||
|
if profilCurrent["angle"] != 90.:
|
||||||
|
#print("profilNext1 angle : " + str(profilNext1["angle"]))
|
||||||
|
if profilNext1["angle"] == 90. :
|
||||||
|
self.nextPignon(i)
|
||||||
|
elif profilNext1["height"] == profilCurrent["height"] :
|
||||||
|
self.nextSameHeight(i)
|
||||||
|
elif profilNext1["height"] < profilCurrent["height"] :
|
||||||
|
self.nextSmaller(i)
|
||||||
|
elif profilNext1["height"] > profilCurrent["height"] :
|
||||||
|
self.nextHigher(i)
|
||||||
|
else:
|
||||||
|
print("Arch Roof : Case Not implemented")
|
||||||
|
if profilBack1["angle"] == 90. :
|
||||||
|
self.backPignon(i)
|
||||||
|
elif profilBack1["height"] == profilCurrent["height"] :
|
||||||
|
self.backSameHeight(i)
|
||||||
|
elif profilBack1["height"] < profilCurrent["height"] :
|
||||||
|
self.backSmaller(i)
|
||||||
|
elif profilBack1["height"] > profilCurrent["height"] :
|
||||||
|
self.backHigher(i)
|
||||||
|
else:
|
||||||
|
print("Arch Roof : Case Not implemented")
|
||||||
|
else:
|
||||||
|
self.ptsPaneProject=[]
|
||||||
|
|
||||||
|
self.ptsPaneProject = DraftVecUtils.removeDoubles(self.ptsPaneProject)
|
||||||
|
#print("ptsPaneProject",self.ptsPaneProject)
|
||||||
|
profilCurrent["points"] = self.ptsPaneProject
|
||||||
|
#print("PROFIL " + str(i) + " : End calculs")
|
||||||
|
|
||||||
|
#def createProfilShape (self, points, midpoint, rot, vec, run, d, shapesList, f):
|
||||||
|
def createProfilShape (self, points, midpoint, rot, vec, run, d, f):
|
||||||
import Part
|
import Part
|
||||||
lp = len(points)
|
lp = len(points)
|
||||||
points.append(points[0])
|
points.append(points[0])
|
||||||
|
@ -281,252 +528,8 @@ class _Roof(ArchComponent.Component):
|
||||||
profilFace = Part.Face(profil)
|
profilFace = Part.Face(profil)
|
||||||
profilShp = profilFace.extrude(vecE)
|
profilShp = profilFace.extrude(vecE)
|
||||||
profilShp = f.common(profilShp)
|
profilShp = f.common(profilShp)
|
||||||
shapesList.append(profilShp)
|
#shapesList.append(profilShp)
|
||||||
|
return profilShp
|
||||||
def findProfil(self, idx):
|
|
||||||
#print("base " + str(idx))
|
|
||||||
if 0<=idx<len(self.profilsDico):
|
|
||||||
profil = self.profilsDico[idx]
|
|
||||||
else:
|
|
||||||
idx = abs(abs(idx) - len(self.profilsDico))
|
|
||||||
#print("change " + str(idx))
|
|
||||||
profil = self.profilsDico[idx]
|
|
||||||
return profil
|
|
||||||
|
|
||||||
def nextPignon(self, i):
|
|
||||||
import DraftGeomUtils
|
|
||||||
print("Next : pignon")
|
|
||||||
profilCurrent = self.findProfil(i)
|
|
||||||
profilNext1 = self.findProfil(i+1)
|
|
||||||
profilNext2 = self.findProfil(i+2)
|
|
||||||
point = DraftGeomUtils.findIntersection(profilCurrent["eave"],profilNext1["eave"],infinite1=True,infinite2=True,)
|
|
||||||
print "a ",FreeCAD.Vector(point[0])
|
|
||||||
self.ptsPaneProject.append(FreeCAD.Vector(point[0]))
|
|
||||||
pt1 = DraftGeomUtils.findIntersection(profilCurrent["edge"],profilNext1["eave"],infinite1=True,infinite2=True,)
|
|
||||||
pt2 = DraftGeomUtils.findIntersection(profilNext2["edge"],profilNext1["eave"],infinite1=True,infinite2=True,)
|
|
||||||
eaveWithoutOverhang = DraftGeomUtils.edg(pt1[0],pt2[0])
|
|
||||||
if profilCurrent["run"]+profilNext2["run"] != eaveWithoutOverhang.Length :
|
|
||||||
points = [FreeCAD.Vector(0.0,0.0,0.0),]
|
|
||||||
points.append(FreeCAD.Vector(profilCurrent["run"],profilCurrent["height"],0.0))
|
|
||||||
rampantCurrent = DraftGeomUtils.edg(points[0],points[1])
|
|
||||||
points = [FreeCAD.Vector(eaveWithoutOverhang.Length,0.0,0.0),]
|
|
||||||
points.append(FreeCAD.Vector(eaveWithoutOverhang.Length-profilNext2["run"],profilNext2["height"],0.0))
|
|
||||||
rampantNext2 = DraftGeomUtils.edg(points[0],points[1])
|
|
||||||
point = DraftGeomUtils.findIntersection(rampantCurrent,rampantNext2,infinite1=True,infinite2=True,)
|
|
||||||
ridgeCurrent = DraftGeomUtils.offset(profilCurrent["edge"],self.getPerpendicular(profilCurrent["vec"],profilCurrent["rot"],point[0].x))
|
|
||||||
point = DraftGeomUtils.findIntersection(ridgeCurrent,profilNext1["eave"],infinite1=True,infinite2=True,)
|
|
||||||
else:
|
|
||||||
point = DraftGeomUtils.findIntersection(profilCurrent["ridge"],profilNext1["eaveD"],infinite1=True,infinite2=True,)
|
|
||||||
print "b ",FreeCAD.Vector(point[0])
|
|
||||||
self.ptsPaneProject.append(FreeCAD.Vector(point[0]))
|
|
||||||
|
|
||||||
def backPignon(self, i):
|
|
||||||
import DraftGeomUtils
|
|
||||||
print("Back : pignon")
|
|
||||||
profilCurrent = self.findProfil(i)
|
|
||||||
profilBack1 = self.findProfil(i-1)
|
|
||||||
profilBack2 = self.findProfil(i-2)
|
|
||||||
pt1 = DraftGeomUtils.findIntersection(profilCurrent["edge"],profilBack1["eave"],infinite1=True,infinite2=True,)
|
|
||||||
pt2 = DraftGeomUtils.findIntersection(profilBack2["edge"],profilBack1["eave"],infinite1=True,infinite2=True,)
|
|
||||||
eaveWithoutOverhang = DraftGeomUtils.edg(pt1[0],pt2[0])
|
|
||||||
if profilCurrent["run"]+profilBack2["run"] != eaveWithoutOverhang.Length :
|
|
||||||
points = [FreeCAD.Vector(0.0,0.0,0.0),]
|
|
||||||
points.append(FreeCAD.Vector(profilCurrent["run"],profilCurrent["height"],0.0))
|
|
||||||
rampantCurrent = DraftGeomUtils.edg(points[0],points[1])
|
|
||||||
points = [FreeCAD.Vector(eaveWithoutOverhang.Length,0.0,0.0),]
|
|
||||||
points.append(FreeCAD.Vector(eaveWithoutOverhang.Length-profilBack2["run"],profilBack2["height"],0.0))
|
|
||||||
rampantBack2 = DraftGeomUtils.edg(points[0],points[1])
|
|
||||||
point = DraftGeomUtils.findIntersection(rampantCurrent,rampantBack2,infinite1=True,infinite2=True,)
|
|
||||||
ridgeCurrent = DraftGeomUtils.offset(profilCurrent["edge"],self.getPerpendicular(profilCurrent["vec"],profilCurrent["rot"],point[0].x))
|
|
||||||
point = DraftGeomUtils.findIntersection(ridgeCurrent,profilBack1["eave"],infinite1=True,infinite2=True,)
|
|
||||||
else:
|
|
||||||
point = DraftGeomUtils.findIntersection(profilCurrent["ridge"],profilBack1["eave"],infinite1=True,infinite2=True,)
|
|
||||||
print "a ", FreeCAD.Vector(point[0])
|
|
||||||
#print "b ", FreeCAD.Vector(profilCurrent["eave"].Vertexes[0].Point[0])
|
|
||||||
self.ptsPaneProject.append(FreeCAD.Vector(point[0]))
|
|
||||||
point = DraftGeomUtils.findIntersection(profilCurrent["eave"],profilBack1["eave"],infinite1=True,infinite2=True,)
|
|
||||||
print "b ",FreeCAD.Vector(point[0])
|
|
||||||
self.ptsPaneProject.append(FreeCAD.Vector(point[0]))
|
|
||||||
#self.ptsPaneProject.append(FreeCAD.Vector(profilCurrent["eave"].Vertexes[0].Point[0]))
|
|
||||||
|
|
||||||
def nextSameHeight(self, i):
|
|
||||||
import DraftGeomUtils
|
|
||||||
print("Next : ht1 = ht2")
|
|
||||||
profilCurrent = self.findProfil(i)
|
|
||||||
profilNext1 = self.findProfil(i+1)
|
|
||||||
ptInterRidges = DraftGeomUtils.findIntersection(profilCurrent["ridge"],profilNext1["ridge"],infinite1=True,infinite2=True,)
|
|
||||||
edgeHip = DraftGeomUtils.edg(FreeCAD.Vector(ptInterRidges[0]),profilCurrent["edge"].Vertexes[-1].Point)
|
|
||||||
ptInterHipEave = DraftGeomUtils.findIntersection(edgeHip,profilCurrent["eave"],infinite1=True,infinite2=False,)
|
|
||||||
if ptInterHipEave:
|
|
||||||
print "a ",FreeCAD.Vector(ptInterHipEave[0])
|
|
||||||
self.ptsPaneProject.append(FreeCAD.Vector(ptInterHipEave[0]))
|
|
||||||
else:
|
|
||||||
ptInterHipEave = DraftGeomUtils.findIntersection(edgeHip,profilNext1["eaveD"],infinite1=True,infinite2=True,)
|
|
||||||
print "b ",FreeCAD.Vector(profilCurrent["eave"].Vertexes[-1].Point)
|
|
||||||
print "c ",FreeCAD.Vector(ptInterHipEave[0])
|
|
||||||
self.ptsPaneProject.append(FreeCAD.Vector(profilCurrent["eave"].Vertexes[-1].Point))
|
|
||||||
self.ptsPaneProject.append(FreeCAD.Vector(ptInterHipEave[0]))
|
|
||||||
print "d ",FreeCAD.Vector(ptInterRidges[0])
|
|
||||||
self.ptsPaneProject.append(FreeCAD.Vector(ptInterRidges[0]))
|
|
||||||
|
|
||||||
def backSameHeight(self, i):
|
|
||||||
import DraftGeomUtils
|
|
||||||
print("Back : ht1 = ht0")
|
|
||||||
profilCurrent = self.findProfil(i)
|
|
||||||
profilBack1 = self.findProfil(i-1)
|
|
||||||
ptInterRidges = DraftGeomUtils.findIntersection(profilCurrent["ridge"],profilBack1["ridge"],infinite1=True,infinite2=True,)
|
|
||||||
print "a ",FreeCAD.Vector(ptInterRidges[0])
|
|
||||||
self.ptsPaneProject.append(FreeCAD.Vector(ptInterRidges[0]))
|
|
||||||
edgeHip = DraftGeomUtils.edg(FreeCAD.Vector(ptInterRidges[0]),profilCurrent["edge"].Vertexes[0].Point)
|
|
||||||
ptInterHipEave = DraftGeomUtils.findIntersection(edgeHip,profilCurrent["eave"],infinite1=True,infinite2=False,)
|
|
||||||
if ptInterHipEave:
|
|
||||||
print "b ",FreeCAD.Vector(ptInterHipEave[0])
|
|
||||||
self.ptsPaneProject.append(FreeCAD.Vector(ptInterHipEave[0]))
|
|
||||||
else:
|
|
||||||
ptInterHipEave = DraftGeomUtils.findIntersection(edgeHip,profilBack1["eaveD"],infinite1=True,infinite2=True,)
|
|
||||||
print "c ",FreeCAD.Vector(ptInterHipEave[0])
|
|
||||||
print "d ",FreeCAD.Vector(profilCurrent["eave"].Vertexes[0].Point)
|
|
||||||
self.ptsPaneProject.append(FreeCAD.Vector(ptInterHipEave[0]))
|
|
||||||
self.ptsPaneProject.append(FreeCAD.Vector(profilCurrent["eave"].Vertexes[0].Point))
|
|
||||||
|
|
||||||
def nextHigher(self, i):
|
|
||||||
import DraftGeomUtils
|
|
||||||
print("Next : ht2 > ht1")
|
|
||||||
profilCurrent = self.findProfil(i)
|
|
||||||
profilNext1 = self.findProfil(i+1)
|
|
||||||
dec = profilCurrent["height"]/math.tan(math.radians(profilNext1["angle"]))
|
|
||||||
edgeRidgeOnPane = DraftGeomUtils.offset(profilNext1["edge"],self.getPerpendicular(profilNext1["vec"],profilNext1["rot"],dec))
|
|
||||||
ptInter = DraftGeomUtils.findIntersection(profilCurrent["ridge"],edgeRidgeOnPane,infinite1=True,infinite2=True,)
|
|
||||||
edgeHip = DraftGeomUtils.edg(FreeCAD.Vector(ptInter[0]),profilCurrent["edge"].Vertexes[-1].Point)
|
|
||||||
ptInterHipEave = DraftGeomUtils.findIntersection(edgeHip,profilCurrent["eave"],infinite1=True,infinite2=False,)
|
|
||||||
if ptInterHipEave:
|
|
||||||
print "a ",FreeCAD.Vector(ptInterHipEave[0])
|
|
||||||
self.ptsPaneProject.append(FreeCAD.Vector(ptInterHipEave[0]))
|
|
||||||
else:
|
|
||||||
ptInterHipEave = DraftGeomUtils.findIntersection(edgeHip,profilNext1["eaveD"],infinite1=True,infinite2=True,)
|
|
||||||
print "b ",FreeCAD.Vector(profilCurrent["eave"].Vertexes[-1].Point[0])
|
|
||||||
print "c ",FreeCAD.Vector(ptInterHipEave[0])
|
|
||||||
self.ptsPaneProject.append(FreeCAD.Vector(profilCurrent["eave"].Vertexes[-1].Point[0]))
|
|
||||||
self.ptsPaneProject.append(FreeCAD.Vector(ptInterHipEave[0]))
|
|
||||||
print "d ",FreeCAD.Vector(ptInter[0])
|
|
||||||
self.ptsPaneProject.append(FreeCAD.Vector(ptInter[0]))
|
|
||||||
ptInterRidges = DraftGeomUtils.findIntersection(profilCurrent["ridge"],profilNext1["ridge"],infinite1=True,infinite2=True,)
|
|
||||||
print "e ",FreeCAD.Vector(ptInterRidges[0])
|
|
||||||
self.ptsPaneProject.append(FreeCAD.Vector(ptInterRidges[0]))
|
|
||||||
|
|
||||||
def backHigher(self, i):
|
|
||||||
import DraftGeomUtils
|
|
||||||
print("Back : ht1 < ht0")
|
|
||||||
profilCurrent = self.findProfil(i)
|
|
||||||
profilBack1 = self.findProfil(i-1)
|
|
||||||
dec = profilCurrent["height"]/math.tan(math.radians(profilBack1["angle"]))
|
|
||||||
edgeRidgeOnPane = DraftGeomUtils.offset(profilBack1["edge"],self.getPerpendicular(profilBack1["vec"],profilBack1["rot"],dec))
|
|
||||||
ptInterRidges = DraftGeomUtils.findIntersection(edgeRidgeOnPane,profilCurrent["ridge"],infinite1=True,infinite2=True,)
|
|
||||||
print "a ",FreeCAD.Vector(ptInterRidges[0])
|
|
||||||
self.ptsPaneProject.append(FreeCAD.Vector(ptInterRidges[0]))
|
|
||||||
edgeHip = DraftGeomUtils.edg(FreeCAD.Vector(ptInterRidges[0]),profilCurrent["edge"].Vertexes[0].Point)
|
|
||||||
ptInterHipEave = DraftGeomUtils.findIntersection(edgeHip,profilCurrent["eave"],infinite1=True,infinite2=False,)
|
|
||||||
if ptInterHipEave:
|
|
||||||
print "b ",FreeCAD.Vector(ptInterHipEave[0])
|
|
||||||
self.ptsPaneProject.append(FreeCAD.Vector(ptInterHipEave[0]))
|
|
||||||
else:
|
|
||||||
ptInterHipEave = DraftGeomUtils.findIntersection(edgeHip,profilBack1["eaveD"],infinite1=True,infinite2=True,)
|
|
||||||
print "c ",FreeCAD.Vector(ptInterHipEave[0])
|
|
||||||
print "d ",FreeCAD.Vector(profilCurrent["eave"].Vertexes[0].Point[0])
|
|
||||||
self.ptsPaneProject.append(FreeCAD.Vector(ptInterHipEave[0]))
|
|
||||||
self.ptsPaneProject.append(FreeCAD.Vector(profilCurrent["eave"].Vertexes[0].Point[0]))
|
|
||||||
|
|
||||||
|
|
||||||
def nextSmaller(self, i):
|
|
||||||
import DraftGeomUtils
|
|
||||||
print("Next : ht2 < ht1")
|
|
||||||
profilCurrent = self.findProfil(i)
|
|
||||||
profilNext1 = self.findProfil(i+1)
|
|
||||||
dec = profilNext1["height"]/math.tan(math.radians(profilCurrent["angle"]))
|
|
||||||
edgeRidgeOnPane = DraftGeomUtils.offset(profilCurrent["edge"],self.getPerpendicular(profilCurrent["vec"],profilCurrent["rot"],dec))
|
|
||||||
ptInter = DraftGeomUtils.findIntersection(profilNext1["ridge"],edgeRidgeOnPane,infinite1=True,infinite2=True,)
|
|
||||||
edgeHip = DraftGeomUtils.edg(FreeCAD.Vector(ptInter[0]),profilCurrent["edge"].Vertexes[-1].Point)
|
|
||||||
ptInterHipEave = DraftGeomUtils.findIntersection(edgeHip,profilCurrent["eave"],infinite1=True,infinite2=False,)
|
|
||||||
if ptInterHipEave:
|
|
||||||
print "a ",FreeCAD.Vector(ptInterHipEave[0])
|
|
||||||
self.ptsPaneProject.append(FreeCAD.Vector(ptInterHipEave[0]))
|
|
||||||
else:
|
|
||||||
ptInterHipEave = DraftGeomUtils.findIntersection(edgeHip,profilNext1["eaveD"],infinite1=True,infinite2=True,)
|
|
||||||
print "b ",FreeCAD.Vector(profilCurrent["eave"].Vertexes[-1].Point[0])
|
|
||||||
print "c ",FreeCAD.Vector(ptInterHipEave[0])
|
|
||||||
self.ptsPaneProject.append(FreeCAD.Vector(profilCurrent["eave"].Vertexes[-1].Point[0]))
|
|
||||||
self.ptsPaneProject.append(FreeCAD.Vector(ptInterHipEave[0]))
|
|
||||||
print "d ",FreeCAD.Vector(ptInter[0])
|
|
||||||
self.ptsPaneProject.append(FreeCAD.Vector(ptInter[0]))
|
|
||||||
ptInter = edgeHip.Vertexes[0].Point
|
|
||||||
vecInterRidges = DraftGeomUtils.findPerpendicular(ptInter, [profilCurrent["ridge"].Edges[0],], force=0)
|
|
||||||
ptInterRidges = ptInter.add(vecInterRidges[0])
|
|
||||||
print "e ",FreeCAD.Vector(ptInterRidges)
|
|
||||||
self.ptsPaneProject.append(FreeCAD.Vector(ptInterRidges))
|
|
||||||
|
|
||||||
def backSmaller(self, i):
|
|
||||||
import DraftGeomUtils
|
|
||||||
print("Back : ht0 < ht1")
|
|
||||||
profilCurrent = self.findProfil(i)
|
|
||||||
profilBack1 = self.findProfil(i-1)
|
|
||||||
dec = profilBack1["height"]/math.tan(math.radians(profilCurrent["angle"]))
|
|
||||||
edgeRidgeOnPane = DraftGeomUtils.offset(profilCurrent["edge"],self.getPerpendicular(profilCurrent["vec"],profilCurrent["rot"],dec))
|
|
||||||
ptInter1 = DraftGeomUtils.findIntersection(edgeRidgeOnPane,profilBack1["ridge"],infinite1=True,infinite2=True,)
|
|
||||||
edgeHip = DraftGeomUtils.edg(FreeCAD.Vector(ptInter1[0]),profilCurrent["edge"].Vertexes[0].Point)
|
|
||||||
ptInter2 = edgeHip.Vertexes[0].Point
|
|
||||||
vecInterRidges = DraftGeomUtils.findPerpendicular(ptInter2, [profilCurrent["ridge"].Edges[0],], force=0)
|
|
||||||
ptInterRidges = ptInter2.add(vecInterRidges[0])
|
|
||||||
print "a ",FreeCAD.Vector(ptInterRidges)
|
|
||||||
print "b ",FreeCAD.Vector(ptInter1[0])
|
|
||||||
self.ptsPaneProject.append(FreeCAD.Vector(ptInterRidges))
|
|
||||||
self.ptsPaneProject.append(FreeCAD.Vector(ptInter1[0]))
|
|
||||||
ptInterHipEave = DraftGeomUtils.findIntersection(edgeHip,profilCurrent["eave"],infinite1=True,infinite2=False,)
|
|
||||||
if ptInterHipEave:
|
|
||||||
print "c ",FreeCAD.Vector(ptInterHipEave[0])
|
|
||||||
self.ptsPaneProject.append(FreeCAD.Vector(ptInterHipEave[0]))
|
|
||||||
else:
|
|
||||||
ptInterHipEave = DraftGeomUtils.findIntersection(edgeHip,profilBack1["eaveD"],infinite1=True,infinite2=True,)
|
|
||||||
print "d ",FreeCAD.Vector(ptInterHipEave[0])
|
|
||||||
print "e ",FreeCAD.Vector(profilCurrent["eave"].Vertexes[0].Point[0])
|
|
||||||
self.ptsPaneProject.append(FreeCAD.Vector(ptInterHipEave[0]))
|
|
||||||
self.ptsPaneProject.append(FreeCAD.Vector(profilCurrent["eave"].Vertexes[0].Point[0]))
|
|
||||||
|
|
||||||
def getRoofPaneProject(self, i):
|
|
||||||
self.ptsPaneProject=[]
|
|
||||||
profilCurrent = self.findProfil(i)
|
|
||||||
profilBack1 = self.findProfil(i-1)
|
|
||||||
profilNext1 = self.findProfil(i+1)
|
|
||||||
|
|
||||||
print("PROFIL " + str(i) + " : Start calculs")
|
|
||||||
if profilCurrent["angle"] != 90.:
|
|
||||||
#print("profilNext1 angle : " + str(profilNext1["angle"]))
|
|
||||||
if profilNext1["angle"] == 90. :
|
|
||||||
self.nextPignon(i)
|
|
||||||
elif profilNext1["height"] == profilCurrent["height"] :
|
|
||||||
self.nextSameHeight(i)
|
|
||||||
elif profilNext1["height"] < profilCurrent["height"] :
|
|
||||||
self.nextSmaller(i)
|
|
||||||
elif profilNext1["height"] > profilCurrent["height"] :
|
|
||||||
self.nextHigher(i)
|
|
||||||
else:
|
|
||||||
print("Cas de figure non pris en charge")
|
|
||||||
if profilBack1["angle"] == 90. :
|
|
||||||
self.backPignon(i)
|
|
||||||
elif profilBack1["height"] == profilCurrent["height"] :
|
|
||||||
self.backSameHeight(i)
|
|
||||||
elif profilBack1["height"] < profilCurrent["height"] :
|
|
||||||
self.backSmaller(i)
|
|
||||||
elif profilBack1["height"] > profilCurrent["height"] :
|
|
||||||
self.backHigher(i)
|
|
||||||
else:
|
|
||||||
print("Cas de figure non pris en charge")
|
|
||||||
else:
|
|
||||||
self.ptsPaneProject=[]
|
|
||||||
|
|
||||||
self.ptsPaneProject = DraftVecUtils.removeDoubles(self.ptsPaneProject)
|
|
||||||
print("ptsPaneProject",self.ptsPaneProject)
|
|
||||||
profilCurrent["points"] = self.ptsPaneProject
|
|
||||||
print("PROFIL " + str(i) + " : End calculs")
|
|
||||||
|
|
||||||
def execute(self,obj):
|
def execute(self,obj):
|
||||||
|
|
||||||
|
@ -539,13 +542,11 @@ class _Roof(ArchComponent.Component):
|
||||||
|
|
||||||
base = None
|
base = None
|
||||||
if obj.Base:
|
if obj.Base:
|
||||||
if not obj.Angles:
|
|
||||||
if obj.Base.isDerivedFrom("Part::Feature"):
|
if obj.Base.isDerivedFrom("Part::Feature"):
|
||||||
|
w = None
|
||||||
if obj.Base.Shape.Solids:
|
if obj.Base.Shape.Solids:
|
||||||
base = obj.Base.Shape.copy()
|
base = obj.Base.Shape.copy()
|
||||||
else:
|
else:
|
||||||
w = None
|
|
||||||
if obj.Base.isDerivedFrom("Part::Feature"):
|
|
||||||
if (obj.Base.Shape.Faces and obj.Face):
|
if (obj.Base.Shape.Faces and obj.Face):
|
||||||
w = obj.Base.Shape.Faces[obj.Face-1].Wires[0]
|
w = obj.Base.Shape.Faces[obj.Face-1].Wires[0]
|
||||||
elif obj.Base.Shape.Wires:
|
elif obj.Base.Shape.Wires:
|
||||||
|
@ -558,7 +559,7 @@ class _Roof(ArchComponent.Component):
|
||||||
heights = []
|
heights = []
|
||||||
edges = Part.__sortEdges__(w.Edges)
|
edges = Part.__sortEdges__(w.Edges)
|
||||||
l = len(edges)
|
l = len(edges)
|
||||||
print("le contour contient "+str(l)+" aretes")
|
#print("le contour contient "+str(l)+" aretes")
|
||||||
for i in range(l):
|
for i in range(l):
|
||||||
self.makeRoofProfilsDic(i, obj.Angles[i], obj.Runs[i], obj.IdRel[i], obj.Overhang[i], obj.Thickness[i])
|
self.makeRoofProfilsDic(i, obj.Angles[i], obj.Runs[i], obj.IdRel[i], obj.Overhang[i], obj.Thickness[i])
|
||||||
for i in range(l):
|
for i in range(l):
|
||||||
|
@ -591,15 +592,16 @@ class _Roof(ArchComponent.Component):
|
||||||
overhangV = profilCurrent["overhang"]*math.tan(math.radians(profilCurrent["angle"]))
|
overhangV = profilCurrent["overhang"]*math.tan(math.radians(profilCurrent["angle"]))
|
||||||
if wire.isClosed():
|
if wire.isClosed():
|
||||||
f = Part.Face(wire)
|
f = Part.Face(wire)
|
||||||
#Part.show(f)
|
|
||||||
f = f.extrude(FreeCAD.Vector(0,0,profilCurrent["height"]+2*thicknessV+2*overhangV))
|
f = f.extrude(FreeCAD.Vector(0,0,profilCurrent["height"]+2*thicknessV+2*overhangV))
|
||||||
f.translate(FreeCAD.Vector(0.0,0.0,-2*overhangV))
|
f.translate(FreeCAD.Vector(0.0,0.0,-2*overhangV))
|
||||||
ptsPaneProfil=[FreeCAD.Vector(-profilCurrent["overhang"],-overhangV,0.0),FreeCAD.Vector(profilCurrent["run"],profilCurrent["height"],0.0),FreeCAD.Vector(profilCurrent["run"],profilCurrent["height"]+thicknessV,0.0),FreeCAD.Vector(-profilCurrent["overhang"],-overhangV+thicknessV,0.0)]
|
ptsPaneProfil=[FreeCAD.Vector(-profilCurrent["overhang"],-overhangV,0.0),FreeCAD.Vector(profilCurrent["run"],profilCurrent["height"],0.0),FreeCAD.Vector(profilCurrent["run"],profilCurrent["height"]+thicknessV,0.0),FreeCAD.Vector(-profilCurrent["overhang"],-overhangV+thicknessV,0.0)]
|
||||||
self.createProfilShape (ptsPaneProfil, midpoint, profilCurrent["rot"], profilCurrent["vec"], profilCurrent["run"], d, self.shps, f)
|
#self.createProfilShape(ptsPaneProfil, midpoint, profilCurrent["rot"], profilCurrent["vec"], profilCurrent["run"], d, self.shps, f)
|
||||||
|
self.shps.append(self.createProfilShape(ptsPaneProfil, midpoint, profilCurrent["rot"], profilCurrent["vec"], profilCurrent["run"], d, f))
|
||||||
## subVolume shape
|
## subVolume shape
|
||||||
ptsSubVolumeProfil=[FreeCAD.Vector(-profilCurrent["overhang"],-overhangV,0.0),FreeCAD.Vector(profilCurrent["run"],profilCurrent["height"],0.0),FreeCAD.Vector(profilCurrent["run"],profilCurrent["height"]+10000,0.0),FreeCAD.Vector(0.0,profilCurrent["height"]+10000,0.0)]
|
ptsSubVolumeProfil=[FreeCAD.Vector(-profilCurrent["overhang"],-overhangV,0.0),FreeCAD.Vector(profilCurrent["run"],profilCurrent["height"],0.0),FreeCAD.Vector(profilCurrent["run"],profilCurrent["height"]+900000.0,0.0),FreeCAD.Vector(-profilCurrent["overhang"],profilCurrent["height"]+900000.0,0.0)]
|
||||||
self.createProfilShape (ptsSubVolumeProfil, midpoint, profilCurrent["rot"], profilCurrent["vec"], profilCurrent["run"], d, self.subVolshps, f)
|
print("Arch Roof ptsSubVolumeProfil :", ptsSubVolumeProfil)
|
||||||
|
#self.createProfilShape(ptsSubVolumeProfil, midpoint, profilCurrent["rot"], profilCurrent["vec"], profilCurrent["run"], d, self.subVolshps, f)
|
||||||
|
self.subVolshps.append(self.createProfilShape(ptsSubVolumeProfil, midpoint, profilCurrent["rot"], profilCurrent["vec"], profilCurrent["run"], d, f))
|
||||||
## SubVolume
|
## SubVolume
|
||||||
self.sub = self.subVolshps.pop()
|
self.sub = self.subVolshps.pop()
|
||||||
for s in self.subVolshps:
|
for s in self.subVolshps:
|
||||||
|
@ -613,6 +615,8 @@ class _Roof(ArchComponent.Component):
|
||||||
if not base.isNull():
|
if not base.isNull():
|
||||||
if not DraftGeomUtils.isNull(pl):
|
if not DraftGeomUtils.isNull(pl):
|
||||||
base.Placement = pl
|
base.Placement = pl
|
||||||
|
else:
|
||||||
|
FreeCAD.Console.PrintMessage(translate("Arch","Unable to create a roof"))
|
||||||
base = self.processSubShapes(obj,base)
|
base = self.processSubShapes(obj,base)
|
||||||
if base:
|
if base:
|
||||||
if not base.isNull():
|
if not base.isNull():
|
||||||
|
@ -640,11 +644,18 @@ class _ViewProviderRoof(ArchComponent.ViewProviderComponent):
|
||||||
def attach(self,vobj):
|
def attach(self,vobj):
|
||||||
self.Object = vobj.Object
|
self.Object = vobj.Object
|
||||||
return
|
return
|
||||||
|
|
||||||
def unsetEdit(self,vobj,mode):
|
def unsetEdit(self,vobj,mode):
|
||||||
FreeCADGui.Control.closeDialog()
|
FreeCADGui.Control.closeDialog()
|
||||||
return
|
return
|
||||||
|
|
||||||
def setEdit(self,vobj,mode=0):
|
def setEdit(self,vobj,mode=0):
|
||||||
|
if vobj.Object.Base.Shape.Solids :
|
||||||
|
taskd = ArchComponent.ComponentTaskPanel()
|
||||||
|
taskd.obj = self.Object
|
||||||
|
taskd.update()
|
||||||
|
FreeCADGui.Control.showDialog(taskd)
|
||||||
|
else:
|
||||||
taskd = _RoofTaskPanel()
|
taskd = _RoofTaskPanel()
|
||||||
taskd.obj = self.Object
|
taskd.obj = self.Object
|
||||||
taskd.update()
|
taskd.update()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user