Noms d'objets

This commit is contained in:
GERALD NICOLAS 2021-04-06 17:50:03 +02:00
parent caba16c69d
commit c018079f7f
11 changed files with 39 additions and 29 deletions

View File

@ -63,6 +63,7 @@ def calculePointsAxiauxPipe(edgesFondFiss, edgesIdByOrientation, facesDefaut,
logging.info(texte) logging.info(texte)
meshFondExt = smesh.Mesh(wireFondFiss) meshFondExt = smesh.Mesh(wireFondFiss)
putName(meshFondExt, "wireFondFiss", i_pref=nro_cas)
algo1d = meshFondExt.Segment() algo1d = meshFondExt.Segment()
hypo1d = algo1d.Adaptive(lgmin, lgmax, deflexion) # a ajuster selon la profondeur de la fissure hypo1d = algo1d.Adaptive(lgmin, lgmax, deflexion) # a ajuster selon la profondeur de la fissure
putName(algo1d.GetSubMesh(), "wireFondFiss", i_pref=nro_cas) putName(algo1d.GetSubMesh(), "wireFondFiss", i_pref=nro_cas)
@ -95,14 +96,12 @@ def calculePointsAxiauxPipe(edgesFondFiss, edgesIdByOrientation, facesDefaut,
origins = list() origins = list()
normals = list() normals = list()
for edu in usort: for edu in usort:
ied = edu[1]
parametre = edu[2]
vertcx = ptGSdic[edu] vertcx = ptGSdic[edu]
norm = geompy.MakeTangentOnCurve(edgesFondFiss[ied], parametre) norm = geompy.MakeTangentOnCurve(edgesFondFiss[edu[1]], edu[2])
plan = geompy.MakePlane(vertcx, norm, 3.*rayonPipe) plan = geompy.MakePlane(vertcx, norm, 3.*rayonPipe)
part = geompy.MakePartition([plan], [wirePipeFiss], list(), list(), geompy.ShapeType["VERTEX"], 0, list(), 0) part = geompy.MakePartition([plan], [wirePipeFiss], list(), list(), geompy.ShapeType["VERTEX"], 0, list(), 0)
liste = geompy.ExtractShapes(part, geompy.ShapeType["VERTEX"], True) liste = geompy.ExtractShapes(part, geompy.ShapeType["VERTEX"], True)
if len(liste) == 5: # 4 coins du plan plus intersection recherchée if ( len(liste) == 5 ): # 4 coins du plan plus intersection recherchée
for point in liste: for point in liste:
if geompy.MinDistance(point, vertcx) < 1.1*rayonPipe: # les quatre coins sont plus loin if geompy.MinDistance(point, vertcx) < 1.1*rayonPipe: # les quatre coins sont plus loin
vertpx = point vertpx = point
@ -135,8 +134,8 @@ def calculePointsAxiauxPipe(edgesFondFiss, edgesIdByOrientation, facesDefaut,
points = [vertcx] # les points du rayon de référence points = [vertcx] # les points du rayon de référence
dist_0 = rayonPipe/float(nbsegRad) dist_0 = rayonPipe/float(nbsegRad)
for j in range(nbsegRad): for j_aux in range(nbsegRad):
point = geompy.MakeTranslationVectorDistance(vertcx, vec1, (j+1)*dist_0) point = geompy.MakeTranslationVectorDistance(vertcx, vec1, float(j_aux+1)*dist_0)
points.append(point) points.append(point)
gptdsk.append(points) gptdsk.append(points)
point = geompy.MakeTranslationVectorDistance(vertcx, vec1, 1.5*rayonPipe) point = geompy.MakeTranslationVectorDistance(vertcx, vec1, 1.5*rayonPipe)
@ -144,15 +143,15 @@ def calculePointsAxiauxPipe(edgesFondFiss, edgesIdByOrientation, facesDefaut,
raydisks[0].append(rayon) raydisks[0].append(rayon)
angle_0 = 2.*math.pi/float(nbsegCercle) angle_0 = 2.*math.pi/float(nbsegCercle)
for k in range(nbsegCercle-1): for k_aux in range(nbsegCercle-1):
angle = float(k+1)*angle_0 angle = float(k_aux+1)*angle_0
pts = [vertcx] # les points d'un rayon obtenu par rotation pts = [vertcx] # les points d'un rayon obtenu par rotation
for j in range(nbsegRad): for j_aux in range(nbsegRad):
point = geompy.MakeRotation(points[j+1], normal, angle) point = geompy.MakeRotation(points[j_aux+1], normal, angle)
pts.append(point) pts.append(point)
gptdsk.append(pts) gptdsk.append(pts)
ray = geompy.MakeRotation(rayon, normal, angle) ray = geompy.MakeRotation(rayon, normal, angle)
raydisks[k+1].append(ray) raydisks[k_aux+1].append(ray)
gptsdisks.append(gptdsk) gptsdisks.append(gptdsk)

View File

@ -24,16 +24,20 @@ import logging
import SMESH import SMESH
from .geomsmesh import smesh from .geomsmesh import smesh
from .putName import putName
from .construitMaillagePipe_a import construitMaillagePipe_a from .construitMaillagePipe_a import construitMaillagePipe_a
from .construitMaillagePipe_b import construitMaillagePipe_b from .construitMaillagePipe_b import construitMaillagePipe_b
from .construitMaillagePipe_c import construitMaillagePipe_c from .construitMaillagePipe_c import construitMaillagePipe_c
from .construitMaillagePipe_d import construitMaillagePipe_d from .construitMaillagePipe_d import construitMaillagePipe_d
def construitMaillagePipe(gptsdisks, idisklim, nbsegCercle, nbsegRad): def construitMaillagePipe(gptsdisks, idisklim, nbsegCercle, nbsegRad, \
nro_cas=None):
"""maillage effectif du pipe""" """maillage effectif du pipe"""
logging.info('start') logging.info('start')
meshPipe = smesh.Mesh(None, "meshPipe") meshPipe = smesh.Mesh(None, "meshPipe")
putName(meshPipe, "meshPipe", i_pref=nro_cas)
fondFissGroup = meshPipe.CreateEmptyGroup(SMESH.EDGE, "FONDFISS") fondFissGroup = meshPipe.CreateEmptyGroup(SMESH.EDGE, "FONDFISS")
nodesFondFissGroup = meshPipe.CreateEmptyGroup(SMESH.NODE, "nfondfis") nodesFondFissGroup = meshPipe.CreateEmptyGroup(SMESH.NODE, "nfondfis")
faceFissGroup = meshPipe.CreateEmptyGroup(SMESH.FACE, "fisInPi") faceFissGroup = meshPipe.CreateEmptyGroup(SMESH.FACE, "fisInPi")

View File

@ -33,6 +33,7 @@ from .quadranglesToShapeNoCorner import quadranglesToShapeNoCorner
from .creeZoneDefautFilling import creeZoneDefautFilling from .creeZoneDefautFilling import creeZoneDefautFilling
from .creeZoneDefautGeom import creeZoneDefautGeom from .creeZoneDefautGeom import creeZoneDefautGeom
from .getCentreFondFiss import getCentreFondFiss from .getCentreFondFiss import getCentreFondFiss
from .putName import putName
def creeZoneDefautDansObjetSain(geometriesSaines, maillagesSains, shapesFissure, \ def creeZoneDefautDansObjetSain(geometriesSaines, maillagesSains, shapesFissure, \
shapeFissureParams, maillageFissureParams, \ shapeFissureParams, maillageFissureParams, \
@ -89,6 +90,7 @@ def creeZoneDefautDansObjetSain(geometriesSaines, maillagesSains, shapesFissure,
isPlane = False isPlane = False
if isHexa and not isPlane: if isHexa and not isPlane:
meshQuad = smesh.CopyMesh( zoneDefaut_skin, 'meshQuad', 0, 0) meshQuad = smesh.CopyMesh( zoneDefaut_skin, 'meshQuad', 0, 0)
putName(meshQuad, "meshQuad", i_pref=nro_cas)
fillings, _, bordsPartages, fillconts, idFilToCont = quadranglesToShapeNoCorner(meshQuad, shapeFissureParams, centreFondFiss) fillings, _, bordsPartages, fillconts, idFilToCont = quadranglesToShapeNoCorner(meshQuad, shapeFissureParams, centreFondFiss)

View File

@ -2,7 +2,7 @@
# Copyright (C) 2014-2021 EDF R&D # Copyright (C) 2014-2021 EDF R&D
# #
# This library is free software; you can redistribute it and/or # This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public # modify it under the terms of th79e GNU Lesser General Public
# License as published by the Free Software Foundation; either # License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version. # version 2.1 of the License, or (at your option) any later version.
# #
@ -76,7 +76,7 @@ def fusionMaillageDefaut(maillageSain, maillageDefautCible, maillageInterneCible
tmpExplodeNum = geompy.ExtractShapes(tmpPartition, geompy.ShapeType["EDGE"], True) tmpExplodeNum = geompy.ExtractShapes(tmpPartition, geompy.ShapeType["EDGE"], True)
if len(tmpExplodeRef) == len(tmpExplodeNum): if len(tmpExplodeRef) == len(tmpExplodeNum):
logging.debug("face de filling non coupee") logging.debug("face de filling non coupee")
geompy.addToStudy( filling, "faceNonCoupee_{0}".format(i_aux+1)) # doit etre publie pour critere OK plus bas geompy.addToStudy( filling, "faceNonCoupee_{0}".format(i_aux+1)) # doit etre publié pour critère OK plus bas
facesNonCoupees.append(filling) facesNonCoupees.append(filling)
maillagesNonCoupes.append(listOfNewMeshes[i_aux]) maillagesNonCoupes.append(listOfNewMeshes[i_aux])
else: else:

View File

@ -24,7 +24,6 @@ from . import initLog
from .geomsmesh import geompy from .geomsmesh import geompy
from .geomsmesh import geomPublish from .geomsmesh import geomPublish
from .geomsmesh import geomPublishInFather
from .toreFissure import toreFissure from .toreFissure import toreFissure
from .ellipsoideDefaut import ellipsoideDefaut from .ellipsoideDefaut import ellipsoideDefaut

View File

@ -27,6 +27,7 @@ info = 20
warning = 30 warning = 30
error = 40 error = 40
critical = 50 critical = 50
always = 100
loglevel = warning loglevel = warning
logging.basicConfig(format='%(funcName)s[%(lineno)d] %(message)s', logging.basicConfig(format='%(funcName)s[%(lineno)d] %(message)s',

View File

@ -41,7 +41,7 @@ def insereFissureLongue_g(nomFicFissure, fichierMaillageFissure, nomFicSain, mai
nro_cas=None): nro_cas=None):
"""Les groupes de la fissure longue""" """Les groupes de la fissure longue"""
logging.info('start') logging.info('start')
logging.info("Pour le cas n°%d", mailleur, nro_cas) logging.info("Pour le cas n°%d", nro_cas)
O, _, _, _ = triedreBase() O, _, _, _ = triedreBase()

View File

@ -25,7 +25,9 @@ import SMESH
from .geomsmesh import geompy from .geomsmesh import geompy
from .geomsmesh import smesh from .geomsmesh import smesh
from .geomsmesh import geomPublish
from . import initLog
from .putName import putName from .putName import putName
def mailleAretesEtJonction (internalBoundary, aretesVivesCoupees, lgAretesVives, \ def mailleAretesEtJonction (internalBoundary, aretesVivesCoupees, lgAretesVives, \
@ -43,7 +45,7 @@ def mailleAretesEtJonction (internalBoundary, aretesVivesCoupees, lgAretesVives,
bordsLibres = internalBoundary.MakeGroupByFilter( 'bords', filtre ) bordsLibres = internalBoundary.MakeGroupByFilter( 'bords', filtre )
putName(bordsLibres, 'bordsLibres', i_pref=nro_cas) putName(bordsLibres, 'bordsLibres', i_pref=nro_cas)
# --- pour aider l'algo hexa-tetra à ne pas mettre de pyramides à l'exterieur des volumes repliés sur eux-mêmes # --- pour aider l'algo hexa-tetra à ne pas mettre de pyramides à l'extérieur des volumes repliés sur eux-mêmes
# on désigne les faces de peau en quadrangles par le groupe "skinFaces" # on désigne les faces de peau en quadrangles par le groupe "skinFaces"
skinFaces = internalBoundary.CreateEmptyGroup( SMESH.FACE, 'skinFaces' ) skinFaces = internalBoundary.CreateEmptyGroup( SMESH.FACE, 'skinFaces' )
@ -55,6 +57,7 @@ def mailleAretesEtJonction (internalBoundary, aretesVivesCoupees, lgAretesVives,
if aretesVivesCoupees: if aretesVivesCoupees:
aretesVivesC = geompy.MakeCompound(aretesVivesCoupees) aretesVivesC = geompy.MakeCompound(aretesVivesCoupees)
geomPublish(initLog.always, aretesVivesC, "aretesVives", nro_cas)
meshAretesVives = smesh.Mesh(aretesVivesC) meshAretesVives = smesh.Mesh(aretesVivesC)
algo1d = meshAretesVives.Segment() algo1d = meshAretesVives.Segment()
hypo1d = algo1d.LocalLength(lgAretesVives,[],1e-07) hypo1d = algo1d.LocalLength(lgAretesVives,[],1e-07)

View File

@ -97,6 +97,7 @@ def peauInterne(fichierMaillage, shapeDefaut, nomZones, \
_, maillageSain, DefautBoundary = maillageSain.MakeBoundaryElements( SMESH.BND_2DFROM3D, 'DefBound', '', 0, [ zoneDefaut ]) _, maillageSain, DefautBoundary = maillageSain.MakeBoundaryElements( SMESH.BND_2DFROM3D, 'DefBound', '', 0, [ zoneDefaut ])
internal = maillageSain.GetMesh().CutListOfGroups( [ DefautBoundary ], [ zoneDefaut_skin ], 'internal' ) internal = maillageSain.GetMesh().CutListOfGroups( [ DefautBoundary ], [ zoneDefaut_skin ], 'internal' )
internalBoundary = smesh.CopyMesh( internal, 'internalBoundary', 0, 0) internalBoundary = smesh.CopyMesh( internal, 'internalBoundary', 0, 0)
putName(internalBoundary, "internalBoundary", i_pref=nro_cas)
maillageDefautCible = smesh.CopyMesh(zoneDefaut_skin, 'maillageCible', 0, 0) maillageDefautCible = smesh.CopyMesh(zoneDefaut_skin, 'maillageCible', 0, 0)
putName(maillageDefautCible, "maillageCible", i_pref=nro_cas) putName(maillageDefautCible, "maillageCible", i_pref=nro_cas)

View File

@ -78,11 +78,11 @@ def quadranglesToShapeWithCorner(meshQuad, shapeDefaut, listOfCorners):
tmpFace.append(line) tmpFace.append(line)
setOfLines.append(tmpFace) setOfLines.append(tmpFace)
for i, face in enumerate(setOfLines): for i_aux, face in enumerate(setOfLines):
# A partir des lignes de chaque face, # A partir des lignes de chaque face,
# on recrée un objet GEOM temporaire par filling. # 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) filling = geompy.MakeFilling(geompy.MakeCompound(face), 2, 5, 0.0001, 0.0001, 0, GEOM.FOM_Default, True)
geomPublish(initLog.debug, filling, 'filling_{}'.format(i + 1)) geomPublish(initLog.debug, filling, 'filling_{}'.format(i_aux+1))
tmpFillings.append(filling) tmpFillings.append(filling)
for face in setOfNodes: for face in setOfNodes:
@ -96,27 +96,27 @@ def quadranglesToShapeWithCorner(meshQuad, shapeDefaut, listOfCorners):
line = geompy.MakeInterpol(tmpPoints, False, False) line = geompy.MakeInterpol(tmpPoints, False, False)
tmpBords.append(line) tmpBords.append(line)
for i, filling in enumerate(tmpFillings): for i_aux, filling in enumerate(tmpFillings):
tmpPartition = geompy.MakePartition([filling], [shapeDefaut], list(), list(), geompy.ShapeType["FACE"], 0, list(), 0, True) tmpPartition = geompy.MakePartition([filling], [shapeDefaut], list(), list(), geompy.ShapeType["FACE"], 0, list(), 0, True)
tmpExplodeRef = geompy.ExtractShapes(filling, geompy.ShapeType["EDGE"], True) tmpExplodeRef = geompy.ExtractShapes(filling, geompy.ShapeType["EDGE"], True)
tmpExplodeNum = geompy.ExtractShapes(tmpPartition, geompy.ShapeType["EDGE"], True) tmpExplodeNum = geompy.ExtractShapes(tmpPartition, geompy.ShapeType["EDGE"], True)
if len(tmpExplodeRef) == len(tmpExplodeNum): if len(tmpExplodeRef) == len(tmpExplodeNum):
geomPublish(initLog.debug, filling, "faceNonCoupee_{}".format(i + 1)) geomPublish(initLog.debug, filling, "faceNonCoupee_{}".format(i_aux+1))
facesNonCoupees.append(filling) facesNonCoupees.append(filling)
else: else:
geomPublish(initLog.debug, filling, "faceCoupee_{}".format(i + 1)) geomPublish(initLog.debug, filling, "faceCoupee_{}".format(i_aux+1))
facesCoupees.append(filling) facesCoupees.append(filling)
fillings = facesCoupees, facesNonCoupees fillings = facesCoupees, facesNonCoupees
for i, filling in enumerate(tmpBords): for i_aux, filling in enumerate(tmpBords):
tmpPartition = geompy.MakePartition([shapeDefaut], [filling], list(), list(), geompy.ShapeType["SHELL"], 0, list(), 0, True) tmpPartition = geompy.MakePartition([shapeDefaut], [filling], list(), list(), geompy.ShapeType["SHELL"], 0, list(), 0, True)
tmpExplodeRef = geompy.ExtractShapes(shapeDefaut, geompy.ShapeType["EDGE"], True) + geompy.ExtractShapes(shapeDefaut, geompy.ShapeType["VERTEX"], True) 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) tmpExplodeNum = geompy.ExtractShapes(tmpPartition, geompy.ShapeType["EDGE"], True) + geompy.ExtractShapes(tmpPartition, geompy.ShapeType["VERTEX"], True)
if len(tmpExplodeRef) == len(tmpExplodeNum): if len(tmpExplodeRef) == len(tmpExplodeNum):
geomPublish(initLog.debug, filling, "areteNonCoupee_{}".format(i + 1)) geomPublish(initLog.debug, filling, "areteNonCoupee_{}".format(i_aux+1))
aretesNonCoupees.append(filling) aretesNonCoupees.append(filling)
else: else:
geomPublish(initLog.debug, filling, "areteCoupee_{}".format(i + 1)) geomPublish(initLog.debug, filling, "areteCoupee_{}".format(i_aux+1))
aretesCoupees.append(filling) aretesCoupees.append(filling)
bords_Partages = aretesCoupees, aretesNonCoupees bords_Partages = aretesCoupees, aretesNonCoupees

View File

@ -31,7 +31,8 @@ from . import initLog
from .sortFaces import sortFaces from .sortFaces import sortFaces
from .fissError import fissError from .fissError import fissError
def restreintFaceFissure(shapeDefaut, facesDefaut, pointInterne): def restreintFaceFissure(shapeDefaut, facesDefaut, pointInterne, \
nro_cas=None):
"""restriction de la face de fissure au domaine solide """restriction de la face de fissure au domaine solide
partition face fissure étendue par fillings partition face fissure étendue par fillings
@ -39,13 +40,13 @@ def restreintFaceFissure(shapeDefaut, facesDefaut, pointInterne):
logging.info('start') logging.info('start')
partShapeDefaut = geompy.MakePartition([shapeDefaut], facesDefaut, [], [], geompy.ShapeType["FACE"], 0, [], 0) partShapeDefaut = geompy.MakePartition([shapeDefaut], facesDefaut, [], [], geompy.ShapeType["FACE"], 0, [], 0)
geomPublish(initLog.debug, partShapeDefaut, 'partShapeDefaut') geomPublish(initLog.debug, partShapeDefaut, 'partShapeDefaut', i_pref=nro_cas)
facesPartShapeDefaut = geompy.ExtractShapes(partShapeDefaut, geompy.ShapeType["FACE"], False) facesPartShapeDefaut = geompy.ExtractShapes(partShapeDefaut, geompy.ShapeType["FACE"], False)
if pointInterne is not None: if pointInterne is not None:
distfaces = [(geompy.MinDistance(face,pointInterne), i, face) for i, face in enumerate(facesPartShapeDefaut)] distfaces = [(geompy.MinDistance(face,pointInterne), i, face) for i, face in enumerate(facesPartShapeDefaut)]
distfaces.sort() distfaces.sort()
texte = "selection de la face la plus proche du point interne, distance={}".format(distfaces[0][0]) texte = "lection de la face la plus proche du point interne, distance={}".format(distfaces[0][0])
logging.debug(texte) logging.debug(texte)
facesPortFissure = distfaces[0][2] facesPortFissure = distfaces[0][2]
else: else:
@ -63,6 +64,6 @@ def restreintFaceFissure(shapeDefaut, facesDefaut, pointInterne):
logging.debug(texte) logging.debug(texte)
facesPortFissure = facesPartShapeDefautSorted[-1] facesPortFissure = facesPartShapeDefautSorted[-1]
geomPublish(initLog.debug, facesPortFissure, "facesPortFissure") geomPublish(initLog.debug, facesPortFissure, "facesPortFissure", i_pref=nro_cas)
return facesPortFissure return facesPortFissure