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

View File

@ -24,16 +24,20 @@ import logging
import SMESH
from .geomsmesh import smesh
from .putName import putName
from .construitMaillagePipe_a import construitMaillagePipe_a
from .construitMaillagePipe_b import construitMaillagePipe_b
from .construitMaillagePipe_c import construitMaillagePipe_c
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"""
logging.info('start')
meshPipe = smesh.Mesh(None, "meshPipe")
putName(meshPipe, "meshPipe", i_pref=nro_cas)
fondFissGroup = meshPipe.CreateEmptyGroup(SMESH.EDGE, "FONDFISS")
nodesFondFissGroup = meshPipe.CreateEmptyGroup(SMESH.NODE, "nfondfis")
faceFissGroup = meshPipe.CreateEmptyGroup(SMESH.FACE, "fisInPi")

View File

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

View File

@ -2,7 +2,7 @@
# Copyright (C) 2014-2021 EDF R&D
#
# 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
# 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)
if len(tmpExplodeRef) == len(tmpExplodeNum):
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)
maillagesNonCoupes.append(listOfNewMeshes[i_aux])
else:

View File

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

View File

@ -27,6 +27,7 @@ info = 20
warning = 30
error = 40
critical = 50
always = 100
loglevel = warning
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):
"""Les groupes de la fissure longue"""
logging.info('start')
logging.info("Pour le cas n°%d", mailleur, nro_cas)
logging.info("Pour le cas n°%d", nro_cas)
O, _, _, _ = triedreBase()

View File

@ -25,7 +25,9 @@ import SMESH
from .geomsmesh import geompy
from .geomsmesh import smesh
from .geomsmesh import geomPublish
from . import initLog
from .putName import putName
def mailleAretesEtJonction (internalBoundary, aretesVivesCoupees, lgAretesVives, \
@ -43,7 +45,7 @@ def mailleAretesEtJonction (internalBoundary, aretesVivesCoupees, lgAretesVives,
bordsLibres = internalBoundary.MakeGroupByFilter( 'bords', filtre )
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"
skinFaces = internalBoundary.CreateEmptyGroup( SMESH.FACE, 'skinFaces' )
@ -55,6 +57,7 @@ def mailleAretesEtJonction (internalBoundary, aretesVivesCoupees, lgAretesVives,
if aretesVivesCoupees:
aretesVivesC = geompy.MakeCompound(aretesVivesCoupees)
geomPublish(initLog.always, aretesVivesC, "aretesVives", nro_cas)
meshAretesVives = smesh.Mesh(aretesVivesC)
algo1d = meshAretesVives.Segment()
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 ])
internal = maillageSain.GetMesh().CutListOfGroups( [ DefautBoundary ], [ zoneDefaut_skin ], 'internal' )
internalBoundary = smesh.CopyMesh( internal, 'internalBoundary', 0, 0)
putName(internalBoundary, "internalBoundary", i_pref=nro_cas)
maillageDefautCible = smesh.CopyMesh(zoneDefaut_skin, 'maillageCible', 0, 0)
putName(maillageDefautCible, "maillageCible", i_pref=nro_cas)

View File

@ -78,11 +78,11 @@ def quadranglesToShapeWithCorner(meshQuad, shapeDefaut, listOfCorners):
tmpFace.append(line)
setOfLines.append(tmpFace)
for i, face in enumerate(setOfLines):
for i_aux, face in enumerate(setOfLines):
# 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)
geomPublish(initLog.debug, filling, 'filling_{}'.format(i + 1))
geomPublish(initLog.debug, filling, 'filling_{}'.format(i_aux+1))
tmpFillings.append(filling)
for face in setOfNodes:
@ -96,27 +96,27 @@ def quadranglesToShapeWithCorner(meshQuad, shapeDefaut, listOfCorners):
line = geompy.MakeInterpol(tmpPoints, False, False)
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)
tmpExplodeRef = geompy.ExtractShapes(filling, geompy.ShapeType["EDGE"], True)
tmpExplodeNum = geompy.ExtractShapes(tmpPartition, geompy.ShapeType["EDGE"], True)
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)
else:
geomPublish(initLog.debug, filling, "faceCoupee_{}".format(i + 1))
geomPublish(initLog.debug, filling, "faceCoupee_{}".format(i_aux+1))
facesCoupees.append(filling)
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)
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):
geomPublish(initLog.debug, filling, "areteNonCoupee_{}".format(i + 1))
geomPublish(initLog.debug, filling, "areteNonCoupee_{}".format(i_aux+1))
aretesNonCoupees.append(filling)
else:
geomPublish(initLog.debug, filling, "areteCoupee_{}".format(i + 1))
geomPublish(initLog.debug, filling, "areteCoupee_{}".format(i_aux+1))
aretesCoupees.append(filling)
bords_Partages = aretesCoupees, aretesNonCoupees

View File

@ -31,7 +31,8 @@ from . import initLog
from .sortFaces import sortFaces
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
partition face fissure étendue par fillings
@ -39,13 +40,13 @@ def restreintFaceFissure(shapeDefaut, facesDefaut, pointInterne):
logging.info('start')
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)
if pointInterne is not None:
distfaces = [(geompy.MinDistance(face,pointInterne), i, face) for i, face in enumerate(facesPartShapeDefaut)]
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)
facesPortFissure = distfaces[0][2]
else:
@ -63,6 +64,6 @@ def restreintFaceFissure(shapeDefaut, facesDefaut, pointInterne):
logging.debug(texte)
facesPortFissure = facesPartShapeDefautSorted[-1]
geomPublish(initLog.debug, facesPortFissure, "facesPortFissure")
geomPublish(initLog.debug, facesPortFissure, "facesPortFissure", i_pref=nro_cas)
return facesPortFissure