From fd1b23f8046f7c063b80443c20fae2cc3bc6bc00 Mon Sep 17 00:00:00 2001 From: Paul RASCLE Date: Mon, 5 Dec 2016 13:27:27 +0100 Subject: [PATCH 1/3] debug blocFissure: geom behaviour change --- src/Tools/blocFissure/CasTests/cubeAngle.py | 2 +- src/Tools/blocFissure/CasTests/cubeCoin.py | 2 +- src/Tools/blocFissure/CasTests/cubeMilieu.py | 2 +- src/Tools/blocFissure/CasTests/cylindre.py | 2 +- src/Tools/blocFissure/CasTests/disquePerce.py | 2 +- src/Tools/blocFissure/CasTests/ellipse_1.py | 4 +- src/Tools/blocFissure/CasTests/ellipse_2.py | 2 +- .../blocFissure/CasTests/fissure_Coude.py | 11 ++-- src/Tools/blocFissure/CasTests/vis_1.py | 2 +- src/Tools/blocFissure/gmu/fissureCoude.py | 66 +++++++++---------- 10 files changed, 48 insertions(+), 47 deletions(-) diff --git a/src/Tools/blocFissure/CasTests/cubeAngle.py b/src/Tools/blocFissure/CasTests/cubeAngle.py index 38d11ea40..772e465b8 100644 --- a/src/Tools/blocFissure/CasTests/cubeAngle.py +++ b/src/Tools/blocFissure/CasTests/cubeAngle.py @@ -57,7 +57,7 @@ class cubeAngle(fissureGenerique): shellFiss = geompy.ImportFile(os.path.join(gmu.pathBloc, "materielCasTests/CubeAngleFiss.brep"), "BREP") fondFiss = geompy.CreateGroup(shellFiss, geompy.ShapeType["EDGE"]) - geompy.UnionIDs(fondFiss, [4]) + geompy.UnionIDs(fondFiss, [3]) geompy.addToStudy( shellFiss, 'shellFiss' ) geompy.addToStudyInFather( shellFiss, fondFiss, 'fondFiss' ) diff --git a/src/Tools/blocFissure/CasTests/cubeCoin.py b/src/Tools/blocFissure/CasTests/cubeCoin.py index 97d18a45d..c70801eaa 100644 --- a/src/Tools/blocFissure/CasTests/cubeCoin.py +++ b/src/Tools/blocFissure/CasTests/cubeCoin.py @@ -6,7 +6,7 @@ from blocFissure import gmu dicoParams = dict(nomCas = 'cubeCoin', maillageSain = os.path.join(gmu.pathBloc, 'materielCasTests/cubeFin.med'), brepFaceFissure = os.path.join(gmu.pathBloc, "materielCasTests/cubeFin_Coin.brep"), - edgeFissIds = [7], + edgeFissIds = [6], lgInfluence = 50, meshBrep = (5,10), rayonPipe = 10, diff --git a/src/Tools/blocFissure/CasTests/cubeMilieu.py b/src/Tools/blocFissure/CasTests/cubeMilieu.py index 0d93518cd..cd3db8cb2 100644 --- a/src/Tools/blocFissure/CasTests/cubeMilieu.py +++ b/src/Tools/blocFissure/CasTests/cubeMilieu.py @@ -6,7 +6,7 @@ from blocFissure import gmu dicoParams = dict(nomCas = 'cubeMilieu', maillageSain = os.path.join(gmu.pathBloc, 'materielCasTests/cubeFin.med'), brepFaceFissure = os.path.join(gmu.pathBloc, "materielCasTests/cubeFin_Milieu.brep"), - edgeFissIds = [7], + edgeFissIds = [6], lgInfluence = 50, meshBrep = (5,10), rayonPipe = 10, diff --git a/src/Tools/blocFissure/CasTests/cylindre.py b/src/Tools/blocFissure/CasTests/cylindre.py index 9885a96a3..628831869 100644 --- a/src/Tools/blocFissure/CasTests/cylindre.py +++ b/src/Tools/blocFissure/CasTests/cylindre.py @@ -61,7 +61,7 @@ class cylindre(fissureGenerique): shellFiss = geompy.ImportFile(os.path.join(gmu.pathBloc, "materielCasTests/FissInCylindre2.brep"), "BREP") fondFiss = geompy.CreateGroup(shellFiss, geompy.ShapeType["EDGE"]) - geompy.UnionIDs(fondFiss, [7]) + geompy.UnionIDs(fondFiss, [6]) geompy.addToStudy( shellFiss, 'shellFiss' ) geompy.addToStudyInFather( shellFiss, fondFiss, 'fondFiss' ) diff --git a/src/Tools/blocFissure/CasTests/disquePerce.py b/src/Tools/blocFissure/CasTests/disquePerce.py index 5c4b63f3d..0e54cca99 100644 --- a/src/Tools/blocFissure/CasTests/disquePerce.py +++ b/src/Tools/blocFissure/CasTests/disquePerce.py @@ -6,7 +6,7 @@ from blocFissure import gmu dicoParams = dict(nomCas = 'disque', maillageSain = os.path.join(gmu.pathBloc, 'materielCasTests/disque.med'), brepFaceFissure = os.path.join(gmu.pathBloc, "materielCasTests/ellipse_disque.brep"), - edgeFissIds = [4], + edgeFissIds = [3], lgInfluence = 10, meshBrep = (0.5,2.5), rayonPipe = 1.0, diff --git a/src/Tools/blocFissure/CasTests/ellipse_1.py b/src/Tools/blocFissure/CasTests/ellipse_1.py index 2e39357ae..53ac507b8 100644 --- a/src/Tools/blocFissure/CasTests/ellipse_1.py +++ b/src/Tools/blocFissure/CasTests/ellipse_1.py @@ -34,7 +34,7 @@ class ellipse_1(fissureGenerique): # logging.info("genereGeometrieSaine %s", self.nomCas) # box = geompy.MakeBox(0, -500, 0, 400, 500, 800, "boiteSaine") # return [box] - + # --------------------------------------------------------------------------- def genereMaillageSain(self, geometriesSaines, meshParams): logging.info("genereMaillageSain %s", self.nomCas) @@ -65,7 +65,7 @@ class ellipse_1(fissureGenerique): shellFiss = geompy.ImportFile(os.path.join(gmu.pathBloc, "materielCasTests/ellipse1.brep"), "BREP") fondFiss = geompy.CreateGroup(shellFiss, geompy.ShapeType["EDGE"]) - geompy.UnionIDs(fondFiss, [4]) + geompy.UnionIDs(fondFiss, [3]) geompy.addToStudy( shellFiss, 'shellFiss' ) geompy.addToStudyInFather( shellFiss, fondFiss, 'fondFiss' ) diff --git a/src/Tools/blocFissure/CasTests/ellipse_2.py b/src/Tools/blocFissure/CasTests/ellipse_2.py index 69ae3ed95..35c8598d9 100644 --- a/src/Tools/blocFissure/CasTests/ellipse_2.py +++ b/src/Tools/blocFissure/CasTests/ellipse_2.py @@ -37,7 +37,7 @@ class ellipse_2(ellipse_1): shellFiss = geompy.ImportFile(os.path.join(gmu.pathBloc, "materielCasTests/ellipse1_pb.brep"), "BREP") fondFiss = geompy.CreateGroup(shellFiss, geompy.ShapeType["EDGE"]) - geompy.UnionIDs(fondFiss, [4]) + geompy.UnionIDs(fondFiss, [3]) geompy.addToStudy( shellFiss, 'shellFiss' ) geompy.addToStudyInFather( shellFiss, fondFiss, 'fondFiss' ) diff --git a/src/Tools/blocFissure/CasTests/fissure_Coude.py b/src/Tools/blocFissure/CasTests/fissure_Coude.py index 6f87ec6b4..a348ae454 100644 --- a/src/Tools/blocFissure/CasTests/fissure_Coude.py +++ b/src/Tools/blocFissure/CasTests/fissure_Coude.py @@ -140,10 +140,11 @@ class fissure_Coude(fissureGenerique): # --- peau tube exterieur (PEAUEXT) - cercle1 = geompy.MakeCircle(centre, OZ, de/2.) - extru1 = geompy.MakePrismVecH(cercle1, OZ, l_tube_p1) - revol1 = geompy.MakeRevolution(cercle1, axe, angleCoude*math.pi/180.0) - rot1 = geompy.MakeRotation(cercle1, axe, angleCoude*math.pi/180.0) + Disk_3 = geompy.MakeDiskPntVecR(centre, OZ, de/2. +epais) + couronne1 = geompy.MakeCut(Disk_3, Disk_1) + extru1 = geompy.MakePrismVecH(couronne1, OZ, l_tube_p1) + revol1 = geompy.MakeRevolution(couronne1, axe, angleCoude*math.pi/180.0) + rot1 = geompy.MakeRotation(couronne1, axe, angleCoude*math.pi/180.0) extru2 = geompy.MakePrismVecH(rot1, Rotation_2, -l_tube_p2) externe = geompy.MakeFuse(extru1, revol1) externe = geompy.MakeFuse(extru2, externe) @@ -294,7 +295,7 @@ class fissure_Coude(fissureGenerique): azimut = -azimut # axe inverse / ASCOUF axe = geompy.MakeTranslation(OY, -r_cintr, 0, -l_tube_p1) - + if not lgInfluence: lgInfluence = profondeur diff --git a/src/Tools/blocFissure/CasTests/vis_1.py b/src/Tools/blocFissure/CasTests/vis_1.py index cf4400faa..34ab00322 100644 --- a/src/Tools/blocFissure/CasTests/vis_1.py +++ b/src/Tools/blocFissure/CasTests/vis_1.py @@ -59,7 +59,7 @@ class vis_1(fissureGenerique): shellFiss = geompy.ImportFile(os.path.join(gmu.pathBloc, "materielCasTests/visFiss.brep"), "BREP") fondFiss = geompy.CreateGroup(shellFiss, geompy.ShapeType["EDGE"]) - geompy.UnionIDs(fondFiss, [7, 9]) + geompy.UnionIDs(fondFiss, [6, 8]) geompy.addToStudy( shellFiss, 'shellFiss' ) geompy.addToStudyInFather( shellFiss, fondFiss, 'fondFiss' ) diff --git a/src/Tools/blocFissure/gmu/fissureCoude.py b/src/Tools/blocFissure/gmu/fissureCoude.py index bf8e0e639..224323567 100644 --- a/src/Tools/blocFissure/gmu/fissureCoude.py +++ b/src/Tools/blocFissure/gmu/fissureCoude.py @@ -178,10 +178,10 @@ class fissureCoude(fissureGenerique): # --- peau tube exterieur (PEAUEXT) - cercle1 = geompy.MakeCircle(centre, OZ, de/2.) - extru1 = geompy.MakePrismVecH(cercle1, OZ, l_tube_p1) - revol1 = geompy.MakeRevolution(cercle1, axe, angleCoude*math.pi/180.0) - rot1 = geompy.MakeRotation(cercle1, axe, angleCoude*math.pi/180.0) + Disk_3 = geompy.MakeDiskPntVecR(centre, OZ, de/2. +epais) + extru1 = geompy.MakePrismVecH(Disk_3, OZ, l_tube_p1) + revol1 = geompy.MakeRevolution(Disk_3, axe, angleCoude*math.pi/180.0) + rot1 = geompy.MakeRotation(Disk_3, axe, angleCoude*math.pi/180.0) extru2 = geompy.MakePrismVecH(rot1, Rotation_2, -l_tube_p2) externe = geompy.MakeFuse(extru1, revol1) externe = geompy.MakeFuse(extru2, externe) @@ -338,13 +338,13 @@ class fissureCoude(fissureGenerique): self.elliptique = False if shapeFissureParams.has_key('elliptique'): self.elliptique = shapeFissureParams['elliptique'] - + azimut = -azimut # axe inverse / ASCOUF axe = geompy.MakeTranslation(OY, -r_cintr, 0, -l_tube_p1) geomPublish(initLog.debug, axe,"axe") - + if not lgInfluence: lgInfluence = profondeur @@ -377,7 +377,7 @@ class fissureCoude(fissureGenerique): lgfond = longueur -2*profondeur angle = lgfond/(2*raybor) pb = geompy.MakeVertex(raybor, 0, 0) - pi = geompy.MakeVertex(rayint, 0, 0) + pi = geompy.MakeVertex(rayint, 0, 0) pbl = geompy.MakeRotation(pb, OZ, angle) pbr = geompy.MakeRotation(pb, OZ, -angle) geomPublish(initLog.debug, pbl,"pbl") @@ -395,7 +395,7 @@ class fissureCoude(fissureGenerique): pt = geompy.MakeRotation(pil, axl, angi) points.append(pt) for i in range(nbp): - angi = angle -2.0*i*angle/nbp + angi = angle -2.0*i*angle/nbp pt = geompy.MakeRotation(pi, OZ, angi) points.append(pt) for i in range(nbp+1): @@ -407,30 +407,30 @@ class fissureCoude(fissureGenerique): pt = geompy.MakeTranslation(pt, 0, 0, -l_tube_p1) pt = geompy.MakeRotation(pt, axe, alpha*math.pi/180.) points[i] = pt - wire0 = geompy.MakeInterpol(points[0:nbp+1]) - wire1 = geompy.MakeInterpol(points[nbp:2*nbp+1]) - wire2 = geompy.MakeInterpol(points[2*nbp:3*nbp+1]) + wire0 = geompy.MakeInterpol(points[0:nbp+1]) + wire1 = geompy.MakeInterpol(points[nbp:2*nbp+1]) + wire2 = geompy.MakeInterpol(points[2*nbp:3*nbp+1]) #wiretube = geompy.MakeInterpol(points) wiretube=geompy.MakeWire([wire0,wire1,wire2]) geomPublish(initLog.debug, wiretube,"wiretube") - + pe = geompy.MakeVertex(rayext, 0, 0) pe = geompy.MakeRotation(pe, OZ, azimut*math.pi/180.) pe = geompy.MakeTranslation(pe, 0, 0, -l_tube_p1) pe = geompy.MakeRotation(pe, axe, alpha*math.pi/180.) - + arce = geompy.MakeArc(points[0], pe, points[-1]) geomPublish(initLog.debug, arce,"arce") - + facefiss = geompy.MakeFaceWires([arce, wiretube], 1) geomPublish(initLog.debug, facefiss, 'facefissPlace' ) - + pc = geompy.MakeVertex((raybor + rayint)/2.0, 0, 0) centre = geompy.MakeRotation(pc, OZ, azimut*math.pi/180.) centre = geompy.MakeTranslation(centre, 0, 0, -l_tube_p1) centre = geompy.MakeRotation(centre, axe, alpha*math.pi/180.) geomPublish(initLog.debug, centre, 'centrefissPlace' ) - + wiretube = geompy.GetInPlace(facefiss, wiretube) geomPublish(initLog.debug, wiretube, 'wiretubePlace' ) try: @@ -449,7 +449,7 @@ class fissureCoude(fissureGenerique): else: raybor = de/2. - epais dp = +1.0 - prof = dp * profondeur + prof = dp * profondeur lgfond = longueur -2*profondeur cosaz = math.cos(azimut*math.pi/180.) sinaz = math.sin(azimut*math.pi/180.) @@ -477,9 +477,9 @@ class fissureCoude(fissureGenerique): for i in range(nbp+2): x = math.sin(i*math.pi/(nbp+1)) # fonction de répartition des points : distance relative x2 = x*x - totx += x2 + totx += x2 xs.append(totx) - logging.debug("x2: %s, totx: %s", x2, totx) + logging.debug("x2: %s, totx: %s", x2, totx) for i in range(nbp+1): #posi = nbp -i # répartition équidistante des points sur la courbe posi = nbp*(1 -xs[i]/totx) # points plus resserrés aux extrémités de la courbe @@ -501,11 +501,11 @@ class fissureCoude(fissureGenerique): x = math.sin(i*math.pi/nbp) #x = 1.0 # répartition équidistante des points sur la courbe x2 = x*x # points plus resserrés aux extrémités de la courbe - totx += x2 + totx += x2 xs.append(totx) - logging.debug("x2: %s, totx: %s", x2, totx) + logging.debug("x2: %s, totx: %s", x2, totx) for i in range(nbp): - angi = alfrd -angle +2.0*angle*xs[i]/totx + angi = alfrd -angle +2.0*angle*xs[i]/totx pt = geompy.MakeRotation(pi, axe, angi) points.append(pt) curves.append(geompy.MakeInterpol(points)) @@ -521,9 +521,9 @@ class fissureCoude(fissureGenerique): for i in range(nbp+2): x = math.sin(i*math.pi/(nbp+1)) x2 = x*x - totx += x2 + totx += x2 xs.append(totx) - logging.debug("x2: %s, totx: %s", x2, totx) + logging.debug("x2: %s, totx: %s", x2, totx) for i in range(nbp+1): #posi = nbp -i # répartition équidistante des points sur la courbe posi = nbp*xs[i]/totx # points plus resserrés aux extrémités de la courbe @@ -536,7 +536,7 @@ class fissureCoude(fissureGenerique): # for i, pt in enumerate(points): # name = "point%d"%i # geomPublishInFather(initLog.debug,curves[-1], pt, name) - + wiretube = geompy.MakeWire(curves) geomPublish(initLog.debug, wiretube,"wiretube") try: @@ -545,26 +545,26 @@ class fissureCoude(fissureGenerique): except: logging.debug("erreur MakeEdgeWire sur fond de fissure, on fait sans") edgetube = None - + pts = [] pts.append(point0) dpr = prof*math.cos(5.0*math.pi/8.0) pe = geompy.MakeTranslation(pb, dpr*cosaz, dpr*sinaz, 0., "pe") for i in range(nbp): - angi = alfrd -angle +2.0*i*angle/nbp + angi = alfrd -angle +2.0*i*angle/nbp pt = geompy.MakeRotation(pe, axe, angi) pts.append(pt) pts.append(point1) arce = geompy.MakeInterpol(pts) geomPublish(initLog.debug, arce,"arce") - + facefiss = geompy.MakeFaceWires([arce, wiretube], 0) geomPublish(initLog.debug, facefiss, 'facefissPlace' ) - + pc = geompy.MakeTranslation(pb, 0.5*prof*cosaz, 0.5*prof*sinaz, 0.) centre = geompy.MakeRotation(pc, axe, alfrd) geomPublish(initLog.debug, centre, 'centrefissPlace' ) - + edges = geompy.ExtractShapes(facefiss, geompy.ShapeType["EDGE"], True) edgesTriees, minl, maxl = sortEdges(edges) edges = edgesTriees[:-1] # la plus grande correspond à arce, on l'elimine @@ -581,7 +581,7 @@ class fissureCoude(fissureGenerique): else: raybor = de/2. - epais dp = +1.0 - prof = dp * profondeur + prof = dp * profondeur cosaz = math.cos(azimut*math.pi/180.) sinaz = math.sin(azimut*math.pi/180.) alfrd = alpha*math.pi/180. @@ -602,7 +602,7 @@ class fissureCoude(fissureGenerique): cox = geompy.VectorCoordinates(ax1) coy = geompy.VectorCoordinates(ay1) localLCS = geompy.MakeMarker(coo[0], coo[1], coo[2], cox[0], cox[1], cox[2], coy[0], coy[1], coy[2], "localLCS") - + pco = geompy.MakeVertex(0, 0, -profondeur, "pco") pao = geompy.MakeRotation(pco, OY, 0.6*math.pi, "pao") pbo = geompy.MakeRotation(pco, OY, -0.6*math.pi, "pbo") @@ -620,7 +620,7 @@ class fissureCoude(fissureGenerique): edgesTriees, minl, maxl = sortEdges(edges) edgetube = edgesTriees[-1] # la plus grande correspond à arci wiretube = edgetube - + pc = geompy.MakeTranslation(pb, 0.5*prof*cosaz, 0.5*prof*sinaz, 0.) centre = geompy.MakeRotation(pc, axe, alfrd) geomPublish(initLog.debug, centre, 'centrefissPlace' ) From 596f40f5981b792f2edff687ed42a7ebbfe98d49 Mon Sep 17 00:00:00 2001 From: Paul RASCLE Date: Mon, 5 Dec 2016 17:54:39 +0100 Subject: [PATCH 2/3] debug blocFissure: CasTests.ellipse_1 --- .../gmu/construitEdgesRadialesDebouchantes.py | 49 +++++++++++++------ 1 file changed, 35 insertions(+), 14 deletions(-) diff --git a/src/Tools/blocFissure/gmu/construitEdgesRadialesDebouchantes.py b/src/Tools/blocFissure/gmu/construitEdgesRadialesDebouchantes.py index d77ccafd6..0dcd41f39 100644 --- a/src/Tools/blocFissure/gmu/construitEdgesRadialesDebouchantes.py +++ b/src/Tools/blocFissure/gmu/construitEdgesRadialesDebouchantes.py @@ -12,12 +12,12 @@ from sortEdges import sortEdges def construitEdgesRadialesDebouchantes(idisklim, idiskout, gptsdisks, raydisks, facesPipePeau, edgeRadFacePipePeau, nbsegCercle): """ - construction des listes d'edges radiales sur chaque extrémité débouchante + construction des listes d'edges radiales sur chaque extrémité débouchante """ logging.info('start') - + # --- listes de nappes radiales en filling à chaque extrémité débouchante - + facesDebouchantes = [False, False] idFacesDebouchantes = [-1, -1] # contiendra les indices des faces disque débouchantes (facesPipePeau) listNappes =[] @@ -47,7 +47,7 @@ def construitEdgesRadialesDebouchantes(idisklim, idiskout, gptsdisks, raydisks, geomPublish(initLog.debug, nappe, name) facesDebouchantes[i] = True listNappes.append(nappes) - + # --- mise en correspondance avec les indices des faces disque débouchantes (facesPipePeau) for i, nappes in enumerate(listNappes): if facesDebouchantes[i]: @@ -82,27 +82,48 @@ def construitEdgesRadialesDebouchantes(idisklim, idiskout, gptsdisks, raydisks, else: maxl = geompy.BasicProperties(edge)[0] if maxl < 0.01: # problème MakeSection - logging.debug("problème MakeSection recherche edge radiale %s, longueur trop faible: %s, utilisation partition", k, maxl) + logging.info("problème MakeSection recherche edge radiale %s, longueur trop faible: %s, utilisation partition", k, maxl) partNappeFace = geompy.MakePartition([face, nappes[k]], [] , [], [], geompy.ShapeType["FACE"], 0, [], 0) edps= geompy.ExtractShapes(partNappeFace, geompy.ShapeType["EDGE"], False) ednouv = [] for ii, ed in enumerate(edps): + dmax=100. vxs = geompy.ExtractShapes(ed, geompy.ShapeType["VERTEX"], False) distx = [geompy.MinDistance(vx, face) for vx in vxs] distx += [geompy.MinDistance(vx, nappes[k]) for vx in vxs] dmax = max(distx) - logging.debug(" dmax %s",dmax) - if dmax < 0.01: + lgedge = geompy.BasicProperties(ed)[0] + logging.debug(" dmax %s, longueur edge %s",dmax, lgedge) + if dmax < 0.01 and lgedge > 0.01: ednouv.append(ed) - logging.debug(" edges issues de la partition: %s", ednouv) - for ii, ed in enumerate(ednouv): - geomPublish(initLog.debug, ed, "ednouv%d"%ii) - [edsorted, minl,maxl] = sortEdges(ednouv) - logging.debug(" longueur edge trouvée: %s", maxl) - edge = edsorted[-1] + if (len(ednouv) > 0): + logging.debug(" edges issues de la partition: %s", ednouv) + for ii, ed in enumerate(ednouv): + geomPublish(initLog.debug, ed, "ednouv%d"%ii) + [edsorted, minl,maxl] = sortEdges(ednouv) + logging.debug(" longueur edge trouvée: %s", maxl) + edge = edsorted[-1] + else: + logging.info("problème partition recherche edge radiale %s", k) + vxs = geompy.ExtractShapes(partNappeFace, geompy.ShapeType["VERTEX"], False) + vxnouv=[] + for ii,vx in enumerate(vxs): + distx = geompy.MinDistance(vx, face) + distx += geompy.MinDistance(vx, nappes[k]) + logging.debug("vertex distance: %s", distx) + if distx < 0.005: + vxnouv.append(vx) + logging.debug("nombre vertex candidats %s", len(vxnouv)) + if len(vxnouv) >= 2: + eds = [geompy.MakeEdge(vxnouv[j],vxnouv[(j+1)%len(vxnouv)]) for j in range(len(vxnouv))] + [edsorted2, minl,maxl] = sortEdges(eds) + edge = edsorted2[-1] + logging.debug("lg edge: %s", maxl) + else: + logging.debug("problème recherche edge radiale %s non résolu", k) edges.append(edge) name = 'edgeEndPipe%d'%k geomPublish(initLog.debug, edge, name) listEdges.append(edges) - + return (listEdges, idFacesDebouchantes) \ No newline at end of file From 54a5b4f97e70d004ef072526d759daf4bd54f9c5 Mon Sep 17 00:00:00 2001 From: Paul RASCLE Date: Tue, 6 Dec 2016 14:50:48 +0100 Subject: [PATCH 3/3] debug blocFissure: problem GetInPlace --- .../blocFissure/gmu/identifieEdgesPeau.py | 36 ++++++++++++++----- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/src/Tools/blocFissure/gmu/identifieEdgesPeau.py b/src/Tools/blocFissure/gmu/identifieEdgesPeau.py index a3abb6208..70595896e 100644 --- a/src/Tools/blocFissure/gmu/identifieEdgesPeau.py +++ b/src/Tools/blocFissure/gmu/identifieEdgesPeau.py @@ -15,16 +15,16 @@ def identifieEdgesPeau(edgesFissExtPipe,verticesPipePeau, facePeau, facesPeauSor identification précise des edges et disques des faces de peau selon index extremité fissure """ logging.info('start') - + facesPipePeau = [None for i in range(len(edgesFissExtPipe))] endsEdgeFond = [None for i in range(len(edgesFissExtPipe))] edgeRadFacePipePeau = [None for i in range(len(edgesFissExtPipe))] - + edgesListees = [] edgesCircPeau = [] verticesCircPeau = [] if len(verticesPipePeau) > 0: # --- au moins une extrémité du pipe sur cette face de peau - + for face in facesPeauSorted[:-1]: # la ou les faces débouchantes, pas la grande face de peau logging.debug("examen face debouchante circulaire") for i,efep in enumerate(edgesFissExtPipe): @@ -52,11 +52,11 @@ def identifieEdgesPeau(edgesFissExtPipe,verticesPipePeau, facePeau, facesPeauSor pass pass pass - + # --- edges circulaires de la face de peau et points de jonction de la face externe de fissure logging.debug("facesPipePeau: %s", facesPipePeau) edgesCircPeau = [None for i in range(len(facesPipePeau))] - verticesCircPeau = [None for i in range(len(facesPipePeau))] + verticesCircPeau = [None for i in range(len(facesPipePeau))] for i,fcirc in enumerate(facesPipePeau): edges = geompy.GetSharedShapesMulti([facePeau, fcirc], geompy.ShapeType["EDGE"]) grpEdgesCirc = geompy.CreateGroup(facePeau, geompy.ShapeType["EDGE"]) @@ -96,8 +96,26 @@ def identifieEdgesPeau(edgesFissExtPipe,verticesPipePeau, facePeau, facesPeauSor geompy.UnionList(groupEdgesBordPeau, edgesBords) bordsVifs = None if aretesVivesC is not None: - logging.debug("identification des bords vifs par GetInPlace (old)") + logging.debug("identification des bords vifs par GetInPlace") bordsVifs = geompy.GetInPlace(facePeau, aretesVivesC) + if bordsVifs is None: + logging.debug("pas d'identification des bords vifs par GetInPlace: test par distance") + edvifs = [] + arvives = geompy.ExtractShapes(aretesVivesC, geompy.ShapeType["EDGE"], False) + edgs = geompy.ExtractShapes(facePeau, geompy.ShapeType["EDGE"], False) + for ed in edgs: + vxs = geompy.ExtractShapes(ed, geompy.ShapeType["VERTEX"], False) + for ar in arvives: + d = geompy.MinDistance(vxs[0], ar) + d += geompy.MinDistance(vxs[1], ar) + logging.debug("test distance bord face peau - arete vive: %s",d) + if d < 0.001: + edvifs.append(ed) + break + if len(edvifs) >0: + bordsVifs = geompy.CreateGroup(facePeau,geompy.ShapeType["EDGE"]) + for ed in edvifs: + geompy.AddObject(bordsVifs, geompy.GetSubShapeID(facePeau, ed)) if bordsVifs is not None: geomPublishInFather(initLog.debug, facePeau, bordsVifs, "bordsVifs") groupEdgesBordPeau = geompy.CutGroups(groupEdgesBordPeau, bordsVifs) @@ -114,9 +132,9 @@ def identifieEdgesPeau(edgesFissExtPipe,verticesPipePeau, facePeau, facesPeauSor aretesVivesCoupees += edv logging.debug("aretesVivesCoupees %s",aretesVivesCoupees) geomPublishInFather(initLog.debug, facePeau, groupEdgesBordPeau , "EdgesBords") - + # --- edges de la face de peau partagées avec la face de fissure - + edgesPeau = geompy.ExtractShapes(facePeau, geompy.ShapeType["EDGE"], False) edges = substractSubShapes(facePeau, edgesPeau, edgesListees) edgesFissurePeau = [] @@ -136,7 +154,7 @@ def identifieEdgesPeau(edgesFissExtPipe,verticesPipePeau, facePeau, facesPeauSor edgesFissurePeau.append(edge) name = "edgeFissurePeau%d"%i geomPublishInFather(initLog.debug, facePeau, edge, name) - + return (endsEdgeFond, facesPipePeau, edgeRadFacePipePeau, edgesCircPeau, verticesCircPeau, groupEdgesBordPeau, bordsVifs, edgesFissurePeau, aretesVivesCoupees)