Ejemplo n.º 1
0
    def getRoofPaneProject(self, i):
        self.ptsPaneProject = []
        profilCurrent = self.findProfil(i)
        profilBack1 = self.findProfil(i - 1)
        profilNext1 = self.findProfil(i + 1)
        if profilCurrent["angle"] != 90.:
            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)
        profilCurrent["points"] = self.ptsPaneProject
Ejemplo n.º 2
0
    def getRoofPaneProject(self, i):
        self.ptsPaneProject=[]
        profilCurrent = self.findProfil(i)
        profilBack1 = self.findProfil(i-1)
        profilNext1 = self.findProfil(i+1)
        if profilCurrent["angle"] != 90.:
            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)
        profilCurrent["points"] = self.ptsPaneProject
Ejemplo n.º 3
0
def face_from_points(ptLst):
    ptLst.append(ptLst[0])
    # Use DraftVecUtils.removeDouble after append as it does not compare the first and last vector:
    ptLst = DraftVecUtils.removeDoubles(ptLst)
    ln = len(ptLst)
    if ln < 4:  # at least 4 points are required for 3 edges
        return None
    edgeLst = []
    for i in range(ln - 1):
        edge = Part.makeLine(ptLst[i], ptLst[i + 1])
        edgeLst.append(edge)
    wire = Part.Wire(edgeLst)
    return Part.Face(wire)
Ejemplo n.º 4
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")
Ejemplo n.º 5
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")
Ejemplo n.º 6
0
    def execute(self, obj):
        import Part, math, DraftGeomUtils
        pl = obj.Placement
        self.baseface = None

        base = None
        if obj.Base and obj.Angles:
            w = None
            if obj.Base.isDerivedFrom("Part::Feature"):
                if (obj.Base.Shape.Faces and obj.Face):
                    w = obj.Base.Shape.Faces[obj.Face - 1].Wires[0]
                elif obj.Base.Shape.Wires:
                    w = obj.Base.Shape.Wires[0]
            if w:
                if w.isClosed():
                    self.profilsDico = []
                    self.shps = []
                    self.subVolshps = []
                    heights = []
                    edges = DraftGeomUtils.sortEdges(w.Edges)
                    l = len(edges)
                    print("le contour contient " + str(l) + " aretes")
                    for i in range(l):
                        self.makeRoofProfilsDic(i, obj.Angles[i], obj.Runs[i],
                                                obj.IdRel[i], obj.Overhang[i],
                                                obj.Thickness[i])
                    for i in range(l):
                        self.calcMissingData(i)
                    for p in self.profilsDico:
                        heights.append(p["height"])
                    obj.Heights = heights
                    for i in range(l):
                        edgesForward = edges[:]
                        edgesForward.append(edges[0])
                        ptsPaneProject = []
                        profil0 = self.profilsDico[i - 1]
                        profil1 = self.profilsDico[i]
                        if i == l - 1:
                            profil2 = self.profilsDico[0]
                        else:
                            profil2 = self.profilsDico[i + 1]
                        vec0 = edges[i - 1].Vertexes[-1].Point.sub(
                            edges[i - 1].Vertexes[0].Point)
                        vec1 = edges[i].Vertexes[-1].Point.sub(
                            edges[i].Vertexes[0].Point)
                        vec2 = edgesForward[i + 1].Vertexes[-1].Point.sub(
                            edgesForward[i + 1].Vertexes[0].Point)
                        rotEdge0 = math.degrees(DraftVecUtils.angle(vec0))
                        rotEdge1 = math.degrees(DraftVecUtils.angle(vec1))
                        rotEdge2 = math.degrees(DraftVecUtils.angle(vec2))
                        edgeEave0 = DraftGeomUtils.offset(
                            edges[i - 1],
                            self.getPerpendicular(
                                vec0, rotEdge0,
                                profil0["overhang"]).negative())
                        edgeEave1 = DraftGeomUtils.offset(
                            edges[i],
                            self.getPerpendicular(
                                vec1, rotEdge1,
                                profil1["overhang"]).negative())
                        edgeEave2 = DraftGeomUtils.offset(
                            edgesForward[i + 1],
                            self.getPerpendicular(
                                vec2, rotEdge2,
                                profil2["overhang"]).negative())
                        pt0Eave1 = DraftGeomUtils.findIntersection(
                            edgeEave0,
                            edgeEave1,
                            infinite1=True,
                            infinite2=True,
                        )
                        pt1Eave1 = DraftGeomUtils.findIntersection(
                            edgeEave1,
                            edgeEave2,
                            infinite1=True,
                            infinite2=True,
                        )
                        edgeEave1 = DraftGeomUtils.edg(
                            FreeCAD.Vector(pt0Eave1[0]),
                            FreeCAD.Vector(pt1Eave1[0]))
                        edgeRidge0 = DraftGeomUtils.offset(
                            edges[i - 1],
                            self.getPerpendicular(vec0, rotEdge0,
                                                  profil0["run"]))
                        edgeRidge1 = DraftGeomUtils.offset(
                            edges[i],
                            self.getPerpendicular(vec1, rotEdge1,
                                                  profil1["run"]))
                        edgeRidge2 = DraftGeomUtils.offset(
                            edgesForward[i + 1],
                            self.getPerpendicular(vec2, rotEdge2,
                                                  profil2["run"]))
                        midpoint = DraftGeomUtils.findMidpoint(edges[i])
                        pt0Edge1 = edges[i].Vertexes[0].Point
                        pt1Edge1 = edges[i].Vertexes[-1].Point
                        print("Analyse profil " + str(i))
                        if profil1["angle"] != 90.:
                            if profil2["angle"] == 90.:
                                print("situation a droite : pignon")
                                ptsPaneProject.append(
                                    FreeCAD.Vector(pt1Eave1[0]))
                                point = DraftGeomUtils.findIntersection(
                                    edgeRidge1,
                                    edgeEave2,
                                    infinite1=True,
                                    infinite2=True,
                                )
                                ptsPaneProject.append(FreeCAD.Vector(point[0]))
                            elif profil1["height"] == profil2["height"]:
                                print("situation a droite : ht1 = ht2")
                                ptInterRidges = DraftGeomUtils.findIntersection(
                                    edgeRidge1,
                                    edgeRidge2,
                                    infinite1=True,
                                    infinite2=True,
                                )
                                edgeHip = DraftGeomUtils.edg(
                                    FreeCAD.Vector(ptInterRidges[0]), pt1Edge1)
                                ptInterHipEave1 = DraftGeomUtils.findIntersection(
                                    edgeHip,
                                    edgeEave1,
                                    infinite1=True,
                                    infinite2=False,
                                )
                                if ptInterHipEave1:
                                    ptsPaneProject.append(
                                        FreeCAD.Vector(ptInterHipEave1[0]))
                                else:
                                    ptInterHipEave2 = DraftGeomUtils.findIntersection(
                                        edgeHip,
                                        edgeEave2,
                                        infinite1=True,
                                        infinite2=True,
                                    )
                                    ptsPaneProject.append(
                                        FreeCAD.Vector(pt1Eave1[0]))
                                    ptsPaneProject.append(
                                        FreeCAD.Vector(ptInterHipEave2[0]))
                                ptsPaneProject.append(
                                    FreeCAD.Vector(ptInterRidges[0]))
                            elif profil1["height"] > profil2["height"]:
                                print("situation a droite : ht1 > ht2")
                                dec = profil2["height"] / math.tan(
                                    math.radians(profil1["angle"]))
                                edgeRidge2OnPane = DraftGeomUtils.offset(
                                    edges[i],
                                    self.getPerpendicular(vec1, rotEdge1, dec))
                                ptInter1 = DraftGeomUtils.findIntersection(
                                    edgeRidge2,
                                    edgeRidge2OnPane,
                                    infinite1=True,
                                    infinite2=True,
                                )
                                edgeHip = DraftGeomUtils.edg(
                                    FreeCAD.Vector(ptInter1[0]), pt1Edge1)
                                ptInterHipEave1 = DraftGeomUtils.findIntersection(
                                    edgeHip,
                                    edgeEave1,
                                    infinite1=True,
                                    infinite2=False,
                                )
                                if ptInterHipEave1:
                                    ptsPaneProject.append(
                                        FreeCAD.Vector(ptInterHipEave1[0]))
                                else:
                                    ptInterHipEave2 = DraftGeomUtils.findIntersection(
                                        edgeHip,
                                        edgeEave2,
                                        infinite1=True,
                                        infinite2=True,
                                    )
                                    ptsPaneProject.append(
                                        FreeCAD.Vector(pt1Eave1[0]))
                                    ptsPaneProject.append(
                                        FreeCAD.Vector(ptInterHipEave2[0]))
                                ptsPaneProject.append(
                                    FreeCAD.Vector(ptInter1[0]))
                                ptInter2 = edgeHip.Vertexes[0].Point
                                vecInterRidges = DraftGeomUtils.findPerpendicular(
                                    ptInter2, [
                                        edgeRidge1.Edges[0],
                                    ], force=0)
                                ptInterRidges = ptInter2.add(vecInterRidges[0])
                                ptsPaneProject.append(
                                    FreeCAD.Vector(ptInterRidges))
                            elif profil1["height"] < profil2["height"]:
                                print("situation a droite : ht1 < ht2")
                                dec = profil1["height"] / math.tan(
                                    math.radians(profil2["angle"]))
                                edgeRidge2OnPane = DraftGeomUtils.offset(
                                    edgesForward[i + 1],
                                    self.getPerpendicular(vec2, rotEdge2, dec))
                                ptInter1 = DraftGeomUtils.findIntersection(
                                    edgeRidge1,
                                    edgeRidge2OnPane,
                                    infinite1=True,
                                    infinite2=True,
                                )
                                edgeHip = DraftGeomUtils.edg(
                                    FreeCAD.Vector(ptInter1[0]), pt1Edge1)
                                ptInterHipEave1 = DraftGeomUtils.findIntersection(
                                    edgeHip,
                                    edgeEave1,
                                    infinite1=True,
                                    infinite2=False,
                                )
                                if ptInterHipEave1:
                                    ptsPaneProject.append(
                                        FreeCAD.Vector(ptInterHipEave1[0]))
                                else:
                                    ptInterHipEave2 = DraftGeomUtils.findIntersection(
                                        edgeHip,
                                        edgeEave2,
                                        infinite1=True,
                                        infinite2=True,
                                    )
                                    ptsPaneProject.append(
                                        FreeCAD.Vector(pt1Eave1[0]))
                                    ptsPaneProject.append(
                                        FreeCAD.Vector(ptInterHipEave2[0]))
                                ptsPaneProject.append(
                                    FreeCAD.Vector(ptInter1[0]))
                                ptInterRidges = DraftGeomUtils.findIntersection(
                                    edgeRidge1,
                                    edgeRidge2,
                                    infinite1=True,
                                    infinite2=True,
                                )
                                ptsPaneProject.append(
                                    FreeCAD.Vector(ptInterRidges[0]))
                            else:
                                print("Cas de figure non pris en charge")
                            if profil0["angle"] == 90.:
                                print("situation a gauche : pignon")
                                point = DraftGeomUtils.findIntersection(
                                    edgeRidge1,
                                    edgeEave0,
                                    infinite1=True,
                                    infinite2=True,
                                )
                                ptsPaneProject.append(FreeCAD.Vector(point[0]))
                                ptsPaneProject.append(
                                    FreeCAD.Vector(pt0Eave1[0]))
                            elif profil0["height"] == profil1["height"]:
                                print("situation a gauche : ht1 = ht0")
                                edgeRidge0 = DraftGeomUtils.offset(
                                    edges[i - 1],
                                    self.getPerpendicular(
                                        vec0, rotEdge0, profil0["run"]))
                                ptInterRidges = DraftGeomUtils.findIntersection(
                                    edgeRidge1,
                                    edgeRidge0,
                                    infinite1=True,
                                    infinite2=True,
                                )
                                ptsPaneProject.append(
                                    FreeCAD.Vector(ptInterRidges[0]))
                                edgeHip = DraftGeomUtils.edg(
                                    FreeCAD.Vector(ptInterRidges[0]), pt0Edge1)
                                ptInterHipEave3 = DraftGeomUtils.findIntersection(
                                    edgeHip,
                                    edgeEave1,
                                    infinite1=True,
                                    infinite2=False,
                                )
                                if ptInterHipEave3:
                                    ptsPaneProject.append(
                                        FreeCAD.Vector(ptInterHipEave3[0]))
                                else:
                                    ptInterHipEave4 = DraftGeomUtils.findIntersection(
                                        edgeHip,
                                        edgeEave0,
                                        infinite1=True,
                                        infinite2=True,
                                    )
                                    ptsPaneProject.append(
                                        FreeCAD.Vector(ptInterHipEave4[0]))
                                    ptsPaneProject.append(
                                        FreeCAD.Vector(pt0Eave1[0]))
                            elif profil1["height"] > profil0["height"]:
                                print("situation a gauche : ht1 > ht0")
                                dec = profil0["height"] / math.tan(
                                    math.radians(profil1["angle"]))
                                edgeRidge0OnPane = DraftGeomUtils.offset(
                                    edges[i],
                                    self.getPerpendicular(vec1, rotEdge1, dec))
                                ptInter1 = DraftGeomUtils.findIntersection(
                                    edgeRidge0OnPane,
                                    edgeRidge0,
                                    infinite1=True,
                                    infinite2=True,
                                )
                                edgeHip = DraftGeomUtils.edg(
                                    FreeCAD.Vector(ptInter1[0]), pt0Edge1)
                                ptInter2 = edgeHip.Vertexes[0].Point
                                vecInterRidges = DraftGeomUtils.findPerpendicular(
                                    ptInter2, [
                                        edgeRidge1.Edges[0],
                                    ], force=0)
                                ptInterRidges = ptInter2.add(vecInterRidges[0])
                                ptsPaneProject.append(
                                    FreeCAD.Vector(ptInterRidges))
                                ptsPaneProject.append(
                                    FreeCAD.Vector(ptInter1[0]))
                                ptInterHipEave3 = DraftGeomUtils.findIntersection(
                                    edgeHip,
                                    edgeEave1,
                                    infinite1=True,
                                    infinite2=False,
                                )
                                if ptInterHipEave3:
                                    ptsPaneProject.append(
                                        FreeCAD.Vector(ptInterHipEave3[0]))
                                else:
                                    ptInterHipEave4 = DraftGeomUtils.findIntersection(
                                        edgeHip,
                                        edgeEave0,
                                        infinite1=True,
                                        infinite2=True,
                                    )
                                    ptsPaneProject.append(
                                        FreeCAD.Vector(ptInterHipEave4[0]))
                                    ptsPaneProject.append(
                                        FreeCAD.Vector(pt0Eave1[0]))
                            elif profil1["height"] < profil0["height"]:
                                print("situation a gauche : ht1 < ht0")
                                dec = profil1["height"] / math.tan(
                                    math.radians(profil0["angle"]))
                                edgeRidge0OnPane = DraftGeomUtils.offset(
                                    edges[i - 1],
                                    self.getPerpendicular(vec0, rotEdge0, dec))
                                ptInterRidges = DraftGeomUtils.findIntersection(
                                    edgeRidge0OnPane,
                                    edgeRidge1,
                                    infinite1=True,
                                    infinite2=True,
                                )
                                ptsPaneProject.append(
                                    FreeCAD.Vector(ptInterRidges[0]))
                                edgeHip = DraftGeomUtils.edg(
                                    FreeCAD.Vector(ptInterRidges[0]), pt0Edge1)
                                ptInterHipEave3 = DraftGeomUtils.findIntersection(
                                    edgeHip,
                                    edgeEave1,
                                    infinite1=True,
                                    infinite2=False,
                                )
                                if ptInterHipEave3:
                                    ptsPaneProject.append(
                                        FreeCAD.Vector(ptInterHipEave3[0]))
                                else:
                                    ptInterHipEave4 = DraftGeomUtils.findIntersection(
                                        edgeHip,
                                        edgeEave0,
                                        infinite1=True,
                                        infinite2=True,
                                    )
                                    ptsPaneProject.append(
                                        FreeCAD.Vector(ptInterHipEave4[0]))
                                    ptsPaneProject.append(
                                        FreeCAD.Vector(pt0Eave1[0]))
                            else:
                                print("Cas de figure non pris en charge")
                            ptsPaneProject = DraftVecUtils.removeDoubles(
                                ptsPaneProject)
                            print("ptsPaneProject", ptsPaneProject)
                            print("Fin Analyse profil " + str(i))
                            self.profilsDico[i]["points"] = ptsPaneProject
                            lp = len(ptsPaneProject)
                            ptsPaneProject.append(ptsPaneProject[0])
                            edgesWire = []
                            for i in range(lp):
                                edge = Part.makeLine(ptsPaneProject[i],
                                                     ptsPaneProject[i + 1])
                                edgesWire.append(edge)
                            wire = Part.Wire(edgesWire)
                            d = wire.BoundBox.DiagonalLength
                            thicknessV = profil1["thickness"] / (math.cos(
                                math.radians(profil1["angle"])))
                            overhangV = profil1["overhang"] * math.tan(
                                math.radians(profil1["angle"]))
                            if wire.isClosed():
                                f = Part.Face(wire)
                                f = f.extrude(
                                    FreeCAD.Vector(
                                        0, 0, profil1["height"] +
                                        2 * thicknessV + 2 * overhangV))
                                f.translate(
                                    FreeCAD.Vector(0.0, 0.0, -2 * overhangV))
                            ptsPaneProfil = [
                                FreeCAD.Vector(-profil1["overhang"],
                                               -overhangV, 0.0),
                                FreeCAD.Vector(profil1["run"],
                                               profil1["height"], 0.0),
                                FreeCAD.Vector(profil1["run"],
                                               profil1["height"] + thicknessV,
                                               0.0),
                                FreeCAD.Vector(-profil1["overhang"],
                                               -overhangV + thicknessV, 0.0)
                            ]
                            self.createProfilShape(ptsPaneProfil, midpoint,
                                                   rotEdge1, vec1,
                                                   profil1["run"], d,
                                                   self.shps, f)
                            ## subVolume shape
                            ptsSubVolumeProfil = [
                                FreeCAD.Vector(-profil1["overhang"],
                                               -overhangV, 0.0),
                                FreeCAD.Vector(profil1["run"],
                                               profil1["height"], 0.0),
                                FreeCAD.Vector(profil1["run"],
                                               profil1["height"] + 10000, 0.0),
                                FreeCAD.Vector(0.0, profil1["height"] + 10000,
                                               0.0)
                            ]
                            self.createProfilShape(ptsSubVolumeProfil,
                                                   midpoint, rotEdge1, vec1,
                                                   profil1["run"], d,
                                                   self.subVolshps, f)
                        else:
                            #TODO PIGNON
                            pass

                    ## SubVolume
                    self.sub = self.subVolshps.pop()
                    for s in self.subVolshps:
                        self.sub = self.sub.fuse(s)
                    self.sub = self.sub.removeSplitter()
                    if not self.sub.isNull():
                        if not DraftGeomUtils.isNull(pl):
                            self.sub.Placement = pl
                    ## BaseVolume
                    base = Part.makeCompound(self.shps)
                    if not base.isNull():
                        if not DraftGeomUtils.isNull(pl):
                            base.Placement = pl
        base = self.processSubShapes(obj, base)
        if base:
            if not base.isNull():
                obj.Shape = base
Ejemplo n.º 7
0
    def execute(self,obj):
        import Part, math, DraftGeomUtils
        pl = obj.Placement
        self.baseface = None

        base = None
        if obj.Base and obj.Angles:
            w = None
            if obj.Base.isDerivedFrom("Part::Feature"):
                if (obj.Base.Shape.Faces and obj.Face):
                    w = obj.Base.Shape.Faces[obj.Face-1].Wires[0]
                elif obj.Base.Shape.Wires:
                    w = obj.Base.Shape.Wires[0]
            if w:
                if w.isClosed():
                    self.profilsDico = []
                    self.shps = []
                    self.subVolshps = []
                    heights = []
                    edges = DraftGeomUtils.sortEdges(w.Edges)
                    l = len(edges)
                    print("le contour contient "+str(l)+" aretes")
                    for i in range(l):
                        self.makeRoofProfilsDic(i, obj.Angles[i], obj.Runs[i], obj.IdRel[i], obj.Overhang[i], obj.Thickness[i])
                    for i in range(l):
                        self.calcMissingData(i)
                    for p in self.profilsDico:
                        heights.append(p["height"])
                    obj.Heights = heights
                    for i in range(l):
                        edgesForward = edges[:]
                        edgesForward.append(edges[0])
                        ptsPaneProject=[]
                        profil0 =self.profilsDico[i-1]
                        profil1 =self.profilsDico[i]
                        if i == l-1:
                            profil2 =self.profilsDico[0]
                        else:
                            profil2 =self.profilsDico[i+1]
                        vec0 = edges[i-1].Vertexes[-1].Point.sub(edges[i-1].Vertexes[0].Point)
                        vec1 = edges[i].Vertexes[-1].Point.sub(edges[i].Vertexes[0].Point)
                        vec2 = edgesForward[i+1].Vertexes[-1].Point.sub(edgesForward[i+1].Vertexes[0].Point)
                        rotEdge0 = math.degrees(DraftVecUtils.angle(vec0))
                        rotEdge1 = math.degrees(DraftVecUtils.angle(vec1))
                        rotEdge2 = math.degrees(DraftVecUtils.angle(vec2))
                        edgeEave0 = DraftGeomUtils.offset(edges[i-1],self.getPerpendicular(vec0,rotEdge0,profil0["overhang"]).negative())
                        edgeEave1 = DraftGeomUtils.offset(edges[i],self.getPerpendicular(vec1,rotEdge1,profil1["overhang"]).negative())
                        edgeEave2 = DraftGeomUtils.offset(edgesForward[i+1],self.getPerpendicular(vec2,rotEdge2,profil2["overhang"]).negative())
                        pt0Eave1 = DraftGeomUtils.findIntersection(edgeEave0,edgeEave1,infinite1=True,infinite2=True,)
                        pt1Eave1 = DraftGeomUtils.findIntersection(edgeEave1,edgeEave2,infinite1=True,infinite2=True,)
                        edgeEave1 = DraftGeomUtils.edg(FreeCAD.Vector(pt0Eave1[0]),FreeCAD.Vector(pt1Eave1[0]))
                        edgeRidge0 = DraftGeomUtils.offset(edges[i-1],self.getPerpendicular(vec0,rotEdge0,profil0["run"]))
                        edgeRidge1 = DraftGeomUtils.offset(edges[i],self.getPerpendicular(vec1,rotEdge1,profil1["run"]))
                        edgeRidge2 = DraftGeomUtils.offset(edgesForward[i+1],self.getPerpendicular(vec2,rotEdge2,profil2["run"]))
                        midpoint = DraftGeomUtils.findMidpoint(edges[i])
                        pt0Edge1 = edges[i].Vertexes[0].Point
                        pt1Edge1 = edges[i].Vertexes[-1].Point
                        print("Analyse profil " + str(i))
                        if profil1["angle"] != 90.:
                            if profil2["angle"] == 90. :
                                print("situation a droite : pignon")
                                ptsPaneProject.append(FreeCAD.Vector(pt1Eave1[0]))
                                point = DraftGeomUtils.findIntersection(edgeRidge1,edgeEave2,infinite1=True,infinite2=True,)
                                ptsPaneProject.append(FreeCAD.Vector(point[0]))
                            elif profil1["height"] == profil2["height"] :
                                print("situation a droite : ht1 = ht2")
                                ptInterRidges = DraftGeomUtils.findIntersection(edgeRidge1,edgeRidge2,infinite1=True,infinite2=True,)
                                edgeHip = DraftGeomUtils.edg(FreeCAD.Vector(ptInterRidges[0]),pt1Edge1)
                                ptInterHipEave1 = DraftGeomUtils.findIntersection(edgeHip,edgeEave1,infinite1=True,infinite2=False,)
                                if ptInterHipEave1:
                                    ptsPaneProject.append(FreeCAD.Vector(ptInterHipEave1[0]))
                                else:
                                    ptInterHipEave2 = DraftGeomUtils.findIntersection(edgeHip,edgeEave2,infinite1=True,infinite2=True,)
                                    ptsPaneProject.append(FreeCAD.Vector(pt1Eave1[0]))
                                    ptsPaneProject.append(FreeCAD.Vector(ptInterHipEave2[0]))
                                ptsPaneProject.append(FreeCAD.Vector(ptInterRidges[0]))
                            elif profil1["height"] > profil2["height"]:
                                print("situation a droite : ht1 > ht2")
                                dec = profil2["height"]/math.tan(math.radians(profil1["angle"]))
                                edgeRidge2OnPane = DraftGeomUtils.offset(edges[i],self.getPerpendicular(vec1,rotEdge1,dec))
                                ptInter1 = DraftGeomUtils.findIntersection(edgeRidge2,edgeRidge2OnPane,infinite1=True,infinite2=True,)
                                edgeHip = DraftGeomUtils.edg(FreeCAD.Vector(ptInter1[0]),pt1Edge1)
                                ptInterHipEave1 = DraftGeomUtils.findIntersection(edgeHip,edgeEave1,infinite1=True,infinite2=False,)
                                if ptInterHipEave1:
                                    ptsPaneProject.append(FreeCAD.Vector(ptInterHipEave1[0]))
                                else:
                                    ptInterHipEave2 = DraftGeomUtils.findIntersection(edgeHip,edgeEave2,infinite1=True,infinite2=True,)
                                    ptsPaneProject.append(FreeCAD.Vector(pt1Eave1[0]))
                                    ptsPaneProject.append(FreeCAD.Vector(ptInterHipEave2[0]))
                                ptsPaneProject.append(FreeCAD.Vector(ptInter1[0]))
                                ptInter2 = edgeHip.Vertexes[0].Point
                                vecInterRidges = DraftGeomUtils.findPerpendicular(ptInter2, [edgeRidge1.Edges[0],], force=0)
                                ptInterRidges = ptInter2.add(vecInterRidges[0])
                                ptsPaneProject.append(FreeCAD.Vector(ptInterRidges))
                            elif profil1["height"] < profil2["height"]:
                                print("situation a droite : ht1 < ht2")
                                dec = profil1["height"]/math.tan(math.radians(profil2["angle"]))
                                edgeRidge2OnPane = DraftGeomUtils.offset(edgesForward[i+1],self.getPerpendicular(vec2,rotEdge2,dec))
                                ptInter1 = DraftGeomUtils.findIntersection(edgeRidge1,edgeRidge2OnPane,infinite1=True,infinite2=True,)
                                edgeHip = DraftGeomUtils.edg(FreeCAD.Vector(ptInter1[0]),pt1Edge1)
                                ptInterHipEave1 = DraftGeomUtils.findIntersection(edgeHip,edgeEave1,infinite1=True,infinite2=False,)
                                if ptInterHipEave1:
                                    ptsPaneProject.append(FreeCAD.Vector(ptInterHipEave1[0]))
                                else:
                                    ptInterHipEave2 = DraftGeomUtils.findIntersection(edgeHip,edgeEave2,infinite1=True,infinite2=True,)
                                    ptsPaneProject.append(FreeCAD.Vector(pt1Eave1[0]))
                                    ptsPaneProject.append(FreeCAD.Vector(ptInterHipEave2[0]))
                                ptsPaneProject.append(FreeCAD.Vector(ptInter1[0]))
                                ptInterRidges = DraftGeomUtils.findIntersection(edgeRidge1,edgeRidge2,infinite1=True,infinite2=True,)
                                ptsPaneProject.append(FreeCAD.Vector(ptInterRidges[0]))
                            else:
                                print("Cas de figure non pris en charge")
                            if profil0["angle"] == 90. :
                                print("situation a gauche : pignon")
                                point = DraftGeomUtils.findIntersection(edgeRidge1,edgeEave0,infinite1=True,infinite2=True,)
                                ptsPaneProject.append(FreeCAD.Vector(point[0]))
                                ptsPaneProject.append(FreeCAD.Vector(pt0Eave1[0]))
                            elif profil0["height"] == profil1["height"]:
                                print("situation a gauche : ht1 = ht0")
                                edgeRidge0 = DraftGeomUtils.offset(edges[i-1],self.getPerpendicular(vec0,rotEdge0,profil0["run"]))
                                ptInterRidges = DraftGeomUtils.findIntersection(edgeRidge1,edgeRidge0,infinite1=True,infinite2=True,)
                                ptsPaneProject.append(FreeCAD.Vector(ptInterRidges[0]))
                                edgeHip = DraftGeomUtils.edg(FreeCAD.Vector(ptInterRidges[0]),pt0Edge1)
                                ptInterHipEave3 = DraftGeomUtils.findIntersection(edgeHip,edgeEave1,infinite1=True,infinite2=False,)
                                if ptInterHipEave3:
                                    ptsPaneProject.append(FreeCAD.Vector(ptInterHipEave3[0]))
                                else:
                                    ptInterHipEave4 = DraftGeomUtils.findIntersection(edgeHip,edgeEave0,infinite1=True,infinite2=True,)
                                    ptsPaneProject.append(FreeCAD.Vector(ptInterHipEave4[0]))
                                    ptsPaneProject.append(FreeCAD.Vector(pt0Eave1[0]))
                            elif profil1["height"] > profil0["height"]:
                                print("situation a gauche : ht1 > ht0")
                                dec = profil0["height"]/math.tan(math.radians(profil1["angle"]))
                                edgeRidge0OnPane = DraftGeomUtils.offset(edges[i],self.getPerpendicular(vec1,rotEdge1,dec))
                                ptInter1 = DraftGeomUtils.findIntersection(edgeRidge0OnPane,edgeRidge0,infinite1=True,infinite2=True,)
                                edgeHip = DraftGeomUtils.edg(FreeCAD.Vector(ptInter1[0]),pt0Edge1)
                                ptInter2 = edgeHip.Vertexes[0].Point
                                vecInterRidges = DraftGeomUtils.findPerpendicular(ptInter2, [edgeRidge1.Edges[0],], force=0)
                                ptInterRidges = ptInter2.add(vecInterRidges[0])
                                ptsPaneProject.append(FreeCAD.Vector(ptInterRidges))
                                ptsPaneProject.append(FreeCAD.Vector(ptInter1[0]))
                                ptInterHipEave3 = DraftGeomUtils.findIntersection(edgeHip,edgeEave1,infinite1=True,infinite2=False,)
                                if ptInterHipEave3:
                                    ptsPaneProject.append(FreeCAD.Vector(ptInterHipEave3[0]))
                                else:
                                    ptInterHipEave4 = DraftGeomUtils.findIntersection(edgeHip,edgeEave0,infinite1=True,infinite2=True,)
                                    ptsPaneProject.append(FreeCAD.Vector(ptInterHipEave4[0]))
                                    ptsPaneProject.append(FreeCAD.Vector(pt0Eave1[0]))
                            elif profil1["height"] < profil0["height"]:
                                print("situation a gauche : ht1 < ht0")
                                dec = profil1["height"]/math.tan(math.radians(profil0["angle"]))
                                edgeRidge0OnPane = DraftGeomUtils.offset(edges[i-1],self.getPerpendicular(vec0,rotEdge0,dec))
                                ptInterRidges = DraftGeomUtils.findIntersection(edgeRidge0OnPane,edgeRidge1,infinite1=True,infinite2=True,)
                                ptsPaneProject.append(FreeCAD.Vector(ptInterRidges[0]))
                                edgeHip = DraftGeomUtils.edg(FreeCAD.Vector(ptInterRidges[0]),pt0Edge1)
                                ptInterHipEave3 = DraftGeomUtils.findIntersection(edgeHip,edgeEave1,infinite1=True,infinite2=False,)
                                if ptInterHipEave3:
                                    ptsPaneProject.append(FreeCAD.Vector(ptInterHipEave3[0]))
                                else:
                                    ptInterHipEave4 = DraftGeomUtils.findIntersection(edgeHip,edgeEave0,infinite1=True,infinite2=True,)
                                    ptsPaneProject.append(FreeCAD.Vector(ptInterHipEave4[0]))
                                    ptsPaneProject.append(FreeCAD.Vector(pt0Eave1[0]))
                            else:
                                print("Cas de figure non pris en charge")
                            ptsPaneProject = DraftVecUtils.removeDoubles(ptsPaneProject)
                            print("ptsPaneProject",ptsPaneProject)
                            print("Fin Analyse profil " + str(i))
                            self.profilsDico[i]["points"] = ptsPaneProject
                            lp = len(ptsPaneProject)
                            ptsPaneProject.append(ptsPaneProject[0])
                            edgesWire = []
                            for i in range(lp):
                                edge = Part.makeLine(ptsPaneProject[i],ptsPaneProject[i+1])
                                edgesWire.append(edge)
                            wire = Part.Wire(edgesWire)
                            d = wire.BoundBox.DiagonalLength
                            thicknessV = profil1["thickness"]/(math.cos(math.radians(profil1["angle"])))
                            overhangV = profil1["overhang"]*math.tan(math.radians(profil1["angle"]))
                            if wire.isClosed():
                                f = Part.Face(wire)
                                f = f.extrude(FreeCAD.Vector(0,0,profil1["height"]+2*thicknessV+2*overhangV))
                                f.translate(FreeCAD.Vector(0.0,0.0,-2*overhangV))
                            ptsPaneProfil=[FreeCAD.Vector(-profil1["overhang"],-overhangV,0.0),FreeCAD.Vector(profil1["run"],profil1["height"],0.0),FreeCAD.Vector(profil1["run"],profil1["height"]+thicknessV,0.0),FreeCAD.Vector(-profil1["overhang"],-overhangV+thicknessV,0.0)]
                            self.createProfilShape (ptsPaneProfil, midpoint, rotEdge1, vec1, profil1["run"], d, self.shps, f)
                            ## subVolume shape
                            ptsSubVolumeProfil=[FreeCAD.Vector(-profil1["overhang"],-overhangV,0.0),FreeCAD.Vector(profil1["run"],profil1["height"],0.0),FreeCAD.Vector(profil1["run"],profil1["height"]+10000,0.0),FreeCAD.Vector(0.0,profil1["height"]+10000,0.0)]
                            self.createProfilShape (ptsSubVolumeProfil, midpoint, rotEdge1, vec1, profil1["run"], d, self.subVolshps, f)
                        else:
                            #TODO PIGNON
                            pass

                    ## SubVolume
                    self.sub = self.subVolshps.pop()
                    for s in self.subVolshps:
                        self.sub = self.sub.fuse(s)
                    self.sub = self.sub.removeSplitter()
                    if not self.sub.isNull():
                        if not DraftGeomUtils.isNull(pl):
                            self.sub.Placement = pl
                    ## BaseVolume
                    base = Part.makeCompound(self.shps)
                    if not base.isNull():
                        if not DraftGeomUtils.isNull(pl):
                            base.Placement = pl
        base = self.processSubShapes(obj,base)
        if base:
            if not base.isNull():
                obj.Shape = base