--- /dev/null
+# -*- coding: utf-8 -*-
+
+""" FissureLauncher:
+ Permet de lancer le script 'casStandard'
+ en fonction des paramètres contenus dans 'dicoParams'. """
+
+#import sys
+import salome
+
+#import os
+#from blocFissure import gmu
+from blocFissure.gmu import initLog
+initLog.setDebug()
+#initLog.setVerbose()
+
+from blocFissure.casStandard import casStandard
+
+mesh = 'ARE_sain_lin_rotated.med'
+crack = 'fissureExtrados.brep'
+
+dicoParams = dict(nomCas = 'fissTuyau',
+ maillageSain = '/local00/home/I48174/Documents/soudure/essaiFissure/{0}'.format(mesh),
+ brepFaceFissure = '/local00/home/I48174/Documents/soudure/essaiFissure/{0}'.format(crack),
+ edgeFissIds = [4],
+ lgInfluence = 12,
+ meshBrep = (0.05, 2.0),
+ rayonPipe = 1.0,
+ lenSegPipe = 1, #9,
+ nbSegRad = 8,
+ nbSegCercle = 20,
+ areteFaceFissure = 1.0)
+
+execInstance = casStandard(dicoParams)
+
+if salome.sg.hasDesktop():
+ salome.sg.updateObjBrowser(1)
--- /dev/null
+# -*- coding: utf-8 -*-
+
+""" FissureLauncher:
+ Permet de lancer le script 'casStandard'
+ en fonction des paramètres contenus dans 'dicoParams'. """
+
+#import sys
+import salome
+
+#import os
+#from blocFissure import gmu
+from blocFissure.gmu import initLog
+initLog.setDebug()
+#initLog.setVerbose()
+
+from blocFissure.casStandard import casStandard
+
+mesh = 'ARE_sain_lin_rotated.med'
+crack = 'fissureIntrados.brep'
+
+dicoParams = dict(nomCas = 'fissTuyau',
+ maillageSain = '/local00/home/I48174/Documents/soudure/essaiFissure/{0}'.format(mesh),
+ brepFaceFissure = '/local00/home/I48174/Documents/soudure/essaiFissure/{0}'.format(crack),
+ edgeFissIds = [4],
+ lgInfluence = 14,
+ meshBrep = (0.05, 2.0),
+ rayonPipe = 1.0,
+ lenSegPipe = 1, #9,
+ nbSegRad = 5,
+ nbSegCercle = 16,
+ areteFaceFissure = 1.0)
+
+execInstance = casStandard(dicoParams)
+
+if salome.sg.hasDesktop():
+ salome.sg.updateObjBrowser(1)
# scripts / static
SET(plugin_SCRIPTS
__init__.py
- casStandard.py
exemple.py
exemple2.py
)
__init__.py
cubeAngle2.py
cubeAngle.py
+ cubeCoin.py
+ cubeMilieu.py
+ cubeTransverse.py
cylindre_2.py
cylindre.py
disquePerce.py
from blocFissure.gmu.triedreBase import triedreBase
from blocFissure.gmu.genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut
from blocFissure.gmu.creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain
-from blocFissure.gmu.insereFissureGenerale import insereFissureGenerale
+from blocFissure.gmu.construitFissureGenerale import construitFissureGenerale
O, OX, OY, OZ = triedreBase()
# ---------------------------------------------------------------------------
def setParamShapeFissure(self):
"""
- paramètres de la fissure pour méthode insereFissureGenerale
+ paramètres de la fissure pour méthode construitFissureGenerale
lgInfluence : distance autour de la shape de fissure a remailler (A ajuster selon le maillage)
rayonPipe : le rayon du pile maillé en hexa autour du fond de fissure
"""
def genereMaillageFissure(self, geometriesSaines, maillagesSains,
shapesFissure, shapeFissureParams,
maillageFissureParams, elementsDefaut, step):
- maillageFissure = insereFissureGenerale(maillagesSains,
- shapesFissure, shapeFissureParams,
- maillageFissureParams, elementsDefaut, step)
+ maillageFissure = construitFissureGenerale(maillagesSains,
+ shapesFissure, shapeFissureParams,
+ maillageFissureParams, elementsDefaut, step)
return maillageFissure
# ---------------------------------------------------------------------------
# ---------------------------------------------------------------------------
def setParamShapeFissure(self):
"""
- paramètres de la fissure pour méthode insereFissureGenerale
+ paramètres de la fissure pour méthode construitFissureGenerale
lgInfluence : distance autour de la shape de fissure a remailler (A ajuster selon le maillage)
rayonPipe : le rayon du pile maillé en hexa autour du fond de fissure
"""
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import os
+from blocFissure import gmu
+
+dicoParams = dict(nomCas = 'cubeCoin',
+ maillageSain = os.path.join(gmu.pathBloc, 'materielCasTests/cubeFin.med'),
+ brepFaceFissure = os.path.join(gmu.pathBloc, "materielCasTests/cubeFin_Coin.brep"),
+ edgeFissIds = [7],
+ lgInfluence = 50,
+ meshBrep = (5,10),
+ rayonPipe = 10,
+ lenSegPipe = 7,
+ nbSegRad = 5,
+ nbSegCercle = 10,
+ areteFaceFissure = 20)
+
+ # ---------------------------------------------------------------------------
+
+referencesMaillageFissure = dict(Entity_Quad_Pyramid = 0,
+ Entity_Quad_Triangle = 0,
+ Entity_Quad_Edge = 0,
+ Entity_Quad_Penta = 0,
+ Entity_Quad_Hexa = 0,
+ Entity_Node = 0,
+ Entity_Quad_Tetra = 0,
+ Entity_Quad_Quadrangle = 0)
+
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import os
+from blocFissure import gmu
+
+dicoParams = dict(nomCas = 'cubeMilieu',
+ maillageSain = os.path.join(gmu.pathBloc, 'materielCasTests/cubeFin.med'),
+ brepFaceFissure = os.path.join(gmu.pathBloc, "materielCasTests/cubeFin_Milieu.brep"),
+ edgeFissIds = [4],
+ lgInfluence = 50,
+ meshBrep = (5,10),
+ rayonPipe = 10,
+ lenSegPipe = 7,
+ nbSegRad = 5,
+ nbSegCercle = 10,
+ areteFaceFissure = 10)
+
+# ---------------------------------------------------------------------------
+
+referencesMaillageFissure = dict(Entity_Quad_Pyramid = 0,
+ Entity_Quad_Triangle = 0,
+ Entity_Quad_Edge = 0,
+ Entity_Quad_Penta = 0,
+ Entity_Quad_Hexa = 0,
+ Entity_Node = 0,
+ Entity_Quad_Tetra = 0,
+ Entity_Quad_Quadrangle = 0)
+
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import os
+from blocFissure import gmu
+
+dicoParams = dict(nomCas = 'cubeTransverse',
+ maillageSain = os.path.join(gmu.pathBloc, 'materielCasTests/cubeFin.med'),
+ brepFaceFissure = os.path.join(gmu.pathBloc, "materielCasTests/cubeFin_Transverse.brep"),
+ edgeFissIds = [6],
+ lgInfluence = 50,
+ meshBrep = (5,10),
+ rayonPipe = 10,
+ lenSegPipe = 7,
+ nbSegRad = 5,
+ nbSegCercle = 10,
+ areteFaceFissure = 10)
+
+# ---------------------------------------------------------------------------
+
+referencesMaillageFissure = dict(Entity_Quad_Pyramid = 0,
+ Entity_Quad_Triangle = 0,
+ Entity_Quad_Edge = 0,
+ Entity_Quad_Penta = 0,
+ Entity_Quad_Hexa = 0,
+ Entity_Node = 0,
+ Entity_Quad_Tetra = 0,
+ Entity_Quad_Quadrangle = 0)
+
from blocFissure.gmu.triedreBase import triedreBase
from blocFissure.gmu.genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut
from blocFissure.gmu.creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain
-from blocFissure.gmu.insereFissureGenerale import insereFissureGenerale
+from blocFissure.gmu.construitFissureGenerale import construitFissureGenerale
O, OX, OY, OZ = triedreBase()
# ---------------------------------------------------------------------------
def setParamShapeFissure(self):
"""
- paramètres de la fissure pour méthode insereFissureGenerale
+ paramètres de la fissure pour méthode construitFissureGenerale
lgInfluence : distance autour de la shape de fissure a remailler (A ajuster selon le maillage)
rayonPipe : le rayon du pile maillé en hexa autour du fond de fissure
"""
def genereMaillageFissure(self, geometriesSaines, maillagesSains,
shapesFissure, shapeFissureParams,
maillageFissureParams, elementsDefaut, step):
- maillageFissure = insereFissureGenerale(maillagesSains,
- shapesFissure, shapeFissureParams,
- maillageFissureParams, elementsDefaut, step)
+ maillageFissure = construitFissureGenerale(maillagesSains,
+ shapesFissure, shapeFissureParams,
+ maillageFissureParams, elementsDefaut, step)
return maillageFissure
# ---------------------------------------------------------------------------
from blocFissure.gmu.triedreBase import triedreBase
from blocFissure.gmu.genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut
from blocFissure.gmu.creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain
-from blocFissure.gmu.insereFissureGenerale import insereFissureGenerale
+from blocFissure.gmu.construitFissureGenerale import construitFissureGenerale
O, OX, OY, OZ = triedreBase()
from blocFissure.gmu.triedreBase import triedreBase
from blocFissure.gmu.genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut
from blocFissure.gmu.creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain
-from blocFissure.gmu.insereFissureGenerale import insereFissureGenerale
+from blocFissure.gmu.construitFissureGenerale import construitFissureGenerale
O, OX, OY, OZ = triedreBase()
# ---------------------------------------------------------------------------
def setParamShapeFissure(self):
"""
- paramètres de la fissure pour méthode insereFissureGenerale
+ paramètres de la fissure pour méthode construitFissureGenerale
lgInfluence : distance autour de la shape de fissure a remailler (A ajuster selon le maillage)
rayonPipe : le rayon du pile maillé en hexa autour du fond de fissure
convexe : optionnel, True : la face est convexe (vue de l'exterieur) sert si on ne donne pas de point interne
def genereMaillageFissure(self, geometriesSaines, maillagesSains,
shapesFissure, shapeFissureParams,
maillageFissureParams, elementsDefaut, step):
- maillageFissure = insereFissureGenerale(maillagesSains,
- shapesFissure, shapeFissureParams,
- maillageFissureParams, elementsDefaut, step)
+ maillageFissure = construitFissureGenerale(maillagesSains,
+ shapesFissure, shapeFissureParams,
+ maillageFissureParams, elementsDefaut, step)
return maillageFissure
# ---------------------------------------------------------------------------
from blocFissure.gmu.triedreBase import triedreBase
from blocFissure.gmu.genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut
from blocFissure.gmu.creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain
-from blocFissure.gmu.insereFissureGenerale import insereFissureGenerale
+from blocFissure.gmu.construitFissureGenerale import construitFissureGenerale
O, OX, OY, OZ = triedreBase()
from blocFissure.gmu.triedreBase import triedreBase
from blocFissure.gmu.genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut
from blocFissure.gmu.creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain
-from blocFissure.gmu.insereFissureGenerale import insereFissureGenerale
+from blocFissure.gmu.construitFissureGenerale import construitFissureGenerale
O, OX, OY, OZ = triedreBase()
# ---------------------------------------------------------------------------
def setParamShapeFissure(self):
"""
- paramètres de la fissure pour méthode insereFissureGenerale
+ paramètres de la fissure pour méthode construitFissureGenerale
lgInfluence : distance autour de la shape de fissure a remailler (A ajuster selon le maillage)
rayonPipe : le rayon du pile maillé en hexa autour du fond de fissure
convexe : optionnel True : la face est convexe (vue de l'exterieur) sert si on ne donne pas de point interne
def genereMaillageFissure(self, geometriesSaines, maillagesSains,
shapesFissure, shapeFissureParams,
maillageFissureParams, elementsDefaut, step):
- maillageFissure = insereFissureGenerale(maillagesSains,
- shapesFissure, shapeFissureParams,
- maillageFissureParams, elementsDefaut, step)
+ maillageFissure = construitFissureGenerale(maillagesSains,
+ shapesFissure, shapeFissureParams,
+ maillageFissureParams, elementsDefaut, step)
return maillageFissure
# ---------------------------------------------------------------------------
from blocFissure.gmu.triedreBase import triedreBase
from blocFissure.gmu.genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut
from blocFissure.gmu.creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain
-from blocFissure.gmu.insereFissureGenerale import insereFissureGenerale
+from blocFissure.gmu.construitFissureGenerale import construitFissureGenerale
O, OX, OY, OZ = triedreBase()
# ---------------------------------------------------------------------------
def setParamShapeFissure(self):
"""
- paramètres de la fissure pour méthode insereFissureGenerale
+ paramètres de la fissure pour méthode construitFissureGenerale
lgInfluence : distance autour de la shape de fissure a remailler (A ajuster selon le maillage)
rayonPipe : le rayon du pile maillé en hexa autour du fond de fissure
convexe : optionnel True : la face est convexe (vue de l'exterieur) sert si on ne donne pas de point interne
def genereMaillageFissure(self, geometriesSaines, maillagesSains,
shapesFissure, shapeFissureParams,
maillageFissureParams, elementsDefaut, step):
- maillageFissure = insereFissureGenerale(maillagesSains,
- shapesFissure, shapeFissureParams,
- maillageFissureParams, elementsDefaut, step)
+ maillageFissure = construitFissureGenerale(maillagesSains,
+ shapesFissure, shapeFissureParams,
+ maillageFissureParams, elementsDefaut, step)
return maillageFissure
# ---------------------------------------------------------------------------
from blocFissure.gmu.triedreBase import triedreBase
from blocFissure.gmu.genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut
from blocFissure.gmu.creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain
-from blocFissure.gmu.insereFissureGenerale import insereFissureGenerale
+from blocFissure.gmu.construitFissureGenerale import construitFissureGenerale
O, OX, OY, OZ = triedreBase()
# -*- coding: utf-8 -*-
import sys, traceback
+import logging
from blocFissure import gmu
from blocFissure.gmu import initLog
+
+# -----------------------------------------------------------------------------------------------
#initLog.setDebug()
initLog.setVerbose()
+#initLog.setRelease()
+#initLog.setPerfTests()
+
+# ---tous les cas en sequence, ou les cas selectionnés ...
+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, 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
-from blocFissure.casStandard import casStandard
+from blocFissure.gmu.casStandard import casStandard
problemes = []
from blocFissure.CasTests.vis_1 import vis_1
problemes.append(vis_1(cas))
-# ---tous les cas en sequence, ou les cas selectionnés ...
-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,]
-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
- 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,]
+cas=25
+from blocFissure.CasTests import cubeCoin
+problemes.append(casStandard(cubeCoin.dicoParams, cubeCoin.referencesMaillageFissure, cas))
+
+cas=26
+from blocFissure.CasTests import cubeMilieu
+problemes.append(casStandard(cubeMilieu.dicoParams, cubeMilieu.referencesMaillageFissure, cas))
+
+cas=27
+from blocFissure.CasTests import cubeTransverse
+problemes.append(casStandard(cubeTransverse.dicoParams, cubeTransverse.referencesMaillageFissure, cas))
+
for i in range(len(problemes)):
if torun[i]:
+ logging.critical("=== Execution cas %s", i)
try:
problemes[i].executeProbleme()
except:
from blocFissure.gmu.triedreBase import triedreBase
from blocFissure.gmu.genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut
from blocFissure.gmu.creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain
-from blocFissure.gmu.insereFissureGenerale import insereFissureGenerale
+from blocFissure.gmu.construitFissureGenerale import construitFissureGenerale
O, OX, OY, OZ = triedreBase()
# ---------------------------------------------------------------------------
def setParamShapeFissure(self):
"""
- paramètres de la fissure pour méthode insereFissureGenerale
+ paramètres de la fissure pour méthode construitFissureGenerale
lgInfluence : distance autour de la shape de fissure a remailler (A ajuster selon le maillage)
rayonPipe : le rayon du pile maillé en hexa autour du fond de fissure
convexe : optionnel True : la face est convexe (vue de l'exterieur) sert si on ne donne pas de point interne
def genereMaillageFissure(self, geometriesSaines, maillagesSains,
shapesFissure, shapeFissureParams,
maillageFissureParams, elementsDefaut, step):
- maillageFissure = insereFissureGenerale(maillagesSains,
- shapesFissure, shapeFissureParams,
- maillageFissureParams, elementsDefaut, step)
+ maillageFissure = construitFissureGenerale(maillagesSains,
+ shapesFissure, shapeFissureParams,
+ maillageFissureParams, elementsDefaut, step)
return maillageFissure
# ---------------------------------------------------------------------------
from blocFissure.gmu.triedreBase import triedreBase
from blocFissure.gmu.genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut
from blocFissure.gmu.creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain
-from blocFissure.gmu.insereFissureGenerale import insereFissureGenerale
+from blocFissure.gmu.construitFissureGenerale import construitFissureGenerale
O, OX, OY, OZ = triedreBase()
# ---------------------------------------------------------------------------
def setParamShapeFissure(self):
"""
- paramètres de la fissure pour méthode insereFissureGenerale
+ paramètres de la fissure pour méthode construitFissureGenerale
lgInfluence : distance autour de la shape de fissure a remailler (A ajuster selon le maillage)
rayonPipe : le rayon du pile maillé en hexa autour du fond de fissure
convexe : optionnel True : la face est convexe (vue de l'exterieur) sert si on ne donne pas de point interne
shellFiss = geompy.ImportFile(os.path.join(gmu.pathBloc, "materielCasTests/faceGauche2FissCoupe.brep"), "BREP")
fondFiss = geompy.CreateGroup(shellFiss, geompy.ShapeType["EDGE"])
- geompy.UnionIDs(fondFiss, [12, 4])
+ geompy.UnionIDs(fondFiss, [14, 9])
geompy.addToStudy( shellFiss, 'shellFiss' )
geompy.addToStudyInFather( shellFiss, fondFiss, 'fondFiss' )
def genereMaillageFissure(self, geometriesSaines, maillagesSains,
shapesFissure, shapeFissureParams,
maillageFissureParams, elementsDefaut, step):
- maillageFissure = insereFissureGenerale(maillagesSains,
- shapesFissure, shapeFissureParams,
- maillageFissureParams, elementsDefaut, step)
+ maillageFissure = construitFissureGenerale(maillagesSains,
+ shapesFissure, shapeFissureParams,
+ maillageFissureParams, elementsDefaut, step)
return maillageFissure
# ---------------------------------------------------------------------------
pointIn_x : optionnel coordonnées x d'un point dans le solide, pas trop loin du centre du fond de fissure (idem y,z)
externe : True : fissure face externe, False : fissure face interne
"""
- print "setParamShapeFissure", self.nomCas
self.shapeFissureParams = dict(profondeur = 10,
rayonPipe = 2.5,
lenSegPipe = 2.5,
pointIn_x : optionnel coordonnées x d'un point dans le solide, pas trop loin du centre du fond de fissure (idem y,z)
externe : True : fissure face externe, False : fissure face interne
"""
-# logging.info("setParamShapeFissure %s", self.nomCas)
self.shapeFissureParams = dict(profondeur = 2.5,
rayonPipe = 1.5,
lenSegPipe = 6,
pointIn_x : optionnel coordonnées x d'un point dans le solide, pas trop loin du centre du fond de fissure (idem y,z)
externe : True : fissure face externe, False : fissure face interne
"""
- print "setParamShapeFissure", self.nomCas
self.shapeFissureParams = dict(profondeur = 10,
rayonPipe = 2.5,
lenSegPipe = 2.5,
pointIn_x : optionnel coordonnées x d'un point dans le solide, pas trop loin du centre du fond de fissure (idem y,z)
externe : True : fissure face externe, False : fissure face interne
"""
- print "setParamShapeFissure", self.nomCas
self.shapeFissureParams = dict(profondeur = 10,
rayonPipe = 2.5,
lenSegPipe = 2.5,
pointIn_x : optionnel coordonnées x d'un point dans le solide, pas trop loin du centre du fond de fissure (idem y,z)
externe : True : fissure face externe, False : fissure face interne
"""
- print "setParamShapeFissure", self.nomCas
self.shapeFissureParams = dict(profondeur = 10,
rayonPipe = 2.5,
lenSegPipe =2.5,
pointIn_x : optionnel coordonnées x d'un point dans le solide, pas trop loin du centre du fond de fissure (idem y,z)
externe : True : fissure face externe, False : fissure face interne
"""
- print "setParamShapeFissure", self.nomCas
self.shapeFissureParams = dict(profondeur = 10,
rayonPipe = 2.5,
lenSegPipe = 2.5,
nomFicSain = self.nomCas,
nomFicFissure = 'fissure_' + self.nomCas,
nbsegRad = 5,
- nbsegCercle = 6,
+ nbsegCercle = 8,
areteFaceFissure = 5)
# ---------------------------------------------------------------------------
pointIn_x : optionnel coordonnées x d'un point dans le solide, pas trop loin du centre du fond de fissure (idem y,z)
externe : True : fissure face externe, False : fissure face interne
"""
- print "setParamShapeFissure", self.nomCas
self.shapeFissureParams = dict(profondeur = 10,
rayonPipe = 4,
lenSegPipe = 4,
pointIn_x : optionnel coordonnées x d'un point dans le solide, pas trop loin du centre du fond de fissure (idem y,z)
externe : True : fissure face externe, False : fissure face interne
"""
-# logging.info("setParamShapeFissure %s", self.nomCas)
self.shapeFissureParams = dict(profondeur = 10,
rayonPipe = 4,
lenSegPipe = 4,
pointIn_x : optionnel coordonnées x d'un point dans le solide, pas trop loin du centre du fond de fissure (idem y,z)
externe : True : fissure face externe, False : fissure face interne
"""
-# logging.info("setParamShapeFissure %s", self.nomCas)
self.shapeFissureParams = dict(profondeur = 8,
rayonPipe = 1,
lenSegPipe = 1.5,
pointIn_x : optionnel coordonnées x d'un point dans le solide, pas trop loin du centre du fond de fissure (idem y,z)
externe : True : fissure face externe, False : fissure face interne
"""
- print "setParamShapeFissure", self.nomCas
self.shapeFissureParams = dict(profondeur = 10,
rayonPipe = 2,
lenSegPipe = 6,
from blocFissure.gmu.triedreBase import triedreBase
from blocFissure.gmu.genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut
from blocFissure.gmu.creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain
-from blocFissure.gmu.insereFissureGenerale import insereFissureGenerale
+from blocFissure.gmu.construitFissureGenerale import construitFissureGenerale
O, OX, OY, OZ = triedreBase()
# ---------------------------------------------------------------------------
def setParamShapeFissure(self):
"""
- paramètres de la fissure pour méthode insereFissureGenerale
+ paramètres de la fissure pour méthode construitFissureGenerale
lgInfluence : distance autour de la shape de fissure a remailler (A ajuster selon le maillage)
rayonPipe : le rayon du pile maillé en hexa autour du fond de fissure
convexe : optionnel True : la face est convexe (vue de l'exterieur) sert si on ne donne pas de point interne
def genereMaillageFissure(self, geometriesSaines, maillagesSains,
shapesFissure, shapeFissureParams,
maillageFissureParams, elementsDefaut, step):
- maillageFissure = insereFissureGenerale(maillagesSains,
- shapesFissure, shapeFissureParams,
- maillageFissureParams, elementsDefaut, step)
+ maillageFissure = construitFissureGenerale(maillagesSains,
+ shapesFissure, shapeFissureParams,
+ maillageFissureParams, elementsDefaut, step)
return maillageFissure
# ---------------------------------------------------------------------------
+++ /dev/null
-# -*- coding: utf-8 -*-
-
-import os
-from blocFissure import gmu
-from blocFissure.gmu.geomsmesh import geompy, smesh
-
-import math
-import GEOM
-import SALOMEDS
-import SMESH
-#import StdMeshers
-#import GHS3DPlugin
-#import NETGENPlugin
-import logging
-
-from blocFissure.gmu.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.insereFissureGenerale import insereFissureGenerale
-
-O, OX, OY, OZ = triedreBase()
-
-class casStandard(fissureGenerique):
- """
- problème de fissure standard, défini par :
- - un maillage sain (hexaèdres),
- - une face géométrique de fissure, qui doit légèrement dépasser hors du volume maillé
- - les numéros d'arêtes (edges géométriques) correspondant au fond de fissure
- - les paramètres de maillage de la fissure
- """
-
- # ---------------------------------------------------------------------------
- def __init__ (self, dicoParams, references = None, numeroCas = 0):
- initEtude()
- self.references = references
- self.dicoParams = dicoParams
- if self.dicoParams.has_key('nomCas'):
- self.nomCas = self.dicoParams['nomCas']
- else:
- self.nomCas = 'casStandard'
- self.numeroCas = numeroCas
- if self.numeroCas != 0:
- self.nomCas = self.nomProbleme +"_%d"%(self.numeroCas)
- else:
- self.nomProbleme = self.nomCas
- if self.dicoParams.has_key('lenSegPipe'):
- self.lenSegPipe = self.dicoParams['lenSegPipe']
- else:
- self.lenSegPipe =self.dicoParams['rayonPipe']
- if self.dicoParams.has_key('step'):
- step = self.dicoParams['step']
- else:
- step = -1 # exécuter toutes les étapes
- if self.numeroCas == 0: # valeur par défaut : exécution immédiate, sinon execution différée dans le cas d'une liste de problèmes
- self.executeProbleme(step)
-
- # ---------------------------------------------------------------------------
- def genereMaillageSain(self, geometriesSaines, meshParams):
- logging.info("genereMaillageSain %s", self.nomCas)
-
- ([objetSain], status) = smesh.CreateMeshesFromMED(self.dicoParams['maillageSain'])
- smesh.SetName(objetSain.GetMesh(), 'objetSain')
-
- return [objetSain, True] # True : maillage hexa
-
- # ---------------------------------------------------------------------------
- def setParamShapeFissure(self):
- """
- paramètres de la fissure pour méthode insereFissureGenerale
- lgInfluence : distance autour de la shape de fissure a remailler (A ajuster selon le maillage)
- rayonPipe : le rayon du pile maillé en hexa autour du fond de fissure
- convexe : True : la face est convexe (vue de l'exterieur) sert si on ne donne pas de point interne
- pointIn_x : optionnel : coordonnée x d'un point dans le solide sain (pour orienter la face - idem avec y,z)
- """
- logging.info("setParamShapeFissure %s", self.nomCas)
- if self.dicoParams.has_key('pointInterieur'):
- self.shapeFissureParams = dict(lgInfluence = self.dicoParams['lgInfluence'],
- rayonPipe = self.dicoParams['rayonPipe'],
- lenSegPipe = self.lenSegPipe,
- pointIn_x = self.dicoParams['pointInterieur'][0],
- pointIn_y = self.dicoParams['pointInterieur'][1],
- pointIn_z = self.dicoParams['pointInterieur'][2])
- else:
- self.shapeFissureParams = dict(lgInfluence = self.dicoParams['lgInfluence'],
- rayonPipe = self.dicoParams['rayonPipe'],
- lenSegPipe = self.lenSegPipe)
-
- # ---------------------------------------------------------------------------
- def genereShapeFissure( self, geometriesSaines, geomParams, shapeFissureParams):
- logging.info("genereShapeFissure %s", self.nomCas)
-
- lgInfluence = shapeFissureParams['lgInfluence']
-
- 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' )
-
-
- coordsNoeudsFissure = genereMeshCalculZoneDefaut(shellFiss, self.dicoParams['meshBrep'][0] ,self.dicoParams['meshBrep'][1])
-
- centre = None
- return [shellFiss, centre, lgInfluence, coordsNoeudsFissure, fondFiss]
-
- # ---------------------------------------------------------------------------
- def setParamMaillageFissure(self):
- self.maillageFissureParams = dict(nomRep = '.',
- nomFicSain = self.nomCas,
- nomFicFissure = 'fissure_' + self.nomCas,
- nbsegRad = self.dicoParams['nbSegRad'],
- nbsegCercle = self.dicoParams['nbSegCercle'],
- areteFaceFissure = self.dicoParams['areteFaceFissure'])
-
- # ---------------------------------------------------------------------------
- def genereZoneDefaut(self, geometriesSaines, maillagesSains, shapesFissure, shapeFissureParams, maillageFissureParams):
- elementsDefaut = creeZoneDefautDansObjetSain(geometriesSaines, maillagesSains, shapesFissure, shapeFissureParams, maillageFissureParams)
- return elementsDefaut
-
- # ---------------------------------------------------------------------------
- def genereMaillageFissure(self, geometriesSaines, maillagesSains,
- shapesFissure, shapeFissureParams,
- maillageFissureParams, elementsDefaut, step):
- maillageFissure = insereFissureGenerale(maillagesSains,
- shapesFissure, shapeFissureParams,
- maillageFissureParams, elementsDefaut, step)
- return maillageFissure
-
- # ---------------------------------------------------------------------------
- def setReferencesMaillageFissure(self):
- if self.references is not None:
- self.referencesMaillageFissure = self.references
- else:
- self.referencesMaillageFissure = dict(Entity_Quad_Pyramid = 0,
- Entity_Quad_Triangle = 0,
- Entity_Quad_Edge = 0,
- Entity_Quad_Penta = 0,
- Entity_Quad_Hexa = 0,
- Entity_Node = 0,
- Entity_Quad_Tetra = 0,
- Entity_Quad_Quadrangle = 0)
-
initLog.setDebug()
#initLog.setVerbose()
-from blocFissure.casStandard import casStandard
+from blocFissure.gmu.casStandard import casStandard
dicoParams = dict(nomCas = 'angleCube',
maillageSain = os.path.join(gmu.pathBloc, 'materielCasTests/CubeAngle.med'),
#initLog.setDebug()
initLog.setVerbose()
-from blocFissure.casStandard import casStandard
+from blocFissure.gmu.casStandard import casStandard
dicoParams = dict(nomCas = 'angleCube2',
maillageSain = 'boite.med',
brepFaceFissure = "disk.brep",
edgeFissIds = [4],
- lgInfluence = 20,
+ lgInfluence = 50,
meshBrep = (5,10),
- rayonPipe = 10,
+ rayonPipe = 15,
+ lenSegPipe = 20,
nbSegRad = 5,
- nbSegCercle = 8,
- areteFaceFissure = 10)
+ nbSegCercle = 12,
+ areteFaceFissure = 2)
execInstance = casStandard(dicoParams)
--- /dev/null
+# -*- coding: utf-8 -*-
+
+""" FissureLauncher:
+ Permet de lancer le script 'casStandard'
+ en fonction des paramètres contenus dans 'dicoParams'. """
+
+#import sys
+import salome
+
+#import os
+#from blocFissure import gmu
+from blocFissure.gmu import initLog
+initLog.setDebug()
+#initLog.setVerbose()
+
+from blocFissure.casStandard import casStandard
+
+mesh = 'maillageSainTuyauFEM.med'
+crack = 'fissureQuartEllipse.brep'
+
+dicoParams = dict(nomCas = 'fissTuyau',
+ maillageSain = '/local00/home/I48174/Bureau/supportMaillage/{0}'.format(mesh),
+ brepFaceFissure = '/local00/home/I48174/Bureau/supportMaillage/{0}'.format(crack),
+ edgeFissIds = [9],
+ lgInfluence = 250,
+ meshBrep = (10, 50),
+ rayonPipe = 35,
+ lenSegPipe = 7, #9,
+ nbSegRad = 6,
+ nbSegCercle = 30,
+ areteFaceFissure = 20)
+
+execInstance = casStandard(dicoParams)
+
+if salome.sg.hasDesktop():
+ salome.sg.updateObjBrowser(1)
\ No newline at end of file
# scripts / static
SET(plugin_SCRIPTS
__init__.py
+ ajustePointsEdgePipeFissure.py
blocDefaut.py
+ calculePointsAxiauxPipe.py
+ casStandard.py
checkDecoupePartition.py
commonSubShapes.py
+ compoundFromList.py
+ construitEdgesRadialesDebouchantes.py
+ construitFissureGenerale.py
+ construitMaillagePipe.py
+ construitPartitionsPeauFissure.py
+ creePointsPipePeau.py
creeZoneDefautDansObjetSain.py
creeZoneDefautFilling.py
creeZoneDefautGeom.py
creeZoneDefautMaillage.py
distance2.py
eliminateDoubles.py
+ elimineExtremitesPipe.py
ellipsoideDefaut.py
enleveDefaut.py
extractionOrienteeMulti.py
findWireIntermediateVertices.py
fissureCoude.py
fissureGenerique.py
+ fusionMaillageAttributionDefaut.py
genereElemsFissureElliptique.py
genereMeshCalculZoneDefaut.py
geomsmesh.py
getCentreFondFiss.py
getStatsMaillageFissure.py
getSubshapeIds.py
+ identifieEdgesPeau.py
+ identifieElementsDebouchants.py
+ identifieElementsFissure.py
+ identifieElementsGeometriquesPeau.py
+ identifieFacesEdgesFissureExterne.py
+ identifieFacesPeau.py
initEtude.py
initLog.py
insereFissureElliptique.py
insereFissureGenerale.py
insereFissureLongue.py
+ listOfExtraFunctions.py
+ mailleAretesEtJonction.py
+ mailleFacesFissure.py
+ mailleFacesPeau.py
meshBlocPart.py
orderEdgesFromWire.py
partitionBlocDefaut.py
+ partitionneFissureParPipe.py
partitionVolumeSain.py
peauInterne.py
produitMixte.py
prolongeWire.py
propagateTore.py
putName.py
+ quadranglesToShapeNoCorner.py
quadranglesToShape.py
+ quadranglesToShapeWithCorner.py
regroupeSainEtDefaut.py
+ restreintFaceFissure.py
rotTrans.py
shapesSurFissure.py
shapeSurFissure.py
testgmu.py
toreFissure.py
triedreBase.py
+ trouveEdgesFissPeau.py
whichSideMulti.py
whichSide.py
whichSideVertex.py
import os
import initLog
-#initLog.setDebug()
-#initLog.setVerbose()
-#initLog.setRelease()
# --- calcul path blocFissure
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import logging
+
+from geomsmesh import geompy
+from findWireIntermediateVertices import findWireIntermediateVertices
+from projettePointSurCourbe import projettePointSurCourbe
+
+def ajustePointsEdgePipeFissure(edgesPipeFissureExterneC, wirePipeFissureExterne, gptsdisks, idisklim):
+ """
+ ajustement precis des points sur edgesPipeFissureExterneC
+ """
+ logging.info('start')
+
+ edgesPFE = geompy.ExtractShapes(edgesPipeFissureExterneC, geompy.ShapeType["EDGE"], False)
+ verticesPFE = findWireIntermediateVertices(wirePipeFissureExterne) # vertices intermédiaires (des points en trop dans ptsInWireFissExtPipe)
+ idiskmin = idisklim[0] + 1 # on ne prend pas le disque sur la peau, déjà ajusté
+ idiskmax = idisklim[1] # on ne prend pas le disque sur la peau, déjà ajusté
+ idiskint = []
+ for vtx in verticesPFE:
+ distPtVt = []
+ for idisk in range(idiskmin, idiskmax):
+ gptdsk = gptsdisks[idisk]
+ pt = gptdsk[0][-1] # le point sur l'edge de la fissure externe au pipe
+ distPtVt.append((geompy.MinDistance(pt, vtx), idisk))
+ distPtVt.sort()
+ idiskint.append(distPtVt[0][1])
+ gptsdisks[idiskint[-1]][0][-1] = vtx
+ logging.debug("ajustement point sur edgePipeFissureExterne, vertex: %s %s", idiskint[-1], distPtVt[0][0])
+ for idisk in range(idiskmin, idiskmax):
+ if idisk in idiskint:
+ break
+ logging.debug("ajustement point sur edgePipeFissureExterne: %s", idisk)
+ gptdsk = gptsdisks[idisk]
+ pt = gptdsk[0][-1] # le point sur l'edge de la fissure externe au pipe
+ distPtEd = [(geompy.MinDistance(pt, edgePFE), k, edgePFE) for k, edgePFE in enumerate(edgesPFE)]
+ distPtEd.sort()
+ edgePFE = distPtEd[0][2]
+ u = projettePointSurCourbe(pt, edgePFE)
+ ptproj = geompy.MakeVertexOnCurve(edgePFE, u)
+ gptsdisks[idisk][0][-1] = ptproj
+
+ return gptsdisks
\ No newline at end of file
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import logging
+import math
+
+from geomsmesh import geompy
+from geomsmesh import smesh
+
+def calculePointsAxiauxPipe(edgesFondFiss, edgesIdByOrientation, facesDefaut,
+ centreFondFiss, wireFondFiss, wirePipeFiss,
+ lenSegPipe, rayonPipe, nbsegCercle, nbsegRad):
+ """
+ preparation maillage du pipe :
+ - détections des points a respecter : jonction des edges/faces constituant
+ la face de fissure externe au pipe
+ - points sur les edges de fond de fissure et edges pipe/face fissure,
+ - vecteurs tangents au fond de fissure (normal au disque maillé)
+ """
+
+ logging.info('start')
+
+ # --- option de maillage selon le rayon de courbure du fond de fissure
+ lenEdgeFondExt = 0
+ for edff in edgesFondFiss:
+ lenEdgeFondExt += geompy.BasicProperties(edff)[0]
+
+ disfond = []
+ for filling in facesDefaut:
+ disfond.append(geompy.MinDistance(centreFondFiss, filling))
+ disfond.sort()
+ rcourb = disfond[0]
+ nbSegQuart = 5 # on veut 5 segments min sur un quart de cercle
+ alpha = math.pi/(4*nbSegQuart)
+ deflexion = rcourb*(1.0 -math.cos(alpha))
+ lgmin = lenSegPipe*0.25
+ lgmax = lenSegPipe*1.5
+ logging.debug("rcourb: %s, lenFond:%s, deflexion: %s, lgmin: %s, lgmax: %s", rcourb, lenEdgeFondExt, deflexion, lgmin, lgmax)
+
+ meshFondExt = smesh.Mesh(wireFondFiss)
+ algo1d = meshFondExt.Segment()
+ hypo1d = algo1d.Adaptive(lgmin, lgmax, deflexion) # a ajuster selon la profondeur de la fissure
+ isDone = meshFondExt.Compute()
+
+ ptGSdic = {} # dictionnaire [paramètre sur la courbe] --> point géométrique
+ allNodeIds = meshFondExt.GetNodesId()
+ for nodeId in allNodeIds:
+ xyz = meshFondExt.GetNodeXYZ(nodeId)
+ #logging.debug("nodeId %s, coords %s", nodeId, str(xyz))
+ pt = geompy.MakeVertex(xyz[0], xyz[1], xyz[2])
+ u, PointOnEdge, EdgeInWireIndex = geompy.MakeProjectionOnWire(pt, wireFondFiss) # u compris entre 0 et 1
+ edgeOrder = edgesIdByOrientation[EdgeInWireIndex]
+ ptGSdic[(edgeOrder, EdgeInWireIndex, u)] = pt
+ #logging.debug("nodeId %s, u %s", nodeId, str(u))
+ usort = sorted(ptGSdic)
+ logging.debug("nombre de points obtenus par deflexion %s",len(usort))
+
+ centres = []
+ origins = []
+ normals = []
+ for edu in usort:
+ ied = edu[1]
+ u = edu[2]
+ vertcx = ptGSdic[edu]
+ norm = geompy.MakeTangentOnCurve(edgesFondFiss[ied], u)
+ plan = geompy.MakePlane(vertcx, norm, 3*rayonPipe)
+ part = geompy.MakePartition([plan], [wirePipeFiss], [], [], geompy.ShapeType["VERTEX"], 0, [], 0)
+ liste = geompy.ExtractShapes(part, geompy.ShapeType["VERTEX"], True)
+ 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
+ break
+ centres.append(vertcx)
+ origins.append(vertpx)
+ normals.append(norm)
+# name = "vertcx%d"%i
+# geompy.addToStudyInFather(wireFondFiss, vertcx, name)
+# name = "vertpx%d"%i
+# geompy.addToStudyInFather(wireFondFiss, vertpx, name)
+# name = "plan%d"%i
+# geompy.addToStudyInFather(wireFondFiss, plan, name)
+
+ # --- maillage du pipe étendu, sans tenir compte de l'intersection avec la face de peau
+
+ logging.debug("nbsegCercle %s", nbsegCercle)
+
+ # -----------------------------------------------------------------------
+ # --- points géométriques
+
+ gptsdisks = [] # vertices géométrie de tous les disques
+ raydisks = [[] for i in range(nbsegCercle)]
+ for i in range(len(centres)): # boucle sur les disques
+ gptdsk = [] # vertices géométrie d'un disque
+ vertcx = centres[i]
+ vertpx = origins[i]
+ normal = normals[i]
+ vec1 = geompy.MakeVector(vertcx, vertpx)
+
+ points = [vertcx] # les points du rayon de référence
+ for j in range(nbsegRad):
+ pt = geompy.MakeTranslationVectorDistance(vertcx, vec1, (j+1)*float(rayonPipe)/nbsegRad)
+ points.append(pt)
+ gptdsk.append(points)
+ pt = geompy.MakeTranslationVectorDistance(vertcx, vec1, 1.5*rayonPipe)
+ rayon = geompy.MakeLineTwoPnt(vertcx, pt)
+ raydisks[0].append(rayon)
+
+ for k in range(nbsegCercle-1):
+ angle = (k+1)*2*math.pi/nbsegCercle
+ pts = [vertcx] # les points d'un rayon obtenu par rotation
+ for j in range(nbsegRad):
+ pt = geompy.MakeRotation(points[j+1], normal, angle)
+ pts.append(pt)
+ gptdsk.append(pts)
+ ray = geompy.MakeRotation(rayon, normal, angle)
+ raydisks[k+1].append(ray)
+
+ gptsdisks.append(gptdsk)
+
+ return (centres, gptsdisks, raydisks)
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import os
+from geomsmesh import geompy, smesh
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
+
+import math
+import GEOM
+import SALOMEDS
+import SMESH
+#import StdMeshers
+#import GHS3DPlugin
+#import NETGENPlugin
+import logging
+
+from fissureGenerique import fissureGenerique
+
+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()
+
+class casStandard(fissureGenerique):
+ """
+ problème de fissure standard, défini par :
+ - un maillage sain (hexaèdres),
+ - une face géométrique de fissure, qui doit légèrement dépasser hors du volume maillé
+ - les numéros d'arêtes (edges géométriques) correspondant au fond de fissure
+ - les paramètres de maillage de la fissure
+ """
+
+ # ---------------------------------------------------------------------------
+ def __init__ (self, dicoParams, references = None, numeroCas = 0):
+ initEtude()
+ self.references = references
+ self.dicoParams = dicoParams
+ if self.dicoParams.has_key('nomCas'):
+ self.nomCas = self.dicoParams['nomCas']
+ else:
+ self.nomCas = 'casStandard'
+ self.numeroCas = numeroCas
+ if self.numeroCas != 0:
+ self.nomCas = self.nomProbleme +"_%d"%(self.numeroCas)
+ else:
+ self.nomProbleme = self.nomCas
+ if self.dicoParams.has_key('lenSegPipe'):
+ self.lenSegPipe = self.dicoParams['lenSegPipe']
+ else:
+ self.lenSegPipe =self.dicoParams['rayonPipe']
+ if self.dicoParams.has_key('step'):
+ step = self.dicoParams['step']
+ else:
+ step = -1 # exécuter toutes les étapes
+ if self.numeroCas == 0: # valeur par défaut : exécution immédiate, sinon execution différée dans le cas d'une liste de problèmes
+ self.executeProbleme(step)
+
+ # ---------------------------------------------------------------------------
+ def genereMaillageSain(self, geometriesSaines, meshParams):
+ logging.info("genereMaillageSain %s", self.nomCas)
+
+ ([objetSain], status) = smesh.CreateMeshesFromMED(self.dicoParams['maillageSain'])
+ smesh.SetName(objetSain.GetMesh(), 'objetSain')
+
+ return [objetSain, True] # True : maillage hexa
+
+ # ---------------------------------------------------------------------------
+ def setParamShapeFissure(self):
+ """
+ paramètres de la fissure pour méthode insereFissureGenerale
+ lgInfluence : distance autour de la shape de fissure a remailler (A ajuster selon le maillage)
+ rayonPipe : le rayon du pile maillé en hexa autour du fond de fissure
+ convexe : True : la face est convexe (vue de l'exterieur) sert si on ne donne pas de point interne
+ pointIn_x : optionnel : coordonnée x d'un point dans le solide sain (pour orienter la face - idem avec y,z)
+ """
+ logging.info("setParamShapeFissure %s", self.nomCas)
+ if self.dicoParams.has_key('pointInterieur'):
+ self.shapeFissureParams = dict(lgInfluence = self.dicoParams['lgInfluence'],
+ rayonPipe = self.dicoParams['rayonPipe'],
+ lenSegPipe = self.lenSegPipe,
+ pointIn_x = self.dicoParams['pointInterieur'][0],
+ pointIn_y = self.dicoParams['pointInterieur'][1],
+ pointIn_z = self.dicoParams['pointInterieur'][2])
+ else:
+ self.shapeFissureParams = dict(lgInfluence = self.dicoParams['lgInfluence'],
+ rayonPipe = self.dicoParams['rayonPipe'],
+ lenSegPipe = self.lenSegPipe)
+
+ # ---------------------------------------------------------------------------
+ def genereShapeFissure( self, geometriesSaines, geomParams, shapeFissureParams):
+ logging.info("genereShapeFissure %s", self.nomCas)
+
+ lgInfluence = shapeFissureParams['lgInfluence']
+
+ shellFiss = geompy.ImportFile( self.dicoParams['brepFaceFissure'], "BREP")
+ fondFiss = geompy.CreateGroup(shellFiss, geompy.ShapeType["EDGE"])
+ geompy.UnionIDs(fondFiss, self.dicoParams['edgeFissIds'] )
+ geomPublish(initLog.debug, shellFiss, 'shellFiss' )
+ geomPublishInFather(initLog.debug, shellFiss, fondFiss, 'fondFiss' )
+
+
+ coordsNoeudsFissure = genereMeshCalculZoneDefaut(shellFiss, self.dicoParams['meshBrep'][0] ,self.dicoParams['meshBrep'][1])
+
+ centre = None
+ return [shellFiss, centre, lgInfluence, coordsNoeudsFissure, fondFiss]
+
+ # ---------------------------------------------------------------------------
+ def setParamMaillageFissure(self):
+ self.maillageFissureParams = dict(nomRep = '.',
+ nomFicSain = self.nomCas,
+ nomFicFissure = 'fissure_' + self.nomCas,
+ nbsegRad = self.dicoParams['nbSegRad'],
+ nbsegCercle = self.dicoParams['nbSegCercle'],
+ areteFaceFissure = self.dicoParams['areteFaceFissure'])
+
+ # ---------------------------------------------------------------------------
+ def genereZoneDefaut(self, geometriesSaines, maillagesSains, shapesFissure, shapeFissureParams, maillageFissureParams):
+ elementsDefaut = creeZoneDefautDansObjetSain(geometriesSaines, maillagesSains, shapesFissure, shapeFissureParams, maillageFissureParams)
+ return elementsDefaut
+
+ # ---------------------------------------------------------------------------
+ def genereMaillageFissure(self, geometriesSaines, maillagesSains,
+ shapesFissure, shapeFissureParams,
+ maillageFissureParams, elementsDefaut, step):
+ maillageFissure = construitFissureGenerale(maillagesSains,
+ shapesFissure, shapeFissureParams,
+ maillageFissureParams, elementsDefaut, step)
+ return maillageFissure
+
+ # ---------------------------------------------------------------------------
+ def setReferencesMaillageFissure(self):
+ if self.references is not None:
+ self.referencesMaillageFissure = self.references
+ else:
+ self.referencesMaillageFissure = dict(Entity_Quad_Pyramid = 0,
+ Entity_Quad_Triangle = 0,
+ Entity_Quad_Edge = 0,
+ Entity_Quad_Penta = 0,
+ Entity_Quad_Hexa = 0,
+ Entity_Node = 0,
+ Entity_Quad_Tetra = 0,
+ Entity_Quad_Quadrangle = 0)
+
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import logging
+from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
+
+def compoundFromList(elements, nom=None):
+ """
+
+ """
+ logging.debug('start')
+
+ shapeList = []
+ for a in elements:
+ if not isinstance(a, list):
+ shapeList.append(a)
+ else:
+ if a[0] is not None:
+ shapeList.append(a[0])
+
+ if nom is not None:
+ for i,a in enumerate(shapeList):
+ nom = nom +"%d"%i
+ logging.debug('nom: %s',nom)
+ geomPublish(initLog.debug, a, nom)
+
+ shapeCompound = None
+ if len(shapeList) > 0:
+ shapeCompound =geompy.MakeCompound(shapeList)
+
+ return shapeCompound
+
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import logging
+
+from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
+import GEOM
+from sortEdges import sortEdges
+
+def construitEdgesRadialesDebouchantes(idisklim, idiskout, gptsdisks, raydisks,
+ facesPipePeau, edgeRadFacePipePeau, nbsegCercle):
+ """
+ construction des listes d'edges radiales sur chaque extrémité débouchante
+ """
+ logging.info('start')
+
+ # --- listes de nappes radiales en filling à chaque extrémité débouchante
+
+ facesDebouchantes = [False, False]
+ idFacesDebouchantes = [-1, -1] # contiendra les indices des faces disque débouchantes (facesPipePeau)
+ listNappes =[]
+ for i, idisk in enumerate(idisklim):
+ numout = idiskout[i]
+ logging.debug("extremité %s, indices disques interne %s, externe %s",i, idisk, numout)
+ nappes = []
+ if (idisk != 0) and (idisk != len(gptsdisks)-1): # si extrémité débouchante
+ for k in range(nbsegCercle):
+ if i == 0:
+ iddeb = max(0, numout)
+ idfin = max(iddeb+3,idisk+1) # 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
+ 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
+ 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
+ geomPublish(initLog.debug, nappe, name)
+ facesDebouchantes[i] = True
+ listNappes.append(nappes)
+
+ # --- mise en correspondance avec les indices des faces disque débouchantes (facesPipePeau)
+ for i, nappes in enumerate(listNappes):
+ if facesDebouchantes[i]:
+ for k, face in enumerate(facesPipePeau):
+ #logging.debug('i, k, face, nappes[0] %s %s %s %s', i, k, face, nappes[0])
+ #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
+ break
+ logging.debug("idFacesDebouchantes: %s", idFacesDebouchantes)
+
+ # --- construction des listes d'edges radiales sur chaque extrémité débouchante
+ listEdges = []
+ for i, nappes in enumerate(listNappes):
+ ifd = idFacesDebouchantes[i] # indice de face débouchante (facesPipePeau)
+ if ifd < 0:
+ listEdges.append([])
+ else:
+ face = facesPipePeau[ifd]
+ edges = [edgeRadFacePipePeau[ifd]]
+ for k, nappe in enumerate(nappes):
+ if k > 0:
+ obj = geompy.MakeSection(face, nappes[k]) # normalement une edge, parfois un compound d'edges dont un tout petit
+ edge = obj
+ vs = geompy.ExtractShapes(obj, geompy.ShapeType["VERTEX"], False)
+ if len(vs) > 2:
+ eds = geompy.ExtractShapes(obj, geompy.ShapeType["EDGE"], False)
+ [edsorted, minl,maxl] = sortEdges(eds)
+ edge = edsorted[-1]
+ else:
+ maxl = geompy.BasicProperties(edge)[0]
+ if maxl < 0.01: # problème MakeSection
+ logging.debug("problème MakeSection recherche edge radiale %s, longueur trop faible: %s, utilisation partition", k, maxl)
+ partNappeFace = geompy.MakePartition([face, nappes[k]], [] , [], [], geompy.ShapeType["FACE"], 0, [], 0)
+ edps= geompy.ExtractShapes(partNappeFace, geompy.ShapeType["EDGE"], False)
+ ednouv = []
+ for ii, ed in enumerate(edps):
+ vxs = geompy.ExtractShapes(ed, geompy.ShapeType["VERTEX"], False)
+ distx = [geompy.MinDistance(vx, face) for vx in vxs]
+ distx += [geompy.MinDistance(vx, nappes[k]) for vx in vxs]
+ dmax = max(distx)
+ logging.debug(" dmax %s",dmax)
+ if dmax < 0.01:
+ ednouv.append(ed)
+ logging.debug(" edges issues de la partition: %s", ednouv)
+ for ii, ed in enumerate(ednouv):
+ geomPublish(initLog.debug, ed, "ednouv%d"%ii)
+ [edsorted, minl,maxl] = sortEdges(ednouv)
+ logging.debug(" longueur edge trouvée: %s", maxl)
+ edge = edsorted[-1]
+ edges.append(edge)
+ name = 'edgeEndPipe%d'%k
+ geomPublish(initLog.debug, edge, name)
+ listEdges.append(edges)
+
+ return (listEdges, idFacesDebouchantes)
\ No newline at end of file
--- /dev/null
+# -*- coding: utf-8 -*-
+
+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
+import SMESH
+import math
+import bisect
+
+# from extractionOrientee import extractionOrientee
+# from extractionOrienteeMulti import extractionOrienteeMulti
+# from sortFaces import sortFaces
+#from sortEdges import sortEdges
+# from eliminateDoubles import eliminateDoubles
+# from substractSubShapes import substractSubShapes
+# from produitMixte import produitMixte
+# from findWireEndVertices import findWireEndVertices
+#from findWireIntermediateVertices import findWireIntermediateVertices
+from orderEdgesFromWire import orderEdgesFromWire
+# from getSubshapeIds import getSubshapeIds
+from putName import putName
+# from distance2 import distance2
+from enleveDefaut import enleveDefaut
+from shapeSurFissure import shapeSurFissure
+from regroupeSainEtDefaut import RegroupeSainEtDefaut
+from triedreBase import triedreBase
+# from checkDecoupePartition import checkDecoupePartition
+# from whichSide import whichSide
+# from whichSideMulti import whichSideMulti
+#from whichSideVertex import whichSideVertex
+#from projettePointSurCourbe import projettePointSurCourbe
+# from prolongeWire import prolongeWire
+from restreintFaceFissure import restreintFaceFissure
+from partitionneFissureParPipe import partitionneFissureParPipe
+from construitPartitionsPeauFissure import construitPartitionsPeauFissure
+from compoundFromList import compoundFromList
+from identifieElementsGeometriquesPeau import identifieElementsGeometriquesPeau
+from identifieFacesEdgesFissureExterne import identifieFacesEdgesFissureExterne
+from calculePointsAxiauxPipe import calculePointsAxiauxPipe
+from elimineExtremitesPipe import elimineExtremitesPipe
+from construitEdgesRadialesDebouchantes import construitEdgesRadialesDebouchantes
+from creePointsPipePeau import creePointsPipePeau
+from ajustePointsEdgePipeFissure import ajustePointsEdgePipeFissure
+from construitMaillagePipe import construitMaillagePipe
+from mailleAretesEtJonction import mailleAretesEtJonction
+from mailleFacesFissure import mailleFacesFissure
+from mailleFacesPeau import mailleFacesPeau
+
+# -----------------------------------------------------------------------------
+# --- procédure complète fissure générale
+
+def construitFissureGenerale(maillagesSains,
+ shapesFissure, shapeFissureParams,
+ maillageFissureParams, elementsDefaut, step=-1):
+ """
+ TODO: a completer
+ """
+ logging.info('start')
+
+ shapeDefaut = shapesFissure[0] # faces de fissure, débordant
+ fondFiss = shapesFissure[4] # groupe d'edges de fond de fissure
+
+ rayonPipe = shapeFissureParams['rayonPipe']
+ if shapeFissureParams.has_key('lenSegPipe'):
+ lenSegPipe = shapeFissureParams['lenSegPipe']
+ else:
+ lenSegPipe = rayonPipe
+
+ nomRep = maillageFissureParams['nomRep']
+ nomFicSain = maillageFissureParams['nomFicSain']
+ nomFicFissure = maillageFissureParams['nomFicFissure']
+
+ nbsegRad = maillageFissureParams['nbsegRad'] # nombre de couches selon un rayon du pipe
+ nbsegCercle = maillageFissureParams['nbsegCercle'] # nombre de secteur dans un cercle du pipe
+ areteFaceFissure = maillageFissureParams['areteFaceFissure']
+
+ pointIn_x = 0.0
+ pointIn_y = 0.0
+ pointIn_z = 0.0
+ isPointInterne = False
+ if shapeFissureParams.has_key('pointIn_x'):
+ pointIn_x = shapeFissureParams['pointIn_x']
+ isPointInterne = True
+ if shapeFissureParams.has_key('pointIn_y'):
+ pointIn_y = shapeFissureParams['pointIn_y']
+ isPointInterne = True
+ if shapeFissureParams.has_key('pointIn_z'):
+ pointIn_z = shapeFissureParams['pointIn_z']
+ isPointInterne = True
+ if isPointInterne:
+ pointInterne = geompy.MakeVertex(pointIn_x, pointIn_y, pointIn_z)
+ else:
+ pointInterne = None
+
+ #fichierMaillageSain = nomRep + '/' + nomFicSain + '.med'
+ fichierMaillageFissure = nomRep + '/' + nomFicFissure + '.med'
+
+ # fillings des faces en peau
+ facesDefaut = elementsDefaut[0]
+ #centresDefaut = elementsDefaut[1]
+ #normalsDefaut = elementsDefaut[2]
+ #extrusionsDefaut = elementsDefaut[3]
+ dmoyen = elementsDefaut[4]
+ bordsPartages = elementsDefaut[5]
+ #fillconts = elementsDefaut[6]
+ #idFilToCont = elementsDefaut[7]
+ maillageSain = elementsDefaut[8]
+ internalBoundary = elementsDefaut[9]
+ zoneDefaut = elementsDefaut[10]
+ zoneDefaut_skin = elementsDefaut[11]
+ zoneDefaut_internalFaces = elementsDefaut[12]
+ zoneDefaut_internalEdges = elementsDefaut[13]
+ #edgeFondExt = elementsDefaut[14]
+ centreFondFiss = elementsDefaut[15]
+ #tgtCentre = elementsDefaut[16]
+
+ O, OX, OY, OZ = triedreBase()
+
+ # --- restriction de la face de fissure au domaine solide :
+ # partition face fissure étendue par fillings, on garde la face interne
+
+ facesPortFissure = restreintFaceFissure(shapeDefaut, facesDefaut, pointInterne)
+
+ # --- pipe de fond de fissure, prolongé, partition face fissure par pipe
+ # identification des edges communes pipe et face fissure
+
+ (fissPipe, edgesPipeFiss, edgesFondFiss, wirePipeFiss, wireFondFiss) = partitionneFissureParPipe(shapesFissure, elementsDefaut, rayonPipe)
+ edgesFondFiss, edgesIdByOrientation = orderEdgesFromWire(wireFondFiss)
+ for i,edge in enumerate(edgesFondFiss):
+ geomPublishInFather(initLog.debug, wireFondFiss, edge, "edgeFondFiss%d"%i)
+
+ # --- peau et face de fissure
+ #
+ # --- partition peau défaut - face de fissure prolongée - wire de fond de fissure prolongée
+ # il peut y avoir plusieurs faces externes, dont certaines sont découpées par la fissure
+ # liste de faces externes : facesDefaut
+ # liste de partitions face externe - fissure : partitionPeauFissFond (None quand pas d'intersection)
+
+ partitionsPeauFissFond = construitPartitionsPeauFissure(facesDefaut, fissPipe)
+
+ # --- arêtes vives détectées (dans quadranglesToShapeNoCorner
+ # et quadranglesToShapeWithCorner)
+
+ aretesVivesC = compoundFromList(bordsPartages, "areteVive")
+ aretesVivesCoupees = [] # ensembles des arêtes vives identifiées sur les faces de peau dans l'itération sur partitionsPeauFissFond
+
+ # --- inventaire des faces de peau coupées par la fissure
+ # pour chaque face de peau : 0, 1 ou 2 faces débouchante du fond de fissure
+ # 0, 1 ou plus edges de la face de fissure externe au pipe
+
+ nbFacesFilling = len(partitionsPeauFissFond)
+
+ ptEdgeFond = [ [] for i in range(nbFacesFilling)] # pour chaque face [points edge fond de fissure aux débouchés du pipe]
+ fsPipePeau = [ [] for i in range(nbFacesFilling)] # pour chaque face [faces du pipe débouchantes]
+ edRadFPiPo = [ [] for i in range(nbFacesFilling)] # pour chaque face [edge radiale des faces du pipe débouchantes ]
+ fsFissuExt = [ [] for i in range(nbFacesFilling)] # pour chaque face [faces de fissure externes au pipe]
+ edFisExtPe = [ [] for i in range(nbFacesFilling)] # pour chaque face [edge en peau des faces de fissure externes (pas subshape facePeau)]
+ edFisExtPi = [ [] for i in range(nbFacesFilling)] # pour chaque face [edge commun au pipe des faces de fissure externes]
+ facesPeaux = [None for i in range(nbFacesFilling)] # pour chaque face : la face de peau finale a mailler (percée des faces débouchantes)
+ edCircPeau = [ [] for i in range(nbFacesFilling)] # pour chaque face de peau : [subshape edge circulaire aux débouchés du pipe]
+ ptCircPeau = [ [] for i in range(nbFacesFilling)] # pour chaque face de peau : [subshape point sur edge circulaire aux débouchés du pipe]
+ gpedgeBord = [None for i in range(nbFacesFilling)] # pour chaque face de peau : groupe subshape des edges aux bords liés à la partie saine
+ gpedgeVifs = [None for i in range(nbFacesFilling)] # pour chaque face de peau : groupes subshape des edges aux arêtes vives entre fillings
+ edFissPeau = [ [] for i in range(nbFacesFilling)] # pour chaque face de peau : [subshape edge en peau des faces de fissure externes]
+ ptFisExtPi = [ [] for i in range(nbFacesFilling)] # pour chaque face de peau : [point commun edFissPeau edCircPeau]
+
+ for ifil, partitionPeauFissFond in enumerate(partitionsPeauFissFond):
+ if partitionPeauFissFond is not None:
+ dataPPFF,aretesVivesCoupees = identifieElementsGeometriquesPeau(ifil, partitionPeauFissFond, edgesPipeFiss,
+ edgesFondFiss, wireFondFiss, aretesVivesC,
+ facesDefaut, centreFondFiss, rayonPipe,
+ aretesVivesCoupees)
+ ptEdgeFond[ifil] = dataPPFF['endsEdgeFond']
+ fsPipePeau[ifil] = dataPPFF['facesPipePeau']
+ edRadFPiPo[ifil] = dataPPFF['edgeRadFacePipePeau']
+ fsFissuExt[ifil] = dataPPFF['facesFissExt']
+ edFisExtPe[ifil] = dataPPFF['edgesFissExtPeau']
+ edFisExtPi[ifil] = dataPPFF['edgesFissExtPipe']
+ facesPeaux[ifil] = dataPPFF['facePeau']
+ edCircPeau[ifil] = dataPPFF['edgesCircPeau']
+ ptCircPeau[ifil] = dataPPFF['verticesCircPeau']
+ gpedgeBord[ifil] = dataPPFF['groupEdgesBordPeau']
+ gpedgeVifs[ifil] = dataPPFF['bordsVifs']
+ edFissPeau[ifil] = dataPPFF['edgesFissurePeau']
+ ptFisExtPi[ifil] = dataPPFF['verticesPipePeau']
+
+ facesPipePeau = []
+ edgeRadFacePipePeau = []
+ for ifil in range(nbFacesFilling):
+ facesPipePeau += fsPipePeau[ifil]
+ edgeRadFacePipePeau += edRadFPiPo[ifil]
+
+ for i, avc in enumerate(aretesVivesCoupees):
+ name = "areteViveCoupee%d"%i
+ geomPublish(initLog.debug, avc, name)
+
+ # --- identification des faces et edges de fissure externe pour maillage
+
+ (faceFissureExterne, edgesPipeFissureExterneC,
+ wirePipeFissureExterne, edgesPeauFissureExterneC) = identifieFacesEdgesFissureExterne(fsFissuExt, edFisExtPe,
+ edFisExtPi, edgesPipeFiss)
+
+ # --- preparation maillage du pipe :
+ # - détections des points a respecter : jonction des edges/faces constituant la face de fissure externe au pipe
+ # - points sur les edges de fond de fissure et edges pipe/face fissure,
+ # - vecteurs tangents au fond de fissure (normal au disque maillé)
+
+ (centres, gptsdisks, raydisks) = calculePointsAxiauxPipe(edgesFondFiss, edgesIdByOrientation, facesDefaut,
+ centreFondFiss, wireFondFiss, wirePipeFiss,
+ lenSegPipe, rayonPipe, nbsegCercle, nbsegRad)
+
+ # --- recherche des points en trop (externes au volume à remailler)
+ # - on associe chaque extrémité du pipe à une face filling
+ # - on part des disques aux extrémités du pipe
+ # - pour chaque disque, on prend les vertices de géométrie,
+ # on marque leur position relative à la face.
+ # - on s'arrete quand tous les noeuds sont dedans
+
+ (idFillingFromBout, idisklim, idiskout) = elimineExtremitesPipe(ptEdgeFond, facesDefaut, centres, gptsdisks, nbsegCercle)
+
+ # --- construction des listes d'edges radiales sur chaque extrémité débouchante
+
+ (listEdges, idFacesDebouchantes) = construitEdgesRadialesDebouchantes(idisklim, idiskout, gptsdisks, raydisks,
+ facesPipePeau, edgeRadFacePipePeau, nbsegCercle)
+
+ # --- création des points du maillage du pipe sur la face de peau
+
+ (gptsdisks, idisklim) = creePointsPipePeau(listEdges, idFacesDebouchantes, idFillingFromBout,
+ ptEdgeFond, ptFisExtPi, edCircPeau, gptsdisks, idisklim, nbsegRad)
+
+ # --- ajustement precis des points sur edgesPipeFissureExterneC
+
+ gptsdisks = ajustePointsEdgePipeFissure(edgesPipeFissureExterneC, wirePipeFissureExterne, gptsdisks, idisklim)
+
+ # --- maillage effectif du pipe
+
+ (meshPipe, meshPipeGroups, edgesCircPipeGroup) = construitMaillagePipe(gptsdisks, idisklim, nbsegCercle, nbsegRad)
+
+ # --- edges de bord, faces défaut à respecter
+
+ (internalBoundary, bordsLibres, grpAretesVives) = mailleAretesEtJonction(internalBoundary, aretesVivesCoupees, dmoyen)
+
+ # --- maillage faces de fissure
+
+ (meshFaceFiss, grpFaceFissureExterne,
+ grpEdgesPeauFissureExterne, grpEdgesPipeFissureExterne) = mailleFacesFissure(faceFissureExterne, edgesPipeFissureExterneC, edgesPeauFissureExterneC,
+ meshPipeGroups, areteFaceFissure, rayonPipe, nbsegRad)
+
+ # --- maillage faces de peau
+
+ meshesFacesPeau = mailleFacesPeau(partitionsPeauFissFond, idFillingFromBout, facesDefaut,
+ facesPeaux, edCircPeau, ptCircPeau, gpedgeBord, gpedgeVifs, edFissPeau,
+ bordsLibres, grpEdgesPeauFissureExterne, grpAretesVives,
+ edgesCircPipeGroup, dmoyen, rayonPipe, nbsegRad)
+
+ # --- regroupement des maillages du défaut
+
+ listMeshes = [internalBoundary.GetMesh(),
+ meshPipe.GetMesh(),
+ meshFaceFiss.GetMesh()]
+ for mp in meshesFacesPeau:
+ listMeshes.append(mp.GetMesh())
+
+ meshBoiteDefaut = smesh.Concatenate(listMeshes, 1, 1, 1e-05,False)
+ # pour aider l'algo hexa-tetra à ne pas mettre de pyramides à l'exterieur des volumes repliés sur eux-mêmes
+ # on désigne les faces de peau en quadrangles par le groupe "skinFaces"
+ group_faceFissOutPipe = None
+ group_faceFissInPipe = None
+ groups = meshBoiteDefaut.GetGroups()
+ for grp in groups:
+ if grp.GetType() == SMESH.FACE:
+ if grp.GetName() == "fisOutPi":
+ group_faceFissOutPipe = grp
+ elif grp.GetName() == "fisInPi":
+ group_faceFissInPipe = grp
+
+ # le maillage NETGEN ne passe pas toujours ==> utiliser GHS3D
+ distene=True
+ if distene:
+ algo3d = meshBoiteDefaut.Tetrahedron(algo=smeshBuilder.GHS3D)
+ else:
+ algo3d = meshBoiteDefaut.Tetrahedron(algo=smeshBuilder.NETGEN)
+ hypo3d = algo3d.MaxElementVolume(1000.0)
+ putName(algo3d.GetSubMesh(), "boiteDefaut")
+ putName(algo3d, "algo3d_boiteDefaut")
+ isDone = meshBoiteDefaut.Compute()
+ putName(meshBoiteDefaut, "boiteDefaut")
+ logging.info("meshBoiteDefaut fini")
+
+ faceFissure = meshBoiteDefaut.GetMesh().UnionListOfGroups( [ group_faceFissOutPipe, group_faceFissInPipe ], 'FACE1' )
+ maillageSain = enleveDefaut(maillageSain, zoneDefaut, zoneDefaut_skin,
+ zoneDefaut_internalFaces, zoneDefaut_internalEdges)
+ putName(maillageSain, nomFicSain+"_coupe")
+ extrusionFaceFissure, normfiss = shapeSurFissure(facesPortFissure)
+ maillageComplet = RegroupeSainEtDefaut(maillageSain, meshBoiteDefaut,
+ None, None, 'COMPLET', normfiss)
+
+ logging.info("conversion quadratique")
+ maillageComplet.ConvertToQuadratic( 1 )
+ logging.info("groupes")
+ groups = maillageComplet.GetGroups()
+ grps = [ grp for grp in groups if grp.GetName() == 'FONDFISS']
+ fond = maillageComplet.GetMesh().CreateDimGroup( grps, SMESH.NODE, 'FONDFISS' )
+
+ logging.info("réorientation face de fissure FACE1")
+ grps = [ grp for grp in groups if grp.GetName() == 'FACE1']
+ nb = maillageComplet.Reorient2D( grps[0], normfiss, grps[0].GetID(1))
+
+ logging.info("réorientation face de fissure FACE2")
+ plansim = geompy.MakePlane(O, normfiss, 10000)
+ fissnorm = geompy.MakeMirrorByPlane(normfiss, plansim)
+ grps = [ grp for grp in groups if grp.GetName() == 'FACE2']
+ nb = maillageComplet.Reorient2D( grps[0], fissnorm, grps[0].GetID(1))
+ fond = maillageComplet.GetMesh().CreateDimGroup( grps, SMESH.NODE, 'FACE2' )
+
+ logging.info("export maillage fini")
+ maillageComplet.ExportMED( fichierMaillageFissure, 0, SMESH.MED_V2_2, 1 )
+ putName(maillageComplet, nomFicFissure)
+ logging.info("fichier maillage fissure %s", fichierMaillageFissure)
+
+ if salome.sg.hasDesktop():
+ salome.sg.updateObjBrowser(1)
+
+ logging.info("maillage fissure fini")
+
+ return maillageComplet
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import logging
+
+from geomsmesh import geompy
+from geomsmesh import smesh
+import SMESH
+
+def construitMaillagePipe(gptsdisks, idisklim, nbsegCercle, nbsegRad):
+ """
+ maillage effectif du pipe
+ """
+ logging.info('start')
+ meshPipe = smesh.Mesh(None, "meshPipe")
+ fondFissGroup = meshPipe.CreateEmptyGroup(SMESH.EDGE, "FONDFISS")
+ nodesFondFissGroup = meshPipe.CreateEmptyGroup(SMESH.NODE, "nfondfis")
+ faceFissGroup = meshPipe.CreateEmptyGroup(SMESH.FACE, "fisInPi")
+ edgeFaceFissGroup = meshPipe.CreateEmptyGroup(SMESH.EDGE, "edgeFaceFiss")
+ edgeCircPipe0Group = meshPipe.CreateEmptyGroup(SMESH.EDGE, "edgeCircPipe0")
+ edgeCircPipe1Group = meshPipe.CreateEmptyGroup(SMESH.EDGE, "edgeCircPipe1")
+ faceCircPipe0Group = meshPipe.CreateEmptyGroup(SMESH.FACE, "faceCircPipe0")
+ faceCircPipe1Group = meshPipe.CreateEmptyGroup(SMESH.FACE, "faceCircPipe1")
+
+ mptsdisks = [] # vertices maillage de tous les disques
+ mEdges = [] # identifiants edges maillage fond de fissure
+ mEdgeFaces = [] # identifiants edges maillage edge face de fissure externe
+ mFaces = [] # identifiants faces maillage fissure
+ mVols = [] # identifiants volumes maillage pipe
+
+ mptdsk = None
+ for idisk in range(idisklim[0], idisklim[1]+1): # boucle sur les disques internes
+
+ # -----------------------------------------------------------------------
+ # --- points
+
+ gptdsk = gptsdisks[idisk]
+ if idisk > idisklim[0]:
+ oldmpts = mptdsk
+ mptdsk = [] # vertices maillage d'un disque
+ for k in range(nbsegCercle):
+ points = gptdsk[k]
+ mptids = []
+ for j, pt in enumerate(points):
+ if j == 0 and k > 0:
+ id = mptdsk[0][0]
+ else:
+ coords = geompy.PointCoordinates(pt)
+ id = meshPipe.AddNode(coords[0], coords[1], coords[2])
+ mptids.append(id)
+ mptdsk.append(mptids)
+ mptsdisks.append(mptdsk)
+
+ # -----------------------------------------------------------------------
+ # --- groupes edges cercles debouchants
+
+ if idisk == idisklim[0]:
+ pts = []
+ for k in range(nbsegCercle):
+ pts.append(mptdsk[k][-1])
+ edges = []
+ for k in range(len(pts)):
+ k1 = (k+1)%len(pts)
+ idEdge = meshPipe.AddEdge([pts[k], pts[k1]])
+ edges.append(idEdge)
+ edgeCircPipe0Group.Add(edges)
+
+ if idisk == idisklim[1]:
+ pts = []
+ for k in range(nbsegCercle):
+ pts.append(mptdsk[k][-1])
+ edges = []
+ for k in range(len(pts)):
+ k1 = (k+1)%len(pts)
+ idEdge = meshPipe.AddEdge([pts[k], pts[k1]])
+ edges.append(idEdge)
+ edgeCircPipe1Group.Add(edges)
+
+ # -----------------------------------------------------------------------
+ # --- groupes faces debouchantes
+
+ if idisk == idisklim[0]:
+ faces = []
+ for j in range(nbsegRad):
+ for k in range(nbsegCercle):
+ k1 = k+1
+ if k == nbsegCercle-1:
+ k1 = 0
+ if j == 0:
+ idf = meshPipe.AddFace([mptdsk[k][0], mptdsk[k][1], mptdsk[k1][1]]) # triangle
+ else:
+ idf = meshPipe.AddFace([mptdsk[k][j], mptdsk[k][j+1], mptdsk[k1][j+1], mptdsk[k1][j]]) # quadrangle
+ faces.append(idf)
+ faceCircPipe0Group.Add(faces)
+
+ if idisk == idisklim[1]:
+ faces = []
+ for j in range(nbsegRad):
+ for k in range(nbsegCercle):
+ k1 = k+1
+ if k == nbsegCercle-1:
+ k1 = 0
+ if j == 0:
+ idf = meshPipe.AddFace([mptdsk[k][0], mptdsk[k][1], mptdsk[k1][1]]) # triangle
+ else:
+ idf = meshPipe.AddFace([mptdsk[k][j], mptdsk[k][j+1], mptdsk[k1][j+1], mptdsk[k1][j]]) # quadrangle
+ faces.append(idf)
+ faceCircPipe1Group.Add(faces)
+
+ # -----------------------------------------------------------------------
+ # --- mailles volumiques, groupes noeuds et edges de fond de fissure, groupe de face de fissure
+
+ if idisk == idisklim[0]:
+ mEdges.append(0)
+ mEdgeFaces.append(0)
+ mFaces.append([0])
+ mVols.append([[0]])
+ nodesFondFissGroup.Add([mptdsk[0][0]])
+ else:
+ ide = meshPipe.AddEdge([oldmpts[0][0], mptdsk[0][0]])
+ mEdges.append(ide)
+ fondFissGroup.Add([ide])
+ nodesFondFissGroup.Add([mptdsk[0][0]])
+ ide2 = meshPipe.AddEdge([oldmpts[0][-1], mptdsk[0][-1]])
+ mEdgeFaces.append(ide2)
+ edgeFaceFissGroup.Add([ide2])
+ idFaces = []
+ idVols = []
+
+ for j in range(nbsegRad):
+ idf = meshPipe.AddFace([oldmpts[0][j], mptdsk[0][j], mptdsk[0][j+1], oldmpts[0][j+1]])
+ faceFissGroup.Add([idf])
+ idFaces.append(idf)
+
+ idVolCercle = []
+ for k in range(nbsegCercle):
+ k1 = k+1
+ if k == nbsegCercle-1:
+ k1 = 0
+ if j == 0:
+ idv = meshPipe.AddVolume([mptdsk[k][j], mptdsk[k][j+1], mptdsk[k1][j+1],
+ oldmpts[k][j], oldmpts[k][j+1], oldmpts[k1][j+1]])
+ else:
+ idv = meshPipe.AddVolume([mptdsk[k][j], mptdsk[k][j+1], mptdsk[k1][j+1], mptdsk[k1][j],
+ oldmpts[k][j], oldmpts[k][j+1], oldmpts[k1][j+1], oldmpts[k1][j]])
+ idVolCercle.append(idv)
+ idVols.append(idVolCercle)
+
+ mFaces.append(idFaces)
+ mVols.append(idVols)
+
+ pipeFissGroup = meshPipe.CreateEmptyGroup( SMESH.VOLUME, 'PIPEFISS' )
+ nbAdd = pipeFissGroup.AddFrom( meshPipe.GetMesh() )
+
+ nb, new_mesh, new_group = meshPipe.MakeBoundaryElements(SMESH.BND_2DFROM3D, "pipeBoundaries")
+ edgesCircPipeGroup = [edgeCircPipe0Group, edgeCircPipe1Group]
+
+ meshPipeGroups = dict(fondFissGroup = fondFissGroup,
+ nodesFondFissGroup = nodesFondFissGroup,
+ faceFissGroup = faceFissGroup,
+ edgeFaceFissGroup = edgeFaceFissGroup,
+ edgeCircPipe0Group = edgeCircPipe0Group,
+ edgeCircPipe1Group = edgeCircPipe1Group,
+ faceCircPipe0Group = faceCircPipe0Group,
+ faceCircPipe1Group = faceCircPipe1Group,
+ pipeFissGroup = pipeFissGroup,
+ edgesCircPipeGroup = edgesCircPipeGroup
+ )
+
+ return (meshPipe, meshPipeGroups, edgesCircPipeGroup)
\ No newline at end of file
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import logging
+from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
+from checkDecoupePartition import checkDecoupePartition
+
+ # -----------------------------------------------------------------------------
+ # --- peau et face de fissure
+ #
+ # --- partition peau défaut - face de fissure prolongée - wire de fond de fissure prolongée
+ # il peut y avoir plusieurs faces externes, dont certaines sont découpées par la fissure
+ # liste de faces externes : facesDefaut
+ # liste de partitions face externe - fissure : partitionPeauFissFond (None quand pas d'intersection)
+
+def construitPartitionsPeauFissure(facesDefaut, fissPipe):
+ """
+ partition peau défaut - face de fissure prolongée - wire de fond de fissure prolongée.
+ Il peut y avoir plusieurs faces externes, dont certaines sont découpées par la fissure.
+ @param facesDefaut liste de faces externes
+ @param fissPipe partition face de fissure etendue par pipe prolongé
+ @return partitionsPeauFissFond : liste de partitions face externe - fissure (None quand pas d'intersection)
+ """
+
+ logging.info('start')
+ partitionsPeauFissFond = []
+ ipart = 0
+ for filling in facesDefaut:
+ part = geompy.MakePartition([fissPipe, filling], [], [], [], geompy.ShapeType["FACE"], 0, [], 0)
+ isPart = checkDecoupePartition([fissPipe, filling], part)
+ if isPart: # on recrée la partition avec toutes les faces filling en outil pour avoir une face de fissure correcte
+ otherFD = [fd for fd in facesDefaut if fd != filling]
+ if len(otherFD) > 0:
+ fissPipePart = geompy.MakePartition([fissPipe], otherFD, [], [], geompy.ShapeType["FACE"], 0, [], 0)
+ else:
+ fissPipePart = fissPipe
+ part = geompy.MakePartition([fissPipePart, filling], [], [], [], geompy.ShapeType["FACE"], 0, [], 0)
+ partitionsPeauFissFond.append(part)
+ geomPublish(initLog.debug, part, 'partitionPeauFissFond%d'%ipart )
+ else:
+ partitionsPeauFissFond.append(None)
+ ipart = ipart +1
+
+ return partitionsPeauFissFond
\ No newline at end of file
--- /dev/null
+# -*- coding: utf-8 -*-
+
+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,
+ ptEdgeFond, ptFisExtPi, edCircPeau, gptsdisks, idisklim, nbsegRad):
+ """
+ création des points du maillage du pipe sur la face de peau
+ """
+ logging.info('start')
+
+ for i, edges in enumerate(listEdges):
+ idf = idFacesDebouchantes[i] # indice de face débouchante (facesPipePeau)
+ if idf >= 0:
+ gptdsk = []
+ if idf > 0: # idf vaut 0 ou 1
+ 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
+ geomPublish(initLog.debug, centre, name)
+ vertPipePeau = ptFisExtPi[idFillingFromBout[i]][idf]
+ geomPublishInFather(initLog.debug, centre, vertPipePeau, "vertPipePeau")
+ grpsEdgesCirc = edCircPeau[idFillingFromBout[i]] # liste de groupes
+ edgesCirc = []
+ for grpEdgesCirc in grpsEdgesCirc:
+ edgesCirc += geompy.ExtractShapes(grpEdgesCirc, geompy.ShapeType["EDGE"], False)
+ for k, edge in enumerate(edges):
+ extrems = geompy.ExtractShapes(edge, geompy.ShapeType["VERTEX"], True)
+ if geompy.MinDistance(centre, extrems[0]) < geompy.MinDistance(centre, extrems[1]):
+ bout = extrems[1]
+ else:
+ bout = extrems[0]
+ # ajustement du point extrémité (bout) sur l'edge circulaire en face de peau
+ logging.debug("edgesCirc: %s", edgesCirc)
+ distEdgeCirc = [(geompy.MinDistance(bout, edgeCirc), k2, edgeCirc) for k2, edgeCirc in enumerate(edgesCirc)]
+ distEdgeCirc.sort()
+ logging.debug("distEdgeCirc: %s", distEdgeCirc)
+ u = projettePointSurCourbe(bout, distEdgeCirc[0][2])
+ if (abs(u) < 0.02) or (abs(1-u) < 0.02): # les points très proches d'une extrémité doivent y être mis précisément.
+ extrCircs = geompy.ExtractShapes(distEdgeCirc[0][2], geompy.ShapeType["VERTEX"], True)
+ if geompy.MinDistance(bout, extrCircs[0]) < geompy.MinDistance(bout, extrCircs[1]):
+ bout = extrCircs[0]
+ else:
+ bout = extrCircs[1]
+ else:
+ bout = geompy.MakeVertexOnCurve(distEdgeCirc[0][2], u)
+ name ="bout%d"%k
+ geomPublishInFather(initLog.debug, centre, bout, name)
+ # enregistrement des points dans la structure
+ points = []
+ for j in range(nbsegRad +1):
+ u = j/float(nbsegRad)
+ points.append(geompy.MakeVertexOnCurve(edge, u))
+ if geompy.MinDistance(bout, points[0]) < geompy.MinDistance(centre, points[0]):
+ points.reverse()
+ points[0] = centre
+ points[-1] = bout
+ gptdsk.append(points)
+ if i == 0:
+ gptsdisks[idisklim[0] -1] = gptdsk
+ idisklim[0] = idisklim[0] -1
+ else:
+ gptsdisks[idisklim[1] +1] = gptdsk
+ idisklim[1] = idisklim[1] +1
+
+ return (gptsdisks, idisklim)
\ No newline at end of file
from creeZoneDefautMaillage import creeZoneDefautMaillage
from peauInterne import peauInterne
-from quadranglesToShape import quadranglesToShape
+from quadranglesToShapeNoCorner import quadranglesToShapeNoCorner
from creeZoneDefautFilling import creeZoneDefautFilling
from creeZoneDefautGeom import creeZoneDefautGeom
from getCentreFondFiss import getCentreFondFiss
def creeZoneDefautDansObjetSain(geometriesSaines, maillagesSains, shapesFissure,
shapeFissureParams, maillageFissureParams):
"""
- TODO: a compléter
+ #TODO: a compléter
"""
logging.info('start')
maillageSain.ExportMED( fichierMaillageSain, 0, SMESH.MED_V2_2, 1 )
logging.debug("fichier maillage sain %s", fichierMaillageSain)
[maillageSain, internalBoundary, zoneDefaut, zoneDefaut_skin, zoneDefaut_internalFaces, zoneDefaut_internalEdges] = \
- peauInterne(fichierMaillageSain, nomZones)
+ peauInterne(fichierMaillageSain, shapeDefaut, nomZones)
facesDefaut = []
centresDefaut = []
isPlane = False
if isHexa and not isPlane:
meshQuad = smesh.CopyMesh( zoneDefaut_skin, 'meshQuad', 0, 0)
- fillings, noeuds_bords, bordsPartages, fillconts, idFilToCont = quadranglesToShape(meshQuad, shapeFissureParams, centreFondFiss)
+
+ fillings, noeuds_bords, bordsPartages, fillconts, idFilToCont = quadranglesToShapeNoCorner(meshQuad, shapeFissureParams, centreFondFiss)
+
for filling in fillings:
[faceDefaut, centreDefaut, normalDefaut, extrusionDefaut] = \
creeZoneDefautFilling(filling, shapeDefaut, lgExtrusion)
else:
[facesDefaut, centreDefaut, normalDefaut, extrusionDefaut] = \
creeZoneDefautGeom( geometrieSaine, shapeDefaut, origShapes, verticesShapes, dmoyen, lgExtrusion)
- bordsPartages =[]
+ bordsPartages = []
for face in facesDefaut:
bordsPartages.append([None,None]) # TODO : traitement des arêtes vives ?
fillconts = facesDefaut
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
def creeZoneDefautFilling(filling, shapeDefaut, lgExtrusion=50):
"""
Construction CAO de la zone à remailler, quand on utilise un filling,
- après appel creeZoneDefautMaillage et quadranglesToShape
+ après appel creeZoneDefautMaillage et quadranglesToShapeNoCorner
@param filling : la CAO de la peau du défaut reconstituée
@param shapeDefaut : objet géométrique représentant la fissure
(selon les cas, un point central, ou une shape plus complexe,
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
import logging
from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
from prolongeVertices import prolongeVertices
# -----------------------------------------------------------------------------
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])
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
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
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 = []
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 = []
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)
solid0 = geompy.MakeFuse(solid0, solids[i])
extrusionDefaut = solid0
if trace:
- geompy.addToStudy(extrusionDefaut, "extrusionDefaut")
+ geomPublish(initLog.debug, extrusionDefaut, "extrusionDefaut")
return facesDefaut, centreDefaut, normalDefaut, extrusionDefaut
nomZones, coordsNoeudsFissure):
"""
Identification de la zone à remailler, opérations sur le maillage
- de l'objet sain
+ de l'objet sain.
La zone à remailler est définie à partir d'un objet géométrique
ou à partir d'un jeu de points et d'une distance d'influence.
@param maillagesSains : (le maillage de l'objet initial, booleen isHexa)
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import logging
+
+from geomsmesh import geompy
+from whichSideVertex import whichSideVertex
+
+def elimineExtremitesPipe(ptEdgeFond, facesDefaut, centres, gptsdisks, nbsegCercle):
+ """
+ recherche des points en trop (externes au volume à remailler)
+ - on associe chaque extrémité du pipe à une face filling
+ - on part des disques aux extrémités du pipe
+ - pour chaque disque, on prend les vertices de géométrie,
+ on marque leur position relative à la face.
+ - on s'arrete quand tous les noeuds sont dedans
+ """
+
+ logging.info('start')
+
+ pt0 = centres[0]
+ pt1 = centres[-1]
+ idFillingFromBout = [None, None] # contiendra l'index du filling pour les extrémités 0 et 1
+ nbFacesFilling = len(ptEdgeFond)
+ for ifil in range(nbFacesFilling):
+ for ipt, pt in enumerate(ptEdgeFond[ifil]): # il y a un ou deux points débouchant sur cette face
+ if geompy.MinDistance(pt,pt0) < geompy.MinDistance(pt,pt1): # TODO: trouver plus fiable pour les cas tordus...
+ idFillingFromBout[0] = ifil
+ else:
+ idFillingFromBout[1] = ifil
+ logging.debug("association bouts du pipe - faces de filling: %s", idFillingFromBout)
+
+ logging.debug("recherche des disques de noeuds complètement internes")
+ idisklim = [] # indices des premier et dernier disques internes
+ idiskout = [] # indices des premier et dernier disques externes
+ for bout in range(2):
+ if bout == 0:
+ idisk = -1
+ inc = 1
+ numout = -1
+ else:
+ idisk = len(gptsdisks)
+ inc = -1
+ numout = len(gptsdisks)
+ inside = False
+ outside = True
+ while not inside:
+ idisk = idisk + inc
+ logging.debug("examen disque %s", idisk)
+ gptdsk = gptsdisks[idisk]
+ inside = True
+ for k in range(nbsegCercle):
+ points = gptdsk[k]
+ for j, pt in enumerate(points):
+ side = whichSideVertex(facesDefaut[idFillingFromBout[bout]], pt)
+ if side < 0:
+ if outside: # premier point detecté dedans
+ outside = False
+ numout = idisk -inc # le disque précédent était dehors
+ else:
+ inside = False # ce point est dehors
+ if not inside and not outside:
+ break
+ idisklim.append(idisk) # premier et dernier disques internes
+ idiskout.append(numout) # premier et dernier disques externes
+
+ return (idFillingFromBout, idisklim, idiskout)
\ No newline at end of file
import logging
from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
from whichSide import whichSide
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]
import logging
from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
from whichSideMulti import whichSideMulti
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]
import logging
from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
# -----------------------------------------------------------------------------
# --- 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)
[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)
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]):
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
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:
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é
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
import logging
from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
from extractionOrientee import extractionOrientee
from getSubshapeIds import getSubshapeIds
#[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
import logging
from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
# -----------------------------------------------------------------------------
# --- trouver les vertices extremites d'un wire
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:
import logging
from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
# -----------------------------------------------------------------------------
# --- trouver les vertices intermediaires d'un wire
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])
# -*- coding: utf-8 -*-
from geomsmesh import geompy, smesh
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
import math
import GEOM
from triedreBase import triedreBase
from genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut
from creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain
-from insereFissureGenerale import insereFissureGenerale
+from construitFissureGenerale import construitFissureGenerale
from sortEdges import sortEdges
O, OX, OY, OZ = triedreBase()
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
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)
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)
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)
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]
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
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)
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.)
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
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
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
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
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' )
# ---------------------------------------------------------
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
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)
def genereMaillageFissure(self, geometriesSaines, maillagesSains,
shapesFissure, shapeFissureParams,
maillageFissureParams, elementsDefaut, step):
- maillageFissure = insereFissureGenerale(maillagesSains,
- shapesFissure, shapeFissureParams,
- maillageFissureParams, elementsDefaut, step)
+ maillageFissure = construitFissureGenerale(maillagesSains,
+ shapesFissure, shapeFissureParams,
+ maillageFissureParams, elementsDefaut, step)
return maillageFissure
# ---------------------------------------------------------------------------
# -*- coding: utf-8 -*-
+import logging
+
from blocFissure import gmu
from blocFissure.gmu.initEtude import initEtude
from blocFissure.gmu.getStatsMaillageFissure import getStatsMaillageFissure
# ---------------------------------------------------------------------------
def executeProbleme(self, step=-1):
- print "executeProbleme", self.nomCas
+ logging.info(" --- executeProbleme %s", self.nomCas)
if step == 0:
return
--- /dev/null
+# -*- coding: utf-8 -*-
+"""
+Created on Tue Jun 24 09:14:13 2014
+
+@author: I48174 (Olivier HOAREAU)
+"""
+
+import logging
+from geomsmesh import geompy
+from geomsmesh import smesh
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
+import GEOM
+import SMESH
+
+from listOfExtraFunctions import createNewMeshesFromCorner
+from listOfExtraFunctions import createLinesFromMesh
+
+# -----------------------------------------------------------------------------
+# --- groupe de quadrangles de face transformé en face géométrique par filling
+
+def fusionMaillageDefaut(maillageSain, maillageDefautCible, maillageInterneCible, zoneDefaut_skin, shapeDefaut, listOfCorners):
+ """ """
+ # TODO: rédiger la docstring
+
+ logging.info("start")
+
+ facesNonCoupees = []
+ facesCoupees = []
+ maillagesNonCoupes = []
+ maillagesCoupes = []
+
+ # On crée une liste contenant le maillage de chaque face.
+ listOfNewMeshes = createNewMeshesFromCorner(maillageDefautCible, listOfCorners)
+
+ i = 0
+ while i < len(listOfNewMeshes):
+ lines = createLinesFromMesh(listOfNewMeshes[i])
+ setOfLines = []
+ for line in lines:
+ # On possède l'information 'ID' de chaque noeud composant chaque
+ # ligne de la face. A partir de l'ID, on crée un vertex. Un
+ # ensemble de vertices constitue une ligne. Un ensemble de lignes
+ # constitue la face.
+ tmpCoords = [maillageDefautCible.GetNodeXYZ(node) for node in line]
+ tmpPoints = [geompy.MakeVertex(val[0], val[1], val[2]) for val in tmpCoords]
+ line = geompy.MakeInterpol(tmpPoints, False, False)
+ setOfLines.append(line)
+
+ # A partir des lignes de la face,
+ # 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")
+ #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)) # 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))
+ facesCoupees.append(filling)
+ maillagesCoupes.append(listOfNewMeshes[i])
+
+ i += 1
+
+ listOfInternMeshes = [maillageInterneCible] + [msh.GetMesh() for msh in maillagesNonCoupes]
+
+ newMaillageInterne = smesh.Concatenate(listOfInternMeshes, 1, 1, 1e-05, False)
+
+ facesEnTrop = []
+
+ criteres = [smesh.GetCriterion(SMESH.FACE, SMESH.FT_BelongToGenSurface, SMESH.FT_Undefined, face) for face in facesNonCoupees]
+ filtres = [smesh.GetFilterFromCriteria([critere]) for critere in criteres]
+ for i, filtre in enumerate(filtres):
+ filtre.SetMesh(maillageSain.GetMesh())
+ faceEnTrop = maillageSain.GroupOnFilter(SMESH.FACE, 'faceEnTrop_{0}'.format(i + 1), filtre)
+ facesEnTrop.append(faceEnTrop)
+
+ newZoneDefaut_skin = maillageSain.GetMesh().CutListOfGroups([zoneDefaut_skin], facesEnTrop, 'newZoneDefaut_skin')
+
+ smesh.SetName(newMaillageInterne, 'newInternalBoundary')
+
+ return newZoneDefaut_skin, newMaillageInterne
+
\ No newline at end of file
import logging
from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
from toreFissure import toreFissure
from ellipsoideDefaut import ellipsoideDefaut
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)
def genereMeshCalculZoneDefaut(facefiss, minSize, maxSize):
"""
- TODO: a completer
- """
+ -Permet de générer un maillage sur l'objet géométrique 'facefiss' via
+ l'algorithme NETGEN_1D2D :
+ -SetMaxSize = dimension max d'un élément (maxSize)
+ -SetSecondOrder = élément quadratique (Y=1, N=0)
+ -SetOptimize = élément régulier (Y=1, N=0)
+ -SetFineness = finesse du maillage
+ [very_coarse, coarse, moderate, fine, very_fine, custom]
+ [0, 1, 2, 3, 4, 5 ]
+ -SetMinSize = dimension min d'un élément (minSize)
+ -SetQuadAllowed = permission quadrangle dans maillage triangle
+ -On récupère les coordonnées de chaque noeud de la fissure qu'on stocke
+ dans une liste sous la forme : [X0, Y0, Z0, ..., Xn, Yn, Zn]"""
+
logging.info('start')
meshFissure = smesh.Mesh(facefiss)
import logging
logging.info('start')
+import initLog
import salome
salome.salome_init()
smesh = smeshBuilder.New(salome.myStudy)
logging.debug("initialisation de geompy et smesh OK")
+
+def geomPublish(level,aShape, aName):
+ if initLog.getLogLevel() <= level:
+ geompy.addToStudy(aShape, aName)
+
+def geomPublishInFather(level, aFather, aShape, aName):
+ if initLog.getLogLevel() <= level:
+ geompy.addToStudyInFather(aFather, aShape, aName)
+
\ No newline at end of file
import logging
from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
import bisect
publie = False
def getCentreFondFiss(shapesFissure):
"""
identification du centre de fond de fissure,
- transformation fond de fissure en edge unique (seulement pour la procédure insereFissureGenerale).
+ transformation fond de fissure en edge unique (seulement pour la procédure construitFissureGenerale).
On distingue le cas d'utilisation de la procédure insereFissureLongue par le nombre d'éléments de shapesFissure.
"""
global publie
logging.debug("start")
fondFiss = shapesFissure[4] # groupe d'edges de fond de fissure
- if len(shapesFissure) == 6: # procédure insereFissureGenerale, et edge fond de fissure fournie explicitement
+ if len(shapesFissure) == 6: # procédure construitFissureGenerale, et edge fond de fissure fournie explicitement
edgeFondExt = shapesFissure[5]
else:
edgeFondExt = None
if len(shapesFissure) > 6: # procédure insereFissureLongue (fissure plane, plusieurs edges sur le fond de fissure)
centreFondFiss = shapesFissure[1]
tgtCentre = None
- else: # procédure insereFissureGenerale, détermination edge unique et milieu de l'edge
+ else: # procédure construitFissureGenerale, détermination edge unique et milieu de l'edge
if geompy.NumberOfEdges(fondFiss) > 1:
if geompy.NbShapes(fondFiss, geompy.ShapeType["WIRE"]) > 0: # wire
aWire = fondFiss
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)
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
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
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import logging
+
+from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
+
+from substractSubShapes import substractSubShapes
+
+def identifieEdgesPeau(edgesFissExtPipe,verticesPipePeau, facePeau, facesPeauSorted,
+ edgesPeauFondIn, fillingFaceExterne, aretesVivesC, aretesVivesCoupees):
+ """
+ identification précise des edges et disques des faces de peau selon index extremité fissure
+ """
+ logging.info('start')
+
+ facesPipePeau = [None for i in range(len(edgesFissExtPipe))]
+ endsEdgeFond = [None for i in range(len(edgesFissExtPipe))]
+ edgeRadFacePipePeau = [None for i in range(len(edgesFissExtPipe))]
+
+ edgesListees = []
+ edgesCircPeau = []
+ verticesCircPeau = []
+ if len(verticesPipePeau) > 0: # --- au moins une extrémité du pipe sur cette face de peau
+
+ for face in facesPeauSorted[:-1]: # la ou les faces débouchantes, pas la grande face de peau
+ logging.debug("examen face debouchante circulaire")
+ for i,efep in enumerate(edgesFissExtPipe):
+ dist = geompy.MinDistance(face, efep)
+ logging.debug(" distance face circulaire edge %s", dist)
+ if dist < 1e-3:
+ for ik, edpfi in enumerate(edgesPeauFondIn):
+ if geompy.MinDistance(face, edpfi) < 1e-3:
+ break
+ sharedVertices = geompy.GetSharedShapesMulti([face, edgesPeauFondIn[ik]], geompy.ShapeType["VERTEX"])
+ nameFace = "facePipePeau%d"%i
+ nameVert = "endEdgeFond%d"%i
+ nameEdge = "edgeRadFacePipePeau%d"%i
+ facesPipePeau[i] = face
+ endsEdgeFond[i] = sharedVertices[0]
+ 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
+ geomPublish(initLog.debug, edge, nameEdge)
+ break
+ pass
+ pass
+ pass
+ pass
+
+ # --- edges circulaires de la face de peau et points de jonction de la face externe de fissure
+ logging.debug("facesPipePeau: %s", facesPipePeau)
+ edgesCircPeau = [None for i in range(len(facesPipePeau))]
+ verticesCircPeau = [None for i in range(len(facesPipePeau))]
+ for i,fcirc in enumerate(facesPipePeau):
+ edges = geompy.GetSharedShapesMulti([facePeau, fcirc], geompy.ShapeType["EDGE"])
+ grpEdgesCirc = geompy.CreateGroup(facePeau, geompy.ShapeType["EDGE"])
+ geompy.UnionList(grpEdgesCirc, edges)
+ edgesCircPeau[i] = grpEdgesCirc
+ name = "edgeCirc%d"%i
+ 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
+ geomPublishInFather(initLog.debug, facePeau, grpVertCircPeau, name)
+ pass
+ pass # --- au moins une extrémité du pipe sur cette face de peau
+
+ # --- edges de bord de la face de peau
+
+ edgesFilling = geompy.ExtractShapes(fillingFaceExterne, geompy.ShapeType["EDGE"], False)
+ edgesBords = []
+ for i, edge in enumerate(edgesFilling):
+ edgepeau = geompy.GetInPlace(facePeau, edge)
+ name = "edgepeau%d"%i
+ geomPublishInFather(initLog.debug, facePeau,edgepeau, name)
+ logging.debug("edgepeau %s", geompy.ShapeInfo(edgepeau))
+ if geompy.ShapeInfo(edgepeau)['EDGE'] > 1:
+ logging.debug(" EDGES multiples")
+ edgs = geompy.ExtractShapes(edgepeau, geompy.ShapeType["EDGE"], False)
+ edgesBords += edgs
+ edgesListees += edgs
+ else:
+ logging.debug(" EDGE")
+ edgesBords.append(edgepeau)
+ edgesListees.append(edgepeau)
+ groupEdgesBordPeau = geompy.CreateGroup(facePeau, geompy.ShapeType["EDGE"])
+ geompy.UnionList(groupEdgesBordPeau, edgesBords)
+ bordsVifs = None
+ if aretesVivesC is not None:
+ bordsVifs = geompy.GetInPlace(facePeau, aretesVivesC)
+ if bordsVifs is not None:
+ geomPublishInFather(initLog.debug, facePeau, bordsVifs, "bordsVifs")
+ groupEdgesBordPeau = geompy.CutGroups(groupEdgesBordPeau, bordsVifs)
+ grptmp = None
+ if len(aretesVivesCoupees) > 0:
+ grpC = geompy.MakeCompound(aretesVivesCoupees)
+ grptmp = geompy.GetInPlace(facePeau, grpC)
+ if grptmp is not None:
+ grpnew = geompy.CutGroups(bordsVifs, grptmp) # ce qui est nouveau dans bordsVifs
+ else:
+ grpnew = bordsVifs
+ if grpnew is not None:
+ edv = geompy.ExtractShapes(grpnew, geompy.ShapeType["EDGE"], False)
+ aretesVivesCoupees += edv
+ logging.debug("aretesVivesCoupees %s",aretesVivesCoupees)
+ geomPublishInFather(initLog.debug, facePeau, groupEdgesBordPeau , "EdgesBords")
+
+ # --- edges de la face de peau partagées avec la face de fissure
+
+ edgesPeau = geompy.ExtractShapes(facePeau, geompy.ShapeType["EDGE"], False)
+ edges = substractSubShapes(facePeau, edgesPeau, edgesListees)
+ edgesFissurePeau = []
+ if len(verticesPipePeau) > 0: # --- au moins une extrémité du pipe sur cette face de peau
+ edgesFissurePeau = [None for i in range(len(verticesCircPeau))] # edges associés aux extrémités du pipe, en premier
+ for edge in edges:
+ for i, grpVert in enumerate(verticesCircPeau):
+ if (geompy.MinDistance(grpVert, edge) < 1.e-3) and (edge not in edgesFissurePeau):
+ edgesFissurePeau[i] = edge
+ name = "edgeFissurePeau%d"%i
+ 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)
+ else:
+ for i, edge in enumerate(edges):
+ edgesFissurePeau.append(edge)
+ name = "edgeFissurePeau%d"%i
+ geomPublishInFather(initLog.debug, facePeau, edge, name)
+
+ return (endsEdgeFond, facesPipePeau, edgeRadFacePipePeau,
+ edgesCircPeau, verticesCircPeau, groupEdgesBordPeau,
+ bordsVifs, edgesFissurePeau, aretesVivesCoupees)
--- /dev/null
+# -*- coding: utf-8 -*-
+
+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
+
+def identifieElementsDebouchants(ifil, facesDefaut, partitionPeauFissFond,
+ edgesFondIn, edgesFondFiss, wireFondFiss,
+ aretesVivesC, fillingFaceExterne,
+ edgesPipeIn, verticesPipePeau, rayonPipe,
+ facesInside, facesOnside):
+ """
+ elements débouchants (intersection pipe et peau), indexés selon les edges du fond de fissure (edgesFondIn)
+ """
+
+ logging.info('start')
+
+ verticesEdgesFondIn = [] # les points du fond de fissure au débouché du pipe sur la peau (indice de edgesFondIn)
+ pipexts = [] # les segments de pipe associés au points de fond de fissure débouchants (même indice)
+ cercles = [] # les cercles de generation des pipes débouchant (même indice)
+ facesFissExt = [] # les faces de la fissure externe associés au points de fond de fissure débouchants (même indice)
+ edgesFissExtPeau = [] # edges des faces de fissure externe sur la peau (même indice)
+ edgesFissExtPipe = [] # edges des faces de fissure externe sur le pipe (même indice)
+
+ #logging.debug("edgesFondIn %s", edgesFondIn)
+ for iedf, edge in enumerate(edgesFondIn):
+ name = "edgeFondIn%d"%iedf
+ 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)
+ logging.debug("u:%s, EdgeInWireIndex: %s, len(edgesFondFiss): %s", u, EdgeInWireIndex, len(edgesFondFiss))
+ localEdgeInFondFiss = edgesFondFiss[EdgeInWireIndex]
+ centre = PointOnEdge
+ centre2 = geompy.MakeVertexOnCurve(localEdgeInFondFiss, u)
+ geomPublishInFather(initLog.debug, partitionPeauFissFond, centre2, "centre2_%d"%iedf)
+ verticesEdgesFondIn.append(centre)
+ name = "verticeEdgesFondIn%d"%iedf
+ geomPublishInFather(initLog.debug, partitionPeauFissFond, centre, name)
+ norm = geompy.MakeTangentOnCurve(localEdgeInFondFiss, u)
+ geomPublishInFather(initLog.debug, partitionPeauFissFond, centre, "norm%d"%iedf)
+ cercle = geompy.MakeCircle(centre, norm, rayonPipe)
+ 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)
+ angle = geompy.GetAngleRadians(vec1, vec2)
+ # cas général : on reconstitue une portion de pipe, avec l'arête de couture qui coincide
+ # avec la face de fissure, au niveau du débouché sur la face externe
+ # cas dégénéré : le pipe débouche perpendiculairement à une surface plane à l'origine.
+ # La partition filling / pipe reconstruit échoue.
+ # - Si on partitionne le filling avec un simple pipe obtenu par extrusion droite du cercle,
+ # cela donne un point en trop sur le cercle.
+ # - Si on prend une vraie surface plane (pas un filling), on peut faire la partition avec
+ # les pipes reconstruits
+ logging.debug("angle=%s", angle)
+ #if abs(angle) > 1.e-7:
+ sommetAxe = geompy.MakeTranslationVector(centre, norm)
+ pm = produitMixte(centre, vertex, ptPeau, sommetAxe)
+ if pm > 0: # ajout de pi a (-)angle pour éviter des points confondus (partition échoue) dans les cas dégénérés
+ cercle = geompy.MakeRotation(cercle, norm, angle + math.pi)
+ else:
+ cercle = geompy.MakeRotation(cercle, norm, -angle + math.pi)
+ name = "cercle%d"%iedf
+ 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
+ if aretesVivesC is None:
+ faceTestPeau = fillingFaceExterne
+ else:
+ faceTestPeau = facesDefaut[ifil]
+ sideCentre = whichSide(faceTestPeau, centre)
+ locPt0 = geompy.MakeVertexOnCurve(localEdgeInFondFiss, 0.0)
+ locPt1 = geompy.MakeVertexOnCurve(localEdgeInFondFiss, 1.0)
+ sidePt0 = whichSide(faceTestPeau, locPt0)
+ sidePt1 = whichSide(faceTestPeau, locPt1)
+ logging.debug("position centre cercle: %s, extremité edge u0: %s, u1: %s", sideCentre, sidePt0, sidePt1)
+ normFace = geompy.GetNormal(faceTestPeau, ptPeau)
+ inclPipe = abs(geompy.GetAngleRadians(norm, normFace))
+ lgp = max(rayonPipe/2., abs(3*rayonPipe*math.tan(inclPipe)))
+ logging.debug("angle inclinaison Pipe en sortie: %s degres, lgp: %s", inclPipe*180/math.pi, lgp)
+
+ # --- position des points extremite du pipe sur l'edge debouchante
+ # il faut la distance curviligne ofp du point central par rapport à une extrémité de l'edge débouchante
+ locEdgePart = geompy.MakePartition([localEdgeInFondFiss],[centre], [], [], geompy.ShapeType["EDGE"], 0, [], 0)
+ edgesLoc = geompy.ExtractShapes(locEdgePart, geompy.ShapeType["EDGE"], False)
+ edgesLocSorted =[(geompy.MinDistance(edge, locPt0), kk, edge) for kk, edge in enumerate(edgesLoc)]
+ edgesLocSorted.sort()
+ ofp = geompy.BasicProperties(edgesLocSorted[0][2])[0] # distance curviligne centre locPt0
+ logging.debug("distance curviligne centre extremite0: %s", ofp)
+ p1 = geompy.MakeVertexOnCurveByLength(localEdgeInFondFiss, ofp +lgp, locPt0)
+ p2 = geompy.MakeVertexOnCurveByLength(localEdgeInFondFiss, ofp -lgp, locPt0)
+ 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)
+ for edp in edps:
+ if geompy.MinDistance(centre, edp) < 1.e-3:
+ pipext = geompy.MakePipe(cercle, edp)
+ name = "pipeExt%d"%iedf
+ geomPublishInFather(initLog.debug, partitionPeauFissFond, pipext, name)
+ pipexts.append(pipext)
+
+ for ifa, face in enumerate(facesInside):
+ logging.debug("recherche edges communes entre une face inside et (faces onside, edges pipe et fond débouchante)")
+ edgesPeauFis = []
+ edgesPipeFis = []
+ edgesPipeFnd = []
+ try:
+ edgesPeauFis = geompy.GetSharedShapesMulti([geompy.MakeCompound(facesOnside), face], geompy.ShapeType["EDGE"])
+ logging.debug(" faces onside %s",edgesPeauFis)
+ edgesPipeFis = geompy.GetSharedShapesMulti([geompy.MakeCompound(edgesPipeIn), face], geompy.ShapeType["EDGE"])
+ logging.debug(" edgesPipeIn %s", edgesPipeFis)
+ edgesPipeFnd = geompy.GetSharedShapesMulti([geompy.MakeCompound(edgesFondIn), face], geompy.ShapeType["EDGE"])
+ logging.debug(" edgesFondIn %s ", edgesPipeFnd)
+ except:
+ logging.debug(" pb edges communes %s %s %s",edgesPeauFis, edgesPipeFis, edgesPipeFnd)
+ pass
+ if (len(edgesPeauFis) > 0) and (len(edgesPipeFis) > 0) and (len(edgesPipeFnd) == 0):
+ dist = geompy.MinDistance(geompy.MakeCompound(edgesPeauFis), ptPeau)
+ logging.debug(" test distance extrémité reference %s", dist)
+ if dist < 1.e-3: # c'est la face de fissure externe associée
+ logging.debug(" face %s inside ajoutée", ifa)
+ facesFissExt.append(face)
+ name="faceFissExt%d"%iedf
+ geomPublishInFather(initLog.debug, partitionPeauFissFond, face, name)
+ dist = 1.
+ for ipe, edpe in enumerate(edgesPeauFis):
+ for ipi, edpi in enumerate(edgesPipeFis):
+ dist = geompy.MinDistance(edpe, edpi)
+ if dist < 1.e-3:
+ edgesFissExtPeau.append(edpe)
+ name="edgesFissExtPeau%d"%iedf
+ geomPublishInFather(initLog.debug, partitionPeauFissFond, edpe, name)
+ edgesFissExtPipe.append(edpi)
+ name="edgesFissExtPipe%d"%iedf
+ geomPublishInFather(initLog.debug, partitionPeauFissFond, edpi, name)
+ break
+ if dist < 1.e-3:
+ break
+
+ return (verticesEdgesFondIn, pipexts, cercles, facesFissExt, edgesFissExtPeau, edgesFissExtPipe)
\ No newline at end of file
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import logging
+
+from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
+
+from extractionOrientee import extractionOrientee
+from extractionOrienteeMulti import extractionOrienteeMulti
+
+def identifieElementsFissure(ifil, facesDefaut, partitionPeauFissFond,
+ edgesPipeFiss, edgesFondFiss, aretesVivesC,
+ fillingFaceExterne, centreFondFiss):
+ """
+ # -----------------------------------------------------------------------
+ # --- identification edges fond de fissure, edges pipe sur la face de fissure,
+ # edges prolongées
+ # edges internes communes pipe et fissure, points communs edges fissure peau et edges circulaires
+ """
+
+ logging.info('start')
+
+ edgesPipeC = geompy.GetInPlace(partitionPeauFissFond, geompy.MakeCompound(edgesPipeFiss))
+ geomPublishInFather(initLog.debug, partitionPeauFissFond, edgesPipeC, "edgesPipeFiss")
+ edgesFondC = geompy.GetInPlace(partitionPeauFissFond, geompy.MakeCompound(edgesFondFiss))
+ geomPublishInFather(initLog.debug, partitionPeauFissFond, edgesFondC, "edgesFondFiss")
+
+ if aretesVivesC is None:
+ [edgesInside, edgesOutside, edgesOnside] = extractionOrientee(fillingFaceExterne, partitionPeauFissFond, centreFondFiss, "EDGE", 1.e-3)
+ [facesInside, facesOutside, facesOnside] = extractionOrientee(fillingFaceExterne, partitionPeauFissFond, centreFondFiss, "FACE", 1.e-3)
+ else:
+ [edgesInside, edgesOutside, edgesOnside] = extractionOrienteeMulti(facesDefaut, ifil, partitionPeauFissFond, centreFondFiss, "EDGE", 1.e-3)
+ [facesInside, facesOutside, facesOnside] = extractionOrienteeMulti(facesDefaut, ifil, partitionPeauFissFond, centreFondFiss, "FACE", 1.e-3)
+
+ edgesPipeIn = geompy.GetSharedShapesMulti([edgesPipeC, geompy.MakeCompound(edgesInside)], geompy.ShapeType["EDGE"])
+ verticesPipePeau = []
+
+ for i, edge in enumerate(edgesPipeIn):
+ try:
+ vertices = geompy.GetSharedShapesMulti([edge, geompy.MakeCompound(facesOnside)], geompy.ShapeType["VERTEX"])
+ verticesPipePeau.append(vertices[0])
+ name = "edgePipeIn%d"%i
+ geomPublishInFather(initLog.debug, partitionPeauFissFond, edge, name)
+ name = "verticePipePeau%d"%i
+ 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)
+
+ edgesFondIn =[]
+ if len(verticesPipePeau) > 0: # au moins une extrémité du pipe sur cette face de peau
+ #tmp = geompy.GetSharedShapesMulti([edgesFondC, geompy.MakeCompound(edgesOutside)], geompy.ShapeType["EDGE"])
+ #edgesFondOut = [ ed for ed in tmp if geompy.MinDistance(ed, geompy.MakeCompound(facesOnside)) < 1.e-3]
+ tmp = geompy.GetSharedShapesMulti([edgesFondC, geompy.MakeCompound(edgesInside)], geompy.ShapeType["EDGE"])
+ edgesFondIn = [ ed for ed in tmp if geompy.MinDistance(ed, geompy.MakeCompound(facesOnside)) < 1.e-3]
+
+ return (edgesPipeIn, verticesPipePeau, edgesFondIn, facesInside, facesOnside)
\ No newline at end of file
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import logging
+
+from identifieElementsFissure import identifieElementsFissure
+from identifieElementsDebouchants import identifieElementsDebouchants
+from trouveEdgesFissPeau import trouveEdgesFissPeau
+from identifieFacesPeau import identifieFacesPeau
+from identifieEdgesPeau import identifieEdgesPeau
+
+def identifieElementsGeometriquesPeau(ifil, partitionPeauFissFond, edgesPipeFiss,
+ edgesFondFiss, wireFondFiss, aretesVivesC,
+ facesDefaut, centreFondFiss, rayonPipe,
+ aretesVivesCoupees):
+ """
+ """
+ logging.info('start')
+ fillingFaceExterne = facesDefaut[ifil]
+
+ logging.debug("traitement partitionPeauFissFond %s", ifil)
+
+ # --- identification edges fond de fissure, edges pipe sur la face de fissure, edges prolongées
+ # edges internes communes pipe et fissure, points communs edges fissure peau et edges circulaires
+
+ (edgesPipeIn, verticesPipePeau, edgesFondIn, facesInside, facesOnside) = identifieElementsFissure(ifil, facesDefaut, partitionPeauFissFond,
+ edgesPipeFiss, edgesFondFiss, aretesVivesC,
+ fillingFaceExterne, centreFondFiss)
+
+ # --- elements débouchants (intersection pipe et peau), indexés selon les edges du fond de fissure (edgesFondIn)
+
+ (verticesEdgesFondIn, pipexts, cercles,
+ facesFissExt, edgesFissExtPeau, edgesFissExtPipe) = identifieElementsDebouchants(ifil, facesDefaut, partitionPeauFissFond,
+ edgesFondIn, edgesFondFiss, wireFondFiss,
+ aretesVivesC, fillingFaceExterne,
+ edgesPipeIn, verticesPipePeau, rayonPipe,
+ facesInside, facesOnside)
+
+ # --- pour les faces de peau sans extremité débouchante de fissure, il faut recenser les edges de fissure sur la face de peau
+
+ if len(verticesPipePeau) == 0: # aucune extrémité du pipe sur cette face de peau
+ edgesFissExtPeau = trouveEdgesFissPeau(facesInside, facesOnside, edgesPipeIn, edgesFondIn, partitionPeauFissFond, edgesFissExtPeau)
+
+ # --- inventaire des faces de peau : face de peau percée du pipe, extrémités du pipe
+
+ (facePeau, facesPeauSorted, edgesPeauFondIn) = identifieFacesPeau(ifil, verticesPipePeau, facesOnside, wireFondFiss,
+ verticesEdgesFondIn, pipexts, cercles,
+ fillingFaceExterne, centreFondFiss)
+
+ # --- identification précise des edges et disques des faces de peau selon index extremité fissure
+
+ (endsEdgeFond, facesPipePeau, edgeRadFacePipePeau,
+ edgesCircPeau, verticesCircPeau, groupEdgesBordPeau,
+ bordsVifs, edgesFissurePeau, aretesVivesCoupees) = identifieEdgesPeau(edgesFissExtPipe, verticesPipePeau, facePeau, facesPeauSorted,
+ edgesPeauFondIn, fillingFaceExterne, aretesVivesC, aretesVivesCoupees)
+
+ dataPPFF = dict(endsEdgeFond = endsEdgeFond, # pour chaque face [points edge fond de fissure aux débouchés du pipe]
+ facesPipePeau = facesPipePeau, # pour chaque face [faces du pipe débouchantes]
+ edgeRadFacePipePeau = edgeRadFacePipePeau, # pour chaque face [edge radiale des faces du pipe débouchantes ]
+ facesFissExt = facesFissExt, # pour chaque face [faces de fissure externes au pipe]
+ edgesFissExtPeau = edgesFissExtPeau, # pour chaque face [edge en peau des faces de fissure externes (pas subshape facePeau)]
+ edgesFissExtPipe = edgesFissExtPipe, # pour chaque face [edge commun au pipe des faces de fissure externes]
+ facePeau = facePeau, # pour chaque face : la face de peau finale a mailler (percee des faces débouchantes)
+ edgesCircPeau = edgesCircPeau, # pour chaque face de peau : [groupe subshapes edges circulaires aux débouchés du pipe]
+ verticesCircPeau = verticesCircPeau, # pour chaque face de peau : [groupe subshapes points sur edges circulaires aux débouchés du pipe]
+ groupEdgesBordPeau = groupEdgesBordPeau, # pour chaque face de peau : groupe subshape des edges aux bords liés à la partie saine
+ bordsVifs = bordsVifs, # pour chaque face de peau : groupe subshape des edges aux bords correspondant à des arêtes vives
+ edgesFissurePeau = edgesFissurePeau, # pour chaque face de peau : [subshape edge en peau des faces de fissure externes]
+ verticesPipePeau = verticesPipePeau # pour chaque face de peau : [point commun edFissPeau edCircPeau]
+ )
+
+ return dataPPFF, aretesVivesCoupees
+
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import logging
+
+from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
+
+def identifieFacesEdgesFissureExterne(fsFissuExt, edFisExtPe, edFisExtPi, edgesPipeFiss):
+ """
+ identification des faces et edges de fissure externe pour maillage
+ """
+ logging.info('start')
+
+ facesFissExt = []
+ edgesFissExtPeau = []
+ edgesFissExtPipe = []
+ for ifil in range(len(fsFissuExt)): # TODO: éliminer les doublons (comparer tous les vertices triés, avec mesure de distance ?)
+ facesFissExt += fsFissuExt[ifil]
+ edgesFissExtPeau += edFisExtPe[ifil]
+ edgesFissExtPipe += edFisExtPi[ifil]
+ logging.debug("---------------------------- identification faces de fissure externes au pipe :%s ", len(facesFissExt))
+ # regroupement des faces de fissure externes au pipe.
+
+ if len(facesFissExt) > 1:
+ faceFissureExterne = geompy.MakePartition(facesFissExt, [], [], [], geompy.ShapeType["FACE"], 0, [], 0)
+ edgesPipeFissureExterneC = geompy.GetInPlace(faceFissureExterne, geompy.MakeCompound(edgesPipeFiss)) # edgesFissExtPipe peut ne pas couvrir toute la longueur
+ # edgesPeauFissureExterneC = geompy.GetInPlace(faceFissureExterne, geompy.MakeCompound(edgesFissExtPeau))
+ # il peut manquer des edges de faceFissureExterne en contact avec la peau dans edgesFissExtPeau
+ (isDone, closedFreeBoundaries, openFreeBoundaries) = geompy.GetFreeBoundary(faceFissureExterne)
+ edgesBordFFE = []
+ for bound in closedFreeBoundaries:
+ edgesBordFFE += geompy.ExtractShapes(bound, geompy.ShapeType["EDGE"], False)
+ edgesBordFFEid = [ (ed,geompy.GetSubShapeID(faceFissureExterne, ed)) for ed in edgesBordFFE]
+ logging.debug("edgesBordFFEid %s", edgesBordFFEid)
+ edgesPPE = geompy.ExtractShapes(edgesPipeFissureExterneC, geompy.ShapeType["EDGE"], False)
+ edgesPPEid = [ geompy.GetSubShapeID(faceFissureExterne, ed) for ed in edgesPPE]
+ logging.debug("edgesPPEid %s", edgesPPEid)
+ edgesPFE = [ edid[0] for edid in edgesBordFFEid if edid[1] not in edgesPPEid] # on garde toutes les edges de bord non en contact avec le pipe
+ logging.debug("edgesPFE %s", edgesPFE)
+ edgesPeauFissureExterneC = geompy.MakeCompound(edgesPFE)
+ else:
+ faceFissureExterne = facesFissExt[0]
+ edgesPeauFissureExterneC = geompy.MakeCompound(edgesFissExtPeau)
+ edgesPipeFissureExterneC = geompy.MakeCompound(edgesFissExtPipe)
+ wirePipeFissureExterne = geompy.MakeWire(geompy.ExtractShapes(edgesPipeFissureExterneC, geompy.ShapeType["EDGE"], False))
+ 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
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import logging
+
+from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
+
+from sortFaces import sortFaces
+from extractionOrientee import extractionOrientee
+
+def identifieFacesPeau(ifil, verticesPipePeau, facesOnside, wireFondFiss,
+ verticesEdgesFondIn, pipexts, cercles,
+ fillingFaceExterne, centreFondFiss):
+ """
+ inventaire des faces de peau : face de peau percée du pipe, extrémités du pipe
+ La partition avec le pipe peut créer un vertex (et un edge) de trop sur le cercle projeté,
+ quand le cercle est très proche de la face.
+ dans ce cas, la projection du cercle sur la face suivie d'une partition permet
+ d'éviter le point en trop
+ """
+ logging.info('start')
+
+ facesAndFond = facesOnside
+ facesAndFond.append(wireFondFiss)
+ try:
+ partitionPeauByPipe = geompy.MakePartition(facesAndFond, pipexts, [], [], geompy.ShapeType["FACE"], 0, [], 1)
+ except:
+ logging.debug("probleme partition face pipe, contournement avec MakeSection")
+ sections = []
+ for pipext in pipexts:
+ sections.append(geompy.MakeSection(facesOnside[0], pipext))
+ partitionPeauByPipe = geompy.MakePartition(facesAndFond, sections, [], [], geompy.ShapeType["FACE"], 0, [], 1)
+
+ # contrôle edge en trop sur edges circulaires
+ if len(verticesPipePeau) > 0: # --- au moins une extrémité du pipe sur cette face de peau
+ edgeEnTrop = []
+ outilPart = pipexts
+ facesPeau = geompy.ExtractShapes(partitionPeauByPipe, geompy.ShapeType["FACE"], False)
+ facesPeauSorted, minsur, maxsurf = sortFaces(facesPeau)
+ for i, face in enumerate(facesPeauSorted[:-1]): # on ne teste que la ou les petites faces "circulaires"
+ nbv = geompy.NumberOfEdges(face)
+ logging.debug("nombre d'edges sur face circulaire: %s", nbv)
+ if nbv > 3:
+ edgeEnTrop.append(True) # TODO : distinguer les cas avec deux faces circulaires dont l'une est correcte
+ else:
+ edgeEnTrop.append(False)
+ refaire = sum(edgeEnTrop)
+ if refaire > 0:
+ dc = [(geompy.MinDistance(verticesEdgesFondIn[0], fac), i) for i, fac in enumerate(facesPeauSorted[:-1])]
+ dc.sort()
+ logging.debug("dc sorted: %s", dc)
+ i0 = dc[0][1] # indice de facesPeauSorted qui correspond à verticesEdgesFondIn[0], donc 0 pour cercles
+ direct = (i0 == 0)
+ for i, bad in enumerate(edgeEnTrop):
+ if direct:
+ j = i
+ else:
+ j = 1-i
+ if bad:
+ outilPart[j] = geompy.MakeProjection(cercles[j],facesOnside[0])
+ pass
+ partitionPeauByPipe = geompy.MakePartition(facesAndFond, outilPart, [], [], geompy.ShapeType["FACE"], 0, [], 1)
+ pass
+
+ name="partitionPeauByPipe%d"%ifil
+ 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)
+
+ if len(verticesPipePeau) > 0: # --- au moins une extrémité du pipe sur cette face de peau
+ facesPeauSorted, minsur, maxsurf = sortFaces(facesPeauFondOn)
+ facePeau = facesPeauSorted[-1] # la plus grande face
+ else:
+ facePeau =geompy.MakePartition(facesPeauFondOn, [], [], [], geompy.ShapeType["FACE"], 0, [], 1)
+ facesPeauSorted = [facePeau]
+ name="facePeau%d"%ifil
+ geomPublish(initLog.debug, facePeau, name)
+
+ return (facePeau, facesPeauSorted, edgesPeauFondIn)
\ No newline at end of file
import logging
+debug = 10
+info = 20
+warning = 30
+error = 40
+critical = 50
+
+loglevel = warning
+
def setDebug():
+ global loglevel
logging.basicConfig(format='%(relativeCreated)d %(funcName)s[%(lineno)d] %(message)s',
level=logging.DEBUG)
- logging.info('start Debug')
+ loglevel = debug
+ logging.info('start Debug %s', loglevel)
def setVerbose():
+ global loglevel
logging.basicConfig(format='%(relativeCreated)d %(funcName)s[%(lineno)d] %(message)s',
level=logging.INFO)
- logging.info('start Verbose')
+ loglevel = info
+ logging.info('start Verbose %s', loglevel)
def setRelease():
+ global loglevel
logging.basicConfig(format='%(funcName)s[%(lineno)d] %(message)s',
level=logging.WARNING)
- logging.warning('start Release')
+ loglevel = warning
+ logging.warning('start Release %s', loglevel)
def setUnitTests():
+ global loglevel
logging.basicConfig(format='%(funcName)s[%(lineno)d] %(message)s',
level=logging.CRITICAL)
- logging.critical('start UnitTests')
+ loglevel = critical
+ logging.critical('start UnitTests %s', loglevel)
+
+def setPerfTests():
+ global loglevel
+ logging.basicConfig(format='%(relativeCreated)d %(funcName)s[%(lineno)d] %(message)s',
+ level=logging.CRITICAL)
+ loglevel = critical
+ logging.info('start PerfTests %s', loglevel)
+
+def getLogLevel():
+ return loglevel
#logging.basicConfig(filename='myapp.log',
# format='%(asctime)s %(message)s',
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
#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:
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
#fichierMaillageSain = nomRep + '/' + nomFicSain + '.med'
fichierMaillageFissure = nomRep + '/' + nomFicFissure + '.med'
- facesDefaut = elementsDefaut[0] # fillings des faces en peau
+ # fillings des faces en peau
+ facesDefaut = elementsDefaut[0]
#centresDefaut = elementsDefaut[1]
#normalsDefaut = elementsDefaut[2]
#extrusionsDefaut = elementsDefaut[3]
dmoyen = elementsDefaut[4]
- bordsPartages = elementsDefaut[5]
+ bordsPartages = elementsDefaut[5]
fillconts = elementsDefaut[6]
idFilToCont = elementsDefaut[7]
maillageSain = elementsDefaut[8]
# 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)]
else:
facesPartShapeDefautSorted, minSurf, maxSurf = sortFaces(facesPartShapeDefaut) # la face de fissure dans le volume doit être la plus grande
logging.debug("surfaces faces fissure étendue, min %s, max %s", minSurf, maxSurf)
- facesPortFissure = facesPartShapeDefautSorted[-1]
+ facesPortFissure = facesPartShapeDefautSorted[-1] #= global
- geompy.addToStudy(facesPortFissure, "facesPortFissure")
+ geomPublish(initLog.debug, facesPortFissure, "facesPortFissure")
O, OX, OY, OZ = triedreBase()
if geompy.NumberOfFaces(shapeDefaut) == 1:
plan = geompy.MakePlane(centreFondFiss, tgtCentre, 10000)
- shapeDefaut = geompy.MakePartition([shapeDefaut], [plan], [], [], geompy.ShapeType["FACE"], 0, [], 0)
- fondFissCoupe = geompy.GetInPlaceByHistory(shapeDefaut, fondFiss)
- geompy.addToStudy(shapeDefaut, 'shapeDefaut_coupe')
- geompy.addToStudyInFather(shapeDefaut, fondFissCoupe, 'fondFiss_coupe')
+ shapeDefaut = geompy.MakePartition([shapeDefaut], [plan], [], [], geompy.ShapeType["FACE"], 0, [], 0) #= local
+ #fondFissCoupe = geompy.GetInPlaceByHistory(shapeDefaut, fondFiss) #= inutile
+ 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')
- fissPipe = geompy.GetInPlaceByHistory(partFissPipe, shapeDefaut)
- geompy.addToStudy(fissPipe, 'fissPipe')
- partPipe = geompy.GetInPlaceByHistory(partFissPipe, pipeFiss)
- geompy.addToStudy(partPipe, 'partPipe')
+ geomPublish(initLog.debug, partFissPipe, 'partFissPipe')
+ fissPipe = geompy.GetInPlaceByHistory(partFissPipe, shapeDefaut) #= global
+ geomPublish(initLog.debug, fissPipe, 'fissPipe')
+ partPipe = geompy.GetInPlaceByHistory(partFissPipe, pipeFiss) #= local
+ geomPublish(initLog.debug, partPipe, 'partPipe')
- edgesPipeFiss = geompy.GetSharedShapesMulti([fissPipe, partPipe], geompy.ShapeType["EDGE"])
+ 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)
+ 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)
- wireFondFiss = geompy.MakeWire(edgesFondFiss)
- geompy.addToStudy(wireFondFiss,"wireFondFiss")
+ geomPublishInFather(initLog.debug,fissPipe, edge, name)
+ wireFondFiss = geompy.MakeWire(edgesFondFiss) #= global
+ geomPublish(initLog.debug, wireFondFiss,"wireFondFiss")
# -----------------------------------------------------------------------------
# --- peau et face de fissure
# il peut y avoir plusieurs faces externes, dont certaines sont découpées par la fissure
# liste de faces externes : facesDefaut
# liste de partitions face externe - fissure : partitionPeauFissFond (None quand pas d'intersection)
-
- partitionsPeauFissFond = []
+
+ partitionsPeauFissFond = [] #= global
ipart = 0
for filling in facesDefaut:
part = geompy.MakePartition([fissPipe, filling], [], [], [], geompy.ShapeType["FACE"], 0, [], 0)
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
+
+
+ # --- arêtes vives détectées (dans quadranglesToShapeNoCorner
+ # et quadranglesToShapeWithCorner)
- # --- arêtes vives détectées (dans quadranglesToShape)
-
aretesVives = []
- aretesVivesCoupees = []
+ aretesVivesCoupees = [] #= global
ia = 0
for a in bordsPartages:
- if a[0] is not None:
- aretesVives.append(a[0])
- name = "areteVive%d"%ia
- geompy.addToStudy(a[0], name)
- ia += 1
- aretesVivesC = None
+ if not isinstance(a, list):
+ aretesVives.append(a)
+ name = "areteVive%d"%ia
+ geomPublish(initLog.debug, a, name)
+ ia += 1
+ else:
+ if a[0] is not None:
+ aretesVives.append(a[0])
+ name = "areteVive%d"%ia
+ geomPublish(initLog.debug, a[0], name)
+ ia += 1
+
+ aretesVivesC = None #= global
if len(aretesVives) > 0:
aretesVivesC =geompy.MakeCompound(aretesVives)
ptFisExtPi = [ [] for i in range(nbFacesFilling)] # pour chaque face de peau : [point commun edFissPeau edCircPeau]
for ifil, partitionPeauFissFond in enumerate(partitionsPeauFissFond):
- fillingFaceExterne = facesDefaut[ifil]
- fillingSansDecoupe = fillconts[idFilToCont[ifil]]
if partitionPeauFissFond is not None:
+ fillingFaceExterne = facesDefaut[ifil]
+ #fillingSansDecoupe = fillconts[idFilToCont[ifil]]
logging.debug("traitement partitionPeauFissFond %s", ifil)
# -----------------------------------------------------------------------
# --- identification edges fond de fissure, edges pipe sur la face de fissure,
# edges prolongées
- edgesPipeC = geompy.GetInPlace(partitionPeauFissFond, geompy.MakeCompound(edgesPipeFiss))
- geompy.addToStudyInFather(partitionPeauFissFond, edgesPipeC, "edgesPipeFiss")
- edgesFondC = geompy.GetInPlace(partitionPeauFissFond, geompy.MakeCompound(edgesFondFiss))
- geompy.addToStudyInFather(partitionPeauFissFond, edgesFondC, "edgesFondFiss")
+ edgesPipeC = geompy.GetInPlace(partitionPeauFissFond, geompy.MakeCompound(edgesPipeFiss)) #= local
+ geomPublishInFather(initLog.debug,partitionPeauFissFond, edgesPipeC, "edgesPipeFiss")
+ edgesFondC = geompy.GetInPlace(partitionPeauFissFond, geompy.MakeCompound(edgesFondFiss)) #= local
+ geomPublishInFather(initLog.debug,partitionPeauFissFond, edgesFondC, "edgesFondFiss")
- if aretesVivesC is None:
+ if aretesVivesC is None: #= global facesInside facesOnside
[edgesInside, edgesOutside, edgesOnside] = extractionOrientee(fillingFaceExterne, partitionPeauFissFond, centreFondFiss, "EDGE", 1.e-3)
[facesInside, facesOutside, facesOnside] = extractionOrientee(fillingFaceExterne, partitionPeauFissFond, centreFondFiss, "FACE", 1.e-3)
else:
[edgesInside, edgesOutside, edgesOnside] = extractionOrienteeMulti(facesDefaut, ifil, partitionPeauFissFond, centreFondFiss, "EDGE", 1.e-3)
[facesInside, facesOutside, facesOnside] = extractionOrienteeMulti(facesDefaut, ifil, partitionPeauFissFond, centreFondFiss, "FACE", 1.e-3)
- edgesPipeIn = geompy.GetSharedShapesMulti([edgesPipeC, geompy.MakeCompound(edgesInside)], geompy.ShapeType["EDGE"])
- verticesPipePeau = []
+ edgesPipeIn = geompy.GetSharedShapesMulti([edgesPipeC, geompy.MakeCompound(edgesInside)], geompy.ShapeType["EDGE"]) #= global
+ verticesPipePeau = [] #= global
for i, edge in enumerate(edgesPipeIn):
try:
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)
- edgesFondOut = []
- edgesFondIn =[]
+ #edgesFondOut = [] #= inutile
+ edgesFondIn =[] #= global
if len(verticesPipePeau) > 0: # au moins une extrémité du pipe sur cette face de peau
- tmp = geompy.GetSharedShapesMulti([edgesFondC, geompy.MakeCompound(edgesOutside)], geompy.ShapeType["EDGE"])
- edgesFondOut = [ ed for ed in tmp if geompy.MinDistance(ed, geompy.MakeCompound(facesOnside)) < 1.e-3]
+ #tmp = geompy.GetSharedShapesMulti([edgesFondC, geompy.MakeCompound(edgesOutside)], geompy.ShapeType["EDGE"])
+ #edgesFondOut = [ ed for ed in tmp if geompy.MinDistance(ed, geompy.MakeCompound(facesOnside)) < 1.e-3]
tmp = geompy.GetSharedShapesMulti([edgesFondC, geompy.MakeCompound(edgesInside)], geompy.ShapeType["EDGE"])
edgesFondIn = [ ed for ed in tmp if geompy.MinDistance(ed, geompy.MakeCompound(facesOnside)) < 1.e-3]
+
verticesEdgesFondIn = [] # les points du fond de fissure au débouché du pipe sur la peau (indice de edgesFondIn)
pipexts = [] # les segments de pipe associés au points de fond de fissure débouchants (même indice)
cercles = [] # les cercles de generation des pipes débouchant (même indice)
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)
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)
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
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)
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:
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):
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
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
# -----------------------------------------------------------------------
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)
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))]
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
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
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")
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:
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
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)
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]
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
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 --------------")
# -----------------------------------------------------------------------
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
#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)
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
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:
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):
aretesVivesC = geompy.MakeCompound(aretesVivesCoupees)
meshAretesVives = smesh.Mesh(aretesVivesC)
algo1d = meshAretesVives.Segment()
- hypo1d = algo1d.LocalLength(dmoyen/3.0,[],1e-07)
+ hypo1d = algo1d.LocalLength(dmoyen,[],1e-07)
putName(algo1d.GetSubMesh(), "aretesVives")
putName(algo1d, "algo1d_aretesVives")
putName(hypo1d, "hypo1d_aretesVives")
grpEdgesPipeFissureExterne = meshFaceFiss.GroupOnGeom(edgesPipeFissureExterneC,'edgesPipeFissureExterne',SMESH.EDGE)
# --- maillage faces de peau
-
+
boutFromIfil = [None for i in range(nbFacesFilling)]
if idFillingFromBout[0] != idFillingFromBout[1]: # repérage des extremites du pipe quand elles débouchent sur des faces différentes
boutFromIfil[idFillingFromBout[0]] = 0
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])
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
facePorteFissure = shapeDefaut
WirePorteFondFissure = wiretube
fillingFaceExterne = facesDefaut[0]
- print fillingFaceExterne
- geompy.addToStudy(fillingFaceExterne, "fillingFaceExterne")
+ logging.debug("fillingFaceExterne %s", fillingFaceExterne)
+ geomPublish(initLog.debug, fillingFaceExterne, "fillingFaceExterne")
edgesFilling = geompy.ExtractShapes(fillingFaceExterne, geompy.ShapeType["EDGE"], False)
O, OX, OY, OZ = triedreBase()
# --- 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)
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 = []
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:
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
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 = []
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
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
#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_")
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_")
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 = []
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
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
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
--- /dev/null
+# -*- coding: utf-8 -*-
+"""
+Created on Mon Jun 23 14:49:36 2014
+
+@author: I48174 (Olivier HOAREAU)
+"""
+
+import logging
+import SMESH
+from geomsmesh import smesh
+
+def lookForCorner(maillageAScanner):
+
+ """ Cette fonction permet de scanner la liste de noeuds qui composent le
+ maillage passé en paramètre. On recherche un ou plusieurs coins, ce
+ qui implique les caractéristiques suivantes:
+ - le noeud doit appartenir au moins à trois éléments distincts
+ - chaque élément doit appartenir à un ensemble distinct
+ La fonction renvoie une liste de coins par l'intermédiaire de l'IDs
+ chaque noeud. La liste contient en général au maximum deux coins.
+ """
+
+ logging.info("start")
+
+ allNodeIds = maillageAScanner.GetNodesId() # On stocke tout les noeuds
+ listOfCorners = []
+ for ND in allNodeIds:
+ # On parcours la liste de noeuds
+ listOfElements = maillageAScanner.GetNodeInverseElements(ND)
+ if len(listOfElements) >=3:
+ # On teste le nombre d'éléments qui partagent le même noeud
+ # --- Filtre selon le critère 'coplanar' --- #
+ listOfCriterion = [smesh.GetCriterion(SMESH.FACE, SMESH.FT_CoplanarFaces, \
+ SMESH.FT_Undefined, elem, SMESH.FT_Undefined, SMESH.FT_Undefined, 30) \
+ for elem in listOfElements]
+ listOfFilters = [smesh.GetFilterFromCriteria([criteria]) for criteria in listOfCriterion]
+ listOfSets = [maillageAScanner.GetIdsFromFilter(filter) for filter in listOfFilters]
+ if listOfSets.count(listOfSets[0]) == len(listOfSets):
+ # Si toutes les listes d'éléments sont similaires, on retourne
+ # au début pour éviter de travailler sur des éléments inutiles.
+ # Exemple : un noeud appartenant à 4 éléments sur la même face.
+ continue
+ for s in listOfSets:
+ while listOfSets.count(s) > 1:
+ # On supprime tant que la liste d'éléments n'est pas unique.
+ listOfSets.remove(s)
+ if len(listOfSets) >= 3:
+ # Si on a au moins 3 listes d'élements différentes, on considère
+ # qu'il y a présence d'un coin.
+ listOfCorners.append(ND)
+ return listOfCorners
+
+def createLinesFromMesh(maillageSupport):
+
+ """ Cette fonction permet de générer une liste de lignes à partir du
+ maillage support passé en paramètre. On démarre à partir d'un coin
+ simple et on parcourt tout les noeuds pour former une ligne. Soit la
+ figure ci-dessous :
+
+ 1_____4_____7 On part du coin N1, et on cherche les noeuds
+ | | | successifs tels que [1, 2, 3]. Lorsqu'on arrive
+ | 1 | 3 | arrive sur le noeud de fin de ligne N3, on repart
+ | | | du noeud précédent du premier élément (E1), à
+ 2_____5_____8 savoir le noeud N4. On suit les noeuds succesifs
+ | | | [4, 5, 6] comme précédemment et ainsi de suite.
+ | 2 | 4 | Lorsqu'on arrive sur le dernier noeud de la
+ | | | dernière ligne, à savoir le noeud N9, on considère
+ 3_____6_____9 que toutes les lignes sont créées.
+
+ La fonction retourne une liste de lignes utilisées par la suite.
+ """
+
+ logging.info("start")
+
+ allNodeIds = maillageSupport.GetNodesId()
+ while len(allNodeIds):
+ nodeIds = allNodeIds
+ for idNode in nodeIds: # rechercher un coin
+ elems = maillageSupport.GetNodeInverseElements(idNode)
+ if len(elems) == 1:
+ # un coin: un noeud, un element quadrangle
+ elem = elems[0]
+ break;
+ idStart = idNode # le noeud de coin
+ elemStart = elem # l'élément quadrangle au coin
+ xyz = maillageSupport.GetNodeXYZ(idStart)
+ logging.debug("idStart %s, coords %s", idStart, str(xyz))
+
+ nodelines =[] # on va constituer une liste de lignes de points
+ nextLine = True
+ ligneFinale = False
+ while nextLine:
+ logging.debug("--- une ligne")
+ idNode = idStart
+ elem = elemStart
+ if ligneFinale:
+ agauche = False # sens de parcours des 4 noeuds d'un quadrangle
+ nextLine = False
+ else:
+ agauche = True
+ ligneIncomplete = True # on commence une ligne de points
+ debutLigne = True
+ nodeline = []
+ elemline = []
+ while ligneIncomplete: # compléter la ligne de points
+ nodeline.append(idNode)
+ allNodeIds.remove(idNode)
+ elemline.append(elem)
+ nodes = maillageSupport.GetElemNodes(elem)
+ i = nodes.index(idNode) # repérer l'index du noeud courant (i) dans l'élément quadrangle (0 a 3)
+ if agauche: # déterminer le noeud suivant (j) et celui opposé (k) dans le quadrangle
+ if i < 3:
+ j = i+1
+ else:
+ j = 0
+ if j < 3:
+ k = j+1
+ else:
+ k = 0
+ else:
+ if i > 0:
+ j = i -1
+ else:
+ j = 3
+ if j > 0:
+ k = j -1
+ else:
+ k = 3
+ isuiv = nodes[j] # noeud suivant
+ iapres = nodes[k] # noeud opposé
+ if debutLigne:
+ debutLigne = False
+ # précédent a trouver, dernière ligne : précédent au lieu de suivant
+ if agauche:
+ if i > 0:
+ iprec = nodes[i -1]
+ else:
+ iprec = nodes[3]
+ idStart = iprec
+ elems3 = maillageSupport.GetNodeInverseElements(iprec)
+ if len(elems3) == 1: # autre coin
+ ligneFinale = True
+ else:
+ for elem3 in elems3:
+ if elem3 != elem:
+ elemStart = elem3
+ break
+ #print nodes, idNode, isuiv, iapres
+ elems1 = maillageSupport.GetNodeInverseElements(isuiv)
+ elems2 = maillageSupport.GetNodeInverseElements(iapres)
+ ligneIncomplete = False
+ for elem2 in elems2:
+ if elems1.count(elem2) and elem2 != elem:
+ ligneIncomplete = True
+ idNode = isuiv
+ elem = elem2
+ break
+ if not ligneIncomplete:
+ nodeline.append(isuiv)
+ allNodeIds.remove(isuiv)
+ logging.debug("nodeline %s", nodeline)
+ logging.debug("elemline %s", elemline)
+ nodelines.append(nodeline)
+
+ # on a constitué une liste de lignes de points connexes
+ logging.debug("dimensions [%s, %s]", len(nodelines), len(nodeline))
+
+ return nodelines
+
+def createNewMeshesFromCorner(maillageSupport, listOfCorners):
+
+ """ Cette fonction permet de générer un nouveau maillage plus facile à
+ utiliser. On démarre d'un coin et on récupère les trois éléments
+ auquel le noeud appartient. Grâce à un filtre 'coplanar' sur les trois
+ éléments, on peut générer des faces distinctes.
+ """
+
+ logging.info("start")
+
+ tmp = []
+ listOfNewMeshes = []
+ for corner in listOfCorners:
+ elems = maillageSupport.GetNodeInverseElements(corner)
+ for i, elem in enumerate(elems):
+ # --- Filtre selon le critère 'coplanar' --- #
+ critere = smesh.GetCriterion(SMESH.FACE, SMESH.FT_CoplanarFaces, \
+ SMESH.FT_Undefined, elem, SMESH.FT_Undefined, SMESH.FT_Undefined, 30)
+ filtre = smesh.GetFilterFromCriteria([critere])
+ grp = maillageSupport.GroupOnFilter(SMESH.FACE, 'grp', filtre)
+ # On copie le maillage en fonction du filtre
+ msh = smesh.CopyMesh(grp, 'new_{0}'.format(i + 1), False, True)
+ # On stocke l'ensemble des noeuds du maillage dans tmp
+ # On ajoute le maillage à la liste des nouveaux maillages
+ # seulement s'il n'y est pas déjà
+ tmp.append(msh.GetNodesId())
+ if tmp.count(msh.GetNodesId()) <= 1:
+ listOfNewMeshes.append(msh)
+ return listOfNewMeshes
\ No newline at end of file
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import logging
+
+from geomsmesh import geompy
+from geomsmesh import smesh
+import SMESH
+
+from putName import putName
+
+def mailleAretesEtJonction(internalBoundary, aretesVivesCoupees, dmoyen):
+ """
+ edges de bord, faces défaut à respecter
+ """
+ logging.info('start')
+
+ aFilterManager = smesh.CreateFilterManager()
+ nbAdded, internalBoundary, _NoneGroup = internalBoundary.MakeBoundaryElements( SMESH.BND_1DFROM2D, '', '', 0, [ ])
+ criteres = []
+ unCritere = smesh.GetCriterion(SMESH.EDGE,SMESH.FT_FreeBorders,SMESH.FT_Undefined,0)
+ criteres.append(unCritere)
+ filtre = smesh.GetFilterFromCriteria(criteres)
+ bordsLibres = internalBoundary.MakeGroupByFilter( 'bords', filtre )
+ smesh.SetName(bordsLibres, 'bordsLibres')
+
+ # --- pour aider l'algo hexa-tetra à ne pas mettre de pyramides à l'exterieur 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' )
+ nbAdd = skinFaces.AddFrom( internalBoundary.GetMesh() )
+
+ # --- maillage des éventuelles arêtes vives entre faces reconstruites
+
+ grpAretesVives = None
+ if len(aretesVivesCoupees) > 0:
+ aretesVivesC = geompy.MakeCompound(aretesVivesCoupees)
+ meshAretesVives = smesh.Mesh(aretesVivesC)
+ algo1d = meshAretesVives.Segment()
+ hypo1d = algo1d.LocalLength(dmoyen,[],1e-07)
+ putName(algo1d.GetSubMesh(), "aretesVives")
+ putName(algo1d, "algo1d_aretesVives")
+ putName(hypo1d, "hypo1d_aretesVives")
+ isDone = meshAretesVives.Compute()
+ logging.info("aretesVives fini")
+ grpAretesVives = meshAretesVives.CreateEmptyGroup( SMESH.EDGE, 'grpAretesVives' )
+ nbAdd = grpAretesVives.AddFrom( meshAretesVives.GetMesh() )
+
+ return (internalBoundary, bordsLibres, grpAretesVives)
\ No newline at end of file
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import logging
+
+from geomsmesh import geompy
+from geomsmesh import smesh
+from salome.smesh import smeshBuilder
+import SMESH
+
+from putName import putName
+
+def mailleFacesFissure(faceFissureExterne, edgesPipeFissureExterneC, edgesPeauFissureExterneC,
+ meshPipeGroups, areteFaceFissure, rayonPipe, nbsegRad):
+ """
+ maillage faces de fissure
+ """
+ logging.info('start')
+
+ meshFaceFiss = smesh.Mesh(faceFissureExterne)
+ algo2d = meshFaceFiss.Triangle(algo=smeshBuilder.NETGEN_1D2D)
+ hypo2d = algo2d.Parameters()
+ hypo2d.SetMaxSize( areteFaceFissure )
+ hypo2d.SetSecondOrder( 0 )
+ hypo2d.SetOptimize( 1 )
+ hypo2d.SetFineness( 2 )
+ hypo2d.SetMinSize( rayonPipe/float(nbsegRad) )
+ hypo2d.SetQuadAllowed( 0 )
+ putName(algo2d.GetSubMesh(), "faceFiss")
+ putName(algo2d, "algo2d_faceFiss")
+ putName(hypo2d, "hypo2d_faceFiss")
+
+ algo1d = meshFaceFiss.UseExisting1DElements(geom=edgesPipeFissureExterneC)
+ hypo1d = algo1d.SourceEdges([ meshPipeGroups['edgeFaceFissGroup'] ],0,0)
+ putName(algo1d.GetSubMesh(), "edgeFissPeau")
+ putName(algo1d, "algo1d_edgeFissPeau")
+ putName(hypo1d, "hypo1d_edgeFissPeau")
+
+ isDone = meshFaceFiss.Compute()
+ logging.info("meshFaceFiss fini")
+
+ grpFaceFissureExterne = meshFaceFiss.GroupOnGeom(faceFissureExterne, "fisOutPi", SMESH.FACE)
+ grpEdgesPeauFissureExterne = meshFaceFiss.GroupOnGeom(edgesPeauFissureExterneC,'edgesPeauFissureExterne',SMESH.EDGE)
+ grpEdgesPipeFissureExterne = meshFaceFiss.GroupOnGeom(edgesPipeFissureExterneC,'edgesPipeFissureExterne',SMESH.EDGE)
+
+ return (meshFaceFiss, grpFaceFissureExterne, grpEdgesPeauFissureExterne, grpEdgesPipeFissureExterne)
\ No newline at end of file
--- /dev/null
+# -*- coding: utf-8 -*-
+
+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
+
+from putName import putName
+
+def mailleFacesPeau(partitionsPeauFissFond, idFillingFromBout, facesDefaut,
+ facesPeaux, edCircPeau, ptCircPeau, gpedgeBord, gpedgeVifs, edFissPeau,
+ bordsLibres, grpEdgesPeauFissureExterne, grpAretesVives,
+ edgesCircPipeGroup, dmoyen, rayonPipe, nbsegRad):
+ """
+ maillage faces de peau
+ """
+ logging.info('start')
+ nbFacesFilling = len(partitionsPeauFissFond)
+ boutFromIfil = [None for i in range(nbFacesFilling)]
+ if idFillingFromBout[0] != idFillingFromBout[1]: # repérage des extremites du pipe quand elles débouchent sur des faces différentes
+ boutFromIfil[idFillingFromBout[0]] = 0
+ boutFromIfil[idFillingFromBout[1]] = 1
+
+ logging.debug("---------------------------- maillage faces de peau --------------")
+ meshesFacesPeau = []
+ for ifil in range(nbFacesFilling):
+ meshFacePeau = None
+ if partitionsPeauFissFond[ifil] is None: # face de peau maillage sain intacte
+
+ # --- edges de bord de la face de filling
+ filling = facesDefaut[ifil]
+ edgesFilling = geompy.ExtractShapes(filling, geompy.ShapeType["EDGE"], False)
+ groupEdgesBordPeau = geompy.CreateGroup(filling, geompy.ShapeType["EDGE"])
+ geompy.UnionList(groupEdgesBordPeau, edgesFilling)
+ geomPublishInFather(initLog.debug,filling, groupEdgesBordPeau , "EdgesBords")
+
+ meshFacePeau = smesh.Mesh(facesDefaut[ifil])
+
+ algo1d = meshFacePeau.UseExisting1DElements(geom=groupEdgesBordPeau)
+ hypo1d = algo1d.SourceEdges([ bordsLibres ],0,0)
+ putName(algo1d.GetSubMesh(), "bordsLibres", ifil)
+ putName(algo1d, "algo1d_bordsLibres", ifil)
+ putName(hypo1d, "hypo1d_bordsLibres", ifil)
+
+ else:
+
+ facePeau = facesPeaux[ifil] # pour chaque face : la face de peau finale a mailler (percée des faces débouchantes)
+ edgesCircPeau = edCircPeau[ifil] # pour chaque face de peau : [subshape edge circulaire aux débouchés du pipe]
+ verticesCircPeau = ptCircPeau[ifil] # pour chaque face de peau : [subshape point sur edge circulaire aux débouchés du pipe]
+ groupEdgesBordPeau = gpedgeBord[ifil] # pour chaque face de peau : groupe subshape des edges aux bords liés à la partie saine
+ bordsVifs = gpedgeVifs[ifil] # pour chaque face de peau : groupe subshape des edges aux bords correspondant à des arêtes vives
+ edgesFissurePeau = edFissPeau[ifil] # pour chaque face de peau : [subshape edge en peau des faces de fissure externes]
+
+ meshFacePeau = smesh.Mesh(facePeau)
+
+ algo1d = meshFacePeau.UseExisting1DElements(geom=groupEdgesBordPeau)
+ hypo1d = algo1d.SourceEdges([ bordsLibres ],0,0)
+ putName(algo1d.GetSubMesh(), "bordsLibres", ifil)
+ putName(algo1d, "algo1d_bordsLibres", ifil)
+ putName(hypo1d, "hypo1d_bordsLibres", ifil)
+
+ algo1d = meshFacePeau.UseExisting1DElements(geom=geompy.MakeCompound(edgesFissurePeau))
+ hypo1d = algo1d.SourceEdges([ grpEdgesPeauFissureExterne ],0,0)
+ putName(algo1d.GetSubMesh(), "edgePeauFiss", ifil)
+ putName(algo1d, "algo1d_edgePeauFiss", ifil)
+ putName(hypo1d, "hypo1d_edgePeauFiss", ifil)
+
+ if bordsVifs is not None:
+ algo1d = meshFacePeau.UseExisting1DElements(geom=bordsVifs)
+ hypo1d = algo1d.SourceEdges([ grpAretesVives ],0,0)
+ putName(algo1d.GetSubMesh(), "bordsVifs", ifil)
+ putName(algo1d, "algo1d_bordsVifs", ifil)
+ putName(hypo1d, "hypo1d_bordsVifs", ifil)
+
+ for i, edgeCirc in enumerate(edgesCircPeau):
+ if edgeCirc is not None:
+ algo1d = meshFacePeau.UseExisting1DElements(geom=edgeCirc)
+ if boutFromIfil[ifil] is None:
+ hypo1d = algo1d.SourceEdges([ edgesCircPipeGroup[i] ],0,0)
+ else:
+ hypo1d = algo1d.SourceEdges([ edgesCircPipeGroup[boutFromIfil[ifil]] ],0,0)
+ name = "cercle%d"%i
+ putName(algo1d.GetSubMesh(), name, ifil)
+ putName(algo1d, "algo1d_" + name, ifil)
+ putName(hypo1d, "hypo1d_" + name, ifil)
+
+ algo2d = meshFacePeau.Triangle(algo=smeshBuilder.NETGEN_1D2D)
+ hypo2d = algo2d.Parameters()
+ hypo2d.SetMaxSize( dmoyen )
+ hypo2d.SetOptimize( 1 )
+ hypo2d.SetFineness( 2 )
+ hypo2d.SetMinSize( rayonPipe/float(nbsegRad) )
+ hypo2d.SetQuadAllowed( 0 )
+ putName(algo2d.GetSubMesh(), "facePeau", ifil)
+ putName(algo2d, "algo2d_facePeau", ifil)
+ putName(hypo2d, "hypo2d_facePeau", ifil)
+
+ isDone = meshFacePeau.Compute()
+ logging.info("meshFacePeau %d fini", ifil)
+ GroupFaces = meshFacePeau.CreateEmptyGroup( SMESH.FACE, "facePeau%d"%ifil )
+ nbAdd = GroupFaces.AddFrom( meshFacePeau.GetMesh() )
+ meshesFacesPeau.append(meshFacePeau)
+
+ return meshesFacesPeau
\ No newline at end of file
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
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 = []
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"])
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 = []
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:
#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])
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])
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:
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"])
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
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
--- /dev/null
+# -*- coding: utf-8 -*-
+
+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
+
+def partitionneFissureParPipe(shapesFissure, elementsDefaut, rayonPipe):
+ """
+ pipe de fond de fissure, prolongé, partition face fissure par pipe
+ identification des edges communes pipe et face fissure
+ """
+ logging.info('start')
+ shapeDefaut = shapesFissure[0] # faces de fissure, débordant
+ fondFiss = shapesFissure[4] # groupe d'edges de fond de fissure
+ centreFondFiss = elementsDefaut[15]
+ tgtCentre = elementsDefaut[16]
+
+ if geompy.NumberOfFaces(shapeDefaut) == 1:
+ plan = geompy.MakePlane(centreFondFiss, tgtCentre, 10000)
+ shapeDefaut = geompy.MakePartition([shapeDefaut], [plan], [], [], geompy.ShapeType["FACE"], 0, [], 0)
+ #fondFissCoupe = geompy.GetInPlaceByHistory(shapeDefaut, fondFiss) #= inutile
+ 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
+ geomPublish(initLog.debug, cercle, 'cercle')
+ fondFissProlonge = prolongeWire(fondFiss, extrem, norms, 2*rayonPipe)
+ pipeFiss = geompy.MakePipe(cercle, fondFissProlonge)
+ geomPublish(initLog.debug, pipeFiss, 'pipeFiss')
+ partFissPipe = geompy.MakePartition([shapeDefaut, pipeFiss], [], [], [], geompy.ShapeType["FACE"], 0, [], 1)
+ geomPublish(initLog.debug, partFissPipe, 'partFissPipe')
+ fissPipe = geompy.GetInPlaceByHistory(partFissPipe, shapeDefaut)
+ geomPublish(initLog.debug, fissPipe, 'fissPipe')
+ partPipe = geompy.GetInPlaceByHistory(partFissPipe, pipeFiss)
+ geomPublish(initLog.debug, partPipe, 'partPipe')
+
+ edgesPipeFiss = geompy.GetSharedShapesMulti([fissPipe, partPipe], geompy.ShapeType["EDGE"])
+ for i, edge in enumerate(edgesPipeFiss):
+ name = "edgePipe%d"%i
+ geomPublishInFather(initLog.debug,fissPipe, edge, name)
+ try:
+ wirePipeFiss = geompy.MakeWire(edgesPipeFiss)
+ except:
+ wirePipeFiss = geompy.MakeCompound(edgesPipeFiss)
+ logging.debug("wirePipeFiss construit sous forme de compound")
+ 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
+ geomPublishInFather(initLog.debug,fissPipe, edge, name)
+ wireFondFiss = geompy.MakeWire(edgesFondFiss)
+ geomPublish(initLog.debug, wireFondFiss,"wireFondFiss")
+
+ return (fissPipe, edgesPipeFiss, edgesFondFiss, wirePipeFiss, wireFondFiss)
\ No newline at end of file
from geomsmesh import smesh
import SMESH
+from listOfExtraFunctions import lookForCorner
+from fusionMaillageAttributionDefaut import fusionMaillageDefaut
+
# -----------------------------------------------------------------------------
# --- peau interne du defaut dans le maillage sain
-def peauInterne(fichierMaillage, nomZones):
+def peauInterne(fichierMaillage, shapeDefaut, nomZones):
"""
Retrouve les groupes de défaut dans le maillage sain modifié par CreateHoleSkin (CreeZoneDefautMaillage)
On récupère le volume et la peau de la zone de défaut, les éventuelles faces et arêtes internes de cette zone.
groups = maillageSain.GetGroups()
zoneDefaut = None
for grp in groups:
- #print " ",grp.GetName()
+ logging.debug("groupe %s",grp.GetName())
if grp.GetName() == nomZones + "_vol":
zoneDefaut = grp
break
nbAdded, 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)
+
+ maillageDefautCible = smesh.CopyMesh(zoneDefaut_skin, 'maillageCible', 0, 0)
+ listOfCorner = lookForCorner(maillageDefautCible)
+ logging.debug("listOfCorner = %s", listOfCorner)
+ if len(listOfCorner) > 0:
+ logging.info("présence de coins à la surface externe de la zone à reconstruire")
+ zoneDefaut_skin, internalBoundary = fusionMaillageDefaut(maillageSain, maillageDefautCible, internalBoundary, zoneDefaut_skin, shapeDefaut, listOfCorner)
return maillageSain, internalBoundary, zoneDefaut, zoneDefaut_skin, zoneDefaut_internalFaces, zoneDefaut_internalEdges
import logging
from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
+from orderEdgesFromWire import orderEdgesFromWire
# -----------------------------------------------------------------------------
# --- prolongation d'un wire par deux segments tangents
logging.info("start")
if geompy.NumberOfEdges(aWire) > 1:
edges = geompy.ExtractShapes(aWire, geompy.ShapeType["EDGE"])
+ uneSeuleEdge = False
else:
edges = [aWire]
+ uneSeuleEdge = True
+ edgesBout = []
for i, v1 in enumerate(extrem):
exts = [geompy.MakeTranslationVectorDistance(v1, norms[i], l) for l in (-long, long)]
dists = [(geompy.MinDistance(v, aWire), i , v) for i, v in enumerate(exts)]
dists.sort()
v2 = dists[-1][-1]
- #v2 = geompy.MakeTranslationVectorDistance(v1, norms[i], long)
edge = geompy.MakeEdge(v1, v2)
edges.append(edge)
+ edgesBout.append(edge)
name = "extrem%d"%i
- #geompy.addToStudy(edge,name)
- wireProlonge = geompy.MakeWire(edges)
- geompy.addToStudy(wireProlonge, "wireProlonge")
+ geomPublish(initLog.debug, edge, name)
+ try:
+ wireProlonge = geompy.MakeWire(edges)
+ geomPublish(initLog.debug, wireProlonge, "wireProlonge")
+ except:
+ logging.warning("probleme MakeWire, approche pas a pas")
+ if uneSeuleEdge:
+ edgelist = [aWire]
+ accessList = [0]
+ else:
+ edgelist, accessList = orderEdgesFromWire(aWire)
+ edge1 = edgelist[accessList[0]]
+ if geompy.MinDistance(edgesBout[0], edge1) < 1.e-4 :
+ i0 = 0
+ i1 = 1
+ else:
+ i0 = 1
+ i1 = 0
+ wireProlonge = edgesBout[i0]
+ for i in range(len(edgelist)):
+ wireProlonge = geompy.MakeWire([wireProlonge, edgelist[accessList[i]]])
+ geomPublish(initLog.debug, wireProlonge, "wireProlonge_%d"%i)
+ wireProlonge = geompy.MakeWire([wireProlonge,edgesBout[i1]])
+ geomPublish(initLog.debug, wireProlonge, "wireProlonge")
+ logging.warning("prolongation wire pas a pas OK")
return wireProlonge
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
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
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
import logging
from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
import GEOM
import math
import numpy as np
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)
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)
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
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import logging
+from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
+import GEOM
+import math
+import numpy as np
+
+def mydot(a):
+ return np.dot(a,a)
+
+# -----------------------------------------------------------------------------
+# --- groupe de quadrangles de face transformé en face géométrique par filling
+
+def quadranglesToShapeNoCorner(meshQuad, shapeFissureParams, centreFondFiss):
+ """
+ groupe de quadrangles de face transformée en faces géométriques par filling
+ on part de quadrangles définissant une zone a 4 cotés (convexe), et on reconstitue n lignes de p points.
+ Ces n lignes de p points sont transformées en n courbes géométriques,
+ à partir desquelles on reconstitue une surface géométrique.
+ Il peut y avoir plusieurs faces géométriques reconstituées, si on fournit des groupes de quadrangles non connexes.
+ On détecte les angles vifs, pour conserver des arêtes vives délimitant des faces connexes.
+ @param meshQuad : maillages constitué de quadrangles constituant une ou plusieurs zones convexes
+ @return (fillings, noeuds_Bords) : liste de geomObject, listes des bords (bord = liste ordonnée de noeuds (geomObject))
+ """
+ logging.info("start")
+
+ isVecteurDefaut = False
+ if shapeFissureParams.has_key('vecteurDefaut'):
+ isVecteurDefaut = True
+ vecteurDefaut = shapeFissureParams['vecteurDefaut']
+
+ fillings = [] # les faces reconstituées, découpées selon les arêtes vives
+ noeuds_bords = [] #
+ bords_Partages = [] # contient a la fin les courbes correspondant aux arêtes vives
+ fillconts = [] # les faces reconstituées, sans découpage selon les arêtes vives
+ idFilToCont = [] # index face découpée vers face sans découpe
+ iface = 0 # index face découpée
+ icont = 0 # index face continue
+
+ 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)
+ if len(elems) == 1:
+ # un coin: un noeud, un element quadrangle
+ elem = elems[0]
+ break;
+ idStart = idNode # le noeud de coin
+ elemStart = elem # l'élément quadrangle au coin
+ xyz = meshQuad.GetNodeXYZ(idStart)
+ logging.debug("idStart %s, coords %s", idStart, str(xyz))
+
+ nodelines =[] # on va constituer une liste de lignes de points
+ nextLine = True
+ ligneFinale = False
+ while nextLine:
+ logging.debug("--- une ligne")
+ idNode = idStart
+ elem = elemStart
+ if ligneFinale:
+ agauche = False # sens de parcours des 4 noeuds d'un quadrangle
+ nextLine = False
+ else:
+ agauche = True
+ ligneIncomplete = True # on commence une ligne de points
+ debutLigne = True
+ nodeline = []
+ elemline = []
+ while ligneIncomplete: # compléter la ligne de points
+ nodeline.append(idNode)
+ allNodeIds.remove(idNode)
+ elemline.append(elem)
+ nodes = meshQuad.GetElemNodes(elem)
+ i = nodes.index(idNode) # repérer l'index du noeud courant (i) dans l'élément quadrangle (0 a 3)
+ if agauche: # déterminer le noeud suivant (j) et celui opposé (k) dans le quadrangle
+ if i < 3:
+ j = i+1
+ else:
+ j = 0
+ if j < 3:
+ k = j+1
+ else:
+ k = 0
+ else:
+ if i > 0:
+ j = i -1
+ else:
+ j = 3
+ if j > 0:
+ k = j -1
+ else:
+ k = 3
+ isuiv = nodes[j] #noeud suivant
+ iapres = nodes[k] #noeud opposé
+ if debutLigne:
+ debutLigne = False
+ # précédent a trouver, dernière ligne : précédent au lieu de suivant
+ if agauche:
+ if i > 0:
+ iprec = nodes[i -1]
+ else:
+ iprec = nodes[3]
+ idStart = iprec
+ elems3 = meshQuad.GetNodeInverseElements(iprec)
+ if len(elems3) == 1: # autre coin
+ ligneFinale = True
+ else:
+ for elem3 in elems3:
+ if elem3 != elem:
+ elemStart = elem3
+ break
+ #print nodes, idNode, isuiv, iapres
+ elems1 = meshQuad.GetNodeInverseElements(isuiv)
+ elems2 = meshQuad.GetNodeInverseElements(iapres)
+ ligneIncomplete = False
+ for elem2 in elems2:
+ if elems1.count(elem2) and elem2 != elem:
+ ligneIncomplete = True
+ idNode = isuiv
+ elem = elem2
+ break
+ if not ligneIncomplete:
+ nodeline.append(isuiv)
+ allNodeIds.remove(isuiv)
+ logging.debug("nodeline %s", nodeline)
+ logging.debug("elemline %s", elemline)
+ nodelines.append(nodeline)
+ logging.debug("nodelines = %s", nodelines)
+ longueur = [len(val) for val in nodelines]
+ logging.debug("longueur = %s", longueur)
+ # on a constitué une liste de lignes de points connexes
+ logging.debug("dimensions [%s, %s]", len(nodelines), len(nodeline))
+
+ # stockage des coordonnées dans un tableau numpy
+ mat = np.zeros((len(nodelines), len(nodeline), 3))
+ for i, ligne in enumerate(nodelines):
+ for j, nodeId in enumerate(ligne):
+ mat[i,j] = meshQuad.GetNodeXYZ(nodeId)
+ logging.debug("matrice de coordonnées: \n%s",mat)
+ logging.debug("dimensions %s", mat.shape)
+
+ # recherche d'angles supérieurs a un seuil sur une ligne : angle entre deux vecteurs successifs
+ cosmin = math.cos(math.pi/4.) # TODO: angle reference en paramètre
+ vecx = mat[:, 1:, :] - mat[:, :-1, :] # vecteurs selon direction "x"
+ vx0 = vecx[:, :-1, :] # vecteurs amont
+ vx1 = vecx[:, 1:, :] # vecteurs aval
+ e = np.einsum('ijk,ijk->ij', vx0, vx1) # produit scalaire des vecteurs
+ f = np.apply_along_axis(mydot, 2, vx0) # normes carrées vecteurs amont
+ g = np.apply_along_axis(mydot, 2, vx1) # normes carrées vecteurs aval
+ h = e/(np.sqrt(f*g)) # cosinus
+ ruptureX = h < cosmin # True si angle > reference
+ logging.debug("matrice de rupture X: \n%s",ruptureX)
+ rupX = filter(lambda x: np.prod(ruptureX[:,x]), range(len(nodeline)-2))
+ logging.debug("colonnes de rupture: %s",rupX)
+ # recherche d'angles supérieurs a un seuil sur une colonne : angle entre deux vecteurs successifs
+ vecy = mat[ 1:, :, :] - mat[:-1, :, :] # vecteurs selon direction "y"
+ vy0 = vecy[:-1, :, :] # vecteurs amont
+ vy1 = vecy[ 1:, :, :] # vecteurs aval
+ e = np.einsum('ijk,ijk->ij', vy0, vy1) # produit scalaire des vecteurs
+ f = np.apply_along_axis(mydot, 2, vy0) # normes carrées vecteurs amont
+ g = np.apply_along_axis(mydot, 2, vy1) # normes carrées vecteurs aval
+ h = e/(np.sqrt(f*g)) # cosinus
+ ruptureY = h < cosmin # True si angle > reference
+ logging.debug("matrice de rupture Y: \n%s",ruptureY)
+ rupY = filter(lambda x: np.prod(ruptureY[x, :]), range(len(nodelines)-2))
+ logging.debug("lignes de rupture: %s",rupY)
+ if (len(rupX)*len(rupY)) > 0:
+ logging.critical("""Cas non traité: présence d'angles vifs dans 2 directions,
+ lors de la reconstitution des faces géométriques dans la zone remaillée""")
+
+ mats = []
+ bordsPartages = []
+ if (len(rupX)> 0):
+ rupX.append(mat.shape[1]-1)
+ for i, index in enumerate(rupX):
+ imax = index+2
+ imin = 0
+ if i > 0:
+ imin = rupX[i-1] + 1
+ mats.append(mat[:, imin:imax, :])
+ if imax == mat.shape[1] + 1:
+ ifin = 0
+ else:
+ ifin = imax
+ bordsPartages.append([imin,ifin]) # les indices différents de 0 correspondent à des bords partagés
+ elif (len(rupY)> 0):
+ rupY.append(mat.shape[0]-1)
+ for i, index in enumerate(rupY):
+ imax = index+2
+ imin = 0
+ if i > 0:
+ imin = rupY[i-1] + 1
+ mats.append(mat[imin:imax, :, :])
+ if imax == mat.shape[0] + 1:
+ ifin = 0
+ else:
+ ifin = imax
+ bordsPartages.append([imin,ifin]) # les indices différents de 0 correspondent à des bords partagés
+ else:
+ mats.append(mat)
+ bordsPartages.append([0,0]) # les indices différents de 0 correspondent à des bords partagés
+
+ curvconts = []
+ for nmat, amat in enumerate(mats):
+ logging.debug("dimensions matrice %s: %s", nmat, amat.shape)
+ nbLignes = amat.shape[1] # pas de rupture, ou rupture selon des colonnes: on transpose
+ nbCols = amat.shape[0]
+ if len(rupY) > 0 : # rupture selon des lignes: pas de transposition
+ nbLignes = amat.shape[0]
+ nbCols = amat.shape[1]
+ curves = []
+ noeudsBords = []
+ for i in range(4):
+ noeudsBords.append([])
+ k = 0
+ for i in range(nbLignes):
+ nodeList = []
+ for j in range(nbCols):
+ #logging.debug("point[%s,%s] = (%s, %s, %s)",i,j,amat[i,j,0], amat[i,j,1], amat[i,j,2])
+ if len(rupY) > 0 : # pas de transposition
+ node = geompy.MakeVertex(amat[i,j,0], amat[i,j,1], amat[i,j,2])
+ else: # transposition
+ node = geompy.MakeVertex(amat[j,i,0], amat[j,i,1], amat[j,i,2])
+ nodeList.append(node)
+ if i == 0:
+ noeudsBords[0].append(node)
+ #name = "bord0_%d"%k
+ #geomPublish(initLog.debug, node, name )
+ if i == (nbLignes -1):
+ noeudsBords[2].append(node)
+ #name = "bord2_%d"%k
+ #geomPublish(initLog.debug, node, name )
+ if j == 0:
+ noeudsBords[1].append(node)
+ #name = "bord1_%d"%k
+ #geomPublish(initLog.debug, node, name )
+ if j == (nbCols -1):
+ noeudsBords[3].append(node)
+ #name = "bord3_%d"%k
+ #geomPublish(initLog.debug, node, name )
+ k += 1
+ curve = geompy.MakeInterpol(nodeList, False, False)
+ #name = "curve_%d"%i
+ #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)
+ if bordsPartages[nmat][0] :
+ bordsPartages[nmat][0] = curves[0] # la première ligne est un bord partagé
+ else:
+ bordsPartages[nmat][0] = None
+ if bordsPartages[nmat][1] :
+ bordsPartages[nmat][1] = curves[-1] # la dernière ligne est un bord partagé
+ else:
+ bordsPartages[nmat][1] = None
+ filling = geompy.MakeFilling(geompy.MakeCompound(curves), 2, 5, 0.0001, 0.0001, 0, GEOM.FOM_Default, True)
+ # --- test orientation filling
+ vertex = geompy.MakeVertexOnSurface(filling, 0.5, 0.5)
+ normal = geompy.GetNormal(filling, vertex)
+
+ if centreFondFiss is not None:
+ logging.debug("orientation filling a l'aide du centre de fond de fissure")
+ vecteurDefaut = geompy.MakeVector(centreFondFiss, vertex)
+
+ if not isVecteurDefaut:
+ pointIn_x = 0.0
+ pointIn_y = 0.0
+ pointIn_z = 0.0
+ pointExplicite = False
+ if shapeFissureParams.has_key('pointIn_x'):
+ pointExplicite = True
+ pointIn_x = shapeFissureParams['pointIn_x']
+ if shapeFissureParams.has_key('pointIn_y'):
+ pointExplicite = True
+ pointIn_y = shapeFissureParams['pointIn_y']
+ if shapeFissureParams.has_key('pointIn_z'):
+ pointExplicite = True
+ pointIn_z = shapeFissureParams['pointIn_z']
+ if pointExplicite:
+ cdg = geompy.MakeVertex(pointIn_x, pointIn_y, pointIn_z)
+ logging.debug("orientation filling par point intérieur %s", (pointIn_x, pointIn_y, pointIn_z))
+ vecteurDefaut = geompy.MakeVector(cdg, vertex)
+
+ if shapeFissureParams.has_key('convexe'):
+ isConvexe = shapeFissureParams['convexe']
+ logging.debug("orientation filling par indication de convexité %s", isConvexe)
+ cdg = geompy.MakeCDG(filling)
+ if isConvexe:
+ vecteurDefaut = geompy.MakeVector(cdg, vertex)
+ else:
+ vecteurDefaut = geompy.MakeVector(vertex, cdg)
+
+ if vecteurDefaut is not None:
+ 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)
+ geomPublish(initLog.debug, filling, "filling%d"%iface )
+ #geompy.ExportBREP(filling, "filling.brep")
+ iface = iface+1
+ fillings.append(filling)
+ noeuds_bords.append(noeudsBords)
+ idFilToCont.append(icont)
+ bords_Partages += bordsPartages
+ logging.debug("bords_Partages = %s", bords_Partages)
+ pass # --- loop on mats
+ # --- reconstruction des faces continues à partir des listes de noeuds
+ # les courbes doivent suivre la courbure pour éviter les oscillations
+ if icont == iface - 1: # pas de découpe, on garde la même face
+ fillcont = fillings[-1]
+ else:
+ nbLignes = len(curvconts[0])
+ curves = []
+ for i in range(nbLignes):
+ nodes = [curvconts[j][i] for j in range(len(curvconts))]
+ 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)
+ geomPublish(initLog.debug, fillcont, "filcont%d"%icont )
+ fillconts.append(fillcont)
+ icont = icont+1
+ pass # --- loop while there are remaining nodes
+
+ return fillings, noeuds_bords, bords_Partages, fillconts, idFilToCont
--- /dev/null
+# -*- coding: utf-8 -*-
+"""
+Created on Tue Jun 24 09:14:13 2014
+
+@author: I48174
+"""
+
+import logging
+from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
+import GEOM
+
+from listOfExtraFunctions import createNewMeshesFromCorner
+from listOfExtraFunctions import createLinesFromMesh
+
+# -----------------------------------------------------------------------------
+# --- groupe de quadrangles de face transformé en face géométrique par filling
+
+def quadranglesToShapeWithCorner(meshQuad, shapeDefaut, shapeFissureParams, centreFondFiss, listOfCorners):
+ """ """
+ # TODO: rédiger la docstring
+
+ logging.info("start")
+
+ #fillings = [[], []]
+ tmpFillings = []
+ noeuds_bords = []
+ #bords_Partages = [[], []]
+ tmpBords = []
+ fillconts = []
+ idFilToCont = []
+
+ facesNonCoupees = []
+ facesCoupees = []
+ aretesNonCoupees = []
+ aretesCoupees = []
+
+ setOfNodes = []
+ setOfLines = []
+ listOfEdges = []
+ # On crée une liste contenant le maillage de chaque face.
+ listOfNewMeshes = createNewMeshesFromCorner(meshQuad, listOfCorners)
+ for msh in listOfNewMeshes:
+ # On crée une liste de noeuds correspondant aux faces suivant
+ # le modèle liste[face][ligne][noeud].
+ lines = createLinesFromMesh(msh, listOfCorners[0])
+ setOfNodes.append(lines)
+
+ for face in setOfNodes:
+ tmpFace = []
+ for line in face:
+ # On possède l'information 'ID' de chaque noeud composant chaque
+ # ligne de chaque face. A partir de l'ID, on crée un vertex. Un
+ # ensemble de vertices constitue une ligne. Un ensemble de lignes
+ # constitue une face.
+ tmpCoords = [meshQuad.GetNodeXYZ(node) for node in line]
+ tmpPoints = [geompy.MakeVertex(val[0], val[1], val[2]) for val in tmpCoords]
+ line = geompy.MakeInterpol(tmpPoints, False, False)
+ tmpFace.append(line)
+ setOfLines.append(tmpFace)
+
+ for i, 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_{0}'.format(i + 1))
+ tmpFillings.append(filling)
+
+ for face in setOfNodes:
+ # On prend la première ligne qui correspond aux bords partagés
+ listOfEdges.append(face[0])
+
+ for edge in listOfEdges:
+ # On utilise les points de bords pour créer des aretes vives
+ tmpCoords = [meshQuad.GetNodeXYZ(node) for node in list(edge)]
+ tmpPoints = [geompy.MakeVertex(val[0], val[1], val[2]) for val in tmpCoords]
+ line = geompy.MakeInterpol(tmpPoints, False, False)
+ tmpBords.append(line)
+
+ for i, filling in enumerate(tmpFillings):
+ tmpPartition = geompy.MakePartition([filling], [shapeDefaut], [], [], geompy.ShapeType["FACE"], 0, [], 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_{0}".format(i + 1))
+ facesNonCoupees.append(filling)
+ else:
+ geomPublish(initLog.debug, filling, "faceCoupee_{0}".format(i + 1))
+ facesCoupees.append(filling)
+ fillings = facesCoupees, facesNonCoupees
+
+ for i, filling in enumerate(tmpBords):
+ tmpPartition = geompy.MakePartition([shapeDefaut], [filling], [], [], geompy.ShapeType["SHELL"], 0, [], 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_{0}".format(i + 1))
+ aretesNonCoupees.append(filling)
+ else:
+ 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):
+# geomPublish(initLog.debug, line, 'face{0}_ligne{1}'.format(i + 1, j + 1))
+
+ #TODO: A enlever
+# for i, filling in enumerate(fillings[0]):
+# 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))
+
+ return fillings, noeuds_bords, bords_Partages, fillconts, idFilToCont
+
\ No newline at end of file
--- /dev/null
+# -*- coding: utf-8 -*-
+
+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):
+ """
+ restriction de la face de fissure au domaine solide
+ partition face fissure étendue par fillings
+ """
+ logging.info('start')
+ partShapeDefaut = geompy.MakePartition([shapeDefaut], facesDefaut, [], [], geompy.ShapeType["FACE"], 0, [], 0)
+ 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)]
+ distfaces.sort()
+ logging.debug("selection de la face la plus proche du point interne, distance=%s",distfaces[0][0])
+ facesPortFissure = distfaces[0][2]
+ else:
+ facesPartShapeDefautSorted, minSurf, maxSurf = sortFaces(facesPartShapeDefaut) # la face de fissure dans le volume doit être la plus grande
+ logging.debug("surfaces faces fissure étendue, min %s, max %s", minSurf, maxSurf)
+ facesPortFissure = facesPartShapeDefautSorted[-1]
+
+ geomPublish(initLog.debug, facesPortFissure, "facesPortFissure")
+ return facesPortFissure
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()
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])
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)
normal = geompy.GetNormal(face, vertex)
extrusionFaceFissure = geompy.MakePrismVecH(facesFissure, normal, 100)
- geompy.addToStudy(extrusionFaceFissure, "extrusionFaceFissure")
+ geomPublish(initLog.debug, extrusionFaceFissure, "extrusionFaceFissure")
return extrusionFaceFissure, normal
import logging
from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
# -----------------------------------------------------------------------------
# --- tri par longueur des 3 generatrices
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
import logging
from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
import math
from triedreBase import triedreBase
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
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
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
import logging
from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
# --- origine et vecteurs de base
OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
-
+
if not geompy.myStudy.FindObjectByName( 'OX', geompy.ComponentDataType() ):
- 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
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import logging
+
+from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
+
+def trouveEdgesFissPeau(facesInside, facesOnside, edgesPipeIn, edgesFondIn, partitionPeauFissFond, edgesFissExtPeau):
+ """
+ pour les faces de peau sans extremité débouchante de fissure, il faut recenser les edges de fissure sur la face de peau
+ """
+ logging.info('start')
+
+ j = 0
+ for face in facesInside:
+ edgesPeauFis = []
+ edgesPipeFis = []
+ edgesPipeFnd = []
+ try:
+ edgesPeauFis = geompy.GetSharedShapesMulti([geompy.MakeCompound(facesOnside), face], geompy.ShapeType["EDGE"])
+ edgesPipeFis = geompy.GetSharedShapesMulti([geompy.MakeCompound(edgesPipeIn), face], geompy.ShapeType["EDGE"])
+ edgesPipeFnd = geompy.GetSharedShapesMulti([geompy.MakeCompound(edgesFondIn), face], geompy.ShapeType["EDGE"])
+ except:
+ pass
+ if (len(edgesPeauFis) > 0) and (len(edgesPipeFis) > 0) and (len(edgesPipeFnd) == 0):
+ edgesFissExtPeau.append(edgesPeauFis[0])
+ name="edgesFissExtPeau%d"%j
+ geomPublishInFather(initLog.debug,partitionPeauFissFond, edgesPeauFis[0], name)
+ j += 1
+ return edgesFissExtPeau
\ No newline at end of file
<rect>
<x>0</x>
<y>0</y>
- <width>826</width>
- <height>540</height>
+ <width>959</width>
+ <height>618</height>
</rect>
</property>
<property name="windowTitle">
- <string>Dialog</string>
+ <string>Génération de coude avec fissure</string>
</property>
<layout class="QGridLayout" name="gridLayout_8">
<item row="0" column="0">
</item>
</layout>
<zorder>verticalSpacer_2</zorder>
- <zorder>horizontalSpacer</zorder>
- <zorder>lb_calcul</zorder>
- <zorder>horizontalSpacer_9</zorder>
</widget>
<resources/>
<connections>
# This library is free software; you can redistribute it and/or
# modify it under the terms of the 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.
+# version 2.1 of the License.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
</rect>
</property>
<property name="windowTitle">
- <string>Dialog</string>
+ <string>Insertion de fissure dans un maillage sain</string>
</property>
<property name="toolTip">
<string><html><head/><body><p>Insertion d'un maillage de fissure dans un maillage hexaédrique sain.</p><p>Le maillage sain est fourni sous forme de fichier Med.</p><p>La face de fissure est décrite par une géométrie dans un fichier brep.</p><p>La ou les arêtes de fond de fissure sont données par leurs index dans la face de fissure.</p><p>La procédure identfie des mailles saines à enlever et remailler, construit un maillage régulier rayonnant autour de la ligne de fond de fissure, reconstitue les faces externes en triangles, complète la zone à remailler en tétraèdres.</p></body></html></string>
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+
+import sys
+import salome
+
+import os
+from blocFissure import gmu
+from blocFissure.gmu import initLog
+#initLog.setDebug()
+initLog.setVerbose()
+
+from blocFissure.casStandard import casStandard
+
+mesh = 'areteArrondieSoudure.med'
+crack = 'fissureSoudureTest.brep'
+
+dicoParams = dict(nomCas = 'casTestCoinTriple',
+ maillageSain = '/local00/home/I48174/Documents/soudure/essaiFissure/{0}'.format(mesh),
+ brepFaceFissure = '/local00/home/I48174/Documents/soudure/essaiFissure/{0}'.format(crack),
+ edgeFissIds = [4],
+ lgInfluence = 30,
+ meshBrep = (5,10),
+ rayonPipe = 5,
+ lenSegPipe = 7,
+ nbSegRad = 8,
+ nbSegCercle = 20,
+ areteFaceFissure = 8)
+
+execInstance = casStandard(dicoParams)
+
+if salome.sg.hasDesktop():
+ salome.sg.updateObjBrowser(1)
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+
+import sys
+import salome
+
+import os
+from blocFissure import gmu
+from blocFissure.gmu import initLog
+#initLog.setDebug()
+initLog.setVerbose()
+
+from blocFissure.casStandard import casStandard
+
+mesh = 'areteViveSoudure.med'
+crack = 'fissureSoudureTest.brep'
+
+dicoParams = dict(nomCas = 'casTestCoinTriple',
+ maillageSain = '/local00/home/I48174/Documents/soudure/essaiFissure/{0}'.format(mesh),
+ brepFaceFissure = '/local00/home/I48174/Documents/soudure/essaiFissure/{0}'.format(crack),
+ edgeFissIds = [4],
+ lgInfluence = 30,
+ meshBrep = (5,10),
+ rayonPipe = 10,
+ lenSegPipe = 7,
+ nbSegRad = 5,
+ nbSegCercle = 10,
+ areteFaceFissure = 10)
+
+execInstance = casStandard(dicoParams)
+
+if salome.sg.hasDesktop():
+ salome.sg.updateObjBrowser(1)
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+
+import sys
+import salome
+
+import os
+from blocFissure import gmu
+from blocFissure.gmu import initLog
+#initLog.setDebug()
+initLog.setVerbose()
+
+from blocFissure.casStandard import casStandard
+
+mesh = 'huehue.med'
+crack = 'hue.brep'
+
+dicoParams = dict(nomCas = 'testAubry',
+ maillageSain = '/local00/home/I48174/Bureau/{0}'.format(mesh),
+ brepFaceFissure = '/local00/home/I48174/Bureau/{0}'.format(crack),
+ edgeFissIds = [8],
+ lgInfluence = 0.01,
+ meshBrep = (0.0002,0.003),
+ rayonPipe = 0.005,
+ lenSegPipe = 0.0015,
+ nbSegRad = 8,
+ nbSegCercle = 18,
+ areteFaceFissure = 0.0015)
+
+execInstance = casStandard(dicoParams)
+
+if salome.sg.hasDesktop():
+ salome.sg.updateObjBrowser(1)
SET(plugin_SCRIPTS
__init__.py
cubeAngle.py
+ cubeFin.py
decoupeCylindre.py
disque_perce.py
ellipse_disque.py
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import sys
+import salome
+
+salome.salome_init()
+theStudy = salome.myStudy
+
+import salome_notebook
+notebook = salome_notebook.NoteBook(theStudy)
+
+import os
+from blocFissure import gmu
+
+###
+### GEOM component
+###
+
+import GEOM
+from salome.geom import geomBuilder
+import math
+import SALOMEDS
+
+
+geompy = geomBuilder.New(theStudy)
+
+O = geompy.MakeVertex(0, 0, 0)
+OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
+OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
+OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
+cubeFin = geompy.MakeBoxDXDYDZ(200, 200, 200)
+[DEPL,ENCASTR] = geompy.SubShapes(cubeFin, [27, 23])
+origCoin = geompy.MakeVertex(0, 160, 200)
+Disk_1 = geompy.MakeDiskPntVecR(origCoin, OY, 50)
+Translation_1 = geompy.MakeTranslation(origCoin, 0, 10, 0)
+Vector_1 = geompy.MakeVector(origCoin, Translation_1)
+Rotation_1 = geompy.MakeRotation(Disk_1, Vector_1, 90*math.pi/180.0)
+origMilieu = geompy.MakeVertex(0, 160, 100)
+Translation_2 = geompy.MakeTranslationTwoPoints(Rotation_1, origCoin, origMilieu)
+Scale_1 = geompy.MakeScaleAlongAxes(Translation_2, origMilieu, 0.984, 1, 1.2)
+Vertex_1 = geompy.MakeVertex(-10, 160, 210)
+Vertex_2 = geompy.MakeVertex(50, 160, 210)
+Vertex_3 = geompy.MakeVertex(50, 160, -10)
+Vertex_4 = geompy.MakeVertex(-10, 160, -10)
+Line_1 = geompy.MakeLineTwoPnt(Vertex_1, Vertex_2)
+Line_2 = geompy.MakeLineTwoPnt(Vertex_2, Vertex_3)
+Line_3 = geompy.MakeLineTwoPnt(Vertex_3, Vertex_4)
+Line_4 = geompy.MakeLineTwoPnt(Vertex_4, Vertex_1)
+cubeFin_Transverse = geompy.MakeFaceWires([Line_1, Line_2, Line_3, Line_4], 1)
+Vertex_5 = geompy.MakeVertex(55, 160, 100)
+Line_1_vertex_3 = geompy.GetSubShape(Line_1, [3])
+Line_3_vertex_2 = geompy.GetSubShape(Line_3, [2])
+Arc_1 = geompy.MakeArc(Line_1_vertex_3, Vertex_5, Line_3_vertex_2)
+Face_1 = geompy.MakeFaceWires([Line_1, Line_3, Line_4, Arc_1], 1)
+cubeFin_Coin = geompy.MakeCommonList([Rotation_1, Face_1], True)
+cubeFin_Milieu = geompy.MakeCommonList([Scale_1, cubeFin_Transverse], True)
+O_1 = geompy.MakeVertex(0, 0, 0)
+OX_1 = geompy.MakeVectorDXDYDZ(1, 0, 0)
+OY_1 = geompy.MakeVectorDXDYDZ(0, 1, 0)
+OZ_1 = geompy.MakeVectorDXDYDZ(0, 0, 1)
+geompy.addToStudy( O, 'O' )
+geompy.addToStudy( OX, 'OX' )
+geompy.addToStudy( OY, 'OY' )
+geompy.addToStudy( OZ, 'OZ' )
+geompy.addToStudy( cubeFin, 'cubeFin' )
+geompy.addToStudyInFather( cubeFin, DEPL, 'DEPL' )
+geompy.addToStudyInFather( cubeFin, ENCASTR, 'ENCASTR' )
+geompy.addToStudy( origCoin, 'origCoin' )
+geompy.addToStudy( Disk_1, 'Disk_1' )
+geompy.addToStudy( Translation_1, 'Translation_1' )
+geompy.addToStudy( Vector_1, 'Vector_1' )
+geompy.addToStudy( Rotation_1, 'Rotation_1' )
+geompy.addToStudy( origMilieu, 'origMilieu' )
+geompy.addToStudy( Translation_2, 'Translation_2' )
+geompy.addToStudy( Scale_1, 'Scale_1' )
+geompy.addToStudy( Vertex_1, 'Vertex_1' )
+geompy.addToStudy( Vertex_2, 'Vertex_2' )
+geompy.addToStudy( Vertex_3, 'Vertex_3' )
+geompy.addToStudy( Vertex_4, 'Vertex_4' )
+geompy.addToStudy( Line_1, 'Line_1' )
+geompy.addToStudy( Line_2, 'Line_2' )
+geompy.addToStudy( Line_3, 'Line_3' )
+geompy.addToStudy( Line_4, 'Line_4' )
+geompy.addToStudy( cubeFin_Transverse, 'cubeFin_Transverse' )
+geompy.addToStudyInFather( Line_1, Line_1_vertex_3, 'Line_1:vertex_3' )
+geompy.addToStudy( Vertex_5, 'Vertex_5' )
+geompy.addToStudyInFather( Line_3, Line_3_vertex_2, 'Line_3:vertex_2' )
+geompy.addToStudy( Arc_1, 'Arc_1' )
+geompy.addToStudy( Face_1, 'Face_1' )
+geompy.addToStudy( cubeFin_Coin, 'cubeFin_Coin' )
+geompy.addToStudy( cubeFin_Milieu, 'cubeFin_Milieu' )
+geompy.addToStudy( O_1, 'O' )
+geompy.addToStudy( OX_1, 'OX' )
+geompy.addToStudy( OY_1, 'OY' )
+geompy.addToStudy( OZ_1, 'OZ' )
+geompy.Export(cubeFin_Transverse, os.path.join(gmu.pathBloc, "materielCasTests/cubeFin_Transverse.brep"), "BREP")
+geompy.Export(cubeFin_Coin, os.path.join(gmu.pathBloc, "materielCasTests/cubeFin_Coin.brep"), "BREP")
+geompy.Export(cubeFin_Milieu, os.path.join(gmu.pathBloc, "materielCasTests/cubeFin_Milieu.brep"), "BREP")
+
+###
+### SMESH component
+###
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+
+smesh = smeshBuilder.New(theStudy)
+cubeFin_1 = smesh.Mesh(cubeFin)
+Regular_1D = cubeFin_1.Segment()
+Nb_Segments_1 = Regular_1D.NumberOfSegments(20)
+Nb_Segments_1.SetDistrType( 0 )
+Quadrangle_2D = cubeFin_1.Quadrangle(algo=smeshBuilder.QUADRANGLE)
+Hexa_3D = cubeFin_1.Hexahedron(algo=smeshBuilder.Hexa)
+isDone = cubeFin_1.Compute()
+DEPL_1 = cubeFin_1.GroupOnGeom(DEPL,'DEPL',SMESH.FACE)
+ENCASTR_1 = cubeFin_1.GroupOnGeom(ENCASTR,'ENCASTR',SMESH.FACE)
+
+## Set names of Mesh objects
+smesh.SetName(Regular_1D.GetAlgorithm(), 'Regular_1D')
+smesh.SetName(Quadrangle_2D.GetAlgorithm(), 'Quadrangle_2D')
+smesh.SetName(Hexa_3D.GetAlgorithm(), 'Hexa_3D')
+smesh.SetName(DEPL_1, 'DEPL')
+smesh.SetName(ENCASTR_1, 'ENCASTR')
+smesh.SetName(cubeFin_1.GetMesh(), 'cubeFin')
+smesh.SetName(Nb_Segments_1, 'Nb. Segments_1')
+
+cubeFin_1.ExportMED( os.path.join(gmu.pathBloc, "materielCasTests/cubeFin.med"), 0, SMESH.MED_V2_2, 1 )
+
+if salome.sg.hasDesktop():
+ salome.sg.updateObjBrowser(1)
-# -*- coding: iso-8859-1 -*-
+# -*- coding: utf-8 -*-
import sys
import salome
geomObj_3 = geompy.MakeCylinderRH(1450, 8000)
Cylinder_3 = geompy.MakeRotation(geomObj_3, OZ, 180*math.pi/180.0)
Cut_1 = geompy.MakeCut(Partition_1, Cylinder_3)
+geompy.addToStudy( Cut_1, 'Cut_1' )
[faceFiss1] = geompy.SubShapes(Cut_1, [61])
+geompy.addToStudyInFather( Cut_1, faceFiss1, 'faceFiss1' )
[Vertex_3,geomObj_4] = geompy.SubShapes(faceFiss1, [4, 5])
Cylinder_4 = geompy.MakeCylinderRH(2000, 4000)
Cylinder_5 = geompy.MakeCylinderRH(1500, 4000)
geompy.addToStudy( Box_1, 'Box_1' )
geompy.addToStudy( Partition_1, 'Partition_1' )
geompy.addToStudy( Cylinder_3, 'Cylinder_3' )
-geompy.addToStudy( Cut_1, 'Cut_1' )
-geompy.addToStudyInFather( Cut_1, faceFiss1, 'faceFiss1' )
geompy.addToStudyInFather( faceFiss1, Vertex_3, 'Vertex_3' )
geompy.addToStudy( Cylinder_4, 'Cylinder_4' )
geompy.addToStudy( Cylinder_5, 'Cylinder_5' )
-# -*- coding: iso-8859-1 -*-
+# -*- coding: utf-8 -*-
import sys
import salome
objetSain = geompy.MakeBoxTwoPnt(Vertex_3, Vertex_2)
Rotation_1 = geompy.MakeRotation(Extrusion_1, OX, 180*math.pi/180.0)
Partition_2 = geompy.MakePartition([Rotation_1], [Extrusion_2], [], [], geompy.ShapeType["FACE"], 0, [], 0)
+geompy.addToStudy( Partition_2, 'Partition_2' )
[FaceFissExtSimple] = geompy.SubShapes(Partition_2, [13])
+geompy.addToStudyInFather( Partition_2, FaceFissExtSimple, 'FaceFissExtSimple' )
Plane_1 = geompy.MakePlaneLCS(None, 2000, 3)
FaceFissExtCoupe = geompy.MakePartition([FaceFissExtSimple], [Plane_1], [], [], geompy.ShapeType["FACE"], 0, [], 0)
geompy.Export(FaceFissExtCoupe, os.path.join(gmu.pathBloc, "materielCasTests/faceGauche2FissCoupe.brep"), "BREP")
geompy.addToStudy( Vertex_3, 'Vertex_3' )
geompy.addToStudy( objetSain, 'objetSain' )
geompy.addToStudy( Rotation_1, 'Rotation_1' )
-geompy.addToStudy( Partition_2, 'Partition_2' )
-geompy.addToStudyInFather( Partition_2, FaceFissExtSimple, 'FaceFissExtSimple' )
geompy.addToStudy( Plane_1, 'Plane_1' )
geompy.addToStudy( FaceFissExtCoupe, 'FaceFissExtCoupe' )
from blocFissure.materielCasTests import disque_perce
from blocFissure.materielCasTests import ellipse_disque
from blocFissure.materielCasTests import vis
+from blocFissure.materielCasTests import cubeFin