cosmétique

This commit is contained in:
GERALD NICOLAS 2021-01-28 15:06:48 +01:00
parent 4e85b9376b
commit 8fde0dfff8
4 changed files with 68 additions and 60 deletions

View File

@ -18,6 +18,8 @@
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
# #
"""maillage faces de peau"""
import logging import logging
from .geomsmesh import geompy from .geomsmesh import geompy
@ -34,9 +36,7 @@ def mailleFacesPeau(partitionsPeauFissFond, idFillingFromBout, facesDefaut,
facesPeaux, edCircPeau, ptCircPeau, gpedgeBord, gpedgeVifs, edFissPeau, facesPeaux, edCircPeau, ptCircPeau, gpedgeBord, gpedgeVifs, edFissPeau,
bordsLibres, grpEdgesPeauFissureExterne, grpAretesVives, bordsLibres, grpEdgesPeauFissureExterne, grpAretesVives,
edgesCircPipeGroup, dmoyen, rayonPipe, nbsegRad): edgesCircPipeGroup, dmoyen, rayonPipe, nbsegRad):
""" """maillage faces de peau"""
maillage faces de peau
"""
logging.info('start') logging.info('start')
nbFacesFilling = len(partitionsPeauFissFond) nbFacesFilling = len(partitionsPeauFissFond)
boutFromIfil = [None for i in range(nbFacesFilling)] boutFromIfil = [None for i in range(nbFacesFilling)]

View File

@ -18,17 +18,17 @@
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
# #
"""Maillage sain sans la zone de defaut"""
import logging import logging
from .geomsmesh import geompy
from .geomsmesh import smesh from .geomsmesh import smesh
import SMESH import SMESH
from .geomsmesh import geompy
# -----------------------------------------------------------------------------
# --- maillage complet et fissure
def RegroupeSainEtDefaut(maillageSain, blocComplet, extrusionFaceFissure, faceGeomFissure, nomVolume, normal = None): def RegroupeSainEtDefaut(maillageSain, blocComplet, extrusionFaceFissure, faceGeomFissure, nomVolume, normal = None):
""" """Maillage sain sans la zone de defaut
Maillage sain sans la zone de defaut
TODO: a completer TODO: a completer
""" """
logging.info('Concatenation') logging.info('Concatenation')
@ -36,22 +36,26 @@ def RegroupeSainEtDefaut(maillageSain, blocComplet, extrusionFaceFissure, faceGe
maillageComplet = smesh.Concatenate([maillageSain.GetMesh(), blocComplet.GetMesh()], 1, 1, 1e-05,False) maillageComplet = smesh.Concatenate([maillageSain.GetMesh(), blocComplet.GetMesh()], 1, 1, 1e-05,False)
groups = maillageComplet.GetGroups() groups = maillageComplet.GetGroups()
grps = [ grp for grp in groups if grp.GetName() == 'FACE1'] for grp in groups:
faceFissure = grps[0] grp_nom = grp.GetName()
grps = [ grp for grp in groups if grp.GetName() == 'nfondfis'] if ( grp_nom == "FACE1" ):
noeudsFondFissure = grps[0] faceFissure = grp
grps = [ grp for grp in groups if grp.GetName() == 'fisInPi'] elif ( grp_nom == "nfondfis" ):
fisInPi = grps[0] noeudsFondFissure = grp
grps = [ grp for grp in groups if grp.GetName() == 'fisOutPi'] elif ( grp_nom == "fisInPi" ):
fisOutPi = grps[0] fisInPi = grp
elif ( grp_nom == "fisOutPi" ):
fisOutPi = grp
# --- TODO: fiabiliser l'orientation dans le cas general # --- TODO: fiabiliser l'orientation dans le cas general
if normal is None: if normal is None:
normal = smesh.MakeDirStruct( 0, 0, 1 ) normal = smesh.MakeDirStruct( 0, 0, 1 )
logging.debug('après normal = {}'.format(normal))
maillageComplet.Reorient2D( fisInPi, normal, [0,0,0]) maillageComplet.Reorient2D( fisInPi, normal, [0,0,0])
logging.debug('après Reorient2D In')
maillageComplet.Reorient2D( fisOutPi, normal, [0,0,0]) maillageComplet.Reorient2D( fisOutPi, normal, [0,0,0])
shapes = [] shapes = list()
if extrusionFaceFissure is not None: if extrusionFaceFissure is not None:
subIds = geompy.SubShapeAllIDs(extrusionFaceFissure, geompy.ShapeType["SOLID"]) subIds = geompy.SubShapeAllIDs(extrusionFaceFissure, geompy.ShapeType["SOLID"])
if len(subIds) > 1: if len(subIds) > 1:
@ -65,39 +69,46 @@ def RegroupeSainEtDefaut(maillageSain, blocComplet, extrusionFaceFissure, faceGe
# else: # else:
# shapes = [faceGeomFissure] # shapes = [faceGeomFissure]
grpEdges = [] grpEdges = list()
grpFaces = [] grpFaces = list()
grpVolumes = [] grpVolumes = list()
if len(shapes) == 0: if len(shapes) == 0:
shapes = [None] # calcul uniquement avec les normales des faces mailles de la fissure shapes = [None] # calcul uniquement avec les normales des faces mailles de la fissure
for i, aShape in enumerate(shapes): for i, aShape in enumerate(shapes):
logging.info('Detection elements affectes par le dedoublement de la face %d'%i) texte = "Detection elements affectes par le dedoublement de la face n° {}".format(i)
logging.debug(texte)
affectedGroups = maillageComplet.AffectedElemGroupsInRegion([faceFissure], [noeudsFondFissure], aShape) affectedGroups = maillageComplet.AffectedElemGroupsInRegion([faceFissure], [noeudsFondFissure], aShape)
grps = [ grp for grp in affectedGroups if grp.GetName() == 'affectedEdges'] for grp in affectedGroups:
affectedEdges = grps[0] grp_nom = grp.GetName()
if ( grp_nom == "affectedEdges" ):
affectedEdges = grp
elif ( grp_nom == "affectedFaces" ):
affectedFaces = grp
elif ( grp_nom == "affectedVolumes" ):
affectedVolumes = grp
#grps = [ grp for grp in affectedGroups if grp.GetName() == 'affectedEdges']
#affectedEdges = grps[0]
affectedEdges.SetName('affEd%d'%i) affectedEdges.SetName('affEd%d'%i)
grpEdges.append(affectedEdges) grpEdges.append(affectedEdges)
grps = [ grp for grp in affectedGroups if grp.GetName() == 'affectedFaces'] #grps = [ grp for grp in affectedGroups if grp.GetName() == 'affectedFaces']
affectedFaces = grps[0] #affectedFaces = grps[0]
affectedFaces.SetName('affFa%d'%i) affectedFaces.SetName('affFa%d'%i)
grpFaces.append(affectedFaces) grpFaces.append(affectedFaces)
grps = [ grp for grp in affectedGroups if grp.GetName() == 'affectedVolumes'] #grps = [ grp for grp in affectedGroups if grp.GetName() == 'affectedVolumes']
affectedVolumes = grps[0] #affectedVolumes = grps[0]
affectedVolumes.SetName('affVo%d'%i) affectedVolumes.SetName('affVo%d'%i)
grpVolumes.append(affectedVolumes) grpVolumes.append(affectedVolumes)
logging.info("union des groupes d'edges")
affectedEdges = maillageComplet.UnionListOfGroups(grpEdges, 'affEdges') affectedEdges = maillageComplet.UnionListOfGroups(grpEdges, 'affEdges')
logging.info("union des groupes de faces")
affectedFaces = maillageComplet.UnionListOfGroups(grpFaces, 'affFaces') affectedFaces = maillageComplet.UnionListOfGroups(grpFaces, 'affFaces')
logging.info("union des groupes de volumes")
affectedVolumes = maillageComplet.UnionListOfGroups(grpVolumes, 'affVols') affectedVolumes = maillageComplet.UnionListOfGroups(grpVolumes, 'affVols')
for grp in affectedGroups: for grp in affectedGroups:
logging.debug("nom groupe %s",grp.GetName()) texte = "Traitement du groupe '{}'".format(grp.GetName())
[ FACE2, FACE2_nodes ] = maillageComplet.DoubleNodeElemGroups([faceFissure], [noeudsFondFissure], affectedGroups, True, True) logging.debug(texte)
[ FACE2, _ ] = maillageComplet.DoubleNodeElemGroups([faceFissure], [noeudsFondFissure], affectedGroups, True, True)
FACE2.SetName( 'FACE2' ) FACE2.SetName( 'FACE2' )
# Groupe de toutes les mailles volumiques
GroupVol = maillageComplet.CreateEmptyGroup( SMESH.VOLUME, nomVolume ) GroupVol = maillageComplet.CreateEmptyGroup( SMESH.VOLUME, nomVolume )
nbAdd = GroupVol.AddFrom( maillageComplet.GetMesh() ) _ = GroupVol.AddFrom( maillageComplet.GetMesh() )
return maillageComplet return maillageComplet

View File

@ -19,15 +19,15 @@
# #
from blocFissure.materielCasTests import cubeAngle from blocFissure.materielCasTests import cubeAngle
from blocFissure.materielCasTests import cubeFin
from blocFissure.materielCasTests import decoupeCylindre from blocFissure.materielCasTests import decoupeCylindre
from blocFissure.materielCasTests import disque_perce
from blocFissure.materielCasTests import ellipse
from blocFissure.materielCasTests import ellipse_disque
from blocFissure.materielCasTests import ellipse_probleme
from blocFissure.materielCasTests import eprouvetteCourbe from blocFissure.materielCasTests import eprouvetteCourbe
from blocFissure.materielCasTests import eprouvetteDroite from blocFissure.materielCasTests import eprouvetteDroite
from blocFissure.materielCasTests import fissureGauche from blocFissure.materielCasTests import fissureGauche
from blocFissure.materielCasTests import fissureGauche2 from blocFissure.materielCasTests import fissureGauche2
from blocFissure.materielCasTests import tube from blocFissure.materielCasTests import ellipse
from blocFissure.materielCasTests import ellipse_probleme
from blocFissure.materielCasTests import disque_perce
from blocFissure.materielCasTests import ellipse_disque
from blocFissure.materielCasTests import vis from blocFissure.materielCasTests import vis
from blocFissure.materielCasTests import cubeFin
#from blocFissure.materielCasTests import tube

View File

@ -19,18 +19,20 @@
# #
"""Cas-test de blocFissure sur un tube""" """Cas-test de blocFissure sur un tube"""
__revision__ = "V02.04" __revision__ = "V02.05"
import logging import logging
import sys
import salome
salome.salome_init()
import os import os
from blocFissure import gmu from blocFissure import gmu
import salome
from SketchAPI import *
from salome.shaper import model
import SHAPERSTUDY
import SMESH
from salome.smesh import smeshBuilder
#=============== Options ==================== #=============== Options ====================
# 1. NOM_OBJET = nom de l'objet # 1. NOM_OBJET = nom de l'objet
NOM_OBJET = "Tube" NOM_OBJET = "Tube"
@ -51,14 +53,12 @@ NB_S_H = 60
NB_S_P = 30 NB_S_P = 30
#============================================ #============================================
salome.salome_init()
### ###
### SHAPER component ### SHAPER component
### ###
from SketchAPI import *
from salome.shaper import model
model.begin() model.begin()
partSet = model.moduleDocument() partSet = model.moduleDocument()
@ -152,7 +152,8 @@ SketchPoint_5 = SketchProjection_5.createdFeature()
### Create SketchEllipticArc ### Create SketchEllipticArc
SketchEllipticArc_1 = Sketch_2.addEllipticArc(-20, 8.956370781951521e-27, -10.21629725685072, 9.783702743149284, 10.10993798723031, 4.722461741243296, 9.440921421952831, 9.565935245237778, False) SketchEllipticArc_1 = Sketch_2.addEllipticArc(-20, 8.956370781951521e-27, -10.21629725685072, 9.783702743149284, 10.10993798723031, 4.722461741243296, 9.440921421952831, 9.565935245237778, False)
[SketchPoint_6, SketchPoint_7, SketchPoint_8, SketchPoint_9, SketchPoint_10, SketchPoint_11, SketchPoint_12, SketchLine_7, SketchLine_8] = SketchEllipticArc_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") [SketchPoint_6, SketchPoint_7, SketchPoint_8, SketchPoint_9, SketchPoint_10, SketchPoint_11, SketchPoint_12, SketchLine_7, SketchLine_8] = \
SketchEllipticArc_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux")
Sketch_2.setCoincident(SketchEllipticArc_1.startPoint(), SketchLine_6.endPoint()) Sketch_2.setCoincident(SketchEllipticArc_1.startPoint(), SketchLine_6.endPoint())
Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_6).coordinates(), SketchLine_5.result()) Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_6).coordinates(), SketchLine_5.result())
Sketch_2.setTangent(SketchEllipticArc_1.result(), SketchArc_1.results()[1]) Sketch_2.setTangent(SketchEllipticArc_1.result(), SketchArc_1.results()[1])
@ -228,7 +229,7 @@ model.end()
### ###
model.publishToShaperStudy() model.publishToShaperStudy()
import SHAPERSTUDY
l_aux = SHAPERSTUDY.shape(model.featureStringId(Revolution_1)) l_aux = SHAPERSTUDY.shape(model.featureStringId(Revolution_1))
objet = l_aux[0] objet = l_aux[0]
l_groups = l_aux[1:] l_groups = l_aux[1:]
@ -237,11 +238,7 @@ l_groups = l_aux[1:]
### SMESH component ### SMESH component
### ###
import SMESH, SALOMEDS
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New() smesh = smeshBuilder.New()
from salome.StdMeshers import StdMeshersBuilder
Maillage_tube = smesh.Mesh(objet) Maillage_tube = smesh.Mesh(objet)
smesh.SetName(Maillage_tube, NOM_OBJET) smesh.SetName(Maillage_tube, NOM_OBJET)