diff --git a/src/Tools/blocFissure/CasTests/execution_Cas.py b/src/Tools/blocFissure/CasTests/execution_Cas.py index 3fa7f7f06..8d8524f73 100644 --- a/src/Tools/blocFissure/CasTests/execution_Cas.py +++ b/src/Tools/blocFissure/CasTests/execution_Cas.py @@ -16,7 +16,7 @@ runall = True if runall: torun = [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,] else: #prob 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27 - torun = [ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,] + torun = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,] # ----------------------------------------------------------------------------------------------- from blocFissure.gmu import geomsmesh diff --git a/src/Tools/blocFissure/gmu/casStandard.py b/src/Tools/blocFissure/gmu/casStandard.py index 4bfedef33..b0bca4ec1 100644 --- a/src/Tools/blocFissure/gmu/casStandard.py +++ b/src/Tools/blocFissure/gmu/casStandard.py @@ -1,8 +1,10 @@ # -*- coding: utf-8 -*- import os -from blocFissure import gmu -from blocFissure.gmu.geomsmesh import geompy, smesh +from geomsmesh import geompy, smesh +from geomsmesh import geomPublish +from geomsmesh import geomPublishInFather +import initLog import math import GEOM @@ -13,13 +15,13 @@ import SMESH #import NETGENPlugin import logging -from blocFissure.gmu.fissureGenerique import fissureGenerique +from fissureGenerique import fissureGenerique -from blocFissure.gmu.initEtude import initEtude -from blocFissure.gmu.triedreBase import triedreBase -from blocFissure.gmu.genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut -from blocFissure.gmu.creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain -from blocFissure.gmu.construitFissureGenerale import construitFissureGenerale +from initEtude import initEtude +from triedreBase import triedreBase +from genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut +from creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain +from construitFissureGenerale import construitFissureGenerale O, OX, OY, OZ = triedreBase() @@ -97,8 +99,8 @@ class casStandard(fissureGenerique): shellFiss = geompy.ImportFile( self.dicoParams['brepFaceFissure'], "BREP") fondFiss = geompy.CreateGroup(shellFiss, geompy.ShapeType["EDGE"]) geompy.UnionIDs(fondFiss, self.dicoParams['edgeFissIds'] ) - geompy.addToStudy( shellFiss, 'shellFiss' ) - geompy.addToStudyInFather( shellFiss, fondFiss, 'fondFiss' ) + geomPublish(initLog.debug, shellFiss, 'shellFiss' ) + geomPublishInFather(initLog.debug, shellFiss, fondFiss, 'fondFiss' ) coordsNoeudsFissure = genereMeshCalculZoneDefaut(shellFiss, self.dicoParams['meshBrep'][0] ,self.dicoParams['meshBrep'][1]) diff --git a/src/Tools/blocFissure/gmu/compoundFromList.py b/src/Tools/blocFissure/gmu/compoundFromList.py index 6787b2520..8f1ed1962 100644 --- a/src/Tools/blocFissure/gmu/compoundFromList.py +++ b/src/Tools/blocFissure/gmu/compoundFromList.py @@ -2,6 +2,9 @@ import logging from geomsmesh import geompy +from geomsmesh import geomPublish +from geomsmesh import geomPublishInFather +import initLog def compoundFromList(elements, nom=None): """ @@ -21,7 +24,7 @@ def compoundFromList(elements, nom=None): for i,a in enumerate(shapeList): nom = nom +"%d"%i logging.debug('nom: %s',nom) - geompy.addToStudy(a, nom) + geomPublish(initLog.debug, a, nom) shapeCompound = None if len(shapeList) > 0: diff --git a/src/Tools/blocFissure/gmu/construitEdgesRadialesDebouchantes.py b/src/Tools/blocFissure/gmu/construitEdgesRadialesDebouchantes.py index 91b1b725c..d77ccafd6 100644 --- a/src/Tools/blocFissure/gmu/construitEdgesRadialesDebouchantes.py +++ b/src/Tools/blocFissure/gmu/construitEdgesRadialesDebouchantes.py @@ -3,6 +3,9 @@ import logging from geomsmesh import geompy +from geomsmesh import geomPublish +from geomsmesh import geomPublishInFather +import initLog import GEOM from sortEdges import sortEdges @@ -30,18 +33,18 @@ def construitEdgesRadialesDebouchantes(idisklim, idiskout, gptsdisks, raydisks, #logging.debug("extremité %s, indices retenus interne %s, externe %s",i, idfin, iddeb) comp = geompy.MakeCompound(raydisks[k][iddeb:idfin]) name='compoundRay%d'%k - geompy.addToStudy(comp, name) + geomPublish(initLog.debug, comp, name) else: idfin = min(len(gptsdisks), numout+1) iddeb = min(idfin-3, idisk) # il faut 3 rayons pour faire un filling qui suive le fond de fissure #logging.debug("extremité %s, indices retenus interne %s, externe %s",i, idfin, iddeb) comp = geompy.MakeCompound(raydisks[k][iddeb:idfin]) name='compoundRay%d'%k - geompy.addToStudy(comp, name) + geomPublish(initLog.debug, comp, name) nappe = geompy.MakeFilling(comp, 2, 5, 0.0001, 0.0001, 0, GEOM.FOM_Default) nappes.append(nappe) name='nappe%d'%k - geompy.addToStudy(nappe, name) + geomPublish(initLog.debug, nappe, name) facesDebouchantes[i] = True listNappes.append(nappes) @@ -50,8 +53,8 @@ def construitEdgesRadialesDebouchantes(idisklim, idiskout, gptsdisks, raydisks, if facesDebouchantes[i]: for k, face in enumerate(facesPipePeau): #logging.debug('i, k, face, nappes[0] %s %s %s %s', i, k, face, nappes[0]) - #geompy.addToStudy(nappes[0], 'lanappe') - #geompy.addToStudy(face, 'laface') + #geomPublish(initLog.debug, nappes[0], 'lanappe') + #geomPublish(initLog.debug, face, 'laface') edge = geompy.MakeSection(face, nappes[0]) if geompy.NbShapes(edge, geompy.ShapeType["EDGE"]) > 0: idFacesDebouchantes[i] = k @@ -93,13 +96,13 @@ def construitEdgesRadialesDebouchantes(idisklim, idiskout, gptsdisks, raydisks, ednouv.append(ed) logging.debug(" edges issues de la partition: %s", ednouv) for ii, ed in enumerate(ednouv): - geompy.addToStudy(ed, "ednouv%d"%ii) + geomPublish(initLog.debug, ed, "ednouv%d"%ii) [edsorted, minl,maxl] = sortEdges(ednouv) logging.debug(" longueur edge trouvée: %s", maxl) edge = edsorted[-1] edges.append(edge) name = 'edgeEndPipe%d'%k - geompy.addToStudy(edge, name) + geomPublish(initLog.debug, edge, name) listEdges.append(edges) return (listEdges, idFacesDebouchantes) \ No newline at end of file diff --git a/src/Tools/blocFissure/gmu/construitFissureGenerale.py b/src/Tools/blocFissure/gmu/construitFissureGenerale.py index d4936d0ae..ddffac389 100644 --- a/src/Tools/blocFissure/gmu/construitFissureGenerale.py +++ b/src/Tools/blocFissure/gmu/construitFissureGenerale.py @@ -3,6 +3,9 @@ import logging import salome from geomsmesh import geompy +from geomsmesh import geomPublish +from geomsmesh import geomPublishInFather +import initLog import GEOM from geomsmesh import smesh from salome.smesh import smeshBuilder @@ -130,7 +133,7 @@ def construitFissureGenerale(maillagesSains, (fissPipe, edgesPipeFiss, edgesFondFiss, wirePipeFiss, wireFondFiss) = partitionneFissureParPipe(shapesFissure, elementsDefaut, rayonPipe) edgesFondFiss, edgesIdByOrientation = orderEdgesFromWire(wireFondFiss) for i,edge in enumerate(edgesFondFiss): - geompy.addToStudyInFather(wireFondFiss, edge, "edgeFondFiss%d"%i) + geomPublishInFather(initLog.debug, wireFondFiss, edge, "edgeFondFiss%d"%i) # --- peau et face de fissure # @@ -195,7 +198,7 @@ def construitFissureGenerale(maillagesSains, for i, avc in enumerate(aretesVivesCoupees): name = "areteViveCoupee%d"%i - geompy.addToStudy(avc, name) + geomPublish(initLog.debug, avc, name) # --- identification des faces et edges de fissure externe pour maillage diff --git a/src/Tools/blocFissure/gmu/construitPartitionsPeauFissure.py b/src/Tools/blocFissure/gmu/construitPartitionsPeauFissure.py index 05430c750..20ba23bf5 100644 --- a/src/Tools/blocFissure/gmu/construitPartitionsPeauFissure.py +++ b/src/Tools/blocFissure/gmu/construitPartitionsPeauFissure.py @@ -2,6 +2,9 @@ import logging from geomsmesh import geompy +from geomsmesh import geomPublish +from geomsmesh import geomPublishInFather +import initLog from checkDecoupePartition import checkDecoupePartition # ----------------------------------------------------------------------------- @@ -35,7 +38,7 @@ def construitPartitionsPeauFissure(facesDefaut, fissPipe): fissPipePart = fissPipe part = geompy.MakePartition([fissPipePart, filling], [], [], [], geompy.ShapeType["FACE"], 0, [], 0) partitionsPeauFissFond.append(part) - geompy.addToStudy( part, 'partitionPeauFissFond%d'%ipart ) + geomPublish(initLog.debug, part, 'partitionPeauFissFond%d'%ipart ) else: partitionsPeauFissFond.append(None) ipart = ipart +1 diff --git a/src/Tools/blocFissure/gmu/creePointsPipePeau.py b/src/Tools/blocFissure/gmu/creePointsPipePeau.py index 30836c723..0f3bb71a3 100644 --- a/src/Tools/blocFissure/gmu/creePointsPipePeau.py +++ b/src/Tools/blocFissure/gmu/creePointsPipePeau.py @@ -3,6 +3,9 @@ import logging from geomsmesh import geompy +from geomsmesh import geomPublish +from geomsmesh import geomPublishInFather +import initLog from projettePointSurCourbe import projettePointSurCourbe def creePointsPipePeau(listEdges, idFacesDebouchantes, idFillingFromBout, @@ -20,9 +23,9 @@ def creePointsPipePeau(listEdges, idFacesDebouchantes, idFillingFromBout, idf = -1 # si idf vaut 1, on prend le dernier élément de la liste (1 ou 2 extrémités débouchent sur la face) centre = ptEdgeFond[idFillingFromBout[i]][idf] name = "centre%d"%idf - geompy.addToStudy(centre, name) + geomPublish(initLog.debug, centre, name) vertPipePeau = ptFisExtPi[idFillingFromBout[i]][idf] - geompy.addToStudyInFather(centre, vertPipePeau, "vertPipePeau") + geomPublishInFather(initLog.debug, centre, vertPipePeau, "vertPipePeau") grpsEdgesCirc = edCircPeau[idFillingFromBout[i]] # liste de groupes edgesCirc = [] for grpEdgesCirc in grpsEdgesCirc: @@ -48,7 +51,7 @@ def creePointsPipePeau(listEdges, idFacesDebouchantes, idFillingFromBout, else: bout = geompy.MakeVertexOnCurve(distEdgeCirc[0][2], u) name ="bout%d"%k - geompy.addToStudyInFather(centre, bout, name) + geomPublishInFather(initLog.debug, centre, bout, name) # enregistrement des points dans la structure points = [] for j in range(nbsegRad +1): diff --git a/src/Tools/blocFissure/gmu/creeZoneDefautFilling.py b/src/Tools/blocFissure/gmu/creeZoneDefautFilling.py index fd98acab2..c83f2aa02 100644 --- a/src/Tools/blocFissure/gmu/creeZoneDefautFilling.py +++ b/src/Tools/blocFissure/gmu/creeZoneDefautFilling.py @@ -2,6 +2,9 @@ import logging from geomsmesh import geompy +from geomsmesh import geomPublish +from geomsmesh import geomPublishInFather +import initLog # ----------------------------------------------------------------------------- # --- crée zone géométrique défaut a partir d'un filling @@ -21,15 +24,15 @@ def creeZoneDefautFilling(filling, shapeDefaut, lgExtrusion=50): trace = True facesDefaut = filling centreSphere = geompy.MakeCDG(shapeDefaut) - geompy.addToStudy(centreSphere, "cdg_defaut") + geomPublish(initLog.debug, centreSphere, "cdg_defaut") centreDefaut = geompy.MakeProjection(centreSphere, filling) if trace: - geompy.addToStudy(centreDefaut, "centreDefaut") + geomPublish(initLog.debug, centreDefaut, "centreDefaut") normalDefaut = geompy.GetNormal(filling, centreDefaut) if trace: - geompy.addToStudy(normalDefaut, "normalDefaut") + geomPublish(initLog.debug, normalDefaut, "normalDefaut") extrusionDefaut = geompy.MakePrismVecH(filling, normalDefaut, -lgExtrusion) if trace: - geompy.addToStudy(extrusionDefaut, "extrusionDefaut") + geomPublish(initLog.debug, extrusionDefaut, "extrusionDefaut") return facesDefaut, centreDefaut, normalDefaut, extrusionDefaut diff --git a/src/Tools/blocFissure/gmu/creeZoneDefautGeom.py b/src/Tools/blocFissure/gmu/creeZoneDefautGeom.py index 9969c8d8c..4c622ebea 100644 --- a/src/Tools/blocFissure/gmu/creeZoneDefautGeom.py +++ b/src/Tools/blocFissure/gmu/creeZoneDefautGeom.py @@ -2,6 +2,9 @@ import logging from geomsmesh import geompy +from geomsmesh import geomPublish +from geomsmesh import geomPublishInFather +import initLog from prolongeVertices import prolongeVertices # ----------------------------------------------------------------------------- @@ -42,57 +45,57 @@ def creeZoneDefautGeom(objetSain, shapeDefaut, origShapes, verticesShapes, dmoye curves.append(curve) if trace: name="poly_%d"%aShape - geompy.addToStudy(curve, name) + geomPublish(initLog.debug, curve, name) # cdg = geompy.MakeCDG(curve) cdgs.append(cdg) if trace: name="cdgpoly_%d"%aShape - geompy.addToStudy(cdg, name) + geomPublish(initLog.debug, cdg, name) # projCdg = geompy.MakeProjection(cdg, face) projs.append(projCdg) if trace: name="projCdg_%d"%aShape - geompy.addToStudy(projCdg, name) + geomPublish(initLog.debug, projCdg, name) # normal = geompy.GetNormal(face, projCdg) normals.append(normal) if trace: name="normal_%d"%aShape - geompy.addToStudy(normal, name) + geomPublish(initLog.debug, normal, name) # extrusion = geompy.MakePrismVecH2Ways(curve, normal, 10) extrusions.append(extrusion) if trace: name="extrusion_%d"%aShape - geompy.addToStudy(extrusion, name) + geomPublish(initLog.debug, extrusion, name) # verticesProlongees = prolongeVertices(vertices) # curveprol = geompy.MakePolyline(verticesProlongees, False) if trace: name="polyProl_%d"%aShape - geompy.addToStudy(curveprol, name) + geomPublish(initLog.debug, curveprol, name) # extruprol = geompy.MakePrismVecH2Ways(curveprol, normal, 10) if trace: name="extruProl_%d"%aShape - geompy.addToStudy(extruprol, name) + geomPublish(initLog.debug, extruprol, name) # partition = geompy.MakePartition([face], [extruprol], [], [], geompy.ShapeType["FACE"], 0, [], 0) partitions.append(partition) if trace: name="partition_%d"%aShape - geompy.addToStudy(partition, name) + geomPublish(initLog.debug, partition, name) pass # centreSphere = geompy.MakeCDG(shapeDefaut) - geompy.addToStudy(centreSphere, "cdg_defaut") + geomPublish(initLog.debug, centreSphere, "cdg_defaut") ccurves = geompy.MakeCompound(curves) gravCenter = geompy.MakeCDG(ccurves) - geompy.addToStudy(gravCenter, "cdg_curves") + geomPublish(initLog.debug, gravCenter, "cdg_curves") for i in range(len(partitions)): if trace: logging.debug(" --- original shape %s", origShapes[i]) @@ -114,7 +117,7 @@ def creeZoneDefautGeom(objetSain, shapeDefaut, origShapes, verticesShapes, dmoye if d == minDist: aFace = facesToSort[j] name="decoupe_%d"%origShapes[i] - geompy.addToStudy(aFace, name) + geomPublish(initLog.debug, aFace, name) decoupes.append(aFace) break pass @@ -123,7 +126,7 @@ def creeZoneDefautGeom(objetSain, shapeDefaut, origShapes, verticesShapes, dmoye facesDefaut = decoupes[0] if len(decoupes) > 1: facesDefaut = geompy.MakePartition(decoupes, [], [], [], geompy.ShapeType["FACE"], 0, [], 0) - geompy.addToStudy(facesDefaut, "facesDefaut") + geomPublish(initLog.debug, facesDefaut, "facesDefaut") shells=[] if len(decoupes) > 1: # plusieurs faces de defaut @@ -159,7 +162,7 @@ def creeZoneDefautGeom(objetSain, shapeDefaut, origShapes, verticesShapes, dmoye theFaces[k:k+1] = [] theShell = geompy.MakeShell(aShell) name = "theShell%d"%len(shells) - geompy.addToStudy(theShell,name) + geomPublish(initLog.debug, theShell,name) shells.append(theShell) # distances = [] @@ -175,7 +178,7 @@ def creeZoneDefautGeom(objetSain, shapeDefaut, origShapes, verticesShapes, dmoye subFaces = [facesDefaut] theShellDefaut = geompy.MakeShell(subFaces) if trace: - geompy.addToStudy(theShellDefaut,"theShellDefaut") + geomPublish(initLog.debug, theShellDefaut,"theShellDefaut") theFaces = geompy.ExtractShapes(theShellDefaut, geompy.ShapeType["FACE"], True) distances = [] @@ -188,10 +191,10 @@ def creeZoneDefautGeom(objetSain, shapeDefaut, origShapes, verticesShapes, dmoye centreDefaut = geompy.MakeProjection(centreSphere, theFaces[index]) if trace: - geompy.addToStudy(centreDefaut, "centreDefaut") + geomPublish(initLog.debug, centreDefaut, "centreDefaut") normalDefaut = geompy.GetNormal(subFaces[index], centreDefaut) if trace: - geompy.addToStudy(normalDefaut, "normalDefaut") + geomPublish(initLog.debug, normalDefaut, "normalDefaut") extrusionDefaut = geompy.MakePrismVecH(theShellDefaut, normalDefaut, -lgExtrusion) info = geompy.ShapeInfo(extrusionDefaut) logging.debug("shape info %s", info) @@ -202,6 +205,6 @@ def creeZoneDefautGeom(objetSain, shapeDefaut, origShapes, verticesShapes, dmoye solid0 = geompy.MakeFuse(solid0, solids[i]) extrusionDefaut = solid0 if trace: - geompy.addToStudy(extrusionDefaut, "extrusionDefaut") + geomPublish(initLog.debug, extrusionDefaut, "extrusionDefaut") return facesDefaut, centreDefaut, normalDefaut, extrusionDefaut diff --git a/src/Tools/blocFissure/gmu/extractionOrientee.py b/src/Tools/blocFissure/gmu/extractionOrientee.py index 2ea9e52f9..ec95646de 100644 --- a/src/Tools/blocFissure/gmu/extractionOrientee.py +++ b/src/Tools/blocFissure/gmu/extractionOrientee.py @@ -2,6 +2,9 @@ import logging from geomsmesh import geompy +from geomsmesh import geomPublish +from geomsmesh import geomPublishInFather +import initLog from whichSide import whichSide @@ -32,19 +35,19 @@ def extractionOrientee(face, obj, ref, shapeType, tol, prefix=""): shapesInside.append(shape) if trace: name = prefix + "_Inside%d"%i - geompy.addToStudyInFather(obj, shape, name) + geomPublishInFather(initLog.debug, obj, shape, name) i+=1 elif side == -sideRef: shapesOutside.append(shape) if trace: name = prefix + "_Outside%d"%j - geompy.addToStudyInFather(obj, shape, name) + geomPublishInFather(initLog.debug, obj, shape, name) j+=1 elif side == 0: shapesOnside.append(shape) if trace: name = prefix + "_Onside%d"%k - geompy.addToStudyInFather(obj, shape, name) + geomPublishInFather(initLog.debug, obj, shape, name) k+=1 logging.debug("--- shape was %s", name) return [shapesInside, shapesOutside, shapesOnside] diff --git a/src/Tools/blocFissure/gmu/extractionOrienteeMulti.py b/src/Tools/blocFissure/gmu/extractionOrienteeMulti.py index 86faec83d..0c6457ad3 100644 --- a/src/Tools/blocFissure/gmu/extractionOrienteeMulti.py +++ b/src/Tools/blocFissure/gmu/extractionOrienteeMulti.py @@ -2,6 +2,9 @@ import logging from geomsmesh import geompy +from geomsmesh import geomPublish +from geomsmesh import geomPublishInFather +import initLog from whichSideMulti import whichSideMulti @@ -30,19 +33,19 @@ def extractionOrienteeMulti(faces, ifil, obj, centre, shapeType, tol, prefix="") shapesInside.append(shape) if trace: name = prefix + "_Inside%d"%i - geompy.addToStudyInFather(obj, shape, name) + geomPublishInFather(initLog.debug, obj, shape, name) i+=1 elif side == -1: shapesOutside.append(shape) if trace: name = prefix + "_Outside%d"%j - geompy.addToStudyInFather(obj, shape, name) + geomPublishInFather(initLog.debug, obj, shape, name) j+=1 elif side == 0: shapesOnside.append(shape) if trace: name = prefix + "_Onside%d"%k - geompy.addToStudyInFather(obj, shape, name) + geomPublishInFather(initLog.debug, obj, shape, name) k+=1 logging.debug("--- shape was %s", name) return [shapesInside, shapesOutside, shapesOnside] diff --git a/src/Tools/blocFissure/gmu/facesCirculaires.py b/src/Tools/blocFissure/gmu/facesCirculaires.py index daca717f2..71df8eeb0 100644 --- a/src/Tools/blocFissure/gmu/facesCirculaires.py +++ b/src/Tools/blocFissure/gmu/facesCirculaires.py @@ -2,6 +2,9 @@ import logging from geomsmesh import geompy +from geomsmesh import geomPublish +from geomsmesh import geomPublishInFather +import initLog # ----------------------------------------------------------------------------- # --- TORE @@ -20,10 +23,10 @@ def facesCirculaires(bloc, tore): faces = geompy.GetShapesOnShape(bloc, tore, geompy.ShapeType["FACE"], GEOM.ST_ON) - geompy.addToStudyInFather( tore, faces[0], 'face0' ) - geompy.addToStudyInFather( tore, faces[1], 'face1' ) - geompy.addToStudyInFather( tore, faces[2], 'face2' ) - geompy.addToStudyInFather( tore, faces[3], 'face3' ) + geomPublishInFather(initLog.debug, tore, faces[0], 'face0' ) + geomPublishInFather(initLog.debug, tore, faces[1], 'face1' ) + geomPublishInFather(initLog.debug, tore, faces[2], 'face2' ) + geomPublishInFather(initLog.debug, tore, faces[3], 'face3' ) centres = [None, None, None, None] [v1,centres[0],v3] = geompy.ExtractShapes(faces[0], geompy.ShapeType["VERTEX"], True) @@ -31,10 +34,10 @@ def facesCirculaires(bloc, tore): [v1,centres[2],v3] = geompy.ExtractShapes(faces[2], geompy.ShapeType["VERTEX"], True) [v1,centres[3],v3] = geompy.ExtractShapes(faces[3], geompy.ShapeType["VERTEX"], True) - geompy.addToStudyInFather( faces[0], centres[0], 'centre0' ) - geompy.addToStudyInFather( faces[1], centres[1], 'centre1' ) - geompy.addToStudyInFather( faces[2], centres[2], 'centre2' ) - geompy.addToStudyInFather( faces[3], centres[3], 'centre3' ) + geomPublishInFather(initLog.debug, faces[0], centres[0], 'centre0' ) + geomPublishInFather(initLog.debug, faces[1], centres[1], 'centre1' ) + geomPublishInFather(initLog.debug, faces[2], centres[2], 'centre2' ) + geomPublishInFather(initLog.debug, faces[3], centres[3], 'centre3' ) alledges = [None, None, None, None] alledges[0] = geompy.ExtractShapes(faces[0], geompy.ShapeType["EDGE"], True) @@ -60,7 +63,7 @@ def facesCirculaires(bloc, tore): dicoedge[edgid] = edgesface[j] edges.append(edgesface[j]) named = 'edge_' + str(i) + '_' +str(j) - geompy.addToStudyInFather( faces[i], edgesface[j], named) + geomPublishInFather(initLog.debug, faces[i], edgesface[j], named) vertices = geompy.ExtractShapes(edgesface[j], geompy.ShapeType["VERTEX"], False) #firstVertex = geompy.GetFirstVertex(edgesface[j]) if geompy.GetSubShapeID(tore, vertices[0]) != geompy.GetSubShapeID(tore, centres[i]): diff --git a/src/Tools/blocFissure/gmu/facesFissure.py b/src/Tools/blocFissure/gmu/facesFissure.py index 1cbf8cea4..f1b8dbe40 100644 --- a/src/Tools/blocFissure/gmu/facesFissure.py +++ b/src/Tools/blocFissure/gmu/facesFissure.py @@ -2,6 +2,9 @@ import logging from geomsmesh import geompy +from geomsmesh import geomPublish +from geomsmesh import geomPublishInFather +import initLog # ----------------------------------------------------------------------------- # --- faces fissure dans et hors tore, et edges face hors tore @@ -24,18 +27,18 @@ def facesFissure(blocp, faceFissure, extrusionDefaut, genint): facefissintore = f1 facefissoutore = f0 - geompy.addToStudyInFather(faceFissure, facefissintore,'facefissintore') - geompy.addToStudyInFather(faceFissure, facefissoutore,'facefissoutore') + geomPublishInFather(initLog.debug, faceFissure, facefissintore,'facefissintore') + geomPublishInFather(initLog.debug, faceFissure, facefissoutore,'facefissoutore') edgeint = geompy.GetShapesOnShape(extrusionDefaut, facefissoutore, geompy.ShapeType["EDGE"], GEOM.ST_IN) edgeext = geompy.GetShapesOnShape(extrusionDefaut, facefissoutore, geompy.ShapeType["EDGE"], GEOM.ST_ON) for i in range(len(edgeint)): name = "edgeint_%d"%i - geompy.addToStudyInFather(facefissoutore, edgeint[i],name) + geomPublishInFather(initLog.debug, facefissoutore, edgeint[i],name) for i in range(len(edgeext)): name = "edgeext_%d"%i - geompy.addToStudyInFather(facefissoutore, edgeext[i],name) + geomPublishInFather(initLog.debug, facefissoutore, edgeext[i],name) reverext = [] if len(edgeext) > 1: diff --git a/src/Tools/blocFissure/gmu/facesToreInBloc.py b/src/Tools/blocFissure/gmu/facesToreInBloc.py index 043155426..529216958 100644 --- a/src/Tools/blocFissure/gmu/facesToreInBloc.py +++ b/src/Tools/blocFissure/gmu/facesToreInBloc.py @@ -2,6 +2,9 @@ import logging from geomsmesh import geompy +from geomsmesh import geomPublish +from geomsmesh import geomPublishInFather +import initLog # ----------------------------------------------------------------------------- # --- identification des faces tore et fissure dans le solide hors tore du bloc partitionné @@ -21,9 +24,9 @@ def facesToreInBloc(blocp, facefissoutore, facetore1, facetore2): blocFaceTore1 = geompy.GetInPlaceByHistory(blocp, facetore1) blocFaceTore2 = geompy.GetInPlaceByHistory(blocp, facetore2) - geompy.addToStudyInFather(blocp, blocFaceFiss,'blocFaceFiss') - geompy.addToStudyInFather(blocp, blocFaceTore1,'blocFaceTore1') - geompy.addToStudyInFather(blocp, blocFaceTore2,'blocFaceTore2') + geomPublishInFather(initLog.debug, blocp, blocFaceFiss,'blocFaceFiss') + geomPublishInFather(initLog.debug, blocp, blocFaceTore1,'blocFaceTore1') + geomPublishInFather(initLog.debug, blocp, blocFaceTore2,'blocFaceTore2') return blocFaceFiss, blocFaceTore1, blocFaceTore2 diff --git a/src/Tools/blocFissure/gmu/facesVolumesToriques.py b/src/Tools/blocFissure/gmu/facesVolumesToriques.py index 2ad4dc6e7..6d3434ba1 100644 --- a/src/Tools/blocFissure/gmu/facesVolumesToriques.py +++ b/src/Tools/blocFissure/gmu/facesVolumesToriques.py @@ -2,6 +2,9 @@ import logging from geomsmesh import geompy +from geomsmesh import geomPublish +from geomsmesh import geomPublishInFather +import initLog from extractionOrientee import extractionOrientee from getSubshapeIds import getSubshapeIds @@ -43,11 +46,11 @@ def facesVolumesToriques(tore, plan, facesDefaut): #[facetore1,facetore2] = geompy.GetShapesOnShape(pipe0, tore, geompy.ShapeType["FACE"], GEOM.ST_ON) - geompy.addToStudyInFather( tore, facetore1, 'facetore1' ) - geompy.addToStudyInFather( tore, facetore2, 'facetore2' ) + geomPublishInFather(initLog.debug, tore, facetore1, 'facetore1' ) + geomPublishInFather(initLog.debug, tore, facetore2, 'facetore2' ) [volumeTore1, volumeTore2] = geompy.ExtractShapes(tore, geompy.ShapeType["SOLID"], True) - geompy.addToStudyInFather( tore, volumeTore1, 'volumeTore1' ) - geompy.addToStudyInFather( tore, volumeTore2, 'volumeTore2' ) + geomPublishInFather(initLog.debug, tore, volumeTore1, 'volumeTore1' ) + geomPublishInFather(initLog.debug, tore, volumeTore2, 'volumeTore2' ) return facetore1, facetore2, volumeTore1, volumeTore2 diff --git a/src/Tools/blocFissure/gmu/findWireEndVertices.py b/src/Tools/blocFissure/gmu/findWireEndVertices.py index 1196e28bd..22f4ff014 100644 --- a/src/Tools/blocFissure/gmu/findWireEndVertices.py +++ b/src/Tools/blocFissure/gmu/findWireEndVertices.py @@ -2,6 +2,9 @@ import logging from geomsmesh import geompy +from geomsmesh import geomPublish +from geomsmesh import geomPublishInFather +import initLog # ----------------------------------------------------------------------------- # --- trouver les vertices extremites d'un wire @@ -44,11 +47,11 @@ def findWireEndVertices(aWire, getNormals=False): else: idsubs[subid] = [sub] name='vertex%d'%i - geompy.addToStudyInFather(aWire, sub, name) + geomPublishInFather(initLog.debug, aWire, sub, name) if getNormals: idnorm[subid] = normals[i] name='norm%d'%i - geompy.addToStudyInFather(aWire, normals[i], name) + geomPublishInFather(initLog.debug, aWire, normals[i], name) logging.debug("idsubs: %s", idsubs) for k, v in idsubs.iteritems(): if len(v) == 1: diff --git a/src/Tools/blocFissure/gmu/findWireIntermediateVertices.py b/src/Tools/blocFissure/gmu/findWireIntermediateVertices.py index 3b8b40591..63c884458 100644 --- a/src/Tools/blocFissure/gmu/findWireIntermediateVertices.py +++ b/src/Tools/blocFissure/gmu/findWireIntermediateVertices.py @@ -2,6 +2,9 @@ import logging from geomsmesh import geompy +from geomsmesh import geomPublish +from geomsmesh import geomPublishInFather +import initLog # ----------------------------------------------------------------------------- # --- trouver les vertices intermediaires d'un wire @@ -41,11 +44,11 @@ def findWireIntermediateVertices(aWire, getNormals=False): else: idsubs[subid] = [sub] name='vertex%d'%i - geompy.addToStudyInFather(aWire, sub, name) + geomPublishInFather(initLog.debug, aWire, sub, name) if getNormals: idnorm[subid] = normals[i] name='norm%d'%i - geompy.addToStudyInFather(aWire, normals[i], name) + geomPublishInFather(initLog.debug, aWire, normals[i], name) for k, v in idsubs.iteritems(): if len(v) > 1: shortList.append(v[0]) diff --git a/src/Tools/blocFissure/gmu/fissureCoude.py b/src/Tools/blocFissure/gmu/fissureCoude.py index fdeb69ab2..bf8e0e639 100644 --- a/src/Tools/blocFissure/gmu/fissureCoude.py +++ b/src/Tools/blocFissure/gmu/fissureCoude.py @@ -1,6 +1,9 @@ # -*- coding: utf-8 -*- from geomsmesh import geompy, smesh +from geomsmesh import geomPublish +from geomsmesh import geomPublishInFather +import initLog import math import GEOM @@ -69,22 +72,22 @@ class fissureCoude(fissureGenerique): Rotation_2 = geompy.MakeRotation(OZ, OY, angleCoude*math.pi/180.0) tube_2 = geompy.MakePrismVecH(Rotation_1, Rotation_2, -l_tube_p2) plan_y = geompy.MakePlaneLCS(None, 100000, 3) - geompy.addToStudy( plan_y, "plan_y" ) - geompy.addToStudy( tube_1, "tube_1" ) - geompy.addToStudy( coude, "coude" ) - geompy.addToStudy( tube_2, "tube_2" ) + geomPublish(initLog.debug, plan_y, "plan_y" ) + geomPublish(initLog.debug, tube_1, "tube_1" ) + geomPublish(initLog.debug, coude, "coude" ) + geomPublish(initLog.debug, tube_2, "tube_2" ) P1 = O - geompy.addToStudy( P1, "P1" ) + geompy.addToStudy(P1, "P1" ) op2 = geompy.MakeVertex(0, 0, -l_tube_p1) P2 = geompy.MakeRotation(op2, axe, angleCoude*math.pi/180.0) P2 = geompy.MakeTranslationVectorDistance(P2, Rotation_2, -l_tube_p2) - geompy.addToStudy( P2, "P2" ) + geompy.addToStudy(P2, "P2" ) # --- tube coude sain geometrieSaine = geompy.MakePartition([tube_1, coude, tube_2, P1, P2], [plan_y], [], [], geompy.ShapeType["SOLID"], 0, [], 1) - geompy.addToStudy( geometrieSaine, self.nomCas ) + geomPublish(initLog.debug, geometrieSaine, self.nomCas ) [P1, P2] = geompy.RestoreGivenSubShapes(geometrieSaine, [P1, P2], GEOM.FSM_GetInPlaceByHistory, False, True) xmin = -de -r_cintr -l_tube_p2 @@ -123,19 +126,19 @@ class fissureCoude(fissureGenerique): grped = geompy.CutGroups(grpedy0, long_p1) grped = geompy.CutGroups(grped, long_p2) ep = geompy.CutGroups(grped, long_coude) - geompy.addToStudyInFather( geometrieSaine, long_p1, 'long_p1' ) - geompy.addToStudyInFather( geometrieSaine, ep, 'ep' ) - geompy.addToStudyInFather( geometrieSaine, long_coude, 'long_coude' ) - geompy.addToStudyInFather( geometrieSaine, circ_g, 'circ_g' ) - geompy.addToStudyInFather( geometrieSaine, circ_d, 'circ_d' ) - geompy.addToStudyInFather( geometrieSaine, long_p2, 'long_p2' ) + geomPublishInFather(initLog.debug, geometrieSaine, long_p1, 'long_p1' ) + geomPublishInFather(initLog.debug, geometrieSaine, ep, 'ep' ) + geomPublishInFather(initLog.debug, geometrieSaine, long_coude, 'long_coude' ) + geomPublishInFather(initLog.debug, geometrieSaine, circ_g, 'circ_g' ) + geomPublishInFather(initLog.debug, geometrieSaine, circ_d, 'circ_d' ) + geomPublishInFather(initLog.debug, geometrieSaine, long_p2, 'long_p2' ) # --- face extremite tube (EXTUBE) facesIds = geompy.GetShapesOnPlaneIDs(geometrieSaine, geompy.ShapeType["FACE"], OZ, GEOM.ST_ON) EXTUBE = geompy.CreateGroup(geometrieSaine, geompy.ShapeType["FACE"]) geompy.UnionIDs(EXTUBE, facesIds) - geompy.addToStudyInFather( geometrieSaine, EXTUBE, 'EXTUBE' ) + geomPublishInFather(initLog.debug, geometrieSaine, EXTUBE, 'EXTUBE' ) # --- edge bord extremite tube (BORDTU) @@ -147,17 +150,17 @@ class fissureCoude(fissureGenerique): edgesIds.append(edge) BORDTU = geompy.CreateGroup(geometrieSaine, geompy.ShapeType["EDGE"]) geompy.UnionIDs(BORDTU, edgesIds) - geompy.addToStudyInFather( geometrieSaine, BORDTU, 'BORDTU' ) + geomPublishInFather(initLog.debug, geometrieSaine, BORDTU, 'BORDTU' ) # --- face origine tube (CLGV) pp2 = geompy.MakeTranslationVectorDistance(P2, Rotation_2, 10) vec2 = geompy.MakeVector(P2, pp2) - #geompy.addToStudy(vec2, 'vec2') + #geomPublish(initLog.debug, vec2, 'vec2') facesIds = geompy.GetShapesOnPlaneIDs(geometrieSaine, geompy.ShapeType["FACE"], vec2, GEOM.ST_ON) CLGV = geompy.CreateGroup(geometrieSaine, geompy.ShapeType["FACE"]) geompy.UnionIDs(CLGV, facesIds) - geompy.addToStudyInFather( geometrieSaine, CLGV, 'CLGV' ) + geomPublishInFather(initLog.debug, geometrieSaine, CLGV, 'CLGV' ) # --- peau tube interieur (PEAUINT) @@ -167,11 +170,11 @@ class fissureCoude(fissureGenerique): extru2 = geompy.MakePrismVecH(rot1, Rotation_2, -l_tube_p2) interne = geompy.MakeFuse(extru1, revol1) interne = geompy.MakeFuse(extru2, interne) - geompy.addToStudy(interne, 'interne') + geomPublish(initLog.debug, interne, 'interne') facesIds = geompy.GetShapesOnShapeIDs(interne, geometrieSaine, geompy.ShapeType["FACE"], GEOM.ST_ONIN) PEAUINT = geompy.CreateGroup(geometrieSaine, geompy.ShapeType["FACE"]) geompy.UnionIDs(PEAUINT, facesIds) - geompy.addToStudyInFather( geometrieSaine, PEAUINT, 'PEAUINT' ) + geomPublishInFather(initLog.debug, geometrieSaine, PEAUINT, 'PEAUINT' ) # --- peau tube exterieur (PEAUEXT) @@ -182,18 +185,18 @@ class fissureCoude(fissureGenerique): extru2 = geompy.MakePrismVecH(rot1, Rotation_2, -l_tube_p2) externe = geompy.MakeFuse(extru1, revol1) externe = geompy.MakeFuse(extru2, externe) - geompy.addToStudy(externe, 'externe') + geomPublish(initLog.debug, externe, 'externe') facesIds = geompy.GetShapesOnShapeIDs(externe, geometrieSaine, geompy.ShapeType["FACE"], GEOM.ST_ON) PEAUEXT = geompy.CreateGroup(geometrieSaine, geompy.ShapeType["FACE"]) geompy.UnionIDs(PEAUEXT, facesIds) - geompy.addToStudyInFather( geometrieSaine, PEAUEXT, 'PEAUEXT' ) + geomPublishInFather(initLog.debug, geometrieSaine, PEAUEXT, 'PEAUEXT' ) # --- solide sain volIds = geompy.SubShapeAllIDs(geometrieSaine, geompy.ShapeType["SOLID"]) COUDE = geompy.CreateGroup(geometrieSaine, geompy.ShapeType["SOLID"]) geompy.UnionIDs(COUDE, volIds) - geompy.addToStudyInFather( geometrieSaine, COUDE, 'COUDSAIN' ) + geomPublishInFather(initLog.debug, geometrieSaine, COUDE, 'COUDSAIN' ) geometriesSaines = [geometrieSaine, long_p1, ep, long_coude, circ_g, circ_d, long_p2, P1, P2, EXTUBE, BORDTU, CLGV, PEAUINT, PEAUEXT, COUDE] @@ -340,7 +343,7 @@ class fissureCoude(fissureGenerique): azimut = -azimut # axe inverse / ASCOUF axe = geompy.MakeTranslation(OY, -r_cintr, 0, -l_tube_p1) - geompy.addToStudy(axe,"axe") + geomPublish(initLog.debug, axe,"axe") if not lgInfluence: lgInfluence = profondeur @@ -377,8 +380,8 @@ class fissureCoude(fissureGenerique): pi = geompy.MakeVertex(rayint, 0, 0) pbl = geompy.MakeRotation(pb, OZ, angle) pbr = geompy.MakeRotation(pb, OZ, -angle) - geompy.addToStudy(pbl,"pbl") - geompy.addToStudy(pbr,"pbr") + geomPublish(initLog.debug, pbl,"pbl") + geomPublish(initLog.debug, pbr,"pbr") pal = geompy.MakeTranslationVector(pbl, OZ) par = geompy.MakeTranslationVector(pbr, OZ) axl = geompy.MakeVector(pbl,pal) @@ -409,7 +412,7 @@ class fissureCoude(fissureGenerique): wire2 = geompy.MakeInterpol(points[2*nbp:3*nbp+1]) #wiretube = geompy.MakeInterpol(points) wiretube=geompy.MakeWire([wire0,wire1,wire2]) - geompy.addToStudy(wiretube,"wiretube") + geomPublish(initLog.debug, wiretube,"wiretube") pe = geompy.MakeVertex(rayext, 0, 0) pe = geompy.MakeRotation(pe, OZ, azimut*math.pi/180.) @@ -417,22 +420,22 @@ class fissureCoude(fissureGenerique): pe = geompy.MakeRotation(pe, axe, alpha*math.pi/180.) arce = geompy.MakeArc(points[0], pe, points[-1]) - geompy.addToStudy(arce,"arce") + geomPublish(initLog.debug, arce,"arce") facefiss = geompy.MakeFaceWires([arce, wiretube], 1) - geompy.addToStudy( facefiss, 'facefissPlace' ) + 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.) - geompy.addToStudy( centre, 'centrefissPlace' ) + geomPublish(initLog.debug, centre, 'centrefissPlace' ) wiretube = geompy.GetInPlace(facefiss, wiretube) - geompy.addToStudy(wiretube, 'wiretubePlace' ) + geomPublish(initLog.debug, wiretube, 'wiretubePlace' ) try: edgetube = geompy.MakeEdgeWire(wiretube) - geompy.addToStudy(edgetube,"edgetube") + geomPublish(initLog.debug, edgetube,"edgetube") except: logging.debug("erreur MakeEdgeWire sur fond de fissure, on fait sans") edgetube = None @@ -485,10 +488,10 @@ class fissureCoude(fissureGenerique): points.append(pt) curves.append(geompy.MakeInterpol(points)) point0 = points[0] - geompy.addToStudy(curves[-1],"curve0") + geomPublish(initLog.debug, curves[-1],"curve0") # for i, pt in enumerate(points): # name = "point%d"%i -# geompy.addToStudyInFather(curves[-1], pt, name) +# geomPublishInFather(initLog.debug,curves[-1], pt, name) points = [] nbp = 3*nbp1 @@ -506,10 +509,10 @@ class fissureCoude(fissureGenerique): pt = geompy.MakeRotation(pi, axe, angi) points.append(pt) curves.append(geompy.MakeInterpol(points)) - geompy.addToStudy(curves[-1],"curve1") + geomPublish(initLog.debug, curves[-1],"curve1") # for i, pt in enumerate(points): # name = "point%d"%i -# geompy.addToStudyInFather(curves[-1], pt, name) +# geomPublishInFather(initLog.debug,curves[-1], pt, name) points = [] nbp = 3*nbp1 @@ -529,16 +532,16 @@ class fissureCoude(fissureGenerique): points.append(pt) curves.append(geompy.MakeInterpol(points)) point1 = points[-1] - geompy.addToStudy(curves[-1],"curve2") + geomPublish(initLog.debug, curves[-1],"curve2") # for i, pt in enumerate(points): # name = "point%d"%i -# geompy.addToStudyInFather(curves[-1], pt, name) +# geomPublishInFather(initLog.debug,curves[-1], pt, name) wiretube = geompy.MakeWire(curves) - geompy.addToStudy(wiretube,"wiretube") + geomPublish(initLog.debug, wiretube,"wiretube") try: edgetube = geompy.MakeEdgeWire(wiretube) - geompy.addToStudy(edgetube,"edgetube") + geomPublish(initLog.debug, edgetube,"edgetube") except: logging.debug("erreur MakeEdgeWire sur fond de fissure, on fait sans") edgetube = None @@ -553,21 +556,21 @@ class fissureCoude(fissureGenerique): pts.append(pt) pts.append(point1) arce = geompy.MakeInterpol(pts) - geompy.addToStudy(arce,"arce") + geomPublish(initLog.debug, arce,"arce") facefiss = geompy.MakeFaceWires([arce, wiretube], 0) - geompy.addToStudy( facefiss, 'facefissPlace' ) + geomPublish(initLog.debug, facefiss, 'facefissPlace' ) pc = geompy.MakeTranslation(pb, 0.5*prof*cosaz, 0.5*prof*sinaz, 0.) centre = geompy.MakeRotation(pc, axe, alfrd) - geompy.addToStudy( centre, 'centrefissPlace' ) + 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 wiretube = geompy.MakeWire(edges) #wiretube = edgesTriees[-1] - geompy.addToStudy(wiretube, 'wiretubePlace' ) + geomPublish(initLog.debug, wiretube, 'wiretubePlace' ) # --------------------------------------------------------- @@ -612,7 +615,7 @@ class fissureCoude(fissureGenerique): arci = geompy.MakePosition(arco, originLCS, localLCS, "arci") arce = geompy.MakePosition(lino, originLCS, localLCS, "arce") facefiss = geompy.MakeFaceWires([arce, arci], 0) - geompy.addToStudy( facefiss, 'facefissPlace' ) + geomPublish(initLog.debug, facefiss, 'facefissPlace' ) edges = geompy.ExtractShapes(facefiss, geompy.ShapeType["EDGE"], True) edgesTriees, minl, maxl = sortEdges(edges) edgetube = edgesTriees[-1] # la plus grande correspond à arci @@ -620,7 +623,7 @@ class fissureCoude(fissureGenerique): pc = geompy.MakeTranslation(pb, 0.5*prof*cosaz, 0.5*prof*sinaz, 0.) centre = geompy.MakeRotation(pc, axe, alfrd) - geompy.addToStudy( centre, 'centrefissPlace' ) + geomPublish(initLog.debug, centre, 'centrefissPlace' ) coordsNoeudsFissure = genereMeshCalculZoneDefaut(facefiss, profondeur/2. ,profondeur) diff --git a/src/Tools/blocFissure/gmu/fusionMaillageAttributionDefaut.py b/src/Tools/blocFissure/gmu/fusionMaillageAttributionDefaut.py index 89fef3ae5..703c02447 100644 --- a/src/Tools/blocFissure/gmu/fusionMaillageAttributionDefaut.py +++ b/src/Tools/blocFissure/gmu/fusionMaillageAttributionDefaut.py @@ -8,6 +8,9 @@ Created on Tue Jun 24 09:14:13 2014 import logging from geomsmesh import geompy from geomsmesh import smesh +from geomsmesh import geomPublish +from geomsmesh import geomPublishInFather +import initLog import GEOM import SMESH @@ -49,19 +52,19 @@ def fusionMaillageDefaut(maillageSain, maillageDefautCible, maillageInterneCible # on recrée un objet GEOM temporaire par filling. filling = geompy.MakeFilling(geompy.MakeCompound(setOfLines), 2, 5, 0.0001, 0.0001, 0, GEOM.FOM_Default, True) #logging.debug("face de filling") - #geompy.addToStudy(filling, 'filling_{0}'.format(i + 1)) + #geomPublish(initLog.debug, filling, 'filling_{0}'.format(i + 1)) tmpPartition = geompy.MakePartition([filling], [shapeDefaut], [], [], geompy.ShapeType["FACE"], 0, [], 0) tmpExplodeRef = geompy.ExtractShapes(filling, geompy.ShapeType["EDGE"], True) tmpExplodeNum = geompy.ExtractShapes(tmpPartition, geompy.ShapeType["EDGE"], True) if len(tmpExplodeRef) == len(tmpExplodeNum): logging.debug("face de filling non coupee") - geompy.addToStudy(filling, "faceNonCoupee_{0}".format(i + 1)) + geompy.addToStudy( filling, "faceNonCoupee_{0}".format(i + 1)) # doit etre publie pour critere OK plus bas facesNonCoupees.append(filling) maillagesNonCoupes.append(listOfNewMeshes[i]) else: logging.debug("face de filling coupee") - geompy.addToStudy(filling, "faceCoupee_{0}".format(i + 1)) + geompy.addToStudy( filling, "faceCoupee_{0}".format(i + 1)) facesCoupees.append(filling) maillagesCoupes.append(listOfNewMeshes[i]) diff --git a/src/Tools/blocFissure/gmu/genereElemsFissureElliptique.py b/src/Tools/blocFissure/gmu/genereElemsFissureElliptique.py index bbf939417..62be40c77 100644 --- a/src/Tools/blocFissure/gmu/genereElemsFissureElliptique.py +++ b/src/Tools/blocFissure/gmu/genereElemsFissureElliptique.py @@ -2,6 +2,9 @@ import logging from geomsmesh import geompy +from geomsmesh import geomPublish +from geomsmesh import geomPublishInFather +import initLog from toreFissure import toreFissure from ellipsoideDefaut import ellipsoideDefaut @@ -40,12 +43,12 @@ def genereElemsFissureElliptique(shapeFissureParams): plane1 = rotTrans(Plane_1, orientation, centreDefaut, vecteurDefaut) ellipsoide1 = rotTrans(ellipsoide, orientation, centreDefaut, vecteurDefaut) - geompy.addToStudy( pipe0, 'pipe0' ) - geompy.addToStudy( gener1, 'gener1' ) - geompy.addToStudy( pipe1, 'pipe1' ) - geompy.addToStudy( facefis1, 'facefis1' ) - geompy.addToStudy( plane1, 'plane1' ) - geompy.addToStudy( ellipsoide1, 'ellipsoide1' ) + geomPublish(initLog.debug, pipe0, 'pipe0' ) + geomPublish(initLog.debug, gener1, 'gener1' ) + geomPublish(initLog.debug, pipe1, 'pipe1' ) + geomPublish(initLog.debug, facefis1, 'facefis1' ) + geomPublish(initLog.debug, plane1, 'plane1' ) + geomPublish(initLog.debug, ellipsoide1, 'ellipsoide1' ) shapeDefaut = facefis1 xyz_defaut = geompy.PointCoordinates(centreDefaut) diff --git a/src/Tools/blocFissure/gmu/getCentreFondFiss.py b/src/Tools/blocFissure/gmu/getCentreFondFiss.py index f8f53d7ba..52f1f3bd9 100644 --- a/src/Tools/blocFissure/gmu/getCentreFondFiss.py +++ b/src/Tools/blocFissure/gmu/getCentreFondFiss.py @@ -2,6 +2,9 @@ import logging from geomsmesh import geompy +from geomsmesh import geomPublish +from geomsmesh import geomPublishInFather +import initLog import bisect publie = False @@ -35,7 +38,7 @@ def getCentreFondFiss(shapesFissure): edgeFondExt = fondFiss aWire = geompy.MakeWire([fondFiss], 1e-07) if not publie: - geompy.addToStudy(aWire, "wireFondFissExt") + geomPublish(initLog.debug, aWire, "wireFondFissExt") lgWire = geompy.BasicProperties(aWire)[0] edges = geompy.ExtractShapes(aWire, geompy.ShapeType["EDGE"], True) @@ -61,7 +64,7 @@ def getCentreFondFiss(shapesFissure): centreFondFiss = geompy.MakeVertexOnCurve(edges[iedr], 1.0 - lgOnEdge/lgEdges[iedr]) else: # on ne sait pas comment est orientée l'edge unique, mais ça n'a pas d'importance centreFondFiss = geompy.MakeVertexOnCurve(edges[iedr], lgOnEdge/lgEdges[iedr]) - geompy.addToStudyInFather(aWire, centreFondFiss, "centreFondFiss") + geomPublishInFather(initLog.debug,aWire, centreFondFiss, "centreFondFiss") tgtCentre = geompy.MakeTangentOnCurve(edges[iedr], lgOnEdge/ lgEdges[iedr]) if edgeFondExt is None: # fond de fissure non fourni explicitement sous forme d'edge @@ -71,7 +74,7 @@ def getCentreFondFiss(shapesFissure): logging.debug("erreur MakeEdgeWire sur fond de fissure, on fait sans") edgeFondExt = None if not publie and edgeFondExt is not None: - geompy.addToStudy(edgeFondExt, "edgeFondExt") + geomPublish(initLog.debug, edgeFondExt, "edgeFondExt") publie = True return edgeFondExt, centreFondFiss, tgtCentre diff --git a/src/Tools/blocFissure/gmu/identifieElementsDebouchants.py b/src/Tools/blocFissure/gmu/identifieElementsDebouchants.py index 4f6de333c..af485444e 100644 --- a/src/Tools/blocFissure/gmu/identifieElementsDebouchants.py +++ b/src/Tools/blocFissure/gmu/identifieElementsDebouchants.py @@ -4,6 +4,9 @@ import logging import math from geomsmesh import geompy +from geomsmesh import geomPublish +from geomsmesh import geomPublishInFather +import initLog from produitMixte import produitMixte from whichSide import whichSide @@ -29,7 +32,7 @@ def identifieElementsDebouchants(ifil, facesDefaut, partitionPeauFissFond, #logging.debug("edgesFondIn %s", edgesFondIn) for iedf, edge in enumerate(edgesFondIn): name = "edgeFondIn%d"%iedf - geompy.addToStudyInFather(partitionPeauFissFond, edge, name) + geomPublishInFather(initLog.debug, partitionPeauFissFond, edge, name) dist = [ geompy.MinDistance(pt, edge) for pt in verticesPipePeau] ptPeau = verticesPipePeau[dist.index(min(dist))] # le point de verticesPipePeau a distance minimale de l'edge [u, PointOnEdge, EdgeInWireIndex] = geompy.MakeProjectionOnWire(ptPeau, wireFondFiss) @@ -37,14 +40,14 @@ def identifieElementsDebouchants(ifil, facesDefaut, partitionPeauFissFond, localEdgeInFondFiss = edgesFondFiss[EdgeInWireIndex] centre = PointOnEdge centre2 = geompy.MakeVertexOnCurve(localEdgeInFondFiss, u) - geompy.addToStudyInFather(partitionPeauFissFond, centre2, "centre2_%d"%iedf) + geomPublishInFather(initLog.debug, partitionPeauFissFond, centre2, "centre2_%d"%iedf) verticesEdgesFondIn.append(centre) name = "verticeEdgesFondIn%d"%iedf - geompy.addToStudyInFather(partitionPeauFissFond, centre, name) + geomPublishInFather(initLog.debug, partitionPeauFissFond, centre, name) norm = geompy.MakeTangentOnCurve(localEdgeInFondFiss, u) - geompy.addToStudyInFather(partitionPeauFissFond, centre, "norm%d"%iedf) + geomPublishInFather(initLog.debug, partitionPeauFissFond, centre, "norm%d"%iedf) cercle = geompy.MakeCircle(centre, norm, rayonPipe) - geompy.addToStudyInFather(partitionPeauFissFond, cercle, "cerclorig%d"%iedf) + geomPublishInFather(initLog.debug, partitionPeauFissFond, cercle, "cerclorig%d"%iedf) [vertex] = geompy.ExtractShapes(cercle, geompy.ShapeType["VERTEX"], False) vec1 = geompy.MakeVector(centre, vertex) vec2 = geompy.MakeVector(centre, ptPeau) @@ -66,7 +69,7 @@ def identifieElementsDebouchants(ifil, facesDefaut, partitionPeauFissFond, else: cercle = geompy.MakeRotation(cercle, norm, -angle + math.pi) name = "cercle%d"%iedf - geompy.addToStudyInFather(partitionPeauFissFond, cercle, name) + geomPublishInFather(initLog.debug,partitionPeauFissFond, cercle, name) cercles.append(cercle) # --- estimation de la longueur du pipe necessaire de part et d'autre du point de sortie @@ -95,8 +98,8 @@ def identifieElementsDebouchants(ifil, facesDefaut, partitionPeauFissFond, logging.debug("distance curviligne centre extremite0: %s", ofp) p1 = geompy.MakeVertexOnCurveByLength(localEdgeInFondFiss, ofp +lgp, locPt0) p2 = geompy.MakeVertexOnCurveByLength(localEdgeInFondFiss, ofp -lgp, locPt0) - geompy.addToStudyInFather(wireFondFiss, p1, "p1_%d"%iedf) - geompy.addToStudyInFather(wireFondFiss, p2, "p2_%d"%iedf) + geomPublishInFather(initLog.debug, wireFondFiss, p1, "p1_%d"%iedf) + geomPublishInFather(initLog.debug, wireFondFiss, p2, "p2_%d"%iedf) edgePart = geompy.MakePartition([localEdgeInFondFiss], [p1,p2], [], [], geompy.ShapeType["EDGE"], 0, [], 0) edps = geompy.ExtractShapes(edgePart, geompy.ShapeType["EDGE"], True) @@ -104,7 +107,7 @@ def identifieElementsDebouchants(ifil, facesDefaut, partitionPeauFissFond, if geompy.MinDistance(centre, edp) < 1.e-3: pipext = geompy.MakePipe(cercle, edp) name = "pipeExt%d"%iedf - geompy.addToStudyInFather(partitionPeauFissFond, pipext, name) + geomPublishInFather(initLog.debug, partitionPeauFissFond, pipext, name) pipexts.append(pipext) for ifa, face in enumerate(facesInside): @@ -129,7 +132,7 @@ def identifieElementsDebouchants(ifil, facesDefaut, partitionPeauFissFond, logging.debug(" face %s inside ajoutée", ifa) facesFissExt.append(face) name="faceFissExt%d"%iedf - geompy.addToStudyInFather(partitionPeauFissFond, face, name) + geomPublishInFather(initLog.debug, partitionPeauFissFond, face, name) dist = 1. for ipe, edpe in enumerate(edgesPeauFis): for ipi, edpi in enumerate(edgesPipeFis): @@ -137,10 +140,10 @@ def identifieElementsDebouchants(ifil, facesDefaut, partitionPeauFissFond, if dist < 1.e-3: edgesFissExtPeau.append(edpe) name="edgesFissExtPeau%d"%iedf - geompy.addToStudyInFather(partitionPeauFissFond, edpe, name) + geomPublishInFather(initLog.debug, partitionPeauFissFond, edpe, name) edgesFissExtPipe.append(edpi) name="edgesFissExtPipe%d"%iedf - geompy.addToStudyInFather(partitionPeauFissFond, edpi, name) + geomPublishInFather(initLog.debug, partitionPeauFissFond, edpi, name) break if dist < 1.e-3: break diff --git a/src/Tools/blocFissure/gmu/identifieElementsFissure.py b/src/Tools/blocFissure/gmu/identifieElementsFissure.py index e88624034..fcad8c519 100644 --- a/src/Tools/blocFissure/gmu/identifieElementsFissure.py +++ b/src/Tools/blocFissure/gmu/identifieElementsFissure.py @@ -3,6 +3,10 @@ import logging from geomsmesh import geompy +from geomsmesh import geomPublish +from geomsmesh import geomPublishInFather +import initLog + from extractionOrientee import extractionOrientee from extractionOrienteeMulti import extractionOrienteeMulti @@ -19,9 +23,9 @@ def identifieElementsFissure(ifil, facesDefaut, partitionPeauFissFond, logging.info('start') edgesPipeC = geompy.GetInPlace(partitionPeauFissFond, geompy.MakeCompound(edgesPipeFiss)) - geompy.addToStudyInFather(partitionPeauFissFond, edgesPipeC, "edgesPipeFiss") + geomPublishInFather(initLog.debug, partitionPeauFissFond, edgesPipeC, "edgesPipeFiss") edgesFondC = geompy.GetInPlace(partitionPeauFissFond, geompy.MakeCompound(edgesFondFiss)) - geompy.addToStudyInFather(partitionPeauFissFond, edgesFondC, "edgesFondFiss") + geomPublishInFather(initLog.debug, partitionPeauFissFond, edgesFondC, "edgesFondFiss") if aretesVivesC is None: [edgesInside, edgesOutside, edgesOnside] = extractionOrientee(fillingFaceExterne, partitionPeauFissFond, centreFondFiss, "EDGE", 1.e-3) @@ -38,9 +42,9 @@ def identifieElementsFissure(ifil, facesDefaut, partitionPeauFissFond, vertices = geompy.GetSharedShapesMulti([edge, geompy.MakeCompound(facesOnside)], geompy.ShapeType["VERTEX"]) verticesPipePeau.append(vertices[0]) name = "edgePipeIn%d"%i - geompy.addToStudyInFather(partitionPeauFissFond, edge, name) + geomPublishInFather(initLog.debug, partitionPeauFissFond, edge, name) name = "verticePipePeau%d"%i - geompy.addToStudyInFather(partitionPeauFissFond, vertices[0], name) + geomPublishInFather(initLog.debug, partitionPeauFissFond, vertices[0], name) logging.debug("edgePipeIn%s coupe les faces OnSide", i) except: logging.debug("edgePipeIn%s ne coupe pas les faces OnSide", i) diff --git a/src/Tools/blocFissure/gmu/identifieFacesEdgesFissureExterne.py b/src/Tools/blocFissure/gmu/identifieFacesEdgesFissureExterne.py index 856cfae48..12efab46c 100644 --- a/src/Tools/blocFissure/gmu/identifieFacesEdgesFissureExterne.py +++ b/src/Tools/blocFissure/gmu/identifieFacesEdgesFissureExterne.py @@ -3,6 +3,9 @@ import logging from geomsmesh import geompy +from geomsmesh import geomPublish +from geomsmesh import geomPublishInFather +import initLog def identifieFacesEdgesFissureExterne(fsFissuExt, edFisExtPe, edFisExtPi, edgesPipeFiss): """ @@ -42,8 +45,8 @@ def identifieFacesEdgesFissureExterne(fsFissuExt, edFisExtPe, edFisExtPi, edgesP edgesPeauFissureExterneC = geompy.MakeCompound(edgesFissExtPeau) edgesPipeFissureExterneC = geompy.MakeCompound(edgesFissExtPipe) wirePipeFissureExterne = geompy.MakeWire(geompy.ExtractShapes(edgesPipeFissureExterneC, geompy.ShapeType["EDGE"], False)) - geompy.addToStudy(faceFissureExterne, "faceFissureExterne") - geompy.addToStudyInFather(faceFissureExterne, edgesPeauFissureExterneC, "edgesPeauFissureExterne") - geompy.addToStudyInFather(faceFissureExterne, edgesPipeFissureExterneC, "edgesPipeFissureExterne") + geomPublish(initLog.debug, faceFissureExterne, "faceFissureExterne") + geomPublishInFather(initLog.debug, faceFissureExterne, edgesPeauFissureExterneC, "edgesPeauFissureExterne") + geomPublishInFather(initLog.debug, faceFissureExterne, edgesPipeFissureExterneC, "edgesPipeFissureExterne") return (faceFissureExterne, edgesPipeFissureExterneC, wirePipeFissureExterne, edgesPeauFissureExterneC) \ No newline at end of file diff --git a/src/Tools/blocFissure/gmu/identifieFacesPeau.py b/src/Tools/blocFissure/gmu/identifieFacesPeau.py index 693586b8f..a8917ad78 100644 --- a/src/Tools/blocFissure/gmu/identifieFacesPeau.py +++ b/src/Tools/blocFissure/gmu/identifieFacesPeau.py @@ -3,6 +3,9 @@ import logging from geomsmesh import geompy +from geomsmesh import geomPublish +from geomsmesh import geomPublishInFather +import initLog from sortFaces import sortFaces from extractionOrientee import extractionOrientee @@ -62,7 +65,7 @@ def identifieFacesPeau(ifil, verticesPipePeau, facesOnside, wireFondFiss, pass name="partitionPeauByPipe%d"%ifil - geompy.addToStudy(partitionPeauByPipe, name) + geomPublish(initLog.debug, partitionPeauByPipe, name) [edgesPeauFondIn, edgesPeauFondOut, edgesPeauFondOn] = extractionOrientee(fillingFaceExterne, partitionPeauByPipe, centreFondFiss, "EDGE", 1.e-3) [facesPeauFondIn, facesPeauFondOut, facesPeauFondOn] = extractionOrientee(fillingFaceExterne, partitionPeauByPipe, centreFondFiss, "FACE", 1.e-3) @@ -73,6 +76,6 @@ def identifieFacesPeau(ifil, verticesPipePeau, facesOnside, wireFondFiss, facePeau =geompy.MakePartition(facesPeauFondOn, [], [], [], geompy.ShapeType["FACE"], 0, [], 1) facesPeauSorted = [facePeau] name="facePeau%d"%ifil - geompy.addToStudy(facePeau, name) + geomPublish(initLog.debug, facePeau, name) return (facePeau, facesPeauSorted, edgesPeauFondIn) \ No newline at end of file diff --git a/src/Tools/blocFissure/gmu/insereFissureElliptique.py b/src/Tools/blocFissure/gmu/insereFissureElliptique.py index 95d4a6279..ede20b48c 100644 --- a/src/Tools/blocFissure/gmu/insereFissureElliptique.py +++ b/src/Tools/blocFissure/gmu/insereFissureElliptique.py @@ -3,6 +3,9 @@ import logging import salome from geomsmesh import geompy +from geomsmesh import geomPublish +from geomsmesh import geomPublishInFather +import initLog from geomsmesh import smesh import SMESH import math @@ -98,12 +101,12 @@ def insereFissureElliptique(geometriesSaines, maillagesSains, #plane1 = self.rotTrans(Plane_1, orientation, centreDefaut, normalDefaut) #ellipsoide1 = self.rotTrans(ellipsoide, orientation, centreDefaut, normalDefaut) - #geompy.addToStudy( pipe0, 'pipe0' ) - #geompy.addToStudy( gener1, 'gener1' ) - #geompy.addToStudy( pipe1, 'pipe1' ) - #geompy.addToStudy( facefis1, 'facefis1' ) - #geompy.addToStudy( plane1, 'plane1' ) - #geompy.addToStudy( ellipsoide1, 'ellipsoide1' ) + #geomPublish(initLog.debug, pipe0, 'pipe0' ) + #geomPublish(initLog.debug, gener1, 'gener1' ) + #geomPublish(initLog.debug, pipe1, 'pipe1' ) + #geomPublish(initLog.debug, facefis1, 'facefis1' ) + #geomPublish(initLog.debug, plane1, 'plane1' ) + #geomPublish(initLog.debug, ellipsoide1, 'ellipsoide1' ) # --- partition du bloc défaut par génératrice, tore et plan fissure if step == 7: diff --git a/src/Tools/blocFissure/gmu/insereFissureGenerale.py b/src/Tools/blocFissure/gmu/insereFissureGenerale.py index e3816ab85..96c733e1e 100644 --- a/src/Tools/blocFissure/gmu/insereFissureGenerale.py +++ b/src/Tools/blocFissure/gmu/insereFissureGenerale.py @@ -3,6 +3,9 @@ import logging import salome from geomsmesh import geompy +from geomsmesh import geomPublish +from geomsmesh import geomPublishInFather +import initLog import GEOM from geomsmesh import smesh from salome.smesh import smeshBuilder @@ -105,7 +108,7 @@ def insereFissureGenerale(maillagesSains, # partition face fissure étendue par fillings, on garde la plus grande face partShapeDefaut = geompy.MakePartition([shapeDefaut], facesDefaut, [], [], geompy.ShapeType["FACE"], 0, [], 0) - geompy.addToStudy(partShapeDefaut, 'partShapeDefaut') + geomPublish(initLog.debug, partShapeDefaut, 'partShapeDefaut') facesPartShapeDefaut = geompy.ExtractShapes(partShapeDefaut, geompy.ShapeType["FACE"], False) if isPointInterne: distfaces = [(geompy.MinDistance(face,pointInterne), i, face) for i, face in enumerate(facesPartShapeDefaut)] @@ -117,7 +120,7 @@ def insereFissureGenerale(maillagesSains, logging.debug("surfaces faces fissure étendue, min %s, max %s", minSurf, maxSurf) facesPortFissure = facesPartShapeDefautSorted[-1] #= global - geompy.addToStudy(facesPortFissure, "facesPortFissure") + geomPublish(initLog.debug, facesPortFissure, "facesPortFissure") O, OX, OY, OZ = triedreBase() @@ -129,42 +132,42 @@ def insereFissureGenerale(maillagesSains, plan = geompy.MakePlane(centreFondFiss, tgtCentre, 10000) shapeDefaut = geompy.MakePartition([shapeDefaut], [plan], [], [], geompy.ShapeType["FACE"], 0, [], 0) #= local #fondFissCoupe = geompy.GetInPlaceByHistory(shapeDefaut, fondFiss) #= inutile - geompy.addToStudy(shapeDefaut, 'shapeDefaut_coupe') - #geompy.addToStudyInFather(shapeDefaut, fondFissCoupe, 'fondFiss_coupe') + geomPublish(initLog.debug, shapeDefaut, 'shapeDefaut_coupe') + #geomPublishInFather(initLog.debug,shapeDefaut, fondFissCoupe, 'fondFiss_coupe') extrem, norms = findWireEndVertices(fondFiss, True) logging.debug("extrem: %s, norm: %s",extrem, norms) cercle = geompy.MakeCircle(extrem[0], norms[0], rayonPipe) cercle = geompy.MakeRotation(cercle, norms[0], math.pi/3.0 ) # éviter d'avoir l'arête de couture du pipe presque confondue avec la face fissure - geompy.addToStudy(cercle, 'cercle') + geomPublish(initLog.debug, cercle, 'cercle') fondFissProlonge = prolongeWire(fondFiss, extrem, norms, 2*rayonPipe) pipeFiss = geompy.MakePipe(cercle, fondFissProlonge) - geompy.addToStudy(pipeFiss, 'pipeFiss') + geomPublish(initLog.debug, pipeFiss, 'pipeFiss') partFissPipe = geompy.MakePartition([shapeDefaut, pipeFiss], [], [], [], geompy.ShapeType["FACE"], 0, [], 1) - geompy.addToStudy(partFissPipe, 'partFissPipe') + geomPublish(initLog.debug, partFissPipe, 'partFissPipe') fissPipe = geompy.GetInPlaceByHistory(partFissPipe, shapeDefaut) #= global - geompy.addToStudy(fissPipe, 'fissPipe') + geomPublish(initLog.debug, fissPipe, 'fissPipe') partPipe = geompy.GetInPlaceByHistory(partFissPipe, pipeFiss) #= local - geompy.addToStudy(partPipe, 'partPipe') + geomPublish(initLog.debug, partPipe, 'partPipe') edgesPipeFiss = geompy.GetSharedShapesMulti([fissPipe, partPipe], geompy.ShapeType["EDGE"]) #= global for i, edge in enumerate(edgesPipeFiss): name = "edgePipe%d"%i - geompy.addToStudyInFather(fissPipe, edge, name) + geomPublishInFather(initLog.debug,fissPipe, edge, name) try: wirePipeFiss = geompy.MakeWire(edgesPipeFiss) #= global except: wirePipeFiss = geompy.MakeCompound(edgesPipeFiss) logging.debug("wirePipeFiss construit sous forme de compound") - geompy.addToStudy(wirePipeFiss, "wirePipeFiss") + geomPublish(initLog.debug, wirePipeFiss, "wirePipeFiss") wireFondFiss = geompy.GetInPlace(partFissPipe,fondFiss) edgesFondFiss = geompy.GetSharedShapesMulti([fissPipe, wireFondFiss], geompy.ShapeType["EDGE"]) for i, edge in enumerate(edgesFondFiss): name = "edgeFondFiss%d"%i - geompy.addToStudyInFather(fissPipe, edge, name) + geomPublishInFather(initLog.debug,fissPipe, edge, name) wireFondFiss = geompy.MakeWire(edgesFondFiss) #= global - geompy.addToStudy(wireFondFiss,"wireFondFiss") + geomPublish(initLog.debug, wireFondFiss,"wireFondFiss") # ----------------------------------------------------------------------------- # --- peau et face de fissure @@ -187,7 +190,7 @@ def insereFissureGenerale(maillagesSains, fissPipePart = fissPipe part = geompy.MakePartition([fissPipePart, filling], [], [], [], geompy.ShapeType["FACE"], 0, [], 0) partitionsPeauFissFond.append(part) - geompy.addToStudy( part, 'partitionPeauFissFond%d'%ipart ) + geomPublish(initLog.debug, part, 'partitionPeauFissFond%d'%ipart ) else: partitionsPeauFissFond.append(None) ipart = ipart +1 @@ -203,13 +206,13 @@ def insereFissureGenerale(maillagesSains, if not isinstance(a, list): aretesVives.append(a) name = "areteVive%d"%ia - geompy.addToStudy(a, name) + geomPublish(initLog.debug, a, name) ia += 1 else: if a[0] is not None: aretesVives.append(a[0]) name = "areteVive%d"%ia - geompy.addToStudy(a[0], name) + geomPublish(initLog.debug, a[0], name) ia += 1 aretesVivesC = None #= global @@ -246,9 +249,9 @@ def insereFissureGenerale(maillagesSains, # edges prolongées edgesPipeC = geompy.GetInPlace(partitionPeauFissFond, geompy.MakeCompound(edgesPipeFiss)) #= local - geompy.addToStudyInFather(partitionPeauFissFond, edgesPipeC, "edgesPipeFiss") + geomPublishInFather(initLog.debug,partitionPeauFissFond, edgesPipeC, "edgesPipeFiss") edgesFondC = geompy.GetInPlace(partitionPeauFissFond, geompy.MakeCompound(edgesFondFiss)) #= local - geompy.addToStudyInFather(partitionPeauFissFond, edgesFondC, "edgesFondFiss") + geomPublishInFather(initLog.debug,partitionPeauFissFond, edgesFondC, "edgesFondFiss") if aretesVivesC is None: #= global facesInside facesOnside [edgesInside, edgesOutside, edgesOnside] = extractionOrientee(fillingFaceExterne, partitionPeauFissFond, centreFondFiss, "EDGE", 1.e-3) @@ -265,9 +268,9 @@ def insereFissureGenerale(maillagesSains, vertices = geompy.GetSharedShapesMulti([edge, geompy.MakeCompound(facesOnside)], geompy.ShapeType["VERTEX"]) verticesPipePeau.append(vertices[0]) name = "edgePipeIn%d"%i - geompy.addToStudyInFather(partitionPeauFissFond, edge, name) + geomPublishInFather(initLog.debug,partitionPeauFissFond, edge, name) name = "verticePipePeau%d"%i - geompy.addToStudyInFather(partitionPeauFissFond, vertices[0], name) + geomPublishInFather(initLog.debug,partitionPeauFissFond, vertices[0], name) logging.debug("edgePipeIn%s coupe les faces OnSide", i) except: logging.debug("edgePipeIn%s ne coupe pas les faces OnSide", i) @@ -289,11 +292,11 @@ def insereFissureGenerale(maillagesSains, edgesFondFiss, edgesIdByOrientation = orderEdgesFromWire(wireFondFiss) for i,edge in enumerate(edgesFondFiss): - geompy.addToStudyInFather(wireFondFiss, edge, "edgeFondFiss%d"%i) + geomPublishInFather(initLog.debug,wireFondFiss, edge, "edgeFondFiss%d"%i) for iedf, edge in enumerate(edgesFondIn): name = "edgeFondIn%d"%iedf - geompy.addToStudyInFather(partitionPeauFissFond, edge, name) + geomPublishInFather(initLog.debug,partitionPeauFissFond, edge, name) dist = [ geompy.MinDistance(pt, edge) for pt in verticesPipePeau] ptPeau = verticesPipePeau[dist.index(min(dist))] # le point de verticesPipePeau a distance minimale de l'edge [u, PointOnEdge, EdgeInWireIndex] = geompy.MakeProjectionOnWire(ptPeau, wireFondFiss) @@ -301,14 +304,14 @@ def insereFissureGenerale(maillagesSains, localEdgeInFondFiss = edgesFondFiss[EdgeInWireIndex] centre = PointOnEdge centre2 = geompy.MakeVertexOnCurve(localEdgeInFondFiss, u) - geompy.addToStudyInFather(partitionPeauFissFond, centre2, "centre2_%d"%iedf) + geomPublishInFather(initLog.debug,partitionPeauFissFond, centre2, "centre2_%d"%iedf) verticesEdgesFondIn.append(centre) name = "verticeEdgesFondIn%d"%iedf - geompy.addToStudyInFather(partitionPeauFissFond, centre, name) + geomPublishInFather(initLog.debug,partitionPeauFissFond, centre, name) norm = geompy.MakeTangentOnCurve(localEdgeInFondFiss, u) - geompy.addToStudyInFather(partitionPeauFissFond, centre, "norm%d"%iedf) + geomPublishInFather(initLog.debug,partitionPeauFissFond, centre, "norm%d"%iedf) cercle = geompy.MakeCircle(centre, norm, rayonPipe) - geompy.addToStudyInFather(partitionPeauFissFond, cercle, "cerclorig%d"%iedf) + geomPublishInFather(initLog.debug,partitionPeauFissFond, cercle, "cerclorig%d"%iedf) [vertex] = geompy.ExtractShapes(cercle, geompy.ShapeType["VERTEX"], False) vec1 = geompy.MakeVector(centre, vertex) vec2 = geompy.MakeVector(centre, ptPeau) @@ -330,7 +333,7 @@ def insereFissureGenerale(maillagesSains, else: cercle = geompy.MakeRotation(cercle, norm, -angle + math.pi) name = "cercle%d"%iedf - geompy.addToStudyInFather(partitionPeauFissFond, cercle, name) + geomPublishInFather(initLog.debug,partitionPeauFissFond, cercle, name) cercles.append(cercle) # --- estimation de la longueur du pipe necessaire de part et d'autre du point de sortie @@ -359,8 +362,8 @@ def insereFissureGenerale(maillagesSains, logging.debug("distance curviligne centre extremite0: %s", ofp) p1 = geompy.MakeVertexOnCurveByLength(localEdgeInFondFiss, ofp +lgp, locPt0) p2 = geompy.MakeVertexOnCurveByLength(localEdgeInFondFiss, ofp -lgp, locPt0) - geompy.addToStudyInFather(wireFondFiss, p1, "p1_%d"%iedf) - geompy.addToStudyInFather(wireFondFiss, p2, "p2_%d"%iedf) + geomPublishInFather(initLog.debug,wireFondFiss, p1, "p1_%d"%iedf) + geomPublishInFather(initLog.debug,wireFondFiss, p2, "p2_%d"%iedf) edgePart = geompy.MakePartition([localEdgeInFondFiss], [p1,p2], [], [], geompy.ShapeType["EDGE"], 0, [], 0) edps = geompy.ExtractShapes(edgePart, geompy.ShapeType["EDGE"], True) @@ -368,7 +371,7 @@ def insereFissureGenerale(maillagesSains, if geompy.MinDistance(centre, edp) < 1.e-3: pipext = geompy.MakePipe(cercle, edp) name = "pipeExt%d"%iedf - geompy.addToStudyInFather(partitionPeauFissFond, pipext, name) + geomPublishInFather(initLog.debug,partitionPeauFissFond, pipext, name) pipexts.append(pipext) for face in facesInside: @@ -393,7 +396,7 @@ def insereFissureGenerale(maillagesSains, logging.debug(" face %s inside ajoutée", i) facesFissExt.append(face) name="faceFissExt%d"%iedf - geompy.addToStudyInFather(partitionPeauFissFond, face, name) + geomPublishInFather(initLog.debug,partitionPeauFissFond, face, name) dist = 1. for ipe, edpe in enumerate(edgesPeauFis): for ipi, edpi in enumerate(edgesPipeFis): @@ -401,10 +404,10 @@ def insereFissureGenerale(maillagesSains, if dist < 1.e-3: edgesFissExtPeau.append(edpe) name="edgesFissExtPeau%d"%iedf - geompy.addToStudyInFather(partitionPeauFissFond, edpe, name) + geomPublishInFather(initLog.debug,partitionPeauFissFond, edpe, name) edgesFissExtPipe.append(edpi) name="edgesFissExtPipe%d"%iedf - geompy.addToStudyInFather(partitionPeauFissFond, edpi, name) + geomPublishInFather(initLog.debug,partitionPeauFissFond, edpi, name) break if dist < 1.e-3: break @@ -425,7 +428,7 @@ def insereFissureGenerale(maillagesSains, if (len(edgesPeauFis) > 0) and (len(edgesPipeFis) > 0) and (len(edgesPipeFnd) == 0): edgesFissExtPeau.append(edgesPeauFis[0]) name="edgesFissExtPeau%d"%j - geompy.addToStudyInFather(partitionPeauFissFond, edgesPeauFis[0], name) + geomPublishInFather(initLog.debug,partitionPeauFissFond, edgesPeauFis[0], name) j += 1 # ----------------------------------------------------------------------- @@ -478,7 +481,7 @@ def insereFissureGenerale(maillagesSains, pass name="partitionPeauByPipe%d"%ifil - geompy.addToStudy(partitionPeauByPipe, name) + geomPublish(initLog.debug, partitionPeauByPipe, name) [edgesPeauFondIn, edgesPeauFondOut, edgesPeauFondOn] = extractionOrientee(fillingFaceExterne, partitionPeauByPipe, centreFondFiss, "EDGE", 1.e-3) [facesPeauFondIn, facesPeauFondOut, facesPeauFondOn] = extractionOrientee(fillingFaceExterne, partitionPeauByPipe, centreFondFiss, "FACE", 1.e-3) @@ -488,7 +491,7 @@ def insereFissureGenerale(maillagesSains, else: facePeau =geompy.MakePartition(facesPeauFondOn, [], [], [], geompy.ShapeType["FACE"], 0, [], 1) name="facePeau%d"%ifil - geompy.addToStudy(facePeau, name) + geomPublish(initLog.debug, facePeau, name) facesPipePeau = [None for i in range(len(edgesFissExtPipe))] endsEdgeFond = [None for i in range(len(edgesFissExtPipe))] @@ -514,13 +517,13 @@ def insereFissureGenerale(maillagesSains, nameEdge = "edgeRadFacePipePeau%d"%i facesPipePeau[i] = face endsEdgeFond[i] = sharedVertices[0] - geompy.addToStudy(face, nameFace) - geompy.addToStudy(sharedVertices[0], nameVert) + geomPublish(initLog.debug, face, nameFace) + geomPublish(initLog.debug, sharedVertices[0], nameVert) edgesFace = geompy.ExtractShapes(face, geompy.ShapeType["EDGE"], True) for edge in edgesFace: if geompy.MinDistance(edge, sharedVertices[0]) < 1e-3: edgeRadFacePipePeau[i] = edge - geompy.addToStudy(edge, nameEdge) + geomPublish(initLog.debug, edge, nameEdge) break pass pass @@ -537,14 +540,14 @@ def insereFissureGenerale(maillagesSains, geompy.UnionList(grpEdgesCirc, edges) edgesCircPeau[i] = grpEdgesCirc name = "edgeCirc%d"%i - geompy.addToStudyInFather(facePeau, grpEdgesCirc, name) + geomPublishInFather(initLog.debug,facePeau, grpEdgesCirc, name) edgesListees = edgesListees + edges vertices = geompy.GetSharedShapesMulti([facePeau, fcirc], geompy.ShapeType["VERTEX"]) grpVertCircPeau = geompy.CreateGroup(facePeau, geompy.ShapeType["VERTEX"]) geompy.UnionList(grpVertCircPeau, vertices) verticesCircPeau[i] = grpVertCircPeau name = "pointEdgeCirc%d"%i - geompy.addToStudyInFather(facePeau, grpVertCircPeau, name) + geomPublishInFather(initLog.debug,facePeau, grpVertCircPeau, name) pass pass # --- au moins une extrémité du pipe sur cette face de peau @@ -555,7 +558,7 @@ def insereFissureGenerale(maillagesSains, for i, edge in enumerate(edgesFilling): edgepeau = geompy.GetInPlace(facePeau, edge) name = "edgepeau%d"%i - geompy.addToStudyInFather(facePeau,edgepeau, name) + geomPublishInFather(initLog.debug,facePeau,edgepeau, name) logging.debug("edgepeau %s", geompy.ShapeInfo(edgepeau)) if geompy.ShapeInfo(edgepeau)['EDGE'] > 1: logging.debug(" EDGES multiples") @@ -572,7 +575,7 @@ def insereFissureGenerale(maillagesSains, if aretesVivesC is not None: bordsVifs = geompy.GetInPlace(facePeau, aretesVivesC) if bordsVifs is not None: - geompy.addToStudyInFather(facePeau, bordsVifs, "bordsVifs") + geomPublishInFather(initLog.debug,facePeau, bordsVifs, "bordsVifs") groupEdgesBordPeau = geompy.CutGroups(groupEdgesBordPeau, bordsVifs) grptmp = None if len(aretesVivesCoupees) > 0: @@ -586,7 +589,7 @@ def insereFissureGenerale(maillagesSains, edv = geompy.ExtractShapes(grpnew, geompy.ShapeType["EDGE"], False) aretesVivesCoupees += edv logging.debug("aretesVivesCoupees %s",aretesVivesCoupees) - geompy.addToStudyInFather(facePeau, groupEdgesBordPeau , "EdgesBords") + geomPublishInFather(initLog.debug,facePeau, groupEdgesBordPeau , "EdgesBords") # --- edges de la face de peau partagées avec la face de fissure @@ -600,7 +603,7 @@ def insereFissureGenerale(maillagesSains, if (geompy.MinDistance(grpVert, edge) < 1.e-3) and (edge not in edgesFissurePeau): edgesFissurePeau[i] = edge name = "edgeFissurePeau%d"%i - geompy.addToStudyInFather(facePeau, edge, name) + geomPublishInFather(initLog.debug,facePeau, edge, name) for edge in edges: # on ajoute après les edges manquantes if edge not in edgesFissurePeau: edgesFissurePeau.append(edge) @@ -608,7 +611,7 @@ def insereFissureGenerale(maillagesSains, for i, edge in enumerate(edges): edgesFissurePeau.append(edge) name = "edgeFissurePeau%d"%i - geompy.addToStudyInFather(facePeau, edge, name) + geomPublishInFather(initLog.debug,facePeau, edge, name) ptEdgeFond[ifil] = endsEdgeFond # pour chaque face [points edge fond de fissure aux débouchés du pipe] @@ -631,7 +634,7 @@ def insereFissureGenerale(maillagesSains, for i, avc in enumerate(aretesVivesCoupees): name = "areteViveCoupee%d"%i - geompy.addToStudy(avc, name) + geomPublish(initLog.debug, avc, name) # --- identification des faces et edges de fissure externe pour maillage @@ -667,9 +670,9 @@ def insereFissureGenerale(maillagesSains, edgesPeauFissureExterneC = geompy.MakeCompound(edgesFissExtPeau) edgesPipeFissureExterneC = geompy.MakeCompound(edgesFissExtPipe) wirePipeFissureExterne = geompy.MakeWire(geompy.ExtractShapes(edgesPipeFissureExterneC, geompy.ShapeType["EDGE"], False)) - geompy.addToStudy(faceFissureExterne, "faceFissureExterne") - geompy.addToStudyInFather(faceFissureExterne, edgesPeauFissureExterneC, "edgesPeauFissureExterne") - geompy.addToStudyInFather(faceFissureExterne, edgesPipeFissureExterneC, "edgesPipeFissureExterne") + geomPublish(initLog.debug, faceFissureExterne, "faceFissureExterne") + geomPublishInFather(initLog.debug,faceFissureExterne, edgesPeauFissureExterneC, "edgesPeauFissureExterne") + geomPublishInFather(initLog.debug,faceFissureExterne, edgesPipeFissureExterneC, "edgesPipeFissureExterne") logging.debug("---------------------------- Preparation Maillage du Pipe --------------") # ----------------------------------------------------------------------- @@ -734,11 +737,11 @@ def insereFissureGenerale(maillagesSains, origins.append(vertpx) normals.append(norm) # name = "vertcx%d"%i -# geompy.addToStudyInFather(wireFondFiss, vertcx, name) +# geomPublishInFather(initLog.debug,wireFondFiss, vertcx, name) # name = "vertpx%d"%i -# geompy.addToStudyInFather(wireFondFiss, vertpx, name) +# geomPublishInFather(initLog.debug,wireFondFiss, vertpx, name) # name = "plan%d"%i -# geompy.addToStudyInFather(wireFondFiss, plan, name) +# geomPublishInFather(initLog.debug,wireFondFiss, plan, name) # --- maillage du pipe étendu, sans tenir compte de l'intersection avec la face de peau @@ -854,18 +857,18 @@ def insereFissureGenerale(maillagesSains, #logging.debug("extremité %s, indices retenus interne %s, externe %s",i, idfin, iddeb) comp = geompy.MakeCompound(raydisks[k][iddeb:idfin]) name='compoundRay%d'%k - geompy.addToStudy(comp, name) + geomPublish(initLog.debug, comp, name) else: idfin = min(len(gptsdisks), numout+1) iddeb = min(idfin-3, idisk) # il faut 3 rayons pour faire un filling qui suive le fond de fissure #logging.debug("extremité %s, indices retenus interne %s, externe %s",i, idfin, iddeb) comp = geompy.MakeCompound(raydisks[k][iddeb:idfin]) name='compoundRay%d'%k - geompy.addToStudy(comp, name) + geomPublish(initLog.debug, comp, name) nappe = geompy.MakeFilling(comp, 2, 5, 0.0001, 0.0001, 0, GEOM.FOM_Default) nappes.append(nappe) name='nappe%d'%k - geompy.addToStudy(nappe, name) + geomPublish(initLog.debug, nappe, name) facesDebouchantes[i] = True listNappes.append(nappes) @@ -914,13 +917,13 @@ def insereFissureGenerale(maillagesSains, ednouv.append(ed) logging.debug(" edges issues de la partition: %s", ednouv) for ii, ed in enumerate(ednouv): - geompy.addToStudy(ed, "ednouv%d"%ii) + geomPublish(initLog.debug, ed, "ednouv%d"%ii) [edsorted, minl,maxl] = sortEdges(ednouv) logging.debug(" longueur edge trouvée: %s", maxl) edge = edsorted[-1] edges.append(edge) name = 'edgeEndPipe%d'%k - geompy.addToStudy(edge, name) + geomPublish(initLog.debug, edge, name) listEdges.append(edges) # --- création des points du maillage du pipe sur la face de peau @@ -932,9 +935,9 @@ def insereFissureGenerale(maillagesSains, id = -1 # si id vaut 1, on prend le dernier élément de la liste (1 ou 2 extrémités débouchent sur la face) centre = ptEdgeFond[idFillingFromBout[i]][id] name = "centre%d"%id - geompy.addToStudy(centre, name) + geomPublish(initLog.debug, centre, name) vertPipePeau = ptFisExtPi[idFillingFromBout[i]][id] - geompy.addToStudyInFather(centre, vertPipePeau, "vertPipePeau") + geomPublishInFather(initLog.debug,centre, vertPipePeau, "vertPipePeau") grpsEdgesCirc = edCircPeau[idFillingFromBout[i]] # liste de groupes edgesCirc = [] for grpEdgesCirc in grpsEdgesCirc: @@ -961,7 +964,7 @@ def insereFissureGenerale(maillagesSains, else: bout = geompy.MakeVertexOnCurve(distEdgeCirc[0][2], u) name ="bout%d"%k - geompy.addToStudyInFather(centre, bout, name) + geomPublishInFather(initLog.debug,centre, bout, name) # enregistrement des points dans la structure points = [] for j in range(nbsegRad +1): @@ -1238,7 +1241,7 @@ def insereFissureGenerale(maillagesSains, edgesFilling = geompy.ExtractShapes(filling, geompy.ShapeType["EDGE"], False) groupEdgesBordPeau = geompy.CreateGroup(filling, geompy.ShapeType["EDGE"]) geompy.UnionList(groupEdgesBordPeau, edgesFilling) - geompy.addToStudyInFather(filling, groupEdgesBordPeau , "EdgesBords") + geomPublishInFather(initLog.debug,filling, groupEdgesBordPeau , "EdgesBords") meshFacePeau = smesh.Mesh(facesDefaut[ifil]) diff --git a/src/Tools/blocFissure/gmu/insereFissureLongue.py b/src/Tools/blocFissure/gmu/insereFissureLongue.py index 8f9515846..bc33172ee 100644 --- a/src/Tools/blocFissure/gmu/insereFissureLongue.py +++ b/src/Tools/blocFissure/gmu/insereFissureLongue.py @@ -3,6 +3,9 @@ import logging import salome from geomsmesh import geompy +from geomsmesh import geomPublish +from geomsmesh import geomPublishInFather +import initLog from geomsmesh import smesh from salome.smesh import smeshBuilder import SMESH @@ -80,7 +83,7 @@ def insereFissureLongue(geometriesSaines, maillagesSains, WirePorteFondFissure = wiretube fillingFaceExterne = facesDefaut[0] logging.debug("fillingFaceExterne %s", fillingFaceExterne) - geompy.addToStudy(fillingFaceExterne, "fillingFaceExterne") + geomPublish(initLog.debug, fillingFaceExterne, "fillingFaceExterne") edgesFilling = geompy.ExtractShapes(fillingFaceExterne, geompy.ShapeType["EDGE"], False) O, OX, OY, OZ = triedreBase() @@ -90,7 +93,7 @@ def insereFissureLongue(geometriesSaines, maillagesSains, # --- partition peau defaut - face de fissure prolongee - wire de fond de fissure prolongée partitionPeauFissFond = geompy.MakePartition([facePorteFissure, WirePorteFondFissure, fillingFaceExterne], [], [], [], geompy.ShapeType["FACE"], 0, [], 0) - geompy.addToStudy( partitionPeauFissFond, 'partitionPeauFissFond' ) + geomPublish(initLog.debug, partitionPeauFissFond, 'partitionPeauFissFond' ) edges = geompy.ExtractShapes(WirePorteFondFissure, geompy.ShapeType["EDGE"], False) @@ -103,39 +106,39 @@ def insereFissureLongue(geometriesSaines, maillagesSains, lgmax = lg imax = i edgemax = edges[imax] - geompy.addToStudy(edgemax, 'edgemax') + geomPublish(initLog.debug, edgemax, 'edgemax') centreFondFiss = geompy.MakeVertexOnCurve(edgemax, 0.5) - geompy.addToStudy(centreFondFiss, 'centreFondFiss') + geomPublish(initLog.debug, centreFondFiss, 'centreFondFiss') tangentFondFiss = geompy.MakeTangentOnCurve(edgemax, 0.5) - geompy.addToStudy(tangentFondFiss, 'tangentFondFiss') + geomPublish(initLog.debug, tangentFondFiss, 'tangentFondFiss') bord1FondFiss = geompy.MakeVertexOnCurve(edgemax, 0.0) - geompy.addToStudy(bord1FondFiss, 'bord1FondFiss') + geomPublish(initLog.debug, bord1FondFiss, 'bord1FondFiss') tangentBord1FondFiss = geompy.MakeTangentOnCurve(edgemax, 0.0) - geompy.addToStudy(tangentBord1FondFiss, 'tangentBord1FondFiss') + geomPublish(initLog.debug, tangentBord1FondFiss, 'tangentBord1FondFiss') bord2FondFiss = geompy.MakeVertexOnCurve(edgemax, 1.0) - geompy.addToStudy(bord2FondFiss, 'bord2FondFiss') + geomPublish(initLog.debug, bord2FondFiss, 'bord2FondFiss') tangentBord2FondFiss = geompy.MakeTangentOnCurve(edgemax, 1.0) - geompy.addToStudy(tangentBord2FondFiss, 'tangentBord2FondFiss') + geomPublish(initLog.debug, tangentBord2FondFiss, 'tangentBord2FondFiss') planBord1 = geompy.MakePlane(bord1FondFiss, tangentBord1FondFiss, 3*rayonPipe) planBord2 = geompy.MakePlane(bord2FondFiss, tangentBord2FondFiss, 3*rayonPipe) - geompy.addToStudy(planBord1, 'planBord1') - geompy.addToStudy(planBord2, 'planBord2') + geomPublish(initLog.debug, planBord1, 'planBord1') + geomPublish(initLog.debug, planBord2, 'planBord2') [edgesInside, edgesOutside, edgesOnside] = extractionOrientee(fillingFaceExterne, partitionPeauFissFond, centreFondFiss, "EDGE", 1.e-3) [facesInside, facesOutside, facesOnside] = extractionOrientee(fillingFaceExterne, partitionPeauFissFond, centreFondFiss, "FACE", 1.e-3) # --- partition peau -face fissure - pipe fond de fissure prolongé partitionPeauFissByPipe = geompy.MakePartition([facesInside[0], facesOnside[0]], [pipefiss], [], [], geompy.ShapeType["FACE"], 0, [], 0) - geompy.addToStudy( partitionPeauFissByPipe, 'partitionPeauFissByPipe' ) + geomPublish(initLog.debug, partitionPeauFissByPipe, 'partitionPeauFissByPipe' ) # --- identification face de peau [facesPeauFissInside, facesPeauFissOutside, facesPeauFissOnside] = extractionOrientee(fillingFaceExterne, partitionPeauFissByPipe, centreFondFiss, "FACE", 0.1, "peauFiss_bord_") facesPeauSorted, minsur, maxsurf = sortFaces(facesPeauFissOnside) # 4 demi disques, une grande face facePeau = facesPeauSorted[-1] # la plus grande face - geompy.addToStudyInFather(partitionPeauFissByPipe, facePeau, "facePeau") + geomPublishInFather(initLog.debug,partitionPeauFissByPipe, facePeau, "facePeau") # --- identification edges de bord face peau edgesBords = [] @@ -144,7 +147,7 @@ def insereFissureLongue(geometriesSaines, maillagesSains, edgesBords.append(edgepeau) groupEdgesBordPeau = geompy.CreateGroup(facePeau, geompy.ShapeType["EDGE"]) geompy.UnionList(groupEdgesBordPeau, edgesBords) - geompy.addToStudyInFather(facePeau, groupEdgesBordPeau , "EdgesBords") + geomPublishInFather(initLog.debug,facePeau, groupEdgesBordPeau , "EdgesBords") # --- identification face fissure externe au pipe et edge commune peau fissure for face in facesPeauFissInside: @@ -153,9 +156,9 @@ def insereFissureLongue(geometriesSaines, maillagesSains, if sharedEdges is not None: faceFiss = face edgePeauFiss = sharedEdges[0] - geompy.addToStudyInFather(partitionPeauFissByPipe, faceFiss, "faceFiss") - geompy.addToStudyInFather(faceFiss, edgePeauFiss, "edgePeauFiss") - geompy.addToStudyInFather(facePeau, edgePeauFiss, "edgePeauFiss") + geomPublishInFather(initLog.debug,partitionPeauFissByPipe, faceFiss, "faceFiss") + geomPublishInFather(initLog.debug,faceFiss, edgePeauFiss, "edgePeauFiss") + geomPublishInFather(initLog.debug,facePeau, edgePeauFiss, "edgePeauFiss") break except: pass @@ -168,16 +171,16 @@ def insereFissureLongue(geometriesSaines, maillagesSains, verticesDemiCerclesPeau = [] for i, edge in enumerate(demiCerclesPeau): name = "demiCerclePeau_%d"%i - geompy.addToStudyInFather(facePeau, edge, name) + geomPublishInFather(initLog.debug,facePeau, edge, name) verticesDemiCerclesPeau += geompy.ExtractShapes(edge, geompy.ShapeType["VERTEX"], False) verticesDemiCerclesPeau = eliminateDoubles(facePeau, verticesDemiCerclesPeau) for i, vertex in enumerate(verticesDemiCerclesPeau): name = "verticesDemiCerclesPeau_%d"%i - geompy.addToStudyInFather(facePeau, vertex, name) + geomPublishInFather(initLog.debug,facePeau, vertex, name) verticesOutCercles = substractSubShapes(facePeau, verticesDemiCerclesPeau, verticesEdgePeauFiss) for i, vertex in enumerate(verticesOutCercles): name = "verticesOutCercles_%d"%i - geompy.addToStudyInFather(facePeau, vertex, name) + geomPublishInFather(initLog.debug,facePeau, vertex, name) # --- demi cercles regroupés groupsDemiCerclesPeau = [] @@ -189,7 +192,7 @@ def insereFissureLongue(geometriesSaines, maillagesSains, group = geompy.CreateGroup(facePeau, geompy.ShapeType["EDGE"]) geompy.UnionList(group, demis) name = "Cercle%d"%i - geompy.addToStudyInFather(facePeau, group , name) + geomPublishInFather(initLog.debug,facePeau, group , name) groupsDemiCerclesPeau.append(group) # --- identification edges commune pipe face fissure externe au pipe @@ -200,10 +203,10 @@ def insereFissureLongue(geometriesSaines, maillagesSains, if geompy.GetSubShapeID(partitionPeauFissByPipe, edge) != edgePeauFissId: edgesFaceFissPipe.append(edge) name = "edgeFaceFissPipe_%d"%len(edgesFaceFissPipe) - geompy.addToStudyInFather(faceFiss, edge, name) + geomPublishInFather(initLog.debug,faceFiss, edge, name) groupEdgesFaceFissPipe = geompy.CreateGroup(faceFiss, geompy.ShapeType["EDGE"]) geompy.UnionList(groupEdgesFaceFissPipe, edgesFaceFissPipe) - geompy.addToStudyInFather(faceFiss, groupEdgesFaceFissPipe, "edgesFaceFissPipe") + geomPublishInFather(initLog.debug,faceFiss, groupEdgesFaceFissPipe, "edgesFaceFissPipe") # ----------------------------------------------------------------------------- # --- pipe de fond de fissure @@ -240,29 +243,29 @@ def insereFissureLongue(geometriesSaines, maillagesSains, #pipeFondFiss = pipesSorted[-1] #pipeFondFiss = geompy.MakePartition([pipeFondFiss], [planfiss, wireFondFiss, planBord1, planBord2], [], [], geompy.ShapeType["SOLID"], 0, [], 0) - geompy.addToStudy( disque, 'disque') - geompy.addToStudy( wireFondFiss, 'wireFondFiss') - geompy.addToStudy( pipeFondFiss, 'pipeFondFiss') + geomPublish(initLog.debug, disque, 'disque') + geomPublish(initLog.debug, wireFondFiss, 'wireFondFiss') + geomPublish(initLog.debug, pipeFondFiss, 'pipeFondFiss') VerticesEndFondFiss = findWireEndVertices(wireFondFiss) for i, v in enumerate(VerticesEndFondFiss): name = "vertexEndFondFiss_%d"%i - geompy.addToStudyInFather(wireFondFiss, v, name) + geomPublishInFather(initLog.debug,wireFondFiss, v, name) VerticesEndPipeFiss = [] for v in VerticesEndFondFiss: VerticesEndPipeFiss.append(geompy.GetInPlace(pipeFondFiss, v)) for i, v in enumerate(VerticesEndPipeFiss): name = "vertexEndPipeFiss_%d"%i - geompy.addToStudyInFather(pipeFondFiss, v, name) + geomPublishInFather(initLog.debug,pipeFondFiss, v, name) - geompy.addToStudyInFather(pipeFondFiss, VerticesEndPipeFiss[0], "PFOR") - geompy.addToStudyInFather(pipeFondFiss, VerticesEndPipeFiss[1], "PFEX") + geomPublishInFather(initLog.debug,pipeFondFiss, VerticesEndPipeFiss[0], "PFOR") + geomPublishInFather(initLog.debug,pipeFondFiss, VerticesEndPipeFiss[1], "PFEX") if geompy.MinDistance(VerticesEndPipeFiss[0], verticesOutCercles[0]) > geompy.MinDistance(VerticesEndPipeFiss[0], verticesOutCercles[1]): a = verticesOutCercles[0] verticesOutCercles[0] = verticesOutCercles[1] verticesOutCercles[1] = a - geompy.addToStudyInFather(facePeau, verticesOutCercles[0], "THOR") - geompy.addToStudyInFather(facePeau, verticesOutCercles[1], "THEX") + geomPublishInFather(initLog.debug,facePeau, verticesOutCercles[0], "THOR") + geomPublishInFather(initLog.debug,facePeau, verticesOutCercles[1], "THEX") [facesPipeInside, facesPipeOutside, facesPipeOnside] = extractionOrientee(fillingFaceExterne, pipeFondFiss, centreFondFiss, "FACE", 0.1, "pipe_bord_") [edgesPipeInside, edgesPipeOutside, edgesPipeOnside] = extractionOrientee(fillingFaceExterne, pipeFondFiss, centreFondFiss, "EDGE", 0.1, "pipe_bord_") @@ -275,7 +278,7 @@ def insereFissureLongue(geometriesSaines, maillagesSains, centre = geompy.MakeVertexOnSurface(planfiss, 0.5, 0.5) refpoint = geompy.MakeTranslationVector(centre, geompy.GetNormal(planfiss,centre)) - geompy.addToStudy(refpoint, 'refpoint') + geomPublish(initLog.debug, refpoint, 'refpoint') [facesPipeInplan, facesPipeOutplan, facesPipeOnplan] = extractionOrientee(planfiss, pipeFondFiss, refpoint, "FACE", 0.1, "pipe_plan_") [edgesPipeInplan, edgesPipeOutplan, edgesPipeOnplan] = extractionOrientee(planfiss, pipeFondFiss, refpoint, "EDGE", 0.1, "pipe_plan_") @@ -315,7 +318,7 @@ def insereFissureLongue(geometriesSaines, maillagesSains, generFiss.append(edge) groupGenerFiss = geompy.CreateGroup(pipeFondFiss, geompy.ShapeType["EDGE"]) geompy.UnionList(groupGenerFiss, generFiss) - geompy.addToStudyInFather(pipeFondFiss, groupGenerFiss, "GenFiss") + geomPublishInFather(initLog.debug,pipeFondFiss, groupGenerFiss, "GenFiss") # --- demi cercles externes regroupés groupsDemiCerclesPipe = [] @@ -327,7 +330,7 @@ def insereFissureLongue(geometriesSaines, maillagesSains, group = geompy.CreateGroup(pipeFondFiss, geompy.ShapeType["EDGE"]) geompy.UnionList(group, demis) name = "Cercle%d"%i - geompy.addToStudyInFather(pipeFondFiss, group , name) + geomPublishInFather(initLog.debug,pipeFondFiss, group , name) groupsDemiCerclesPipe.append(group) # --- faces fissure dans le pipe @@ -344,12 +347,12 @@ def insereFissureLongue(geometriesSaines, maillagesSains, logging.debug("face found") facesFissinPipe.append(face) name = "faceFissInPipe_%d"%i - geompy.addToStudyInFather(pipeFondFiss, face, name) + geomPublishInFather(initLog.debug,pipeFondFiss, face, name) break groupFaceFissInPipe = geompy.CreateGroup(pipeFondFiss, geompy.ShapeType["FACE"]) geompy.UnionList(groupFaceFissInPipe, facesFissinPipe) name = "FaceFissInPipe" - geompy.addToStudyInFather(pipeFondFiss, groupFaceFissInPipe , name) + geomPublishInFather(initLog.debug,pipeFondFiss, groupFaceFissInPipe , name) # --- edges de fond de fissure @@ -359,11 +362,11 @@ def insereFissureLongue(geometriesSaines, maillagesSains, logging.debug(" edge %s ", anEdge) edgesFondFiss.append(anEdge) name ="edgeFondFissure_%d"%i - geompy.addToStudyInFather(pipeFondFiss, anEdge, name) + geomPublishInFather(initLog.debug,pipeFondFiss, anEdge, name) groupEdgeFondFiss = geompy.CreateGroup(pipeFondFiss, geompy.ShapeType["EDGE"]) geompy.UnionList(groupEdgeFondFiss, edgesFondFiss) name = "FONDFISS" - geompy.addToStudyInFather(pipeFondFiss, groupEdgeFondFiss , name) + geomPublishInFather(initLog.debug,pipeFondFiss, groupEdgeFondFiss , name) # ------------------------------------------------------------------------- # --- maillage diff --git a/src/Tools/blocFissure/gmu/mailleFacesPeau.py b/src/Tools/blocFissure/gmu/mailleFacesPeau.py index 5ff5170be..c73cf1d59 100644 --- a/src/Tools/blocFissure/gmu/mailleFacesPeau.py +++ b/src/Tools/blocFissure/gmu/mailleFacesPeau.py @@ -3,6 +3,9 @@ import logging from geomsmesh import geompy +from geomsmesh import geomPublish +from geomsmesh import geomPublishInFather +import initLog from geomsmesh import smesh from salome.smesh import smeshBuilder import SMESH @@ -34,7 +37,7 @@ def mailleFacesPeau(partitionsPeauFissFond, idFillingFromBout, facesDefaut, edgesFilling = geompy.ExtractShapes(filling, geompy.ShapeType["EDGE"], False) groupEdgesBordPeau = geompy.CreateGroup(filling, geompy.ShapeType["EDGE"]) geompy.UnionList(groupEdgesBordPeau, edgesFilling) - geompy.addToStudyInFather(filling, groupEdgesBordPeau , "EdgesBords") + geomPublishInFather(initLog.debug,filling, groupEdgesBordPeau , "EdgesBords") meshFacePeau = smesh.Mesh(facesDefaut[ifil]) diff --git a/src/Tools/blocFissure/gmu/partitionBlocDefaut.py b/src/Tools/blocFissure/gmu/partitionBlocDefaut.py index 4016c9a5b..be3a3481d 100644 --- a/src/Tools/blocFissure/gmu/partitionBlocDefaut.py +++ b/src/Tools/blocFissure/gmu/partitionBlocDefaut.py @@ -2,6 +2,9 @@ import logging from geomsmesh import geompy +from geomsmesh import geomPublish +from geomsmesh import geomPublishInFather +import initLog # ----------------------------------------------------------------------------- # --- partition du bloc defaut par generatrice, tore et plan fissure @@ -29,10 +32,10 @@ def partitionBlocDefaut(volDefaut, facesDefaut, gener, pipe, faceFissure = geompy.GetInPlaceByHistory(volDefautPart, facefis) #ellipsoidep =geompy.GetInPlaceByHistory(volDefautPart, ellipsoide) - geompy.addToStudy( volDefautPart, 'volDefautPart' ) - geompy.addToStudyInFather( volDefautPart, tore, 'tore' ) - geompy.addToStudyInFather( volDefautPart, faceFissure, 'FACE1' ) - #geompy.addToStudyInFather( volDefautPart, gencnt, 'generatrice' ) + geomPublish(initLog.debug, volDefautPart, 'volDefautPart' ) + geomPublishInFather(initLog.debug, volDefautPart, tore, 'tore' ) + geomPublishInFather(initLog.debug, volDefautPart, faceFissure, 'FACE1' ) + #geomPublishInFather(initLog.debug, volDefautPart, gencnt, 'generatrice' ) solids = geompy.ExtractShapes(blocp, geompy.ShapeType["SOLID"], True) vols = [] @@ -47,13 +50,13 @@ def partitionBlocDefaut(volDefaut, facesDefaut, gener, pipe, imaxvol = vols.index(maxvol) ellipsoidep = solids[imaxvol] - geompy.addToStudyInFather( volDefautPart, blocp, 'bloc' ) - geompy.addToStudyInFather( volDefautPart, ellipsoidep, 'ellipsoide' ) + geomPublishInFather(initLog.debug, volDefautPart, blocp, 'bloc' ) + geomPublishInFather(initLog.debug, volDefautPart, ellipsoidep, 'ellipsoide' ) sharedFaces = geompy.GetSharedShapesMulti([blocp, ellipsoidep], geompy.ShapeType["FACE"]) for i in range(len(sharedFaces)): name = "faceCommuneEllipsoideBloc_%d"%i - geompy.addToStudyInFather(blocp, sharedFaces[i], name) + geomPublishInFather(initLog.debug,blocp, sharedFaces[i], name) #sharedEdges = geompy.GetSharedShapesMulti([blocp, ellipsoidep], geompy.ShapeType["EDGE"]) allSharedEdges = geompy.GetSharedShapesMulti([blocp, ellipsoidep], geompy.ShapeType["EDGE"]) @@ -63,7 +66,7 @@ def partitionBlocDefaut(volDefaut, facesDefaut, gener, pipe, sharedEdges.append(allSharedEdges[i]) for i in range(len(sharedEdges)): name = "edgeCommuneEllipsoideBloc_%d"%i - geompy.addToStudyInFather(blocp, sharedEdges[i], name) + geomPublishInFather(initLog.debug,blocp, sharedEdges[i], name) facesExternes = [] facesExtBloc = [] @@ -75,14 +78,14 @@ def partitionBlocDefaut(volDefaut, facesDefaut, gener, pipe, faceExt = geompy.GetInPlace(ellipsoidep, faces[i]) if faceExt is not None: name = "faceExterne_e%d"%i - geompy.addToStudyInFather(ellipsoidep, faceExt, name) + geomPublishInFather(initLog.debug,ellipsoidep, faceExt, name) facesExternes.append(faceExt) facesExtElli.append(faceExt) faceExt = geompy.GetInPlace(blocp, faces[i]) if faceExt is not None: name = "faceExterne_b%d"%i - geompy.addToStudyInFather(blocp, faceExt, name) + geomPublishInFather(initLog.debug,blocp, faceExt, name) facesExternes.append(faceExt) facesExtBloc.append(faceExt) else: @@ -93,12 +96,12 @@ def partitionBlocDefaut(volDefaut, facesDefaut, gener, pipe, #extrusionFace = geompy.MakePrismVecH2Ways(faces[i], normal, 0.1) #extrusionFace = geompy.MakeScaleTransform(extrusionFace, vertex, 1.01) name = "extrusionFace_b%d"%i - geompy.addToStudyInFather(blocp, extrusionFace, name) + geomPublishInFather(initLog.debug,blocp, extrusionFace, name) #facesExt = geompy.GetShapesOnShape(extrusionFace, blocp, geompy.ShapeType["FACE"], GEOM.ST_ONIN) facesExt = geompy.GetShapesOnShape(extrusionFace, blocp, geompy.ShapeType["FACE"], GEOM.ST_ON) for j in range(len(facesExt)): name = "faceExterne_b%d_%d"%(i,j) - geompy.addToStudyInFather(blocp, facesExt[j], name) + geomPublishInFather(initLog.debug,blocp, facesExt[j], name) facesExternes.append(facesExt[j]) facesExtBloc.append(facesExt[j]) @@ -120,7 +123,7 @@ def partitionBlocDefaut(volDefaut, facesDefaut, gener, pipe, pass if len(allSharedEdges) > 0: name = "faceExterne_b%d_%d"%(i,j) - geompy.addToStudyInFather(blocp, facesBloc[i], name) + geomPublishInFather(initLog.debug,blocp, facesBloc[i], name) facesExternes.append(facesBloc[i]) facesExtBloc.append(facesBloc[i]) @@ -136,7 +139,7 @@ def partitionBlocDefaut(volDefaut, facesDefaut, gener, pipe, aretesInternes += shared for i in range(len(aretesInternes)): name = "aretesInternes_%d"%i - geompy.addToStudyInFather(blocp, aretesInternes[i], name) + geomPublishInFather(initLog.debug,blocp, aretesInternes[i], name) edgesBords = [] for faceExtB in facesExtBloc: @@ -150,7 +153,7 @@ def partitionBlocDefaut(volDefaut, facesDefaut, gener, pipe, if not isInterne: edgesBords.append(edges[i]) name = "edgeBord%d"%i - geompy.addToStudyInFather(blocp,edges[i] , name) + geomPublishInFather(initLog.debug,blocp,edges[i] , name) group = None if len(edgesBords) > 0: group = geompy.CreateGroup(blocp, geompy.ShapeType["EDGE"]) diff --git a/src/Tools/blocFissure/gmu/partitionVolumeSain.py b/src/Tools/blocFissure/gmu/partitionVolumeSain.py index a23fa591a..e7ce51a11 100644 --- a/src/Tools/blocFissure/gmu/partitionVolumeSain.py +++ b/src/Tools/blocFissure/gmu/partitionVolumeSain.py @@ -2,6 +2,9 @@ import logging from geomsmesh import geompy +from geomsmesh import geomPublish +from geomsmesh import geomPublishInFather +import initLog # ----------------------------------------------------------------------------- # --- partition volume sain et bloc, face du bloc recevant la fissure @@ -26,8 +29,8 @@ def partitionVolumeSain(volumeSain,boiteDefaut): partieSaine = b faceBloc = geompy.GetShapesOnShapeAsCompound(volumeSain, volDefaut, geompy.ShapeType["FACE"], GEOM.ST_ON) - geompy.addToStudy( volumeSainPart, 'volumeSainPart' ) - geompy.addToStudyInFather( volumeSainPart, partieSaine, 'partieSaine' ) - geompy.addToStudyInFather( volumeSainPart, volDefaut, 'volDefaut' ) - geompy.addToStudyInFather( volDefaut, faceBloc, 'faceBloc' ) + geomPublish(initLog.debug, volumeSainPart, 'volumeSainPart' ) + geomPublishInFather(initLog.debug, volumeSainPart, partieSaine, 'partieSaine' ) + geomPublishInFather(initLog.debug, volumeSainPart, volDefaut, 'volDefaut' ) + geomPublishInFather(initLog.debug, volDefaut, faceBloc, 'faceBloc' ) return volumeSainPart, partieSaine, volDefaut, faceBloc diff --git a/src/Tools/blocFissure/gmu/partitionneFissureParPipe.py b/src/Tools/blocFissure/gmu/partitionneFissureParPipe.py index 8f770fa51..7d6289797 100644 --- a/src/Tools/blocFissure/gmu/partitionneFissureParPipe.py +++ b/src/Tools/blocFissure/gmu/partitionneFissureParPipe.py @@ -3,6 +3,9 @@ import math import logging from geomsmesh import geompy +from geomsmesh import geomPublish +from geomsmesh import geomPublishInFather +import initLog from findWireEndVertices import findWireEndVertices from prolongeWire import prolongeWire @@ -21,41 +24,41 @@ def partitionneFissureParPipe(shapesFissure, elementsDefaut, rayonPipe): plan = geompy.MakePlane(centreFondFiss, tgtCentre, 10000) shapeDefaut = geompy.MakePartition([shapeDefaut], [plan], [], [], geompy.ShapeType["FACE"], 0, [], 0) #fondFissCoupe = geompy.GetInPlaceByHistory(shapeDefaut, fondFiss) #= inutile - geompy.addToStudy(shapeDefaut, 'shapeDefaut_coupe') - #geompy.addToStudyInFather(shapeDefaut, fondFissCoupe, 'fondFiss_coupe') + geomPublish(initLog.debug, shapeDefaut, 'shapeDefaut_coupe') + #geomPublishInFather(initLog.debug,shapeDefaut, fondFissCoupe, 'fondFiss_coupe') extrem, norms = findWireEndVertices(fondFiss, True) logging.debug("extrem: %s, norm: %s",extrem, norms) cercle = geompy.MakeCircle(extrem[0], norms[0], rayonPipe) cercle = geompy.MakeRotation(cercle, norms[0], math.pi/3.0 ) # éviter d'avoir l'arête de couture du pipe presque confondue avec la face fissure - geompy.addToStudy(cercle, 'cercle') + geomPublish(initLog.debug, cercle, 'cercle') fondFissProlonge = prolongeWire(fondFiss, extrem, norms, 2*rayonPipe) pipeFiss = geompy.MakePipe(cercle, fondFissProlonge) - geompy.addToStudy(pipeFiss, 'pipeFiss') + geomPublish(initLog.debug, pipeFiss, 'pipeFiss') partFissPipe = geompy.MakePartition([shapeDefaut, pipeFiss], [], [], [], geompy.ShapeType["FACE"], 0, [], 1) - geompy.addToStudy(partFissPipe, 'partFissPipe') + geomPublish(initLog.debug, partFissPipe, 'partFissPipe') fissPipe = geompy.GetInPlaceByHistory(partFissPipe, shapeDefaut) - geompy.addToStudy(fissPipe, 'fissPipe') + geomPublish(initLog.debug, fissPipe, 'fissPipe') partPipe = geompy.GetInPlaceByHistory(partFissPipe, pipeFiss) - geompy.addToStudy(partPipe, 'partPipe') + geomPublish(initLog.debug, partPipe, 'partPipe') edgesPipeFiss = geompy.GetSharedShapesMulti([fissPipe, partPipe], geompy.ShapeType["EDGE"]) for i, edge in enumerate(edgesPipeFiss): name = "edgePipe%d"%i - geompy.addToStudyInFather(fissPipe, edge, name) + geomPublishInFather(initLog.debug,fissPipe, edge, name) try: wirePipeFiss = geompy.MakeWire(edgesPipeFiss) except: wirePipeFiss = geompy.MakeCompound(edgesPipeFiss) logging.debug("wirePipeFiss construit sous forme de compound") - geompy.addToStudy(wirePipeFiss, "wirePipeFiss") + geomPublish(initLog.debug, wirePipeFiss, "wirePipeFiss") wireFondFiss = geompy.GetInPlace(partFissPipe,fondFiss) edgesFondFiss = geompy.GetSharedShapesMulti([fissPipe, wireFondFiss], geompy.ShapeType["EDGE"]) for i, edge in enumerate(edgesFondFiss): name = "edgeFondFiss%d"%i - geompy.addToStudyInFather(fissPipe, edge, name) + geomPublishInFather(initLog.debug,fissPipe, edge, name) wireFondFiss = geompy.MakeWire(edgesFondFiss) - geompy.addToStudy(wireFondFiss,"wireFondFiss") + geomPublish(initLog.debug, wireFondFiss,"wireFondFiss") return (fissPipe, edgesPipeFiss, edgesFondFiss, wirePipeFiss, wireFondFiss) \ No newline at end of file diff --git a/src/Tools/blocFissure/gmu/propagateTore.py b/src/Tools/blocFissure/gmu/propagateTore.py index 70678a420..23200e1f7 100644 --- a/src/Tools/blocFissure/gmu/propagateTore.py +++ b/src/Tools/blocFissure/gmu/propagateTore.py @@ -2,6 +2,9 @@ import logging from geomsmesh import geompy +from geomsmesh import geomPublish +from geomsmesh import geomPublishInFather +import initLog # ----------------------------------------------------------------------------- # --- recherche et classement des edges du tore par propagate @@ -18,7 +21,7 @@ def propagateTore(tore): lencomp = [] compounds = geompy.Propagate(tore) for i in range(len(compounds)): - #geompy.addToStudyInFather( tore, compounds[i], 'edges' ) + #geomPublishInFather(initLog.debug, tore, compounds[i], 'edges' ) props = geompy.BasicProperties(compounds[i]) lencomp.append(props[0]) pass @@ -35,10 +38,10 @@ def propagateTore(tore): else: circles.append(compounds[i]) - geompy.addToStudyInFather( tore, diams[0], 'diams0' ) - geompy.addToStudyInFather( tore, diams[1], 'diams1' ) - geompy.addToStudyInFather( tore, circles[0], 'circles0' ) - geompy.addToStudyInFather( tore, circles[1], 'circles1' ) - geompy.addToStudyInFather( tore, geners[0], 'geners' ) + geomPublishInFather(initLog.debug, tore, diams[0], 'diams0' ) + geomPublishInFather(initLog.debug, tore, diams[1], 'diams1' ) + geomPublishInFather(initLog.debug, tore, circles[0], 'circles0' ) + geomPublishInFather(initLog.debug, tore, circles[1], 'circles1' ) + geomPublishInFather(initLog.debug, tore, geners[0], 'geners' ) return diams, circles, geners diff --git a/src/Tools/blocFissure/gmu/quadranglesToShape.py b/src/Tools/blocFissure/gmu/quadranglesToShape.py index faa9478f7..b9facb652 100644 --- a/src/Tools/blocFissure/gmu/quadranglesToShape.py +++ b/src/Tools/blocFissure/gmu/quadranglesToShape.py @@ -2,6 +2,9 @@ import logging from geomsmesh import geompy +from geomsmesh import geomPublish +from geomsmesh import geomPublishInFather +import initLog import GEOM import math import numpy as np @@ -225,23 +228,23 @@ def quadranglesToShape(meshQuad, shapeFissureParams, centreFondFiss): if i == 0: noeudsBords[0].append(node) #name = "bord0_%d"%k - #geompy.addToStudy( node, name ) + #geomPublish(initLog.debug, node, name ) if i == (nbLignes -1): noeudsBords[2].append(node) #name = "bord2_%d"%k - #geompy.addToStudy( node, name ) + #geomPublish(initLog.debug, node, name ) if j == 0: noeudsBords[1].append(node) #name = "bord1_%d"%k - #geompy.addToStudy( node, name ) + #geomPublish(initLog.debug, node, name ) if j == (nbCols -1): noeudsBords[3].append(node) #name = "bord3_%d"%k - #geompy.addToStudy( node, name ) + #geomPublish(initLog.debug, node, name ) k += 1 curve = geompy.MakeInterpol(nodeList, False, False) #name = "curve_%d"%i - #geompy.addToStudy( curve, name ) + #geomPublish(initLog.debug, curve, name ) if len(curvconts) == 0 or len(curves) > 0: # éliminer les doublons de la surface sans découpe curvconts.append(nodeList) curves.append(curve) @@ -291,11 +294,11 @@ def quadranglesToShape(meshQuad, shapeFissureParams, centreFondFiss): vecteurDefaut = geompy.MakeVector(vertex, cdg) if vecteurDefaut is not None: - geompy.addToStudy(normal, "normFillOrig%d"%iface) - geompy.addToStudy(vecteurDefaut, "fromInterieur%d"%iface) + geomPublish(initLog.debug, normal, "normFillOrig%d"%iface) + geomPublish(initLog.debug, vecteurDefaut, "fromInterieur%d"%iface) if geompy.GetAngleRadians(vecteurDefaut, normal) > math.pi/2.0: filling = geompy.ChangeOrientation(filling) - geompy.addToStudy( filling, "filling%d"%iface ) + geomPublish(initLog.debug, filling, "filling%d"%iface ) #geompy.ExportBREP(filling, "filling.brep") iface = iface+1 fillings.append(filling) @@ -315,7 +318,7 @@ def quadranglesToShape(meshQuad, shapeFissureParams, centreFondFiss): curve = geompy.MakeInterpol(nodes, False, False) curves.append(curve) fillcont = geompy.MakeFilling(geompy.MakeCompound(curves), 2, 5, 0.0001, 0.0001, 0, GEOM.FOM_Default, True) - geompy.addToStudy( fillcont, "filcont%d"%icont ) + geomPublish(initLog.debug, fillcont, "filcont%d"%icont ) fillconts.append(fillcont) icont = icont+1 pass # --- loop while there are remaining nodes diff --git a/src/Tools/blocFissure/gmu/quadranglesToShapeNoCorner.py b/src/Tools/blocFissure/gmu/quadranglesToShapeNoCorner.py index a305a05d9..d3c52ab59 100644 --- a/src/Tools/blocFissure/gmu/quadranglesToShapeNoCorner.py +++ b/src/Tools/blocFissure/gmu/quadranglesToShapeNoCorner.py @@ -2,6 +2,9 @@ import logging from geomsmesh import geompy +from geomsmesh import geomPublish +from geomsmesh import geomPublishInFather +import initLog import GEOM import math import numpy as np @@ -40,6 +43,7 @@ def quadranglesToShapeNoCorner(meshQuad, shapeFissureParams, centreFondFiss): allNodeIds = meshQuad.GetNodesId() while len(allNodeIds): + logging.debug("len(allNodeIds): %s ", len(allNodeIds)) nodeIds = allNodeIds for idNode in nodeIds: # rechercher un coin elems = meshQuad.GetNodeInverseElements(idNode) @@ -227,23 +231,23 @@ def quadranglesToShapeNoCorner(meshQuad, shapeFissureParams, centreFondFiss): if i == 0: noeudsBords[0].append(node) #name = "bord0_%d"%k - #geompy.addToStudy( node, name ) + #geomPublish(initLog.debug, node, name ) if i == (nbLignes -1): noeudsBords[2].append(node) #name = "bord2_%d"%k - #geompy.addToStudy( node, name ) + #geomPublish(initLog.debug, node, name ) if j == 0: noeudsBords[1].append(node) #name = "bord1_%d"%k - #geompy.addToStudy( node, name ) + #geomPublish(initLog.debug, node, name ) if j == (nbCols -1): noeudsBords[3].append(node) #name = "bord3_%d"%k - #geompy.addToStudy( node, name ) + #geomPublish(initLog.debug, node, name ) k += 1 curve = geompy.MakeInterpol(nodeList, False, False) #name = "curve_%d"%i - #geompy.addToStudy( curve, name ) + #geomPublish(initLog.debug, curve, name ) if len(curvconts) == 0 or len(curves) > 0: # éliminer les doublons de la surface sans découpe curvconts.append(nodeList) curves.append(curve) @@ -293,11 +297,11 @@ def quadranglesToShapeNoCorner(meshQuad, shapeFissureParams, centreFondFiss): vecteurDefaut = geompy.MakeVector(vertex, cdg) if vecteurDefaut is not None: - geompy.addToStudy(normal, "normFillOrig%d"%iface) - geompy.addToStudy(vecteurDefaut, "fromInterieur%d"%iface) + geomPublish(initLog.debug, normal, "normFillOrig%d"%iface) + geomPublish(initLog.debug, vecteurDefaut, "fromInterieur%d"%iface) if geompy.GetAngleRadians(vecteurDefaut, normal) > math.pi/2.0: filling = geompy.ChangeOrientation(filling) - geompy.addToStudy( filling, "filling%d"%iface ) + geomPublish(initLog.debug, filling, "filling%d"%iface ) #geompy.ExportBREP(filling, "filling.brep") iface = iface+1 fillings.append(filling) @@ -318,7 +322,7 @@ def quadranglesToShapeNoCorner(meshQuad, shapeFissureParams, centreFondFiss): curve = geompy.MakeInterpol(nodes, False, False) curves.append(curve) fillcont = geompy.MakeFilling(geompy.MakeCompound(curves), 2, 5, 0.0001, 0.0001, 0, GEOM.FOM_Default, True) - geompy.addToStudy( fillcont, "filcont%d"%icont ) + geomPublish(initLog.debug, fillcont, "filcont%d"%icont ) fillconts.append(fillcont) icont = icont+1 pass # --- loop while there are remaining nodes diff --git a/src/Tools/blocFissure/gmu/quadranglesToShapeWithCorner.py b/src/Tools/blocFissure/gmu/quadranglesToShapeWithCorner.py index 83fba6078..66963300f 100644 --- a/src/Tools/blocFissure/gmu/quadranglesToShapeWithCorner.py +++ b/src/Tools/blocFissure/gmu/quadranglesToShapeWithCorner.py @@ -7,6 +7,9 @@ Created on Tue Jun 24 09:14:13 2014 import logging from geomsmesh import geompy +from geomsmesh import geomPublish +from geomsmesh import geomPublishInFather +import initLog import GEOM from listOfExtraFunctions import createNewMeshesFromCorner @@ -62,7 +65,7 @@ def quadranglesToShapeWithCorner(meshQuad, shapeDefaut, shapeFissureParams, cent # A partir des lignes de chaque face, # on recrée un objet GEOM temporaire par filling. filling = geompy.MakeFilling(geompy.MakeCompound(face), 2, 5, 0.0001, 0.0001, 0, GEOM.FOM_Default, True) - geompy.addToStudy(filling, 'filling_{0}'.format(i + 1)) + geomPublish(initLog.debug, filling, 'filling_{0}'.format(i + 1)) tmpFillings.append(filling) for face in setOfNodes: @@ -81,10 +84,10 @@ def quadranglesToShapeWithCorner(meshQuad, shapeDefaut, shapeFissureParams, cent tmpExplodeRef = geompy.ExtractShapes(filling, geompy.ShapeType["EDGE"], True) tmpExplodeNum = geompy.ExtractShapes(tmpPartition, geompy.ShapeType["EDGE"], True) if len(tmpExplodeRef) == len(tmpExplodeNum): - geompy.addToStudy(filling, "faceNonCoupee_{0}".format(i + 1)) + geomPublish(initLog.debug, filling, "faceNonCoupee_{0}".format(i + 1)) facesNonCoupees.append(filling) else: - geompy.addToStudy(filling, "faceCoupee_{0}".format(i + 1)) + geomPublish(initLog.debug, filling, "faceCoupee_{0}".format(i + 1)) facesCoupees.append(filling) fillings = facesCoupees, facesNonCoupees @@ -93,21 +96,21 @@ def quadranglesToShapeWithCorner(meshQuad, shapeDefaut, shapeFissureParams, cent tmpExplodeRef = geompy.ExtractShapes(shapeDefaut, geompy.ShapeType["EDGE"], True) + geompy.ExtractShapes(shapeDefaut, geompy.ShapeType["VERTEX"], True) tmpExplodeNum = geompy.ExtractShapes(tmpPartition, geompy.ShapeType["EDGE"], True) + geompy.ExtractShapes(tmpPartition, geompy.ShapeType["VERTEX"], True) if len(tmpExplodeRef) == len(tmpExplodeNum): - geompy.addToStudy(filling, "areteNonCoupee_{0}".format(i + 1)) + geomPublish(initLog.debug, filling, "areteNonCoupee_{0}".format(i + 1)) aretesNonCoupees.append(filling) else: - geompy.addToStudy(filling, "areteCoupee_{0}".format(i + 1)) + geomPublish(initLog.debug, filling, "areteCoupee_{0}".format(i + 1)) aretesCoupees.append(filling) bords_Partages = aretesCoupees, aretesNonCoupees # TODO: A enlever # for i, face in enumerate(setOfLines): # for j, line in enumerate(face): -# geompy.addToStudy(line, 'face{0}_ligne{1}'.format(i + 1, j + 1)) +# geomPublish(initLog.debug, line, 'face{0}_ligne{1}'.format(i + 1, j + 1)) #TODO: A enlever # for i, filling in enumerate(fillings[0]): -# geompy.addToStudy(filling, 'filling_{0}'.format(i + 1)) +# geomPublish(initLog.debug, filling, 'filling_{0}'.format(i + 1)) # for j, line in enumerate(setOfLines[i]): # geompy.addToStudyInFather(filling, line, 'line_{0}'.format(j + 1)) diff --git a/src/Tools/blocFissure/gmu/restreintFaceFissure.py b/src/Tools/blocFissure/gmu/restreintFaceFissure.py index 4cadb4984..50e867e0c 100644 --- a/src/Tools/blocFissure/gmu/restreintFaceFissure.py +++ b/src/Tools/blocFissure/gmu/restreintFaceFissure.py @@ -2,6 +2,9 @@ import logging from geomsmesh import geompy +from geomsmesh import geomPublish +from geomsmesh import geomPublishInFather +import initLog from sortFaces import sortFaces def restreintFaceFissure(shapeDefaut, facesDefaut, pointInterne): @@ -11,7 +14,7 @@ def restreintFaceFissure(shapeDefaut, facesDefaut, pointInterne): """ logging.info('start') partShapeDefaut = geompy.MakePartition([shapeDefaut], facesDefaut, [], [], geompy.ShapeType["FACE"], 0, [], 0) - geompy.addToStudy(partShapeDefaut, 'partShapeDefaut') + geomPublish(initLog.debug, partShapeDefaut, 'partShapeDefaut') facesPartShapeDefaut = geompy.ExtractShapes(partShapeDefaut, geompy.ShapeType["FACE"], False) if pointInterne is not None: distfaces = [(geompy.MinDistance(face,pointInterne), i, face) for i, face in enumerate(facesPartShapeDefaut)] @@ -23,5 +26,5 @@ def restreintFaceFissure(shapeDefaut, facesDefaut, pointInterne): logging.debug("surfaces faces fissure étendue, min %s, max %s", minSurf, maxSurf) facesPortFissure = facesPartShapeDefautSorted[-1] - geompy.addToStudy(facesPortFissure, "facesPortFissure") + geomPublish(initLog.debug, facesPortFissure, "facesPortFissure") return facesPortFissure diff --git a/src/Tools/blocFissure/gmu/rotTrans.py b/src/Tools/blocFissure/gmu/rotTrans.py index 7b8ff6e47..05e3dcbe1 100644 --- a/src/Tools/blocFissure/gmu/rotTrans.py +++ b/src/Tools/blocFissure/gmu/rotTrans.py @@ -2,6 +2,9 @@ import logging from geomsmesh import geompy +from geomsmesh import geomPublish +from geomsmesh import geomPublishInFather +import initLog import math from triedreBase import triedreBase O, OX, OY, OZ = triedreBase() @@ -48,9 +51,9 @@ def rotTrans(objet, orientation, point, normal, trace = False): logging.debug("alpha",alpha) logging.debug("beta",beta) if trace: - geompy.addToStudy( rot1, 'rot1' ) - geompy.addToStudy( axe2, 'axe2' ) - geompy.addToStudy( rot2, 'rot2' ) + geomPublish(initLog.debug, rot1, 'rot1' ) + geomPublish(initLog.debug, axe2, 'axe2' ) + geomPublish(initLog.debug, rot2, 'rot2' ) xyz = geompy.PointCoordinates(point) trans = geompy.MakeTranslation(rot2, xyz[0], xyz[1], xyz[2]) diff --git a/src/Tools/blocFissure/gmu/shapeSurFissure.py b/src/Tools/blocFissure/gmu/shapeSurFissure.py index 10b125ff7..f9e36ac19 100644 --- a/src/Tools/blocFissure/gmu/shapeSurFissure.py +++ b/src/Tools/blocFissure/gmu/shapeSurFissure.py @@ -2,6 +2,9 @@ import logging from geomsmesh import geompy +from geomsmesh import geomPublish +from geomsmesh import geomPublishInFather +import initLog # ----------------------------------------------------------------------------- # --- construction d'une shape de dectection des éléments à modifier suite à la la duplication des noeuds de la face fissure (d'un coté de la face) @@ -30,6 +33,6 @@ def shapeSurFissure(facesFissure): normal = geompy.GetNormal(face, vertex) extrusionFaceFissure = geompy.MakePrismVecH(facesFissure, normal, 100) - geompy.addToStudy(extrusionFaceFissure, "extrusionFaceFissure") + geomPublish(initLog.debug, extrusionFaceFissure, "extrusionFaceFissure") return extrusionFaceFissure, normal diff --git a/src/Tools/blocFissure/gmu/sortGeneratrices.py b/src/Tools/blocFissure/gmu/sortGeneratrices.py index 956a8bcb8..f61dc2838 100644 --- a/src/Tools/blocFissure/gmu/sortGeneratrices.py +++ b/src/Tools/blocFissure/gmu/sortGeneratrices.py @@ -2,6 +2,9 @@ import logging from geomsmesh import geompy +from geomsmesh import geomPublish +from geomsmesh import geomPublishInFather +import initLog # ----------------------------------------------------------------------------- # --- tri par longueur des 3 generatrices @@ -36,8 +39,8 @@ def sortGeneratrices(tore, geners): gencnt= genx[i] pass - geompy.addToStudyInFather( tore, genext, 'genext' ) - geompy.addToStudyInFather( tore, genint, 'genint' ) - geompy.addToStudyInFather( tore, gencnt, 'gencnt' ) + geomPublishInFather(initLog.debug, tore, genext, 'genext' ) + geomPublishInFather(initLog.debug, tore, genint, 'genint' ) + geomPublishInFather(initLog.debug, tore, gencnt, 'gencnt' ) return genext, genint, gencnt diff --git a/src/Tools/blocFissure/gmu/toreFissure.py b/src/Tools/blocFissure/gmu/toreFissure.py index 899ef5e0c..12464f65d 100644 --- a/src/Tools/blocFissure/gmu/toreFissure.py +++ b/src/Tools/blocFissure/gmu/toreFissure.py @@ -2,6 +2,9 @@ import logging from geomsmesh import geompy +from geomsmesh import geomPublish +from geomsmesh import geomPublishInFather +import initLog import math from triedreBase import triedreBase @@ -28,11 +31,11 @@ def toreFissure(minRad,allonge,rayTore): Arc_1 = geompy.MakeArc(Vertex_1, Vertex_2, Vertex_3) generatrice = geompy.MakeScaleAlongAxes(Arc_1, O, 1, allonge, 1) - #geompy.addToStudy( Vertex_1, 'Vertex_1' ) - #geompy.addToStudy( Vertex_2, 'Vertex_2' ) - #geompy.addToStudy( Vertex_3, 'Vertex_3' ) - #geompy.addToStudy( Arc_1, 'Arc_1' ) - #geompy.addToStudy( generatrice, 'generatrice' ) + #geomPublish(initLog.debug, Vertex_1, 'Vertex_1' ) + #geomPublish(initLog.debug, Vertex_2, 'Vertex_2' ) + #geomPublish(initLog.debug, Vertex_3, 'Vertex_3' ) + #geomPublish(initLog.debug, Arc_1, 'Arc_1' ) + #geomPublish(initLog.debug, generatrice, 'generatrice' ) # --- face circulaire sur la generatrice, pour extrusion @@ -41,10 +44,10 @@ def toreFissure(minRad,allonge,rayTore): Translation_1 = geompy.MakeTranslation(Rotation_1, minRad, 0, 0) FaceGenFiss = geompy.MakeFaceWires([Translation_1], 1) - #geompy.addToStudy( Circle_1, 'Circle_1' ) - #geompy.addToStudy( Rotation_1, 'Rotation_1' ) - #geompy.addToStudy( Translation_1, 'Translation_1' ) - #geompy.addToStudy( FaceGenFiss, 'FaceGenFiss' ) + #geomPublish(initLog.debug, Circle_1, 'Circle_1' ) + #geomPublish(initLog.debug, Rotation_1, 'Rotation_1' ) + #geomPublish(initLog.debug, Translation_1, 'Translation_1' ) + #geomPublish(initLog.debug, FaceGenFiss, 'FaceGenFiss' ) # --- tore extrude @@ -56,14 +59,14 @@ def toreFissure(minRad,allonge,rayTore): Line_1 = geompy.MakeLineTwoPnt(Vertex_1, Scale_1_vertex_3) FaceFissure = geompy.MakeFaceWires([generatrice, Line_1], 1) - #geompy.addToStudyInFather( generatrice, Scale_1_vertex_3, 'Scale_1:vertex_3' ) - #geompy.addToStudy( Line_1, 'Line_1' ) - #geompy.addToStudy( FaceFissure, 'FaceFissure' ) + #geomPublishInFather(initLog.debug, generatrice, Scale_1_vertex_3, 'Scale_1:vertex_3' ) + #geomPublish(initLog.debug, Line_1, 'Line_1' ) + #geomPublish(initLog.debug, FaceFissure, 'FaceFissure' ) # --- tore coupe en 2 demi tore de section 1/2 disque Plane_1 = geompy.MakePlane(O, OZ, 2000) Pipe1Part = geompy.MakePartition([Pipe_1], [Plane_1], [], [], geompy.ShapeType["SOLID"], 0, [], 1) - geompy.addToStudy(Pipe1Part , 'Pipe1Part' ) + geomPublish(initLog.debug, Pipe1Part , 'Pipe1Part' ) return generatrice, FaceGenFiss, Pipe_1, FaceFissure, Plane_1, Pipe1Part diff --git a/src/Tools/blocFissure/gmu/triedreBase.py b/src/Tools/blocFissure/gmu/triedreBase.py index 53135633e..068ca40b7 100644 --- a/src/Tools/blocFissure/gmu/triedreBase.py +++ b/src/Tools/blocFissure/gmu/triedreBase.py @@ -2,6 +2,9 @@ import logging from geomsmesh import geompy +from geomsmesh import geomPublish +from geomsmesh import geomPublishInFather +import initLog # --- origine et vecteurs de base @@ -24,9 +27,9 @@ def triedreBase(): OY = geompy.MakeVectorDXDYDZ(0, 1, 0) OZ = geompy.MakeVectorDXDYDZ(0, 0, 1) - geompy.addToStudy( O, 'O' ) - geompy.addToStudy( OX, 'OX' ) - geompy.addToStudy( OY, 'OY' ) - geompy.addToStudy( OZ, 'OZ' ) + geomPublish(initLog.debug, O, 'O' ) + geomPublish(initLog.debug, OX, 'OX' ) + geomPublish(initLog.debug, OY, 'OY' ) + geomPublish(initLog.debug, OZ, 'OZ' ) return O, OX, OY, OZ diff --git a/src/Tools/blocFissure/gmu/trouveEdgesFissPeau.py b/src/Tools/blocFissure/gmu/trouveEdgesFissPeau.py index 13289ac2c..49205e688 100644 --- a/src/Tools/blocFissure/gmu/trouveEdgesFissPeau.py +++ b/src/Tools/blocFissure/gmu/trouveEdgesFissPeau.py @@ -3,6 +3,9 @@ import logging from geomsmesh import geompy +from geomsmesh import geomPublish +from geomsmesh import geomPublishInFather +import initLog def trouveEdgesFissPeau(facesInside, facesOnside, edgesPipeIn, edgesFondIn, partitionPeauFissFond, edgesFissExtPeau): """ @@ -24,6 +27,6 @@ def trouveEdgesFissPeau(facesInside, facesOnside, edgesPipeIn, edgesFondIn, part if (len(edgesPeauFis) > 0) and (len(edgesPipeFis) > 0) and (len(edgesPipeFnd) == 0): edgesFissExtPeau.append(edgesPeauFis[0]) name="edgesFissExtPeau%d"%j - geompy.addToStudyInFather(partitionPeauFissFond, edgesPeauFis[0], name) + geomPublishInFather(initLog.debug,partitionPeauFissFond, edgesPeauFis[0], name) j += 1 return edgesFissExtPeau \ No newline at end of file