From e37cdf15cfdf63eb7db4b591145e23160f46211b Mon Sep 17 00:00:00 2001 From: Jonathan Wiedemann Date: Fri, 19 Feb 2016 16:20:57 +0100 Subject: [PATCH] Arch Change default value Comment some print --- src/Mod/Arch/ArchRoof.py | 545 ++++++++++++++++++++------------------- 1 file changed, 278 insertions(+), 267 deletions(-) diff --git a/src/Mod/Arch/ArchRoof.py b/src/Mod/Arch/ArchRoof.py index bad115681..0dae0a17c 100644 --- a/src/Mod/Arch/ArchRoof.py +++ b/src/Mod/Arch/ArchRoof.py @@ -35,7 +35,7 @@ __title__="FreeCAD Roof" __author__ = "Yorik van Havre", "Jonathan Wiedemann" __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. 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 @@ -76,7 +76,8 @@ def makeRoof(baseobj=None,facenr=0, angles=[45.,], run = [], idrel = [0,],thickn lr = len(run) rlist = run 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 lidrel = len(idrel) @@ -184,7 +185,7 @@ class _Roof(ArchComponent.Component): perpendicular[0] = abs(perpendicular[0]) perpendicular[1] = abs(perpendicular[1])*-1 else: - print("Angle inconnue") + print("Unknown Angle") perpendicular[2] = abs(perpendicular[2]) perpendicular.normalize() perpendicular = perpendicular.multiply(l) @@ -261,7 +262,253 @@ class _Roof(ArchComponent.Component): eave = DraftGeomUtils.edg(FreeCAD.Vector(pt0Eave1[0]),FreeCAD.Vector(pt1Eave1[0])) 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 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 lp = len(points) points.append(points[0]) @@ -281,252 +528,8 @@ class _Roof(ArchComponent.Component): profilFace = Part.Face(profil) profilShp = profilFace.extrude(vecE) profilShp = f.common(profilShp) - shapesList.append(profilShp) - - def findProfil(self, idx): - #print("base " + str(idx)) - if 0<=idx 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") + #shapesList.append(profilShp) + return profilShp def execute(self,obj): @@ -538,14 +541,12 @@ class _Roof(ArchComponent.Component): self.baseface = None base = None - if obj.Base: - if not obj.Angles: - if obj.Base.isDerivedFrom("Part::Feature"): - if obj.Base.Shape.Solids: - base = obj.Base.Shape.copy() - else: + if obj.Base: + if obj.Base.isDerivedFrom("Part::Feature"): w = None - if obj.Base.isDerivedFrom("Part::Feature"): + if obj.Base.Shape.Solids: + base = obj.Base.Shape.copy() + else: if (obj.Base.Shape.Faces and obj.Face): w = obj.Base.Shape.Faces[obj.Face-1].Wires[0] elif obj.Base.Shape.Wires: @@ -558,7 +559,7 @@ class _Roof(ArchComponent.Component): heights = [] edges = Part.__sortEdges__(w.Edges) l = len(edges) - print("le contour contient "+str(l)+" aretes") + #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): @@ -591,15 +592,16 @@ class _Roof(ArchComponent.Component): overhangV = profilCurrent["overhang"]*math.tan(math.radians(profilCurrent["angle"])) if wire.isClosed(): f = Part.Face(wire) - #Part.show(f) f = f.extrude(FreeCAD.Vector(0,0,profilCurrent["height"]+2*thicknessV+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)] - 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 - 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)] - self.createProfilShape (ptsSubVolumeProfil, midpoint, profilCurrent["rot"], profilCurrent["vec"], profilCurrent["run"], d, self.subVolshps, f) - + 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)] + 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 self.sub = self.subVolshps.pop() for s in self.subVolshps: @@ -613,6 +615,8 @@ class _Roof(ArchComponent.Component): if not base.isNull(): if not DraftGeomUtils.isNull(pl): base.Placement = pl + else: + FreeCAD.Console.PrintMessage(translate("Arch","Unable to create a roof")) base = self.processSubShapes(obj,base) if base: if not base.isNull(): @@ -640,15 +644,22 @@ class _ViewProviderRoof(ArchComponent.ViewProviderComponent): def attach(self,vobj): self.Object = vobj.Object return + def unsetEdit(self,vobj,mode): FreeCADGui.Control.closeDialog() return def setEdit(self,vobj,mode=0): - taskd = _RoofTaskPanel() - taskd.obj = self.Object - taskd.update() - FreeCADGui.Control.showDialog(taskd) + if vobj.Object.Base.Shape.Solids : + taskd = ArchComponent.ComponentTaskPanel() + taskd.obj = self.Object + taskd.update() + FreeCADGui.Control.showDialog(taskd) + else: + taskd = _RoofTaskPanel() + taskd.obj = self.Object + taskd.update() + FreeCADGui.Control.showDialog(taskd) return True class _RoofTaskPanel: