mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-26 11:40:32 +05:00
Amélioration du ptyhon
This commit is contained in:
parent
71de383cb6
commit
f44efbc020
@ -17,6 +17,7 @@
|
|||||||
#
|
#
|
||||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
#
|
#
|
||||||
|
"""init de la classe"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from . import initLog
|
from . import initLog
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#
|
#
|
||||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
#
|
#
|
||||||
|
"""Ajustement precis des points sur edgesPipeFissureExterneC"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
@ -25,13 +26,11 @@ from .findWireIntermediateVertices import findWireIntermediateVertices
|
|||||||
from .projettePointSurCourbe import projettePointSurCourbe
|
from .projettePointSurCourbe import projettePointSurCourbe
|
||||||
|
|
||||||
def ajustePointsEdgePipeFissure(edgesPipeFissureExterneC, wirePipeFissureExterne, gptsdisks, idisklim):
|
def ajustePointsEdgePipeFissure(edgesPipeFissureExterneC, wirePipeFissureExterne, gptsdisks, idisklim):
|
||||||
"""
|
"""Ajustement precis des points sur edgesPipeFissureExterneC"""
|
||||||
ajustement precis des points sur edgesPipeFissureExterneC
|
|
||||||
"""
|
|
||||||
logging.info('start')
|
logging.info('start')
|
||||||
|
|
||||||
edgesPFE = geompy.ExtractShapes(edgesPipeFissureExterneC, geompy.ShapeType["EDGE"], False)
|
edgesPFE = geompy.ExtractShapes(edgesPipeFissureExterneC, geompy.ShapeType["EDGE"], False)
|
||||||
verticesPFE = findWireIntermediateVertices(wirePipeFissureExterne) # vertices intermédiaires (des points en trop dans ptsInWireFissExtPipe)
|
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é
|
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é
|
idiskmax = idisklim[1] # on ne prend pas le disque sur la peau, déjà ajusté
|
||||||
idiskint = []
|
idiskint = []
|
||||||
@ -39,8 +38,8 @@ def ajustePointsEdgePipeFissure(edgesPipeFissureExterneC, wirePipeFissureExterne
|
|||||||
distPtVt = []
|
distPtVt = []
|
||||||
for idisk in range(idiskmin, idiskmax):
|
for idisk in range(idiskmin, idiskmax):
|
||||||
gptdsk = gptsdisks[idisk]
|
gptdsk = gptsdisks[idisk]
|
||||||
pt = gptdsk[0][-1] # le point sur l'edge de la fissure externe au pipe
|
point = gptdsk[0][-1] # le point sur l'edge de la fissure externe au pipe
|
||||||
distPtVt.append((geompy.MinDistance(pt, vtx), idisk))
|
distPtVt.append((geompy.MinDistance(point, vtx), idisk))
|
||||||
distPtVt.sort()
|
distPtVt.sort()
|
||||||
idiskint.append(distPtVt[0][1])
|
idiskint.append(distPtVt[0][1])
|
||||||
gptsdisks[idiskint[-1]][0][-1] = vtx
|
gptsdisks[idiskint[-1]][0][-1] = vtx
|
||||||
@ -50,12 +49,12 @@ def ajustePointsEdgePipeFissure(edgesPipeFissureExterneC, wirePipeFissureExterne
|
|||||||
break
|
break
|
||||||
logging.debug("ajustement point sur edgePipeFissureExterne: %s", idisk)
|
logging.debug("ajustement point sur edgePipeFissureExterne: %s", idisk)
|
||||||
gptdsk = gptsdisks[idisk]
|
gptdsk = gptsdisks[idisk]
|
||||||
pt = gptdsk[0][-1] # le point sur l'edge de la fissure externe au pipe
|
point = 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 = [(geompy.MinDistance(point, edgePFE), k, edgePFE) for k, edgePFE in enumerate(edgesPFE)]
|
||||||
distPtEd.sort()
|
distPtEd.sort()
|
||||||
edgePFE = distPtEd[0][2]
|
edgePFE = distPtEd[0][2]
|
||||||
u = projettePointSurCourbe(pt, edgePFE)
|
point_bis = projettePointSurCourbe(point, edgePFE)
|
||||||
ptproj = geompy.MakeVertexOnCurve(edgePFE, u)
|
ptproj = geompy.MakeVertexOnCurve(edgePFE, point_bis)
|
||||||
gptsdisks[idisk][0][-1] = ptproj
|
gptsdisks[idisk][0][-1] = ptproj
|
||||||
|
|
||||||
return gptsdisks
|
return gptsdisks
|
||||||
|
@ -17,22 +17,20 @@
|
|||||||
#
|
#
|
||||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
#
|
#
|
||||||
|
"""bloc defaut"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
from .geomsmesh import geompy
|
from .geomsmesh import geompy
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
|
||||||
# --- bloc defaut
|
|
||||||
|
|
||||||
def blocDefaut(blocDim):
|
def blocDefaut(blocDim):
|
||||||
"""
|
""" Le bloc contenant la fissure est un cube construit centre a l'origine, dont on donne la demi arete.
|
||||||
Le bloc contenant la fissure est un cube construit centre a l'origine, dont on donne la demi arete.
|
|
||||||
@param blocdim : demi arete
|
@param blocdim : demi arete
|
||||||
@return cube (geomObject)
|
@return cube (geomObject)
|
||||||
"""
|
"""
|
||||||
logging.info("start")
|
logging.info("start")
|
||||||
geomObj_1 = geompy.MakeVertex(-blocDim, -blocDim, -blocDim)
|
point_1 = geompy.MakeVertex(-blocDim, -blocDim, -blocDim)
|
||||||
geomObj_2 = geompy.MakeVertex( blocDim, blocDim, blocDim)
|
point_2 = geompy.MakeVertex( blocDim, blocDim, blocDim)
|
||||||
Box = geompy.MakeBoxTwoPnt(geomObj_1, geomObj_2)
|
le_cube = geompy.MakeBoxTwoPnt(point_1, point_2)
|
||||||
#geompy.addToStudy( Box_1, 'Box_1' )
|
|
||||||
return Box
|
return le_cube
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#
|
#
|
||||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
#
|
#
|
||||||
|
"""Préparation maillage du pipe"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import math
|
import math
|
||||||
@ -27,7 +28,7 @@ from .geomsmesh import smesh
|
|||||||
def calculePointsAxiauxPipe(edgesFondFiss, edgesIdByOrientation, facesDefaut,
|
def calculePointsAxiauxPipe(edgesFondFiss, edgesIdByOrientation, facesDefaut,
|
||||||
centreFondFiss, wireFondFiss, wirePipeFiss,
|
centreFondFiss, wireFondFiss, wirePipeFiss,
|
||||||
lenSegPipe, rayonPipe, nbsegCercle, nbsegRad):
|
lenSegPipe, rayonPipe, nbsegCercle, nbsegRad):
|
||||||
"""preparation maillage du pipe :
|
"""Préparation maillage du pipe :
|
||||||
|
|
||||||
- détections des points a respecter : jonction des edges/faces constituant
|
- détections des points a respecter : jonction des edges/faces constituant
|
||||||
la face de fissure externe au pipe
|
la face de fissure externe au pipe
|
||||||
@ -59,7 +60,7 @@ def calculePointsAxiauxPipe(edgesFondFiss, edgesIdByOrientation, facesDefaut,
|
|||||||
|
|
||||||
meshFondExt = smesh.Mesh(wireFondFiss)
|
meshFondExt = smesh.Mesh(wireFondFiss)
|
||||||
algo1d = meshFondExt.Segment()
|
algo1d = meshFondExt.Segment()
|
||||||
hypo1d = algo1d.Adaptive(lgmin, lgmax, deflexion) # a ajuster selon la profondeur de la fissure
|
_ = algo1d.Adaptive(lgmin, lgmax, deflexion) # a ajuster selon la profondeur de la fissure
|
||||||
|
|
||||||
is_done = meshFondExt.Compute()
|
is_done = meshFondExt.Compute()
|
||||||
text = "calculePointsAxiauxPipe meshFondExt.Compute"
|
text = "calculePointsAxiauxPipe meshFondExt.Compute"
|
||||||
@ -75,11 +76,11 @@ def calculePointsAxiauxPipe(edgesFondFiss, edgesIdByOrientation, facesDefaut,
|
|||||||
for nodeId in allNodeIds:
|
for nodeId in allNodeIds:
|
||||||
xyz = meshFondExt.GetNodeXYZ(nodeId)
|
xyz = meshFondExt.GetNodeXYZ(nodeId)
|
||||||
#logging.debug("nodeId %s, coords %s", nodeId, str(xyz))
|
#logging.debug("nodeId %s, coords %s", nodeId, str(xyz))
|
||||||
pt = geompy.MakeVertex(xyz[0], xyz[1], xyz[2])
|
point = geompy.MakeVertex(xyz[0], xyz[1], xyz[2])
|
||||||
u, PointOnEdge, EdgeInWireIndex = geompy.MakeProjectionOnWire(pt, wireFondFiss) # u compris entre 0 et 1
|
parametre, _, EdgeInWireIndex = geompy.MakeProjectionOnWire(point, wireFondFiss) # parametre compris entre 0 et 1
|
||||||
edgeOrder = edgesIdByOrientation[EdgeInWireIndex]
|
edgeOrder = edgesIdByOrientation[EdgeInWireIndex]
|
||||||
ptGSdic[(edgeOrder, EdgeInWireIndex, u)] = pt
|
ptGSdic[(edgeOrder, EdgeInWireIndex, parametre)] = point
|
||||||
#logging.debug("nodeId %s, u %s", nodeId, str(u))
|
#logging.debug("nodeId %s, parametre %s", nodeId, str(parametre))
|
||||||
usort = sorted(ptGSdic)
|
usort = sorted(ptGSdic)
|
||||||
logging.debug("nombre de points obtenus par deflexion %s",len(usort))
|
logging.debug("nombre de points obtenus par deflexion %s",len(usort))
|
||||||
|
|
||||||
@ -88,10 +89,10 @@ def calculePointsAxiauxPipe(edgesFondFiss, edgesIdByOrientation, facesDefaut,
|
|||||||
normals = list()
|
normals = list()
|
||||||
for edu in usort:
|
for edu in usort:
|
||||||
ied = edu[1]
|
ied = edu[1]
|
||||||
u = edu[2]
|
parametre = edu[2]
|
||||||
vertcx = ptGSdic[edu]
|
vertcx = ptGSdic[edu]
|
||||||
norm = geompy.MakeTangentOnCurve(edgesFondFiss[ied], u)
|
norm = geompy.MakeTangentOnCurve(edgesFondFiss[ied], parametre)
|
||||||
plan = geompy.MakePlane(vertcx, norm, 3*rayonPipe)
|
plan = geompy.MakePlane(vertcx, norm, 3.*rayonPipe)
|
||||||
part = geompy.MakePartition([plan], [wirePipeFiss], list(), list(), geompy.ShapeType["VERTEX"], 0, list(), 0)
|
part = geompy.MakePartition([plan], [wirePipeFiss], list(), list(), geompy.ShapeType["VERTEX"], 0, list(), 0)
|
||||||
liste = geompy.ExtractShapes(part, geompy.ShapeType["VERTEX"], True)
|
liste = geompy.ExtractShapes(part, geompy.ShapeType["VERTEX"], True)
|
||||||
if len(liste) == 5: # 4 coins du plan plus intersection recherchée
|
if len(liste) == 5: # 4 coins du plan plus intersection recherchée
|
||||||
@ -117,29 +118,31 @@ def calculePointsAxiauxPipe(edgesFondFiss, edgesIdByOrientation, facesDefaut,
|
|||||||
# --- points géométriques
|
# --- points géométriques
|
||||||
|
|
||||||
gptsdisks = list() # vertices géométrie de tous les disques
|
gptsdisks = list() # vertices géométrie de tous les disques
|
||||||
raydisks = [list() for i in range(nbsegCercle)]
|
raydisks = [list() for _ in range(nbsegCercle)]
|
||||||
for i, centres_i in enumerate(centres): # boucle sur les disques
|
for indice, centres_i in enumerate(centres): # boucle sur les disques
|
||||||
gptdsk = list() # vertices géométrie d'un disque
|
gptdsk = list() # vertices géométrie d'un disque
|
||||||
vertcx = centres_i
|
vertcx = centres_i
|
||||||
vertpx = origins[i]
|
vertpx = origins[indice]
|
||||||
normal = normals[i]
|
normal = normals[indice]
|
||||||
vec1 = geompy.MakeVector(vertcx, vertpx)
|
vec1 = geompy.MakeVector(vertcx, vertpx)
|
||||||
|
|
||||||
points = [vertcx] # les points du rayon de référence
|
points = [vertcx] # les points du rayon de référence
|
||||||
|
dist_0 = rayonPipe/float(nbsegRad)
|
||||||
for j in range(nbsegRad):
|
for j in range(nbsegRad):
|
||||||
pt = geompy.MakeTranslationVectorDistance(vertcx, vec1, (j+1)*float(rayonPipe)/nbsegRad)
|
point = geompy.MakeTranslationVectorDistance(vertcx, vec1, (j+1)*dist_0)
|
||||||
points.append(pt)
|
points.append(point)
|
||||||
gptdsk.append(points)
|
gptdsk.append(points)
|
||||||
pt = geompy.MakeTranslationVectorDistance(vertcx, vec1, 1.5*rayonPipe)
|
point = geompy.MakeTranslationVectorDistance(vertcx, vec1, 1.5*rayonPipe)
|
||||||
rayon = geompy.MakeLineTwoPnt(vertcx, pt)
|
rayon = geompy.MakeLineTwoPnt(vertcx, point)
|
||||||
raydisks[0].append(rayon)
|
raydisks[0].append(rayon)
|
||||||
|
|
||||||
|
angle_0 = 2.*math.pi/float(nbsegCercle)
|
||||||
for k in range(nbsegCercle-1):
|
for k in range(nbsegCercle-1):
|
||||||
angle = (k+1)*2*math.pi/nbsegCercle
|
angle = float(k+1)*angle_0
|
||||||
pts = [vertcx] # les points d'un rayon obtenu par rotation
|
pts = [vertcx] # les points d'un rayon obtenu par rotation
|
||||||
for j in range(nbsegRad):
|
for j in range(nbsegRad):
|
||||||
pt = geompy.MakeRotation(points[j+1], normal, angle)
|
point = geompy.MakeRotation(points[j+1], normal, angle)
|
||||||
pts.append(pt)
|
pts.append(point)
|
||||||
gptdsk.append(pts)
|
gptdsk.append(pts)
|
||||||
ray = geompy.MakeRotation(rayon, normal, angle)
|
ray = geompy.MakeRotation(rayon, normal, angle)
|
||||||
raydisks[k+1].append(ray)
|
raydisks[k+1].append(ray)
|
||||||
|
@ -20,16 +20,17 @@
|
|||||||
"""Cas standard"""
|
"""Cas standard"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from .geomsmesh import geompy, smesh
|
import logging
|
||||||
from .geomsmesh import geomPublish
|
|
||||||
from .geomsmesh import geomPublishInFather
|
|
||||||
from . import initLog
|
|
||||||
|
|
||||||
import math
|
|
||||||
import GEOM
|
import GEOM
|
||||||
import SALOMEDS
|
import SALOMEDS
|
||||||
import SMESH
|
import SMESH
|
||||||
import logging
|
|
||||||
|
from .geomsmesh import geompy, smesh
|
||||||
|
from .geomsmesh import geomPublish
|
||||||
|
from .geomsmesh import geomPublishInFather
|
||||||
|
|
||||||
|
from . import initLog
|
||||||
|
|
||||||
from .fissureGenerique import fissureGenerique
|
from .fissureGenerique import fissureGenerique
|
||||||
|
|
||||||
@ -88,7 +89,7 @@ class casStandard(fissureGenerique):
|
|||||||
def genereMaillageSain(self, geometriesSaines, meshParams):
|
def genereMaillageSain(self, geometriesSaines, meshParams):
|
||||||
logging.info("genereMaillageSain %s", self.nomCas)
|
logging.info("genereMaillageSain %s", self.nomCas)
|
||||||
|
|
||||||
([objetSain], status) = smesh.CreateMeshesFromMED(self.dicoParams['maillageSain'])
|
([objetSain], _) = smesh.CreateMeshesFromMED(self.dicoParams['maillageSain'])
|
||||||
smesh.SetName(objetSain.GetMesh(), 'objetSain')
|
smesh.SetName(objetSain.GetMesh(), 'objetSain')
|
||||||
|
|
||||||
return [objetSain, True] # True : maillage hexa
|
return [objetSain, True] # True : maillage hexa
|
||||||
|
@ -17,17 +17,15 @@
|
|||||||
#
|
#
|
||||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
#
|
#
|
||||||
|
"""Teste si l'opération de partition a produit une modification"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
from .geomsmesh import geompy
|
from .geomsmesh import geompy
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
|
||||||
# --- teste si l'opération de partition a produit une modification
|
|
||||||
|
|
||||||
def checkDecoupePartition(shapes, part):
|
def checkDecoupePartition(shapes, part):
|
||||||
"""
|
"""Teste si l'opération de partition a produit une découpe (plus de shapes dans la partition).
|
||||||
Teste si l'opération de partition a produit une découpe
|
|
||||||
(plus de shapes dans la partition).
|
|
||||||
Résultat non garanti si recouvrement des shapes d'origine.
|
Résultat non garanti si recouvrement des shapes d'origine.
|
||||||
@param shapes : liste des shapes d'origine
|
@param shapes : liste des shapes d'origine
|
||||||
@param part : résultat de la partition
|
@param part : résultat de la partition
|
||||||
@ -35,25 +33,25 @@ def checkDecoupePartition(shapes, part):
|
|||||||
"""
|
"""
|
||||||
logging.info('start')
|
logging.info('start')
|
||||||
# TODO: ShapeInfo donne des résultats faux (deux faces au lieu de une)
|
# TODO: ShapeInfo donne des résultats faux (deux faces au lieu de une)
|
||||||
|
|
||||||
isPart = False
|
orig = dict()
|
||||||
orig = {}
|
|
||||||
for shape in shapes:
|
for shape in shapes:
|
||||||
info = geompy.ShapeInfo(shape)
|
info = geompy.ShapeInfo(shape)
|
||||||
logging.debug("shape info %s", info)
|
logging.debug("shape info %s", info)
|
||||||
for k in ['VERTEX', 'EDGE', 'FACE', 'SOLID']:
|
for type_shape in ['VERTEX', 'EDGE', 'FACE', 'SOLID']:
|
||||||
if k in list(orig.keys()):
|
if type_shape in orig:
|
||||||
orig[k] += info[k]
|
orig[type_shape] += info[type_shape]
|
||||||
else:
|
else:
|
||||||
orig[k] = info[k]
|
orig[type_shape] = info[type_shape]
|
||||||
logging.debug("original shapes info %s", orig)
|
logging.debug("original shapes info %s", orig)
|
||||||
|
|
||||||
info = geompy.ShapeInfo(part)
|
info = geompy.ShapeInfo(part)
|
||||||
logging.debug("partition info %s", info)
|
logging.debug("partition info %s", info)
|
||||||
for k in ['VERTEX', 'EDGE', 'FACE', 'SOLID']:
|
decoupe = False
|
||||||
if orig[k] < info[k]:
|
for type_shape in ['VERTEX', 'EDGE', 'FACE', 'SOLID']:
|
||||||
isPart = True
|
if orig[type_shape] < info[type_shape]:
|
||||||
|
decoupe = True
|
||||||
break
|
break
|
||||||
logging.debug("partition modifie l'original %s", isPart)
|
logging.debug("partition modifie l'original %s", decoupe)
|
||||||
|
|
||||||
return isPart
|
|
||||||
|
|
||||||
|
return decoupe
|
||||||
|
@ -17,25 +17,25 @@
|
|||||||
#
|
#
|
||||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
#
|
#
|
||||||
|
"""subShapes communes à deux listes"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
from .geomsmesh import geompy
|
from .geomsmesh import geompy
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
|
||||||
# --- subShapes communes à deux listes
|
|
||||||
|
|
||||||
def commonSubShapes(obj, sub1, sub2):
|
def commonSubShapes(obj, sub1, sub2):
|
||||||
"""
|
"""liste de subshapes communes"""
|
||||||
liste de subshapes communes
|
|
||||||
"""
|
|
||||||
logging.info("start")
|
logging.info("start")
|
||||||
idsub1 = {}
|
|
||||||
subList = []
|
idsub1 = dict()
|
||||||
for s in sub1:
|
for subshape in sub1:
|
||||||
idsub1[geompy.GetSubShapeID(obj, s)] = s
|
idsub1[geompy.GetSubShapeID(obj, subshape)] = subshape
|
||||||
for s in sub2:
|
|
||||||
idsub = geompy.GetSubShapeID(obj, s)
|
l_subshapes = list()
|
||||||
if idsub in list(idsub1.keys()):
|
for subshape in sub2:
|
||||||
subList.append(s)
|
idsub = geompy.GetSubShapeID(obj, subshape)
|
||||||
logging.debug("subList=%s", subList)
|
if idsub in idsub1:
|
||||||
return subList
|
l_subshapes.append(subshape)
|
||||||
|
|
||||||
|
logging.debug("l_subshapes=%s", l_subshapes)
|
||||||
|
|
||||||
|
return l_subshapes
|
||||||
|
@ -17,36 +17,36 @@
|
|||||||
#
|
#
|
||||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
#
|
#
|
||||||
|
"""compoundFromList"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
from .geomsmesh import geompy
|
from .geomsmesh import geompy
|
||||||
from .geomsmesh import geomPublish
|
from .geomsmesh import geomPublish
|
||||||
from .geomsmesh import geomPublishInFather
|
|
||||||
from . import initLog
|
from . import initLog
|
||||||
|
|
||||||
def compoundFromList(elements, nom=None):
|
def compoundFromList(elements, nom=None):
|
||||||
"""compoundFromList"""
|
"""compoundFromList"""
|
||||||
|
|
||||||
logging.debug('start')
|
logging.debug('start')
|
||||||
|
|
||||||
shapeList = list()
|
l_shapes = list()
|
||||||
for a in elements:
|
for elem in elements:
|
||||||
if not isinstance(a, list):
|
if not isinstance(elem, list):
|
||||||
shapeList.append(a)
|
l_shapes.append(elem)
|
||||||
else:
|
else:
|
||||||
if a[0] is not None:
|
if elem[0] is not None:
|
||||||
shapeList.append(a[0])
|
l_shapes.append(elem[0])
|
||||||
|
|
||||||
if nom is not None:
|
if nom is not None:
|
||||||
for i,a in enumerate(shapeList):
|
for indice, elem in enumerate(l_shapes):
|
||||||
nomi = nom +"%d"%i
|
nomi = nom +"%d"%indice
|
||||||
logging.debug('nom: %s',nomi)
|
logging.debug('nom: %s',nomi)
|
||||||
geomPublish(initLog.debug, a, nomi)
|
geomPublish(initLog.debug, elem, nomi)
|
||||||
|
|
||||||
shapeCompound = None
|
shapeCompound = None
|
||||||
if len(shapeList) > 0:
|
if l_shapes:
|
||||||
shapeCompound =geompy.MakeCompound(shapeList)
|
shapeCompound = geompy.MakeCompound(l_shapes)
|
||||||
nomc = "compound_%s"%nom
|
nomc = "compound_%s"%nom
|
||||||
geomPublish(initLog.debug, shapeCompound, nomc)
|
geomPublish(initLog.debug, shapeCompound, nomc)
|
||||||
|
|
||||||
return shapeCompound
|
return shapeCompound
|
||||||
|
|
||||||
|
@ -20,14 +20,17 @@
|
|||||||
"""procédure complète de construction d'une fissure générale"""
|
"""procédure complète de construction d'une fissure générale"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
from . import initLog
|
||||||
|
|
||||||
import salome
|
import salome
|
||||||
|
from salome.smesh import smeshBuilder
|
||||||
|
import GEOM
|
||||||
|
import SMESH
|
||||||
|
|
||||||
from .geomsmesh import geompy
|
from .geomsmesh import geompy
|
||||||
from .geomsmesh import geomPublishInFather
|
from .geomsmesh import geomPublishInFather
|
||||||
from . import initLog
|
|
||||||
import GEOM
|
|
||||||
from .geomsmesh import smesh
|
from .geomsmesh import smesh
|
||||||
from salome.smesh import smeshBuilder
|
|
||||||
import SMESH
|
|
||||||
|
|
||||||
from .orderEdgesFromWire import orderEdgesFromWire
|
from .orderEdgesFromWire import orderEdgesFromWire
|
||||||
from .restreintFaceFissure import restreintFaceFissure
|
from .restreintFaceFissure import restreintFaceFissure
|
||||||
|
@ -22,13 +22,15 @@
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import salome
|
import salome
|
||||||
from .geomsmesh import geompy
|
|
||||||
import GEOM
|
|
||||||
from .geomsmesh import smesh
|
|
||||||
from salome.smesh import smeshBuilder
|
from salome.smesh import smeshBuilder
|
||||||
|
import GEOM
|
||||||
import SMESH
|
import SMESH
|
||||||
|
|
||||||
|
from .geomsmesh import geompy
|
||||||
|
from .geomsmesh import smesh
|
||||||
|
|
||||||
from .putName import putName
|
from .putName import putName
|
||||||
from .enleveDefaut import enleveDefaut
|
from .enleveDefaut import enleveDefaut
|
||||||
from .shapeSurFissure import shapeSurFissure
|
from .shapeSurFissure import shapeSurFissure
|
||||||
|
@ -17,21 +17,23 @@
|
|||||||
#
|
#
|
||||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
#
|
#
|
||||||
|
"""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)
|
||||||
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
from . import initLog
|
||||||
|
|
||||||
from .geomsmesh import geompy
|
from .geomsmesh import geompy
|
||||||
from .geomsmesh import geomPublish
|
from .geomsmesh import geomPublish
|
||||||
from .geomsmesh import geomPublishInFather
|
from .geomsmesh import geomPublishInFather
|
||||||
from . import initLog
|
|
||||||
from .checkDecoupePartition import checkDecoupePartition
|
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
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):
|
def construitPartitionsPeauFissure(facesDefaut, fissPipe):
|
||||||
"""partition peau défaut - face de fissure prolongée - wire de fond de fissure prolongée.
|
"""partition peau défaut - face de fissure prolongée - wire de fond de fissure prolongée.
|
||||||
@ -47,8 +49,8 @@ def construitPartitionsPeauFissure(facesDefaut, fissPipe):
|
|||||||
ipart = 0
|
ipart = 0
|
||||||
for filling in facesDefaut:
|
for filling in facesDefaut:
|
||||||
part = geompy.MakePartition([fissPipe, filling], list(), list(), list(), geompy.ShapeType["FACE"], 0, list(), 0)
|
part = geompy.MakePartition([fissPipe, filling], list(), list(), list(), geompy.ShapeType["FACE"], 0, list(), 0)
|
||||||
isPart = checkDecoupePartition([fissPipe, filling], part)
|
# on recrée la partition avec toutes les faces filling en outil pour avoir une face de fissure correcte
|
||||||
if isPart: # on recrée la partition avec toutes les faces filling en outil pour avoir une face de fissure correcte
|
if checkDecoupePartition([fissPipe, filling], part):
|
||||||
otherFD = [fd for fd in facesDefaut if fd != filling]
|
otherFD = [fd for fd in facesDefaut if fd != filling]
|
||||||
if otherFD:
|
if otherFD:
|
||||||
fissPipePart = geompy.MakePartition([fissPipe], otherFD, list(), list(), geompy.ShapeType["FACE"], 0, list(), 0)
|
fissPipePart = geompy.MakePartition([fissPipe], otherFD, list(), list(), geompy.ShapeType["FACE"], 0, list(), 0)
|
||||||
|
@ -17,35 +17,34 @@
|
|||||||
#
|
#
|
||||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
#
|
#
|
||||||
|
"""création des points du maillage du pipe sur la face de peau"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
from . import initLog
|
||||||
from .geomsmesh import geompy
|
from .geomsmesh import geompy
|
||||||
from .geomsmesh import geomPublish
|
from .geomsmesh import geomPublish
|
||||||
from .geomsmesh import geomPublishInFather
|
from .geomsmesh import geomPublishInFather
|
||||||
from . import initLog
|
|
||||||
from .projettePointSurCourbe import projettePointSurCourbe
|
from .projettePointSurCourbe import projettePointSurCourbe
|
||||||
|
|
||||||
def creePointsPipePeau(listEdges, idFacesDebouchantes, idFillingFromBout,
|
def creePointsPipePeau(listEdges, idFacesDebouchantes, idFillingFromBout,
|
||||||
ptEdgeFond, ptFisExtPi, edCircPeau, gptsdisks, idisklim, nbsegRad):
|
ptEdgeFond, ptFisExtPi, edCircPeau, gptsdisks, idisklim, nbsegRad):
|
||||||
"""
|
"""création des points du maillage du pipe sur la face de peau"""
|
||||||
création des points du maillage du pipe sur la face de peau
|
|
||||||
"""
|
|
||||||
logging.info('start')
|
logging.info('start')
|
||||||
|
|
||||||
for i, edges in enumerate(listEdges):
|
for n_edges, edges in enumerate(listEdges):
|
||||||
idf = idFacesDebouchantes[i] # indice de face débouchante (facesPipePeau)
|
idf = idFacesDebouchantes[n_edges] # indice de face débouchante (facesPipePeau)
|
||||||
if idf >= 0:
|
if idf >= 0:
|
||||||
gptdsk = []
|
gptdsk = list()
|
||||||
if idf > 0: # idf vaut 0 ou 1
|
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)
|
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]
|
centre = ptEdgeFond[idFillingFromBout[n_edges]][idf]
|
||||||
name = "centre%d"%idf
|
name = "centre%d"%idf
|
||||||
geomPublish(initLog.debug, centre, name)
|
geomPublish(initLog.debug, centre, name)
|
||||||
vertPipePeau = ptFisExtPi[idFillingFromBout[i]][idf]
|
vertPipePeau = ptFisExtPi[idFillingFromBout[n_edges]][idf]
|
||||||
geomPublishInFather(initLog.debug, centre, vertPipePeau, "vertPipePeau")
|
geomPublishInFather(initLog.debug, centre, vertPipePeau, "vertPipePeau")
|
||||||
grpsEdgesCirc = edCircPeau[idFillingFromBout[i]] # liste de groupes
|
grpsEdgesCirc = edCircPeau[idFillingFromBout[n_edges]] # liste de groupes
|
||||||
edgesCirc = []
|
edgesCirc = list()
|
||||||
for grpEdgesCirc in grpsEdgesCirc:
|
for grpEdgesCirc in grpsEdgesCirc:
|
||||||
edgesCirc += geompy.ExtractShapes(grpEdgesCirc, geompy.ShapeType["EDGE"], False)
|
edgesCirc += geompy.ExtractShapes(grpEdgesCirc, geompy.ShapeType["EDGE"], False)
|
||||||
for k, edge in enumerate(edges):
|
for k, edge in enumerate(edges):
|
||||||
@ -59,32 +58,31 @@ def creePointsPipePeau(listEdges, idFacesDebouchantes, idFillingFromBout,
|
|||||||
distEdgeCirc = [(geompy.MinDistance(bout, edgeCirc), k2, edgeCirc) for k2, edgeCirc in enumerate(edgesCirc)]
|
distEdgeCirc = [(geompy.MinDistance(bout, edgeCirc), k2, edgeCirc) for k2, edgeCirc in enumerate(edgesCirc)]
|
||||||
distEdgeCirc.sort()
|
distEdgeCirc.sort()
|
||||||
logging.debug("distEdgeCirc: %s", distEdgeCirc)
|
logging.debug("distEdgeCirc: %s", distEdgeCirc)
|
||||||
u = projettePointSurCourbe(bout, distEdgeCirc[0][2])
|
dist = 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.
|
if (abs(dist) < 0.02) or (abs(1.-dist) < 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)
|
extrCircs = geompy.ExtractShapes(distEdgeCirc[0][2], geompy.ShapeType["VERTEX"], True)
|
||||||
if geompy.MinDistance(bout, extrCircs[0]) < geompy.MinDistance(bout, extrCircs[1]):
|
if geompy.MinDistance(bout, extrCircs[0]) < geompy.MinDistance(bout, extrCircs[1]):
|
||||||
bout = extrCircs[0]
|
bout = extrCircs[0]
|
||||||
else:
|
else:
|
||||||
bout = extrCircs[1]
|
bout = extrCircs[1]
|
||||||
else:
|
else:
|
||||||
bout = geompy.MakeVertexOnCurve(distEdgeCirc[0][2], u)
|
bout = geompy.MakeVertexOnCurve(distEdgeCirc[0][2], dist)
|
||||||
name ="bout%d"%k
|
name ="bout%d"%k
|
||||||
geomPublishInFather(initLog.debug, centre, bout, name)
|
geomPublishInFather(initLog.debug, centre, bout, name)
|
||||||
# enregistrement des points dans la structure
|
# enregistrement des points dans la structure
|
||||||
points = []
|
points = list()
|
||||||
for j in range(nbsegRad +1):
|
for n_seg in range(nbsegRad +1):
|
||||||
u = j/float(nbsegRad)
|
points.append(geompy.MakeVertexOnCurve(edge, float(n_seg)/float(nbsegRad)))
|
||||||
points.append(geompy.MakeVertexOnCurve(edge, u))
|
|
||||||
if geompy.MinDistance(bout, points[0]) < geompy.MinDistance(centre, points[0]):
|
if geompy.MinDistance(bout, points[0]) < geompy.MinDistance(centre, points[0]):
|
||||||
points.reverse()
|
points.reverse()
|
||||||
points[0] = centre
|
points[0] = centre
|
||||||
points[-1] = bout
|
points[-1] = bout
|
||||||
gptdsk.append(points)
|
gptdsk.append(points)
|
||||||
if i == 0:
|
if n_edges == 0:
|
||||||
gptsdisks[idisklim[0] -1] = gptdsk
|
gptsdisks[idisklim[0] -1] = gptdsk
|
||||||
idisklim[0] = idisklim[0] -1
|
idisklim[0] = idisklim[0] -1
|
||||||
else:
|
else:
|
||||||
gptsdisks[idisklim[1] +1] = gptdsk
|
gptsdisks[idisklim[1] +1] = gptdsk
|
||||||
idisklim[1] = idisklim[1] +1
|
idisklim[1] = idisklim[1] +1
|
||||||
|
|
||||||
return (gptsdisks, idisklim)
|
return (gptsdisks, idisklim)
|
||||||
|
@ -17,14 +17,16 @@
|
|||||||
#
|
#
|
||||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
#
|
#
|
||||||
|
"""TODO: a compléter"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
from .geomsmesh import smesh
|
|
||||||
import SMESH
|
import SMESH
|
||||||
import SALOMEDS
|
import SALOMEDS
|
||||||
|
|
||||||
|
from .geomsmesh import smesh
|
||||||
|
|
||||||
from .creeZoneDefautMaillage import creeZoneDefautMaillage
|
from .creeZoneDefautMaillage import creeZoneDefautMaillage
|
||||||
from .peauInterne import peauInterne
|
from .peauInterne import peauInterne
|
||||||
from .quadranglesToShapeNoCorner import quadranglesToShapeNoCorner
|
from .quadranglesToShapeNoCorner import quadranglesToShapeNoCorner
|
||||||
@ -32,10 +34,7 @@ from .creeZoneDefautFilling import creeZoneDefautFilling
|
|||||||
from .creeZoneDefautGeom import creeZoneDefautGeom
|
from .creeZoneDefautGeom import creeZoneDefautGeom
|
||||||
from .getCentreFondFiss import getCentreFondFiss
|
from .getCentreFondFiss import getCentreFondFiss
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
def creeZoneDefautDansObjetSain(geometriesSaines, maillagesSains, shapesFissure, \
|
||||||
# ---
|
|
||||||
|
|
||||||
def creeZoneDefautDansObjetSain(geometriesSaines, maillagesSains, shapesFissure,
|
|
||||||
shapeFissureParams, maillageFissureParams):
|
shapeFissureParams, maillageFissureParams):
|
||||||
"""
|
"""
|
||||||
#TODO: a compléter
|
#TODO: a compléter
|
||||||
@ -65,11 +64,10 @@ def creeZoneDefautDansObjetSain(geometriesSaines, maillagesSains, shapesFissure,
|
|||||||
nomFicSain = maillageFissureParams['nomFicSain']
|
nomFicSain = maillageFissureParams['nomFicSain']
|
||||||
|
|
||||||
fichierMaillageSain = os.path.join (nomRep , '{}.med'.format(nomFicSain))
|
fichierMaillageSain = os.path.join (nomRep , '{}.med'.format(nomFicSain))
|
||||||
|
|
||||||
# --- centre de fond de fissure et tangente
|
# --- centre de fond de fissure et tangente
|
||||||
|
|
||||||
edgeFondExt, centreFondFiss, tgtCentre = getCentreFondFiss(shapesFissure)
|
edgeFondExt, centreFondFiss, tgtCentre = getCentreFondFiss(shapesFissure)
|
||||||
|
|
||||||
|
|
||||||
# --- zone de défaut
|
# --- zone de défaut
|
||||||
nomZones = "zoneDefaut"
|
nomZones = "zoneDefaut"
|
||||||
@ -89,9 +87,9 @@ def creeZoneDefautDansObjetSain(geometriesSaines, maillagesSains, shapesFissure,
|
|||||||
isPlane = False
|
isPlane = False
|
||||||
if isHexa and not isPlane:
|
if isHexa and not isPlane:
|
||||||
meshQuad = smesh.CopyMesh( zoneDefaut_skin, 'meshQuad', 0, 0)
|
meshQuad = smesh.CopyMesh( zoneDefaut_skin, 'meshQuad', 0, 0)
|
||||||
|
|
||||||
fillings, noeuds_bords, bordsPartages, fillconts, idFilToCont = quadranglesToShapeNoCorner(meshQuad, shapeFissureParams, centreFondFiss)
|
fillings, _, bordsPartages, fillconts, idFilToCont = quadranglesToShapeNoCorner(meshQuad, shapeFissureParams, centreFondFiss)
|
||||||
|
|
||||||
for filling in fillings:
|
for filling in fillings:
|
||||||
[faceDefaut, centreDefaut, normalDefaut, extrusionDefaut] = \
|
[faceDefaut, centreDefaut, normalDefaut, extrusionDefaut] = \
|
||||||
creeZoneDefautFilling(filling, shapeDefaut, lgExtrusion)
|
creeZoneDefautFilling(filling, shapeDefaut, lgExtrusion)
|
||||||
@ -101,14 +99,15 @@ def creeZoneDefautDansObjetSain(geometriesSaines, maillagesSains, shapesFissure,
|
|||||||
extrusionsDefaut.append(extrusionDefaut)
|
extrusionsDefaut.append(extrusionDefaut)
|
||||||
else:
|
else:
|
||||||
[facesDefaut, centreDefaut, normalDefaut, extrusionDefaut] = \
|
[facesDefaut, centreDefaut, normalDefaut, extrusionDefaut] = \
|
||||||
creeZoneDefautGeom( geometrieSaine, shapeDefaut, origShapes, verticesShapes, dmoyen, lgExtrusion)
|
creeZoneDefautGeom( geometrieSaine, shapeDefaut, origShapes, verticesShapes, lgExtrusion)
|
||||||
bordsPartages = list()
|
bordsPartages = list()
|
||||||
for face in facesDefaut:
|
for _ in facesDefaut:
|
||||||
bordsPartages.append([None,None]) # TODO : traitement des arêtes vives ?
|
bordsPartages.append([None,None]) # TODO : traitement des arêtes vives ?
|
||||||
fillconts = facesDefaut
|
fillconts = facesDefaut
|
||||||
idFilToCont = list(range(len(facesDefaut)))
|
idFilToCont = list(range(len(facesDefaut)))
|
||||||
|
|
||||||
return [facesDefaut, centresDefaut, normalsDefaut, extrusionsDefaut, dmoyen, bordsPartages, fillconts, idFilToCont,
|
return [facesDefaut, centresDefaut, normalsDefaut, extrusionsDefaut, \
|
||||||
maillageSain, internalBoundary, zoneDefaut, zoneDefaut_skin, zoneDefaut_internalFaces, zoneDefaut_internalEdges,
|
dmoyen, bordsPartages, fillconts, idFilToCont, \
|
||||||
|
maillageSain, internalBoundary, \
|
||||||
|
zoneDefaut, zoneDefaut_skin, zoneDefaut_internalFaces, zoneDefaut_internalEdges, \
|
||||||
edgeFondExt, centreFondFiss, tgtCentre]
|
edgeFondExt, centreFondFiss, tgtCentre]
|
||||||
|
|
||||||
|
@ -17,20 +17,20 @@
|
|||||||
#
|
#
|
||||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
#
|
#
|
||||||
|
"""Crée zone géométrique défaut a partir d'un filling"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
from . import initLog
|
||||||
|
|
||||||
from .geomsmesh import geompy
|
from .geomsmesh import geompy
|
||||||
from .geomsmesh import geomPublish
|
from .geomsmesh import geomPublish
|
||||||
from .geomsmesh import geomPublishInFather
|
from .geomsmesh import geomPublishInFather
|
||||||
from . import initLog
|
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
|
||||||
# --- crée zone géométrique défaut a partir d'un filling
|
|
||||||
|
|
||||||
def creeZoneDefautFilling(filling, shapeDefaut, lgExtrusion=50):
|
def creeZoneDefautFilling(filling, shapeDefaut, lgExtrusion=50):
|
||||||
"""
|
"""Construction CAO de la zone à remailler, quand on utilise un filling,
|
||||||
Construction CAO de la zone à remailler, quand on utilise un filling,
|
|
||||||
après appel creeZoneDefautMaillage et quadranglesToShapeNoCorner
|
après appel creeZoneDefautMaillage et quadranglesToShapeNoCorner
|
||||||
|
|
||||||
@param filling : la CAO de la peau du défaut reconstituée
|
@param filling : la CAO de la peau du défaut reconstituée
|
||||||
@param shapeDefaut : objet géométrique représentant la fissure
|
@param shapeDefaut : objet géométrique représentant la fissure
|
||||||
(selon les cas, un point central, ou une shape plus complexe,
|
(selon les cas, un point central, ou une shape plus complexe,
|
||||||
|
@ -20,23 +20,21 @@
|
|||||||
"""Zone de défaut, constructions géométrique avec CAO d'origine"""
|
"""Zone de défaut, constructions géométrique avec CAO d'origine"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
from . import initLog
|
||||||
|
|
||||||
from .geomsmesh import geompy
|
from .geomsmesh import geompy
|
||||||
from .geomsmesh import geomPublish
|
from .geomsmesh import geomPublish
|
||||||
from .geomsmesh import geomPublishInFather
|
|
||||||
from . import initLog
|
|
||||||
from .prolongeVertices import prolongeVertices
|
from .prolongeVertices import prolongeVertices
|
||||||
|
|
||||||
def creeZoneDefautGeom(objetSain, shapeDefaut, origShapes, verticesShapes, dmoyen, lgExtrusion=50):
|
def creeZoneDefautGeom(objetSain, shapeDefaut, origShapes, verticesShapes, lgExtrusion=50):
|
||||||
"""
|
"""Construction CAO de la zone à remailler, quand on utilise la CAO d'origine,apres appel creeZoneDefautMaillage
|
||||||
Construction CAO de la zone à remailler, quand on utilise la CAO d'origine,
|
|
||||||
apres appel creeZoneDefautMaillage
|
|
||||||
@param objetSain : la géometrie de l'objet initial
|
@param objetSain : la géometrie de l'objet initial
|
||||||
@param shapeDefaut : objet géometrique représentant la fissure
|
@param shapeDefaut : objet géometrique représentant la fissure
|
||||||
(selon les cas, un point central, ou une shape plus complexe,
|
(selon les cas, un point central, ou une shape plus complexe,
|
||||||
dont on ne garde que les vertices)
|
dont on ne garde que les vertices)
|
||||||
@param origShapes : liste id subShapes
|
@param origShapes : liste id subShapes
|
||||||
@param verticesShapes : listes noeuds de bord
|
@param verticesShapes : listes noeuds de bord
|
||||||
@param dmoyen : longueur arete moyenne bord
|
|
||||||
@lgExtrusion : distance d'extrusion de la face du defaut
|
@lgExtrusion : distance d'extrusion de la face du defaut
|
||||||
(ne vaut que pour des fissures courtes)
|
(ne vaut que pour des fissures courtes)
|
||||||
@return (facesDefaut, centreDefaut, normalDefaut, extrusionDefaut)
|
@return (facesDefaut, centreDefaut, normalDefaut, extrusionDefaut)
|
||||||
@ -182,9 +180,8 @@ def creeZoneDefautGeom(objetSain, shapeDefaut, origShapes, verticesShapes, dmoye
|
|||||||
minDist = min(distances)
|
minDist = min(distances)
|
||||||
for indice, dist in enumerate(distances):
|
for indice, dist in enumerate(distances):
|
||||||
if dist == minDist:
|
if dist == minDist:
|
||||||
indice0 = indice
|
theShellDefaut = shells[indice]
|
||||||
break
|
break
|
||||||
theShellDefaut = shells[indice0]
|
|
||||||
#
|
#
|
||||||
else: # --- une seule face de defaut
|
else: # --- une seule face de defaut
|
||||||
subFaces = [facesDefaut]
|
subFaces = [facesDefaut]
|
||||||
|
@ -17,16 +17,17 @@
|
|||||||
#
|
#
|
||||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
#
|
#
|
||||||
|
"""Zone de defaut extraite du maillage"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
from .geomsmesh import geompy
|
|
||||||
import math
|
import math
|
||||||
from .distance2 import distance2
|
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
|
from .geomsmesh import geompy
|
||||||
|
from .distance2 import distance2
|
||||||
from .fissError import fissError
|
from .fissError import fissError
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# --- zone de defaut extraite du maillage
|
|
||||||
|
|
||||||
def creeZoneDefautMaillage(maillagesSains, shapeDefaut, tailleDefaut,
|
def creeZoneDefautMaillage(maillagesSains, shapeDefaut, tailleDefaut,
|
||||||
nomZones, coordsNoeudsFissure):
|
nomZones, coordsNoeudsFissure):
|
||||||
@ -45,12 +46,13 @@ def creeZoneDefautMaillage(maillagesSains, shapeDefaut, tailleDefaut,
|
|||||||
@return (origShapes, verticesShapes, dmoyen) liste id subShapes, listes noeuds de bord, longueur arête moyenne bord
|
@return (origShapes, verticesShapes, dmoyen) liste id subShapes, listes noeuds de bord, longueur arête moyenne bord
|
||||||
"""
|
"""
|
||||||
logging.info("start")
|
logging.info("start")
|
||||||
logging.debug("distance d'influence (tailleDefaut) = %f" % tailleDefaut)
|
texte = "distance d'influence (tailleDefaut) = {}".format(tailleDefaut)
|
||||||
|
logging.debug(texte)
|
||||||
#print (" shapeDefaut : {}".format(shapeDefaut))
|
#print (" shapeDefaut : {}".format(shapeDefaut))
|
||||||
#print (" nomZones : {}".format(nomZones))
|
#print (" nomZones : {}".format(nomZones))
|
||||||
|
|
||||||
maillageSain = maillagesSains[0]
|
maillageSain = maillagesSains[0]
|
||||||
isHexa = maillagesSains[1]
|
#isHexa = maillagesSains[1]
|
||||||
lists = maillageSain.CreateHoleSkin(tailleDefaut, shapeDefaut, nomZones, coordsNoeudsFissure)
|
lists = maillageSain.CreateHoleSkin(tailleDefaut, shapeDefaut, nomZones, coordsNoeudsFissure)
|
||||||
|
|
||||||
#print("lists = {}".format(lists))
|
#print("lists = {}".format(lists))
|
||||||
@ -59,8 +61,8 @@ def creeZoneDefautMaillage(maillagesSains, shapeDefaut, tailleDefaut,
|
|||||||
origShapes = list()
|
origShapes = list()
|
||||||
verticesShapes = list()
|
verticesShapes = list()
|
||||||
|
|
||||||
cumul = 0. # somme des distances carrées entre point ordonnés (taille des arêtes)
|
cumul = 0. # somme des distances carrées entre points ordonnés (taille des arêtes)
|
||||||
nb = 0 # nombre d'arêtes évaluées
|
nbar = 0 # nombre d'arêtes évaluées
|
||||||
|
|
||||||
for aList in lists:
|
for aList in lists:
|
||||||
aShape = aList[0]
|
aShape = aList[0]
|
||||||
@ -77,17 +79,18 @@ def creeZoneDefautMaillage(maillagesSains, shapeDefaut, tailleDefaut,
|
|||||||
xyz0 = xyz
|
xyz0 = xyz
|
||||||
#logging.debug(" node %s %s", node, xyz)
|
#logging.debug(" node %s %s", node, xyz)
|
||||||
vertices.append(geompy.MakeVertex(xyz[0], xyz[1], xyz[2]))
|
vertices.append(geompy.MakeVertex(xyz[0], xyz[1], xyz[2]))
|
||||||
nb += len(aList) - 2
|
nbar += len(aList) - 2
|
||||||
verticesShapes.append(vertices)
|
verticesShapes.append(vertices)
|
||||||
#print ("nb = {}".format(nb))
|
#print ("nbar = {}".format(nbar))
|
||||||
#print ("cumul = {}".format(cumul))
|
#print ("cumul = {}".format(cumul))
|
||||||
|
|
||||||
if (nb == 0):
|
if (nbar == 0):
|
||||||
texte = "La zone à remailler n'est pas détectée correctement.<br>"
|
texte = "La zone à remailler n'est pas détectée correctement.<br>"
|
||||||
texte += "Cause possible :<ul>"
|
texte += "Cause possible :<ul>"
|
||||||
texte += "<li>La distance d'influence est trop petite. "
|
texte += "<li>La distance d'influence est trop petite. "
|
||||||
texte += "L'ordre de grandeur minimal correspond à la taille des mailles du maillage sain dans la zone à remailler.</li></ul>"
|
texte += "L'ordre de grandeur minimal correspond à la taille des mailles du maillage sain dans la zone à remailler.</li></ul>"
|
||||||
raise fissError(traceback.extract_stack(),texte)
|
raise fissError(traceback.extract_stack(),texte)
|
||||||
|
|
||||||
dmoyen = math.sqrt(cumul/float(nb)) # ~ taille de l'arête moyenne du maillage global
|
dmoyen = math.sqrt(cumul/float(nbar)) # ~ taille de l'arête moyenne du maillage global
|
||||||
|
|
||||||
return origShapes, verticesShapes, dmoyen
|
return origShapes, verticesShapes, dmoyen
|
||||||
|
@ -17,38 +17,40 @@
|
|||||||
#
|
#
|
||||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
#
|
#
|
||||||
|
"""calcul du carré de la distance entre deux points"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# --- calcul de distance carree entre deux points, jeux de coordonnees x,y,z
|
# ---
|
||||||
|
|
||||||
def distance2(xyz1, xyz2):
|
def distance2(xyz1, xyz2):
|
||||||
"""
|
"""
|
||||||
carré de la distance entre deux points donnés par des triplets [x,y,z]
|
carré de la distance entre deux points donnés par des triplets [x,y,z]
|
||||||
"""
|
"""
|
||||||
#logging.info("start")
|
#logging.info("start")
|
||||||
|
|
||||||
d2 = 0
|
|
||||||
for i in range(3):
|
|
||||||
d2 += (xyz1[i]-xyz2[i])*(xyz1[i]-xyz2[i])
|
|
||||||
logging.debug('d2=%s', d2)
|
|
||||||
return d2
|
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
dcarre = 0
|
||||||
# --- test unitaire
|
for ijk in range(3):
|
||||||
|
dcarre += (xyz1[ijk]-xyz2[ijk])*(xyz1[ijk]-xyz2[ijk])
|
||||||
|
logging.debug('dcarre=%s', dcarre)
|
||||||
|
|
||||||
import unittest
|
return dcarre
|
||||||
class Test_distance2(unittest.TestCase):
|
|
||||||
|
|
||||||
def setUp(self):
|
## -----------------------------------------------------------------------------
|
||||||
self.a=[0, 0, 0]
|
## --- test unitaire
|
||||||
self.b=[3, 4, 5]
|
|
||||||
self.c=[-5,-4,-3]
|
#import unittest
|
||||||
|
#class Test_distance2(unittest.TestCase):
|
||||||
def test_calcul(self):
|
#"""test de la fonction"""
|
||||||
self.assertEqual(distance2(self.a, self.b), distance2(self.b, self.a))
|
|
||||||
self.assertEqual(distance2(self.a, self.b), distance2(self.a, self.c))
|
#def setUp(self):
|
||||||
self.assertEqual(distance2(self.b, self.b), 0)
|
#self.a=[0, 0, 0]
|
||||||
self.assertEqual(distance2(self.a, self.b), 50)
|
#self.b=[3, 4, 5]
|
||||||
|
#self.c=[-5,-4,-3]
|
||||||
|
|
||||||
|
#def test_calcul(self):
|
||||||
|
#self.assertEqual(distance2(self.a, self.b), distance2(self.b, self.a))
|
||||||
|
#self.assertEqual(distance2(self.a, self.b), distance2(self.a, self.c))
|
||||||
|
#self.assertEqual(distance2(self.b, self.b), 0)
|
||||||
|
#self.assertEqual(distance2(self.a, self.b), 50)
|
||||||
|
@ -17,26 +17,28 @@
|
|||||||
#
|
#
|
||||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
#
|
#
|
||||||
|
"""éliminer les doublons d'une liste de subshapes"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
from .geomsmesh import geompy
|
from .geomsmesh import geompy
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# --- éliminer les doublons d'une liste de subshapes
|
# ---
|
||||||
|
|
||||||
def eliminateDoubles(obj, subshapes):
|
def eliminateDoubles(obj, subshapes):
|
||||||
"""
|
"""éliminer les doublons d'une liste de subshapes"""
|
||||||
éliminer les doublons d'une liste de subshapes
|
|
||||||
"""
|
idsubs = dict()
|
||||||
idsubs = {}
|
|
||||||
for sub in subshapes:
|
for sub in subshapes:
|
||||||
subid = geompy.GetSubShapeID(obj, sub)
|
subid = geompy.GetSubShapeID(obj, sub)
|
||||||
if subid in list(idsubs.keys()):
|
if subid in idsubs:
|
||||||
idsubs[subid].append(sub)
|
idsubs[subid].append(sub)
|
||||||
else:
|
else:
|
||||||
idsubs[subid] = [sub]
|
idsubs[subid] = [sub]
|
||||||
shortList = []
|
|
||||||
for k, v in idsubs.items():
|
shortList = list()
|
||||||
shortList.append(v[0])
|
for l_sub in idsubs.items():
|
||||||
|
shortList.append(l_sub[0])
|
||||||
logging.debug("shortList=%s", shortList)
|
logging.debug("shortList=%s", shortList)
|
||||||
|
|
||||||
return shortList
|
return shortList
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#
|
#
|
||||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
#
|
#
|
||||||
|
"""Recherche des points en trop (externes au volume à remailler)"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
@ -24,33 +25,34 @@ from .geomsmesh import geompy
|
|||||||
from .whichSideVertex import whichSideVertex
|
from .whichSideVertex import whichSideVertex
|
||||||
|
|
||||||
def elimineExtremitesPipe(ptEdgeFond, facesDefaut, centres, gptsdisks, nbsegCercle):
|
def elimineExtremitesPipe(ptEdgeFond, facesDefaut, centres, gptsdisks, nbsegCercle):
|
||||||
"""
|
"""Recherche des points en trop (externes au volume à remailler)
|
||||||
recherche des points en trop (externes au volume à remailler)
|
|
||||||
- on associe chaque extrémité du pipe à une face filling
|
- on associe chaque extrémité du pipe à une face filling
|
||||||
- on part des disques aux extrémités du pipe
|
- on part des disques aux extrémités du pipe
|
||||||
- pour chaque disque, on prend les vertices de géométrie,
|
- pour chaque disque, on prend les vertices de géométrie,
|
||||||
on marque leur position relative à la face.
|
on marque leur position relative à la face.
|
||||||
- on s'arrete quand tous les noeuds sont dedans
|
- on s'arrete quand tous les noeuds sont dedans
|
||||||
"""
|
"""
|
||||||
|
|
||||||
logging.info('start')
|
logging.info('start')
|
||||||
|
|
||||||
pt0 = centres[0]
|
point_0 = centres[0]
|
||||||
pt1 = centres[-1]
|
point_1 = centres[-1]
|
||||||
idFillingFromBout = [None, None] # contiendra l'index du filling pour les extrémités 0 et 1
|
idFillingFromBout = [None, None] # contiendra l'index du filling pour les extrémités 0 et 1
|
||||||
nbFacesFilling = len(ptEdgeFond)
|
nbFacesFilling = len(ptEdgeFond)
|
||||||
for ifil in range(nbFacesFilling):
|
for ifil in range(nbFacesFilling):
|
||||||
for ipt, pt in enumerate(ptEdgeFond[ifil]): # il y a un ou deux points débouchant sur cette face
|
for point in 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...
|
if geompy.MinDistance(point,point_0) < geompy.MinDistance(point,point_1): # TODO: trouver plus fiable pour les cas tordus...
|
||||||
idFillingFromBout[0] = ifil
|
idFillingFromBout[0] = ifil
|
||||||
else:
|
else:
|
||||||
idFillingFromBout[1] = ifil
|
idFillingFromBout[1] = ifil
|
||||||
logging.debug("association bouts du pipe - faces de filling: %s", idFillingFromBout)
|
logging.debug("association bouts du pipe - faces de filling: %s", idFillingFromBout)
|
||||||
|
|
||||||
logging.debug("recherche des disques de noeuds complètement internes")
|
logging.debug("recherche des disques de noeuds complètement internes")
|
||||||
idisklim = [] # indices des premier et dernier disques internes
|
idisklim = list() # indices des premier et dernier disques internes
|
||||||
idiskout = [] # indices des premier et dernier disques externes
|
idiskout = list() # indices des premier et dernier disques externes
|
||||||
for bout in range(2):
|
for bout in range(2):
|
||||||
|
|
||||||
if bout == 0:
|
if bout == 0:
|
||||||
idisk = -1
|
idisk = -1
|
||||||
inc = 1
|
inc = 1
|
||||||
@ -59,26 +61,28 @@ def elimineExtremitesPipe(ptEdgeFond, facesDefaut, centres, gptsdisks, nbsegCerc
|
|||||||
idisk = len(gptsdisks)
|
idisk = len(gptsdisks)
|
||||||
inc = -1
|
inc = -1
|
||||||
numout = len(gptsdisks)
|
numout = len(gptsdisks)
|
||||||
|
|
||||||
inside = False
|
inside = False
|
||||||
outside = True
|
outside = True
|
||||||
while not inside:
|
while not inside:
|
||||||
idisk = idisk + inc
|
idisk += inc
|
||||||
logging.debug("examen disque %s", idisk)
|
logging.debug("examen disque %s", idisk)
|
||||||
gptdsk = gptsdisks[idisk]
|
gptdsk = gptsdisks[idisk]
|
||||||
inside = True
|
inside = True
|
||||||
for k in range(nbsegCercle):
|
for n_seg in range(nbsegCercle):
|
||||||
points = gptdsk[k]
|
points = gptdsk[n_seg]
|
||||||
for j, pt in enumerate(points):
|
for point in points:
|
||||||
side = whichSideVertex(facesDefaut[idFillingFromBout[bout]], pt)
|
side = whichSideVertex(facesDefaut[idFillingFromBout[bout]], point)
|
||||||
if side < 0:
|
if side < 0:
|
||||||
if outside: # premier point detecté dedans
|
if outside: # premier point detecté dedans
|
||||||
outside = False
|
outside = False
|
||||||
numout = idisk -inc # le disque précédent était dehors
|
numout = idisk -inc # le disque précédent était dehors
|
||||||
else:
|
else:
|
||||||
inside = False # ce point est dehors
|
inside = False # ce point est dehors
|
||||||
if not inside and not outside:
|
if not inside and not outside:
|
||||||
break
|
break
|
||||||
|
|
||||||
idisklim.append(idisk) # premier et dernier disques internes
|
idisklim.append(idisk) # premier et dernier disques internes
|
||||||
idiskout.append(numout) # premier et dernier disques externes
|
idiskout.append(numout) # premier et dernier disques externes
|
||||||
|
|
||||||
return (idFillingFromBout, idisklim, idiskout)
|
return (idFillingFromBout, idisklim, idiskout)
|
||||||
|
@ -17,26 +17,25 @@
|
|||||||
#
|
#
|
||||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
#
|
#
|
||||||
|
"""ellipsoide defaut"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import math
|
import math
|
||||||
|
|
||||||
from .geomsmesh import geompy
|
from .geomsmesh import geompy
|
||||||
from .triedreBase import triedreBase
|
from .triedreBase import triedreBase
|
||||||
|
|
||||||
O, OX, OY, OZ = triedreBase()
|
O, OX, OY, OZ = triedreBase()
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
def ellipsoideDefaut(minRad,allonge):
|
||||||
# --- ellipsoide defaut
|
"""Le bloc contenant la fissure est un ellipsoide construit centre a l'origine,
|
||||||
|
|
||||||
def ellipsoideDefaut(minRad,allonge,rayTore):
|
|
||||||
"""
|
|
||||||
Le bloc contenant la fissure est un ellipsoide construit centre a l'origine,
|
|
||||||
contenant le tore elliptique de fissure
|
contenant le tore elliptique de fissure
|
||||||
|
|
||||||
@param minRad :petit rayon
|
@param minRad :petit rayon
|
||||||
@param allonge :rapport grand rayon / petit rayon
|
@param allonge :rapport grand rayon / petit rayon
|
||||||
@param rayTore :rayon du tore construit autour de la generatrice de l'ellipse
|
|
||||||
@return ellipsoide (geomObject)
|
@return ellipsoide (geomObject)
|
||||||
"""
|
"""
|
||||||
logging.info("start")
|
logging.info("start")
|
||||||
boule = geompy.MakeSphereR(2)
|
boule = geompy.MakeSphereR(2)
|
||||||
bouler = geompy.MakeRotation(boule, OY, math.pi/2.0)
|
bouler = geompy.MakeRotation(boule, OY, math.pi/2.0)
|
||||||
face = geompy.MakeFaceHW(100, 100, 3)
|
face = geompy.MakeFaceHW(100, 100, 3)
|
||||||
|
@ -17,26 +17,29 @@
|
|||||||
#
|
#
|
||||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
#
|
#
|
||||||
|
"""maillage sain sans la zone de défaut"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
|
||||||
# --- maillage sain sans la zone defaut
|
|
||||||
|
|
||||||
def enleveDefaut(maillageSain, zoneDefaut, zoneDefaut_skin, zoneDefaut_internalFaces, zoneDefaut_internalEdges):
|
def enleveDefaut(maillageSain, zoneDefaut, zoneDefaut_skin, zoneDefaut_internalFaces, zoneDefaut_internalEdges):
|
||||||
"""
|
"""Maillage sain sans la zone de défaut
|
||||||
Maillage sain sans la zone de defaut
|
|
||||||
TODO: a completer
|
TODO: a completer
|
||||||
"""
|
"""
|
||||||
logging.info('start')
|
logging.info('start')
|
||||||
|
|
||||||
maillageSain.RemoveGroupWithContents(zoneDefaut)
|
maillageSain.RemoveGroupWithContents(zoneDefaut)
|
||||||
|
|
||||||
if zoneDefaut_skin is not None:
|
if zoneDefaut_skin is not None:
|
||||||
maillageSain.RemoveGroupWithContents(zoneDefaut_skin)
|
maillageSain.RemoveGroupWithContents(zoneDefaut_skin)
|
||||||
|
|
||||||
if zoneDefaut_internalFaces is not None:
|
if zoneDefaut_internalFaces is not None:
|
||||||
maillageSain.RemoveGroupWithContents(zoneDefaut_internalFaces)
|
maillageSain.RemoveGroupWithContents(zoneDefaut_internalFaces)
|
||||||
|
|
||||||
if zoneDefaut_internalEdges is not None:
|
if zoneDefaut_internalEdges is not None:
|
||||||
maillageSain.RemoveGroupWithContents(zoneDefaut_internalEdges)
|
maillageSain.RemoveGroupWithContents(zoneDefaut_internalEdges)
|
||||||
nbRemoved = maillageSain.RemoveOrphanNodes()
|
|
||||||
return maillageSain
|
|
||||||
|
|
||||||
|
_ = maillageSain.RemoveOrphanNodes()
|
||||||
|
|
||||||
|
return maillageSain
|
||||||
|
@ -17,17 +17,14 @@
|
|||||||
#
|
#
|
||||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
#
|
#
|
||||||
|
"""Renvoie l'extraction des shapes d'un objet selon leur position par rapport à la face"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from .geomsmesh import geompy
|
from .geomsmesh import geompy
|
||||||
from .geomsmesh import geomPublish
|
|
||||||
from .geomsmesh import geomPublishInFather
|
|
||||||
from . import initLog
|
|
||||||
|
|
||||||
from .whichSide import whichSide
|
from .whichSide import whichSide
|
||||||
|
from .extractionOrientee_a import extractionOrientee_a
|
||||||
# -----------------------------------------------------------------------------
|
|
||||||
# --- renvoie l'extraction des shapes d'un objet selon leur position par rapport à la face.
|
|
||||||
|
|
||||||
def extractionOrientee(face, obj, ref, shapeType, tol, prefix=""):
|
def extractionOrientee(face, obj, ref, shapeType, tol, prefix=""):
|
||||||
"""
|
"""
|
||||||
@ -37,36 +34,22 @@ def extractionOrientee(face, obj, ref, shapeType, tol, prefix=""):
|
|||||||
"""
|
"""
|
||||||
logging.info('start')
|
logging.info('start')
|
||||||
trace = True
|
trace = True
|
||||||
sideRef = whichSide(face, ref)
|
side_ref = whichSide(face, ref)
|
||||||
logging.debug("ref side %s", sideRef)
|
logging.debug("ref side %s", side_ref)
|
||||||
shapesInside = []
|
shapesInside = list()
|
||||||
shapesOutside = []
|
shapesOutside = list()
|
||||||
shapesOnside = []
|
shapesOnside = list()
|
||||||
shapes = geompy.ExtractShapes(obj, geompy.ShapeType[shapeType], False)
|
shapes = geompy.ExtractShapes(obj, geompy.ShapeType[shapeType], False)
|
||||||
i=0
|
|
||||||
j=0
|
i_aux = 0
|
||||||
k=0
|
j_aux = 0
|
||||||
|
k_aux = 0
|
||||||
prefix = prefix + shapeType
|
prefix = prefix + shapeType
|
||||||
for shape in shapes:
|
for shape in shapes:
|
||||||
side = whichSide(face, shape, tol)
|
side = whichSide(face, shape, tol)
|
||||||
if side == sideRef:
|
i_aux, j_aux, k_aux = extractionOrientee_a(obj, shape, side, side_ref, \
|
||||||
shapesInside.append(shape)
|
shapesInside, shapesOutside, shapesOnside, \
|
||||||
if trace:
|
i_aux, j_aux, k_aux, \
|
||||||
name = prefix + "_Inside%d"%i
|
trace, prefix)
|
||||||
geomPublishInFather(initLog.debug, obj, shape, name)
|
|
||||||
i+=1
|
|
||||||
elif side == -sideRef:
|
|
||||||
shapesOutside.append(shape)
|
|
||||||
if trace:
|
|
||||||
name = prefix + "_Outside%d"%j
|
|
||||||
geomPublishInFather(initLog.debug, obj, shape, name)
|
|
||||||
j+=1
|
|
||||||
elif side == 0:
|
|
||||||
shapesOnside.append(shape)
|
|
||||||
if trace:
|
|
||||||
name = prefix + "_Onside%d"%k
|
|
||||||
geomPublishInFather(initLog.debug, obj, shape, name)
|
|
||||||
k+=1
|
|
||||||
logging.debug("--- shape was %s", name)
|
|
||||||
return [shapesInside, shapesOutside, shapesOnside]
|
|
||||||
|
|
||||||
|
return [shapesInside, shapesOutside, shapesOnside]
|
||||||
|
@ -17,17 +17,14 @@
|
|||||||
#
|
#
|
||||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
#
|
#
|
||||||
|
"""Renvoie l'extraction des shapes d'un objet selon leur position par rapport à la fac"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from .geomsmesh import geompy
|
from .geomsmesh import geompy
|
||||||
from .geomsmesh import geomPublish
|
|
||||||
from .geomsmesh import geomPublishInFather
|
|
||||||
from . import initLog
|
|
||||||
|
|
||||||
from .whichSideMulti import whichSideMulti
|
from .whichSideMulti import whichSideMulti
|
||||||
|
from .extractionOrientee_a import extractionOrientee_a
|
||||||
# -----------------------------------------------------------------------------
|
|
||||||
# --- renvoie l'extraction des shapes d'un objet selon leur position par rapport à la face.
|
|
||||||
|
|
||||||
def extractionOrienteeMulti(faces, ifil, obj, centre, shapeType, tol, prefix=""):
|
def extractionOrienteeMulti(faces, ifil, obj, centre, shapeType, tol, prefix=""):
|
||||||
"""
|
"""
|
||||||
@ -37,34 +34,20 @@ def extractionOrienteeMulti(faces, ifil, obj, centre, shapeType, tol, prefix="")
|
|||||||
"""
|
"""
|
||||||
logging.info('start')
|
logging.info('start')
|
||||||
trace = True
|
trace = True
|
||||||
shapesInside = []
|
shapesInside = list()
|
||||||
shapesOutside = []
|
shapesOutside = list()
|
||||||
shapesOnside = []
|
shapesOnside = list()
|
||||||
shapes = geompy.ExtractShapes(obj, geompy.ShapeType[shapeType], False)
|
shapes = geompy.ExtractShapes(obj, geompy.ShapeType[shapeType], False)
|
||||||
i=0
|
|
||||||
j=0
|
i_aux = 0
|
||||||
k=0
|
j_aux = 0
|
||||||
|
k_aux = 0
|
||||||
prefix = prefix + shapeType
|
prefix = prefix + shapeType
|
||||||
for shape in shapes:
|
for shape in shapes:
|
||||||
side = whichSideMulti(faces, ifil, shape, centre, tol)
|
side = whichSideMulti(faces, ifil, shape, centre, tol)
|
||||||
if side == 1:
|
i_aux, j_aux, k_aux = extractionOrientee_a(obj, shape, side, 1, \
|
||||||
shapesInside.append(shape)
|
shapesInside, shapesOutside, shapesOnside, \
|
||||||
if trace:
|
i_aux, j_aux, k_aux, \
|
||||||
name = prefix + "_Inside%d"%i
|
trace, prefix)
|
||||||
geomPublishInFather(initLog.debug, obj, shape, name)
|
|
||||||
i+=1
|
|
||||||
elif side == -1:
|
|
||||||
shapesOutside.append(shape)
|
|
||||||
if trace:
|
|
||||||
name = prefix + "_Outside%d"%j
|
|
||||||
geomPublishInFather(initLog.debug, obj, shape, name)
|
|
||||||
j+=1
|
|
||||||
elif side == 0:
|
|
||||||
shapesOnside.append(shape)
|
|
||||||
if trace:
|
|
||||||
name = prefix + "_Onside%d"%k
|
|
||||||
geomPublishInFather(initLog.debug, obj, shape, name)
|
|
||||||
k+=1
|
|
||||||
logging.debug("--- shape was %s", name)
|
|
||||||
return [shapesInside, shapesOutside, shapesOnside]
|
|
||||||
|
|
||||||
|
return [shapesInside, shapesOutside, shapesOnside]
|
||||||
|
57
src/Tools/blocFissure/gmu/extractionOrientee_a.py
Normal file
57
src/Tools/blocFissure/gmu/extractionOrientee_a.py
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Copyright (C) 2014-2021 EDF R&D
|
||||||
|
#
|
||||||
|
# This library is free software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU Lesser General Public
|
||||||
|
# License as published by the Free Software Foundation; either
|
||||||
|
# version 2.1 of the License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This library is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
# Lesser General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Lesser General Public
|
||||||
|
# License along with this library; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
#
|
||||||
|
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
|
#
|
||||||
|
"""Détermine le bon côté"""
|
||||||
|
|
||||||
|
import logging
|
||||||
|
from . import initLog
|
||||||
|
|
||||||
|
from .geomsmesh import geomPublishInFather
|
||||||
|
|
||||||
|
def extractionOrientee_a(obj, shape, side, side_ref, \
|
||||||
|
shapesInside, shapesOutside, shapesOnside, \
|
||||||
|
i_aux, j_aux, k_aux, \
|
||||||
|
trace=True, prefix=""):
|
||||||
|
"""Détermine le bon côté"""
|
||||||
|
#logging.info('start')
|
||||||
|
|
||||||
|
if side == side_ref:
|
||||||
|
shapesInside.append(shape)
|
||||||
|
if trace:
|
||||||
|
name = prefix + "_Inside%d"%i_aux
|
||||||
|
geomPublishInFather(initLog.debug, obj, shape, name)
|
||||||
|
i_aux += 1
|
||||||
|
|
||||||
|
elif side == -side_ref:
|
||||||
|
shapesOutside.append(shape)
|
||||||
|
if trace:
|
||||||
|
name = prefix + "_Outside%d"%j_aux
|
||||||
|
geomPublishInFather(initLog.debug, obj, shape, name)
|
||||||
|
j_aux += 1
|
||||||
|
|
||||||
|
elif side == 0:
|
||||||
|
shapesOnside.append(shape)
|
||||||
|
if trace:
|
||||||
|
name = prefix + "_Onside%d"%k_aux
|
||||||
|
geomPublishInFather(initLog.debug, obj, shape, name)
|
||||||
|
k_aux += 1
|
||||||
|
|
||||||
|
logging.debug("--- shape was %s", name)
|
||||||
|
|
||||||
|
return i_aux, j_aux, k_aux
|
@ -17,16 +17,14 @@
|
|||||||
#
|
#
|
||||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
#
|
#
|
||||||
|
"""Tore : faces 1/2 circulaires et leur centre, edges de ces faces dans le plan de fissure"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
from .geomsmesh import geompy
|
|
||||||
from .geomsmesh import geomPublish
|
|
||||||
from .geomsmesh import geomPublishInFather
|
|
||||||
from . import initLog
|
from . import initLog
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
from .geomsmesh import geompy
|
||||||
# --- TORE
|
from .geomsmesh import geomPublishInFather
|
||||||
## --- faces 1/2 circulaires et leur centre, edges de ces faces dans le plan de fissure
|
|
||||||
|
|
||||||
def facesCirculaires(bloc, tore):
|
def facesCirculaires(bloc, tore):
|
||||||
"""
|
"""
|
||||||
@ -41,59 +39,42 @@ def facesCirculaires(bloc, tore):
|
|||||||
|
|
||||||
faces = geompy.GetShapesOnShape(bloc, tore, geompy.ShapeType["FACE"], GEOM.ST_ON)
|
faces = geompy.GetShapesOnShape(bloc, tore, geompy.ShapeType["FACE"], GEOM.ST_ON)
|
||||||
|
|
||||||
geomPublishInFather(initLog.debug, tore, faces[0], 'face0' )
|
centres = list()
|
||||||
geomPublishInFather(initLog.debug, tore, faces[1], 'face1' )
|
alledges = list()
|
||||||
geomPublishInFather(initLog.debug, tore, faces[2], 'face2' )
|
for i_aux in range(4):
|
||||||
geomPublishInFather(initLog.debug, tore, faces[3], 'face3' )
|
geomPublishInFather(initLog.debug, tore, faces[i_aux], 'face{}'.format(i_aux))
|
||||||
|
[_,centre,_] = geompy.ExtractShapes(faces[i_aux], geompy.ShapeType["VERTEX"], True)
|
||||||
|
centres.append(centre)
|
||||||
|
geomPublishInFather(initLog.debug, faces[i_aux], centre, 'centre{}'.format(i_aux))
|
||||||
|
alledges.append(geompy.ExtractShapes(faces[i_aux], geompy.ShapeType["EDGE"], True))
|
||||||
|
|
||||||
centres = [None, None, None, None]
|
dicoedge = dict()
|
||||||
[v1,centres[0],v3] = geompy.ExtractShapes(faces[0], geompy.ShapeType["VERTEX"], True)
|
edges = list()
|
||||||
[v1,centres[1],v3] = geompy.ExtractShapes(faces[1], geompy.ShapeType["VERTEX"], True)
|
reverses = list()
|
||||||
[v1,centres[2],v3] = geompy.ExtractShapes(faces[2], geompy.ShapeType["VERTEX"], True)
|
|
||||||
[v1,centres[3],v3] = geompy.ExtractShapes(faces[3], geompy.ShapeType["VERTEX"], True)
|
|
||||||
|
|
||||||
geomPublishInFather(initLog.debug, faces[0], centres[0], 'centre0' )
|
for i_aux, edgesface in enumerate(alledges):
|
||||||
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]
|
lenef = list()
|
||||||
alledges[0] = geompy.ExtractShapes(faces[0], geompy.ShapeType["EDGE"], True)
|
for edge in edgesface:
|
||||||
alledges[1] = geompy.ExtractShapes(faces[1], geompy.ShapeType["EDGE"], True)
|
props = geompy.BasicProperties(edge)
|
||||||
alledges[2] = geompy.ExtractShapes(faces[2], geompy.ShapeType["EDGE"], True)
|
|
||||||
alledges[3] = geompy.ExtractShapes(faces[3], geompy.ShapeType["EDGE"], True)
|
|
||||||
|
|
||||||
dicoedge = {}
|
|
||||||
edges = []
|
|
||||||
reverses = []
|
|
||||||
for i in range(len(alledges)):
|
|
||||||
edgesface = alledges[i]
|
|
||||||
lenef = []
|
|
||||||
for j in range(len(edgesface)):
|
|
||||||
props = geompy.BasicProperties(edgesface[j])
|
|
||||||
lenef.append(props[0])
|
lenef.append(props[0])
|
||||||
pass
|
|
||||||
maxlen = max(lenef)
|
maxlen = max(lenef)
|
||||||
for j in range(len(edgesface)):
|
for j_aux, edge in enumerate(edgesface):
|
||||||
if lenef[j] < maxlen:
|
if lenef[j_aux] < maxlen:
|
||||||
edgid = geompy.GetSubShapeID(tore, edgesface[j])
|
edgid = geompy.GetSubShapeID(tore, edge)
|
||||||
if not (edgid in dicoedge):
|
if not (edgid in dicoedge):
|
||||||
dicoedge[edgid] = edgesface[j]
|
dicoedge[edgid] = edge
|
||||||
edges.append(edgesface[j])
|
edges.append(edge)
|
||||||
named = 'edge_' + str(i) + '_' +str(j)
|
named = 'edge_{}_{}'.format(i_aux,j_aux)
|
||||||
geomPublishInFather(initLog.debug, faces[i], edgesface[j], named)
|
geomPublishInFather(initLog.debug, faces[i_aux], edge, named)
|
||||||
vertices = geompy.ExtractShapes(edgesface[j], geompy.ShapeType["VERTEX"], False)
|
vertices = geompy.ExtractShapes(edge, geompy.ShapeType["VERTEX"], False)
|
||||||
#firstVertex = geompy.GetFirstVertex(edgesface[j])
|
#firstVertex = geompy.GetFirstVertex(edge)
|
||||||
if geompy.GetSubShapeID(tore, vertices[0]) != geompy.GetSubShapeID(tore, centres[i]):
|
if geompy.GetSubShapeID(tore, vertices[0]) != geompy.GetSubShapeID(tore, centres[i_aux]):
|
||||||
reverses.append(1)
|
reverses.append(1)
|
||||||
#print 'reversed ' + str(edgid)
|
#print 'reversed ' + str(edgid)
|
||||||
else:
|
else:
|
||||||
reverses.append(0)
|
reverses.append(0)
|
||||||
#print 'normal' + str(edgid)
|
#print 'normal' + str(edgid)
|
||||||
pass
|
|
||||||
pass
|
|
||||||
pass
|
|
||||||
pass
|
|
||||||
|
|
||||||
return faces, centres, edges, reverses
|
return faces, centres, edges, reverses
|
||||||
|
|
||||||
|
@ -17,33 +17,34 @@
|
|||||||
#
|
#
|
||||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
#
|
#
|
||||||
|
"""Faces fissure dans et hors tore, et edges face hors tore"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
from .geomsmesh import geompy
|
|
||||||
from .geomsmesh import geomPublish
|
import GEOM
|
||||||
from .geomsmesh import geomPublishInFather
|
|
||||||
from . import initLog
|
from . import initLog
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
from .geomsmesh import geompy
|
||||||
# --- faces fissure dans et hors tore, et edges face hors tore
|
from .geomsmesh import geomPublishInFather
|
||||||
|
|
||||||
def facesFissure(blocp, faceFissure, extrusionDefaut, genint):
|
def facesFissure(blocp, faceFissure, extrusionDefaut, genint):
|
||||||
"""
|
"""Extraction des faces de fissure dans et hors tore, des edges le long du tore et en paroi
|
||||||
extraction des faces de fissure dans et hors tore, des edges le long du tore et en paroi
|
|
||||||
@param faceFissure : la face de fissure avec la partie dans le tore elliptique et la partie externe
|
@param faceFissure : la face de fissure avec la partie dans le tore elliptique et la partie externe
|
||||||
@return (facefissintore, facefissoutore, edgeint, edgeext)
|
@return (facefissintore, facefissoutore, edgeint, edgeext)
|
||||||
"""
|
"""
|
||||||
logging.info('start')
|
logging.info('start')
|
||||||
|
|
||||||
[f0,f1] = geompy.ExtractShapes(faceFissure, geompy.ShapeType["FACE"], True)
|
[face_0,face_1] = geompy.ExtractShapes(faceFissure, geompy.ShapeType["FACE"], True)
|
||||||
ed0 = geompy.ExtractShapes(f0, geompy.ShapeType["EDGE"], True)
|
ed0 = geompy.ExtractShapes(face_0, geompy.ShapeType["EDGE"], True)
|
||||||
ed1 = geompy.ExtractShapes(f1, geompy.ShapeType["EDGE"], True)
|
ed1 = geompy.ExtractShapes(face_1, geompy.ShapeType["EDGE"], True)
|
||||||
if len(ed0) > len(ed1):
|
if len(ed0) > len(ed1):
|
||||||
facefissintore = f0
|
facefissintore = face_0
|
||||||
facefissoutore = f1
|
facefissoutore = face_1
|
||||||
else:
|
else:
|
||||||
facefissintore = f1
|
facefissintore = face_1
|
||||||
facefissoutore = f0
|
facefissoutore = face_0
|
||||||
|
|
||||||
geomPublishInFather(initLog.debug, faceFissure, facefissintore,'facefissintore')
|
geomPublishInFather(initLog.debug, faceFissure, facefissintore,'facefissintore')
|
||||||
geomPublishInFather(initLog.debug, faceFissure, facefissoutore,'facefissoutore')
|
geomPublishInFather(initLog.debug, faceFissure, facefissoutore,'facefissoutore')
|
||||||
@ -51,18 +52,18 @@ def facesFissure(blocp, faceFissure, extrusionDefaut, genint):
|
|||||||
edgeint = geompy.GetShapesOnShape(extrusionDefaut, facefissoutore, geompy.ShapeType["EDGE"], GEOM.ST_IN)
|
edgeint = geompy.GetShapesOnShape(extrusionDefaut, facefissoutore, geompy.ShapeType["EDGE"], GEOM.ST_IN)
|
||||||
edgeext = geompy.GetShapesOnShape(extrusionDefaut, facefissoutore, geompy.ShapeType["EDGE"], GEOM.ST_ON)
|
edgeext = geompy.GetShapesOnShape(extrusionDefaut, facefissoutore, geompy.ShapeType["EDGE"], GEOM.ST_ON)
|
||||||
|
|
||||||
for i in range(len(edgeint)):
|
for i_aux, edge in enumerate(edgeint):
|
||||||
name = "edgeint_%d"%i
|
name = "edgeint_{}".format(i_aux)
|
||||||
geomPublishInFather(initLog.debug, facefissoutore, edgeint[i],name)
|
geomPublishInFather(initLog.debug, facefissoutore, edge,name)
|
||||||
for i in range(len(edgeext)):
|
for i_aux, edge in enumerate(edgeext):
|
||||||
name = "edgeext_%d"%i
|
name = "edgeext_{}".format(i_aux)
|
||||||
geomPublishInFather(initLog.debug, facefissoutore, edgeext[i],name)
|
geomPublishInFather(initLog.debug, facefissoutore, edge,name)
|
||||||
|
|
||||||
reverext = []
|
reverext = list()
|
||||||
if len(edgeext) > 1:
|
if len(edgeext) > 1:
|
||||||
vertices = geompy.ExtractShapes(genint, geompy.ShapeType["VERTEX"], False)
|
vertices = geompy.ExtractShapes(genint, geompy.ShapeType["VERTEX"], False)
|
||||||
for i in range(len(edgeext)):
|
for edge in edgeext:
|
||||||
vertedge = geompy.ExtractShapes(edgeext[i], geompy.ShapeType["VERTEX"], False)
|
vertedge = geompy.ExtractShapes(edge, geompy.ShapeType["VERTEX"], False)
|
||||||
if ((geompy.GetSubShapeID(blocp, vertedge[0]) == geompy.GetSubShapeID(blocp, vertices[0])) or
|
if ((geompy.GetSubShapeID(blocp, vertedge[0]) == geompy.GetSubShapeID(blocp, vertices[0])) or
|
||||||
(geompy.GetSubShapeID(blocp, vertedge[0]) == geompy.GetSubShapeID(blocp, vertices[1]))):
|
(geompy.GetSubShapeID(blocp, vertedge[0]) == geompy.GetSubShapeID(blocp, vertices[1]))):
|
||||||
reverext.append(0)
|
reverext.append(0)
|
||||||
|
@ -17,19 +17,18 @@
|
|||||||
#
|
#
|
||||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
#
|
#
|
||||||
|
"""Identification des faces tore et fissure dans le solide hors tore du bloc partitionné"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
from .geomsmesh import geompy
|
|
||||||
from .geomsmesh import geomPublish
|
|
||||||
from .geomsmesh import geomPublishInFather
|
|
||||||
from . import initLog
|
from . import initLog
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
from .geomsmesh import geompy
|
||||||
# --- identification des faces tore et fissure dans le solide hors tore du bloc partitionné
|
from .geomsmesh import geomPublishInFather
|
||||||
|
|
||||||
def facesToreInBloc(blocp, facefissoutore, facetore1, facetore2):
|
def facesToreInBloc(blocp, facefissoutore, facetore1, facetore2):
|
||||||
"""
|
"""Identification des faces tore et fissure dans le bloc partitionné : sous shapes du bloc
|
||||||
identification des faces tore et fissure dans le bloc partitionné : sous shapes du bloc
|
|
||||||
@param blocp : bloc partitionné
|
@param blocp : bloc partitionné
|
||||||
@param facefissoutore : la face de fissure externe au tore
|
@param facefissoutore : la face de fissure externe au tore
|
||||||
@param facetore1 : face du tore selon la génératrice
|
@param facetore1 : face du tore selon la génératrice
|
||||||
@ -47,4 +46,3 @@ def facesToreInBloc(blocp, facefissoutore, facetore1, facetore2):
|
|||||||
geomPublishInFather(initLog.debug, blocp, blocFaceTore2,'blocFaceTore2')
|
geomPublishInFather(initLog.debug, blocp, blocFaceTore2,'blocFaceTore2')
|
||||||
|
|
||||||
return blocFaceFiss, blocFaceTore1, blocFaceTore2
|
return blocFaceFiss, blocFaceTore1, blocFaceTore2
|
||||||
|
|
||||||
|
@ -17,19 +17,18 @@
|
|||||||
#
|
#
|
||||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
#
|
#
|
||||||
|
"""Tore : aces toriques et volumes du tore"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
from .geomsmesh import geompy
|
|
||||||
from .geomsmesh import geomPublish
|
|
||||||
from .geomsmesh import geomPublishInFather
|
|
||||||
from . import initLog
|
from . import initLog
|
||||||
|
|
||||||
|
from .geomsmesh import geompy
|
||||||
|
from .geomsmesh import geomPublishInFather
|
||||||
|
|
||||||
from .extractionOrientee import extractionOrientee
|
from .extractionOrientee import extractionOrientee
|
||||||
from .getSubshapeIds import getSubshapeIds
|
from .getSubshapeIds import getSubshapeIds
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
|
||||||
# --- TORE
|
|
||||||
# --- faces toriques et volumes du tore
|
|
||||||
|
|
||||||
def facesVolumesToriques(tore, plan, facesDefaut):
|
def facesVolumesToriques(tore, plan, facesDefaut):
|
||||||
"""
|
"""
|
||||||
Extraction des deux faces et volumes du tore partitionné, qui suivent la génératrice elliptique.
|
Extraction des deux faces et volumes du tore partitionné, qui suivent la génératrice elliptique.
|
||||||
@ -43,28 +42,25 @@ def facesVolumesToriques(tore, plan, facesDefaut):
|
|||||||
normal = geompy.GetNormal(plan, centre)
|
normal = geompy.GetNormal(plan, centre)
|
||||||
reference = geompy.MakeTranslationVector(centre, normal)
|
reference = geompy.MakeTranslationVector(centre, normal)
|
||||||
|
|
||||||
[facesInPlan, facesOutPlan, facesOnPlan] = extractionOrientee(plan, tore, reference, "FACE", 1.e-2, "faceTorePlan_")
|
[facesInPlan, facesOutPlan, _] = extractionOrientee(plan, tore, reference, "FACE", 1.e-2, "faceTorePlan_")
|
||||||
[facesInSide, facesOutSide, facesOnSide] = extractionOrientee(facesDefaut, tore, reference, "FACE", 1.e-2, "faceTorePeau_")
|
|
||||||
facesIdInPlan = getSubshapeIds(tore, facesInPlan)
|
facesIdInPlan = getSubshapeIds(tore, facesInPlan)
|
||||||
facesIdOutPlan = getSubshapeIds(tore, facesOutPlan)
|
facesIdOutPlan = getSubshapeIds(tore, facesOutPlan)
|
||||||
|
|
||||||
|
[_, _, facesOnSide] = extractionOrientee(facesDefaut, tore, reference, "FACE", 1.e-2, "faceTorePeau_")
|
||||||
facesIdOnSide = getSubshapeIds(tore, facesOnSide)
|
facesIdOnSide = getSubshapeIds(tore, facesOnSide)
|
||||||
facesIdInSide = getSubshapeIds(tore, facesInSide)
|
|
||||||
facesIdOutSide = getSubshapeIds(tore, facesOutSide)
|
|
||||||
#facesIdInOutSide = facesIdInSide + facesIdOutSide
|
|
||||||
facetore1 = None
|
facetore1 = None
|
||||||
faceTore2 = None
|
for i_aux, faceId in enumerate(facesIdInPlan):
|
||||||
for i, faceId in enumerate(facesIdInPlan):
|
|
||||||
if faceId not in facesIdOnSide:
|
if faceId not in facesIdOnSide:
|
||||||
facetore1 = facesInPlan[i]
|
facetore1 = facesInPlan[i_aux]
|
||||||
break
|
break
|
||||||
for i, faceId in enumerate(facesIdOutPlan):
|
|
||||||
if faceId not in facesIdOnSide:
|
|
||||||
facetore2 = facesOutPlan[i]
|
|
||||||
break
|
|
||||||
|
|
||||||
#[facetore1,facetore2] = geompy.GetShapesOnShape(pipe0, tore, geompy.ShapeType["FACE"], GEOM.ST_ON)
|
|
||||||
|
|
||||||
geomPublishInFather(initLog.debug, tore, facetore1, 'facetore1' )
|
geomPublishInFather(initLog.debug, tore, facetore1, 'facetore1' )
|
||||||
|
|
||||||
|
facetore2 = None
|
||||||
|
for i_aux, faceId in enumerate(facesIdOutPlan):
|
||||||
|
if faceId not in facesIdOnSide:
|
||||||
|
facetore2 = facesOutPlan[i_aux]
|
||||||
|
break
|
||||||
geomPublishInFather(initLog.debug, tore, facetore2, 'facetore2' )
|
geomPublishInFather(initLog.debug, tore, facetore2, 'facetore2' )
|
||||||
|
|
||||||
[volumeTore1, volumeTore2] = geompy.ExtractShapes(tore, geompy.ShapeType["SOLID"], True)
|
[volumeTore1, volumeTore2] = geompy.ExtractShapes(tore, geompy.ShapeType["SOLID"], True)
|
||||||
|
@ -17,67 +17,35 @@
|
|||||||
#
|
#
|
||||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
#
|
#
|
||||||
|
"""Trouver les vertices aux extrémites d'un wire"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
from .geomsmesh import geompy
|
|
||||||
from .geomsmesh import geomPublish
|
|
||||||
from .geomsmesh import geomPublishInFather
|
|
||||||
from . import initLog
|
from . import initLog
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
from .geomsmesh import geompy
|
||||||
# --- trouver les vertices extremites d'un wire
|
|
||||||
|
from .findWireVertices import findWireVertices
|
||||||
|
|
||||||
def findWireEndVertices(aWire, getNormals=False):
|
def findWireEndVertices(aWire, getNormals=False):
|
||||||
"""
|
"""Trouver les vertices aux extrémites d'un wire
|
||||||
trouver les vertices extremites d'un wire
|
|
||||||
calcul optionnel des tangentes. Attention à la tolérance qui peut être élevée (> 0.001)
|
Calcul optionnel des tangentes. Attention à la tolérance qui peut être élevée (> 0.001)
|
||||||
"""
|
"""
|
||||||
logging.info("start")
|
logging.info("start")
|
||||||
if geompy.NumberOfEdges(aWire) > 1:
|
if geompy.NumberOfEdges(aWire) > 1:
|
||||||
edges = geompy.ExtractShapes(aWire, geompy.ShapeType["EDGE"], False)
|
edges = geompy.ExtractShapes(aWire, geompy.ShapeType["EDGE"], False)
|
||||||
else:
|
else:
|
||||||
edges = [aWire]
|
edges = [aWire]
|
||||||
vertices = []
|
|
||||||
idsubs = {}
|
|
||||||
shortList = []
|
|
||||||
if getNormals:
|
|
||||||
normals = []
|
|
||||||
idnorm = {}
|
|
||||||
shortNorm = []
|
|
||||||
for edge in edges:
|
|
||||||
vert = geompy.ExtractShapes(edge, geompy.ShapeType["VERTEX"], False)
|
|
||||||
vertices += vert
|
|
||||||
if getNormals:
|
|
||||||
v0 = geompy.MakeVertexOnCurve(edge, 0.0)
|
|
||||||
n0 = geompy.MakeTangentOnCurve(edge, 0.0)
|
|
||||||
v1 = geompy.MakeVertexOnCurve(edge, 1.0)
|
|
||||||
n1 = geompy.MakeTangentOnCurve(edge, 1.0)
|
|
||||||
dist = geompy.MinDistance(v0, vert[0])
|
|
||||||
logging.debug("distance %s", dist)
|
|
||||||
if dist < 1.e-2:
|
|
||||||
normals += [n0, n1]
|
|
||||||
else:
|
|
||||||
normals += [n1, n0]
|
|
||||||
for i, sub in enumerate(vertices):
|
|
||||||
subid = geompy.GetSubShapeID(aWire, sub)
|
|
||||||
if subid in list(idsubs.keys()):
|
|
||||||
idsubs[subid].append(sub)
|
|
||||||
else:
|
|
||||||
idsubs[subid] = [sub]
|
|
||||||
name='vertex%d'%i
|
|
||||||
geomPublishInFather(initLog.debug, aWire, sub, name)
|
|
||||||
if getNormals:
|
|
||||||
idnorm[subid] = normals[i]
|
|
||||||
name='norm%d'%i
|
|
||||||
geomPublishInFather(initLog.debug, aWire, normals[i], name)
|
|
||||||
logging.debug("idsubs: %s", idsubs)
|
|
||||||
for k, v in idsubs.items():
|
|
||||||
if len(v) == 1:
|
|
||||||
shortList.append(v[0])
|
|
||||||
if getNormals:
|
|
||||||
shortNorm.append(idnorm[k])
|
|
||||||
if getNormals:
|
|
||||||
return shortList, shortNorm
|
|
||||||
else:
|
|
||||||
return shortList
|
|
||||||
|
|
||||||
|
idsubs, idnorm = findWireVertices(aWire, edges, getNormals)
|
||||||
|
|
||||||
|
shortList = list()
|
||||||
|
shortNorm = list()
|
||||||
|
for k_aux, sub in idsubs.items():
|
||||||
|
if ( len(sub) == 1 ):
|
||||||
|
shortList.append(sub[0])
|
||||||
|
if getNormals:
|
||||||
|
shortNorm.append(idnorm[k_aux])
|
||||||
|
|
||||||
|
return shortList, shortNorm
|
||||||
|
@ -17,63 +17,35 @@
|
|||||||
#
|
#
|
||||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
#
|
#
|
||||||
|
"""Trouver les vertices intermédiaires d'un wire"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
from .geomsmesh import geompy
|
|
||||||
from .geomsmesh import geomPublish
|
|
||||||
from .geomsmesh import geomPublishInFather
|
|
||||||
from . import initLog
|
from . import initLog
|
||||||
|
|
||||||
|
from .geomsmesh import geompy
|
||||||
|
|
||||||
|
from .findWireVertices import findWireVertices
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# --- trouver les vertices intermediaires d'un wire
|
# --- trouver les vertices intermediaires d'un wire
|
||||||
|
|
||||||
def findWireIntermediateVertices(aWire, getNormals=False):
|
def findWireIntermediateVertices(aWire, getNormals=False):
|
||||||
"""
|
"""Trouver les vertices d'un wire qui ne sont pas aux extremités
|
||||||
trouver les vertices d'un wire qui ne sont pas aux extremités
|
|
||||||
calcul optionnel des tangentes. Attention à la tolérance qui peut être élevée (> 0.001)
|
Calcul optionnel des tangentes. Attention à la tolérance qui peut être élevée (> 0.001)
|
||||||
"""
|
"""
|
||||||
logging.info("start")
|
logging.info("start")
|
||||||
edges = geompy.ExtractShapes(aWire, geompy.ShapeType["EDGE"], False)
|
edges = geompy.ExtractShapes(aWire, geompy.ShapeType["EDGE"], False)
|
||||||
vertices = []
|
|
||||||
idsubs = {}
|
|
||||||
shortList = []
|
|
||||||
if getNormals:
|
|
||||||
normals = []
|
|
||||||
idnorm = {}
|
|
||||||
shortNorm = []
|
|
||||||
for edge in edges:
|
|
||||||
vert = geompy.ExtractShapes(edge, geompy.ShapeType["VERTEX"], False)
|
|
||||||
vertices += vert
|
|
||||||
if getNormals:
|
|
||||||
v0 = geompy.MakeVertexOnCurve(edge, 0.0)
|
|
||||||
n0 = geompy.MakeTangentOnCurve(edge, 0.0)
|
|
||||||
v1 = geompy.MakeVertexOnCurve(edge, 1.0)
|
|
||||||
n1 = geompy.MakeTangentOnCurve(edge, 1.0)
|
|
||||||
dist = geompy.MinDistance(v0, vert[0])
|
|
||||||
logging.debug("distance %s", dist)
|
|
||||||
if dist < 1.e-2:
|
|
||||||
normals += [n0, n1]
|
|
||||||
else:
|
|
||||||
normals += [n1, n0]
|
|
||||||
for i, sub in enumerate(vertices):
|
|
||||||
subid = geompy.GetSubShapeID(aWire, sub)
|
|
||||||
if subid in list(idsubs.keys()):
|
|
||||||
idsubs[subid].append(sub)
|
|
||||||
else:
|
|
||||||
idsubs[subid] = [sub]
|
|
||||||
name='vertex%d'%i
|
|
||||||
geomPublishInFather(initLog.debug, aWire, sub, name)
|
|
||||||
if getNormals:
|
|
||||||
idnorm[subid] = normals[i]
|
|
||||||
name='norm%d'%i
|
|
||||||
geomPublishInFather(initLog.debug, aWire, normals[i], name)
|
|
||||||
for k, v in idsubs.items():
|
|
||||||
if len(v) > 1:
|
|
||||||
shortList.append(v[0])
|
|
||||||
if getNormals:
|
|
||||||
shortNorm.append(idnorm[k])
|
|
||||||
if getNormals:
|
|
||||||
return shortList, shortNorm
|
|
||||||
else:
|
|
||||||
return shortList
|
|
||||||
|
|
||||||
|
idsubs, idnorm = findWireVertices(aWire, edges, getNormals)
|
||||||
|
|
||||||
|
shortList = list()
|
||||||
|
shortNorm = list()
|
||||||
|
for k_aux, sub in idsubs.items():
|
||||||
|
if ( len(sub) > 1 ):
|
||||||
|
shortList.append(sub[0])
|
||||||
|
if getNormals:
|
||||||
|
shortNorm.append(idnorm[k_aux])
|
||||||
|
|
||||||
|
return shortList, shortNorm
|
||||||
|
69
src/Tools/blocFissure/gmu/findWireVertices.py
Normal file
69
src/Tools/blocFissure/gmu/findWireVertices.py
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Copyright (C) 2014-2021 EDF R&D
|
||||||
|
#
|
||||||
|
# This library is free software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU Lesser General Public
|
||||||
|
# License as published by the Free Software Foundation; either
|
||||||
|
# version 2.1 of the License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This library is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
# Lesser General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Lesser General Public
|
||||||
|
# License along with this library; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
#
|
||||||
|
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
|
#
|
||||||
|
"""Trouver les vertices d'un wire"""
|
||||||
|
|
||||||
|
import logging
|
||||||
|
|
||||||
|
from . import initLog
|
||||||
|
|
||||||
|
from .geomsmesh import geompy
|
||||||
|
from .geomsmesh import geomPublishInFather
|
||||||
|
|
||||||
|
def findWireVertices(aWire, edges, getNormals=False):
|
||||||
|
"""Trouver les vertices d'un wire
|
||||||
|
|
||||||
|
Calcul optionnel des tangentes. Attention à la tolérance qui peut être élevée (> 0.001)
|
||||||
|
"""
|
||||||
|
logging.info("start")
|
||||||
|
vertices = list()
|
||||||
|
idsubs = dict()
|
||||||
|
idnorm = dict()
|
||||||
|
if getNormals:
|
||||||
|
normals = list()
|
||||||
|
|
||||||
|
for edge in edges:
|
||||||
|
vert = geompy.ExtractShapes(edge, geompy.ShapeType["VERTEX"], False)
|
||||||
|
vertices += vert
|
||||||
|
if getNormals:
|
||||||
|
vertex_0 = geompy.MakeVertexOnCurve(edge, 0.0)
|
||||||
|
tangente_0 = geompy.MakeTangentOnCurve(edge, 0.0)
|
||||||
|
tangente_1 = geompy.MakeTangentOnCurve(edge, 1.0)
|
||||||
|
dist = geompy.MinDistance(vertex_0, vert[0])
|
||||||
|
logging.debug("distance %s", dist)
|
||||||
|
if dist < 1.e-2:
|
||||||
|
normals += [tangente_0, tangente_1]
|
||||||
|
else:
|
||||||
|
normals += [tangente_1, tangente_0]
|
||||||
|
|
||||||
|
for nro, sub in enumerate(vertices):
|
||||||
|
subid = geompy.GetSubShapeID(aWire, sub)
|
||||||
|
if subid in list(idsubs.keys()):
|
||||||
|
idsubs[subid].append(sub)
|
||||||
|
else:
|
||||||
|
idsubs[subid] = [sub]
|
||||||
|
name='vertex{}'.format(nro)
|
||||||
|
geomPublishInFather(initLog.debug, aWire, sub, name)
|
||||||
|
if getNormals:
|
||||||
|
idnorm[subid] = normals[nro]
|
||||||
|
name='norm{}'.format(nro)
|
||||||
|
geomPublishInFather(initLog.debug, aWire, normals[nro], name)
|
||||||
|
logging.debug("idsubs: %s", idsubs)
|
||||||
|
|
||||||
|
return idsubs, idnorm
|
@ -17,19 +17,18 @@
|
|||||||
#
|
#
|
||||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
#
|
#
|
||||||
|
"""Message d'erreur"""
|
||||||
|
|
||||||
class fissError(Exception):
|
class fissError(Exception):
|
||||||
"""
|
""" Usage:
|
||||||
usage:
|
|
||||||
try:
|
try:
|
||||||
instructions()
|
instructions()
|
||||||
except:
|
except:
|
||||||
raise fissError(traceback.extract_stack(),"mon message")
|
raise fissError(traceback.extract_stack(),"mon message")
|
||||||
"""
|
"""
|
||||||
def __init__(self, pile, msg):
|
def __init__(self, pile, msg):
|
||||||
self.pile = pile
|
self.pile = pile
|
||||||
self.msg = msg
|
self.msg = msg
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return 'msg=%s\npile=%s\n'%(self.msg, repr(self.pile))
|
return 'msg={}\npile={}\n'.format(self.msg, repr(self.pile))
|
||||||
|
|
||||||
|
@ -17,19 +17,21 @@
|
|||||||
#
|
#
|
||||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
#
|
#
|
||||||
|
"""Fissure dans un coude"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from .geomsmesh import geompy, smesh
|
import logging
|
||||||
from .geomsmesh import geomPublish
|
|
||||||
from .geomsmesh import geomPublishInFather
|
|
||||||
from . import initLog
|
|
||||||
|
|
||||||
import math
|
import math
|
||||||
import GEOM
|
import GEOM
|
||||||
import SALOMEDS
|
import SALOMEDS
|
||||||
import SMESH
|
import SMESH
|
||||||
import logging
|
|
||||||
|
from . import initLog
|
||||||
|
|
||||||
|
from .geomsmesh import geompy, smesh
|
||||||
|
from .geomsmesh import geomPublish
|
||||||
|
from .geomsmesh import geomPublishInFather
|
||||||
|
|
||||||
from .fissureGenerique import fissureGenerique
|
from .fissureGenerique import fissureGenerique
|
||||||
|
|
||||||
@ -42,12 +44,12 @@ from .sortEdges import sortEdges
|
|||||||
O, OX, OY, OZ = triedreBase()
|
O, OX, OY, OZ = triedreBase()
|
||||||
|
|
||||||
class fissureCoude(fissureGenerique):
|
class fissureCoude(fissureGenerique):
|
||||||
"""
|
"""Problème de fissure du Coude : version de base - maillage hexa"""
|
||||||
problème de fissure du Coude : version de base
|
|
||||||
maillage hexa
|
|
||||||
"""
|
|
||||||
|
|
||||||
nomProbleme = "fissureCoude"
|
nomProbleme = "fissureCoude"
|
||||||
|
longitudinale = None
|
||||||
|
circonferentielle = None
|
||||||
|
elliptique = None
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
def setParamGeometrieSaine(self):
|
def setParamGeometrieSaine(self):
|
||||||
@ -347,10 +349,8 @@ class fissureCoude(fissureGenerique):
|
|||||||
logging.info("genereShapeFissure %s", self.nomCas)
|
logging.info("genereShapeFissure %s", self.nomCas)
|
||||||
logging.info("shapeFissureParams %s", shapeFissureParams)
|
logging.info("shapeFissureParams %s", shapeFissureParams)
|
||||||
|
|
||||||
angleCoude = geomParams['angleCoude']
|
|
||||||
r_cintr = geomParams['r_cintr']
|
r_cintr = geomParams['r_cintr']
|
||||||
l_tube_p1 = geomParams['l_tube_p1']
|
l_tube_p1 = geomParams['l_tube_p1']
|
||||||
l_tube_p2 = geomParams['l_tube_p2']
|
|
||||||
epais = geomParams['epais']
|
epais = geomParams['epais']
|
||||||
de = geomParams['de']
|
de = geomParams['de']
|
||||||
|
|
||||||
@ -365,8 +365,6 @@ class fissureCoude(fissureGenerique):
|
|||||||
if 'elliptique' in shapeFissureParams:
|
if 'elliptique' in shapeFissureParams:
|
||||||
self.elliptique = shapeFissureParams['elliptique']
|
self.elliptique = shapeFissureParams['elliptique']
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
azimut = -azimut # axe inverse / ASCOUF
|
azimut = -azimut # axe inverse / ASCOUF
|
||||||
axe = geompy.MakeTranslation(OY, -r_cintr, 0, -l_tube_p1)
|
axe = geompy.MakeTranslation(OY, -r_cintr, 0, -l_tube_p1)
|
||||||
geomPublish(initLog.debug, axe,"axe")
|
geomPublish(initLog.debug, axe,"axe")
|
||||||
@ -383,10 +381,8 @@ class fissureCoude(fissureGenerique):
|
|||||||
self.circonferentielle = False
|
self.circonferentielle = False
|
||||||
self.longitudinale = False
|
self.longitudinale = False
|
||||||
if self.fissureLongue and not self.elliptique:
|
if self.fissureLongue and not self.elliptique:
|
||||||
if abs(orientation) < 45 :
|
self.longitudinale = bool(abs(orientation) < 45)
|
||||||
self.longitudinale = True
|
self.circonferentielle = not bool(abs(orientation) < 45)
|
||||||
else:
|
|
||||||
self.circonferentielle = True
|
|
||||||
|
|
||||||
nbp1 = 10
|
nbp1 = 10
|
||||||
if self.circonferentielle:
|
if self.circonferentielle:
|
||||||
@ -400,8 +396,8 @@ class fissureCoude(fissureGenerique):
|
|||||||
raybor = de/2. - epais
|
raybor = de/2. - epais
|
||||||
rayint = raybor + profondeur
|
rayint = raybor + profondeur
|
||||||
rayext = raybor - profondeur/5.0
|
rayext = raybor - profondeur/5.0
|
||||||
lgfond = longueur -2*profondeur
|
lgfond = longueur -2.*profondeur
|
||||||
angle = lgfond/(2*raybor)
|
angle = lgfond/(2.*raybor)
|
||||||
pb = geompy.MakeVertex(raybor, 0, 0)
|
pb = geompy.MakeVertex(raybor, 0, 0)
|
||||||
pi = geompy.MakeVertex(rayint, 0, 0)
|
pi = geompy.MakeVertex(rayint, 0, 0)
|
||||||
pbl = geompy.MakeRotation(pb, OZ, angle)
|
pbl = geompy.MakeRotation(pb, OZ, angle)
|
||||||
@ -592,7 +588,7 @@ class fissureCoude(fissureGenerique):
|
|||||||
geomPublish(initLog.debug, centre, 'centrefissPlace' )
|
geomPublish(initLog.debug, centre, 'centrefissPlace' )
|
||||||
|
|
||||||
edges = geompy.ExtractShapes(facefiss, geompy.ShapeType["EDGE"], True)
|
edges = geompy.ExtractShapes(facefiss, geompy.ShapeType["EDGE"], True)
|
||||||
edgesTriees, minl, maxl = sortEdges(edges)
|
edgesTriees, _, _ = sortEdges(edges)
|
||||||
edges = edgesTriees[:-1] # la plus grande correspond à arce, on l'elimine
|
edges = edgesTriees[:-1] # la plus grande correspond à arce, on l'elimine
|
||||||
wiretube = geompy.MakeWire(edges)
|
wiretube = geompy.MakeWire(edges)
|
||||||
#wiretube = edgesTriees[-1]
|
#wiretube = edgesTriees[-1]
|
||||||
@ -643,7 +639,7 @@ class fissureCoude(fissureGenerique):
|
|||||||
facefiss = geompy.MakeFaceWires([arce, arci], 0)
|
facefiss = geompy.MakeFaceWires([arce, arci], 0)
|
||||||
geomPublish(initLog.debug, facefiss, 'facefissPlace' )
|
geomPublish(initLog.debug, facefiss, 'facefissPlace' )
|
||||||
edges = geompy.ExtractShapes(facefiss, geompy.ShapeType["EDGE"], True)
|
edges = geompy.ExtractShapes(facefiss, geompy.ShapeType["EDGE"], True)
|
||||||
edgesTriees, minl, maxl = sortEdges(edges)
|
edgesTriees, _, _ = sortEdges(edges)
|
||||||
edgetube = edgesTriees[-1] # la plus grande correspond à arci
|
edgetube = edgesTriees[-1] # la plus grande correspond à arci
|
||||||
wiretube = edgetube
|
wiretube = edgetube
|
||||||
|
|
||||||
|
@ -17,93 +17,85 @@
|
|||||||
#
|
#
|
||||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
#
|
#
|
||||||
"""
|
"""Groupe de quadrangles de face transformé en face géométrique par filling
|
||||||
Created on Tue Jun 24 09:14:13 2014
|
|
||||||
|
|
||||||
|
Created on Tue Jun 24 09:14:13 2014
|
||||||
@author: I48174 (Olivier HOAREAU)
|
@author: I48174 (Olivier HOAREAU)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
from .geomsmesh import geompy
|
|
||||||
from .geomsmesh import smesh
|
|
||||||
from .geomsmesh import geomPublish
|
|
||||||
from .geomsmesh import geomPublishInFather
|
|
||||||
from . import initLog
|
|
||||||
import GEOM
|
import GEOM
|
||||||
import SMESH
|
import SMESH
|
||||||
|
|
||||||
|
from .geomsmesh import geompy
|
||||||
|
from .geomsmesh import smesh
|
||||||
|
|
||||||
from .listOfExtraFunctions import createNewMeshesFromCorner
|
from .listOfExtraFunctions import createNewMeshesFromCorner
|
||||||
from .listOfExtraFunctions import createLinesFromMesh
|
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):
|
def fusionMaillageDefaut(maillageSain, maillageDefautCible, maillageInterneCible, zoneDefaut_skin, shapeDefaut, listOfCorners):
|
||||||
""" """
|
"""Groupe de quadrangles de face transformé en face géométrique par filling"""
|
||||||
# TODO: rédiger la docstring
|
|
||||||
|
logging.info("start")
|
||||||
logging.info("start")
|
|
||||||
|
facesNonCoupees = list()
|
||||||
facesNonCoupees = []
|
facesCoupees = list()
|
||||||
facesCoupees = []
|
maillagesNonCoupes = list()
|
||||||
maillagesNonCoupes = []
|
maillagesCoupes = list()
|
||||||
maillagesCoupes = []
|
|
||||||
|
# On crée une liste contenant le maillage de chaque face.
|
||||||
# On crée une liste contenant le maillage de chaque face.
|
listOfNewMeshes = createNewMeshesFromCorner(maillageDefautCible, listOfCorners)
|
||||||
listOfNewMeshes = createNewMeshesFromCorner(maillageDefautCible, listOfCorners)
|
|
||||||
|
i_aux = 0
|
||||||
i = 0
|
while i_aux < len(listOfNewMeshes):
|
||||||
while i < len(listOfNewMeshes):
|
lines = createLinesFromMesh(listOfNewMeshes[i_aux])
|
||||||
lines = createLinesFromMesh(listOfNewMeshes[i])
|
setOfLines = list()
|
||||||
setOfLines = []
|
for line in lines:
|
||||||
for line in lines:
|
# On possède l'information 'ID' de chaque noeud composant chaque
|
||||||
# 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
|
||||||
# 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
|
||||||
# ensemble de vertices constitue une ligne. Un ensemble de lignes
|
# constitue la face.
|
||||||
# constitue la face.
|
tmpCoords = [maillageDefautCible.GetNodeXYZ(node) for node in line]
|
||||||
tmpCoords = [maillageDefautCible.GetNodeXYZ(node) for node in line]
|
tmpPoints = [geompy.MakeVertex(val[0], val[1], val[2]) for val in tmpCoords]
|
||||||
tmpPoints = [geompy.MakeVertex(val[0], val[1], val[2]) for val in tmpCoords]
|
line = geompy.MakeInterpol(tmpPoints, False, False)
|
||||||
line = geompy.MakeInterpol(tmpPoints, False, False)
|
setOfLines.append(line)
|
||||||
setOfLines.append(line)
|
|
||||||
|
# A partir des lignes de la face,
|
||||||
# A partir des lignes de la face,
|
# on recrée un objet GEOM temporaire par filling.
|
||||||
# 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)
|
||||||
filling = geompy.MakeFilling(geompy.MakeCompound(setOfLines), 2, 5, 0.0001, 0.0001, 0, GEOM.FOM_Default, True)
|
#logging.debug("face de filling")
|
||||||
#logging.debug("face de filling")
|
#geomPublish(initLog.debug, filling, 'filling_{0}'.format(i_aux+1))
|
||||||
#geomPublish(initLog.debug, filling, 'filling_{0}'.format(i + 1))
|
|
||||||
|
tmpPartition = geompy.MakePartition([filling], [shapeDefaut], list(), list(), geompy.ShapeType["FACE"], 0, list(), 0)
|
||||||
tmpPartition = geompy.MakePartition([filling], [shapeDefaut], [], [], geompy.ShapeType["FACE"], 0, [], 0)
|
tmpExplodeRef = geompy.ExtractShapes(filling, geompy.ShapeType["EDGE"], True)
|
||||||
tmpExplodeRef = geompy.ExtractShapes(filling, geompy.ShapeType["EDGE"], True)
|
tmpExplodeNum = geompy.ExtractShapes(tmpPartition, geompy.ShapeType["EDGE"], True)
|
||||||
tmpExplodeNum = geompy.ExtractShapes(tmpPartition, geompy.ShapeType["EDGE"], True)
|
if len(tmpExplodeRef) == len(tmpExplodeNum):
|
||||||
if len(tmpExplodeRef) == len(tmpExplodeNum):
|
logging.debug("face de filling non coupee")
|
||||||
logging.debug("face de filling non coupee")
|
geompy.addToStudy( filling, "faceNonCoupee_{0}".format(i_aux+1)) # doit etre publie pour critere OK plus bas
|
||||||
geompy.addToStudy( filling, "faceNonCoupee_{0}".format(i + 1)) # doit etre publie pour critere OK plus bas
|
facesNonCoupees.append(filling)
|
||||||
facesNonCoupees.append(filling)
|
maillagesNonCoupes.append(listOfNewMeshes[i_aux])
|
||||||
maillagesNonCoupes.append(listOfNewMeshes[i])
|
else:
|
||||||
else:
|
logging.debug("face de filling coupee")
|
||||||
logging.debug("face de filling coupee")
|
geompy.addToStudy( filling, "faceCoupee_{0}".format(i_aux+1))
|
||||||
geompy.addToStudy( filling, "faceCoupee_{0}".format(i + 1))
|
facesCoupees.append(filling)
|
||||||
facesCoupees.append(filling)
|
maillagesCoupes.append(listOfNewMeshes[i_aux])
|
||||||
maillagesCoupes.append(listOfNewMeshes[i])
|
i_aux += 1
|
||||||
|
|
||||||
i += 1
|
listOfInternMeshes = [maillageInterneCible] + [msh.GetMesh() for msh in maillagesNonCoupes]
|
||||||
|
|
||||||
listOfInternMeshes = [maillageInterneCible] + [msh.GetMesh() for msh in maillagesNonCoupes]
|
newMaillageInterne = smesh.Concatenate(listOfInternMeshes, 1, 1, 1e-05, False)
|
||||||
|
|
||||||
newMaillageInterne = smesh.Concatenate(listOfInternMeshes, 1, 1, 1e-05, False)
|
facesEnTrop = list()
|
||||||
|
criteres = [smesh.GetCriterion(SMESH.FACE, SMESH.FT_BelongToGenSurface, SMESH.FT_Undefined, face) for face in facesNonCoupees]
|
||||||
facesEnTrop = []
|
filtres = [smesh.GetFilterFromCriteria([critere]) for critere in criteres]
|
||||||
|
for i_aux, filtre in enumerate(filtres):
|
||||||
criteres = [smesh.GetCriterion(SMESH.FACE, SMESH.FT_BelongToGenSurface, SMESH.FT_Undefined, face) for face in facesNonCoupees]
|
filtre.SetMesh(maillageSain.GetMesh())
|
||||||
filtres = [smesh.GetFilterFromCriteria([critere]) for critere in criteres]
|
faceEnTrop = maillageSain.GroupOnFilter(SMESH.FACE, 'faceEnTrop_{0}'.format(i_aux+1), filtre)
|
||||||
for i, filtre in enumerate(filtres):
|
facesEnTrop.append(faceEnTrop)
|
||||||
filtre.SetMesh(maillageSain.GetMesh())
|
|
||||||
faceEnTrop = maillageSain.GroupOnFilter(SMESH.FACE, 'faceEnTrop_{0}'.format(i + 1), filtre)
|
newZoneDefaut_skin = maillageSain.GetMesh().CutListOfGroups([zoneDefaut_skin], facesEnTrop, 'newZoneDefaut_skin')
|
||||||
facesEnTrop.append(faceEnTrop)
|
|
||||||
|
smesh.SetName(newMaillageInterne, 'newInternalBoundary')
|
||||||
newZoneDefaut_skin = maillageSain.GetMesh().CutListOfGroups([zoneDefaut_skin], facesEnTrop, 'newZoneDefaut_skin')
|
|
||||||
|
return newZoneDefaut_skin, newMaillageInterne
|
||||||
smesh.SetName(newMaillageInterne, 'newInternalBoundary')
|
|
||||||
|
|
||||||
return newZoneDefaut_skin, newMaillageInterne
|
|
||||||
|
|
||||||
|
@ -17,26 +17,24 @@
|
|||||||
#
|
#
|
||||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
#
|
#
|
||||||
|
"""Création élements géométriques fissure elliptique"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
from . import initLog
|
||||||
|
|
||||||
from .geomsmesh import geompy
|
from .geomsmesh import geompy
|
||||||
from .geomsmesh import geomPublish
|
from .geomsmesh import geomPublish
|
||||||
from .geomsmesh import geomPublishInFather
|
from .geomsmesh import geomPublishInFather
|
||||||
from . import initLog
|
|
||||||
|
|
||||||
from .toreFissure import toreFissure
|
from .toreFissure import toreFissure
|
||||||
from .ellipsoideDefaut import ellipsoideDefaut
|
from .ellipsoideDefaut import ellipsoideDefaut
|
||||||
from .rotTrans import rotTrans
|
from .rotTrans import rotTrans
|
||||||
from .genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut
|
from .genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
|
||||||
# --- création élements géométriques fissure elliptique
|
|
||||||
|
|
||||||
def genereElemsFissureElliptique(shapeFissureParams, \
|
def genereElemsFissureElliptique(shapeFissureParams, \
|
||||||
mailleur="MeshGems"):
|
mailleur="MeshGems"):
|
||||||
"""
|
"""Création élements géométriques fissure elliptique"""
|
||||||
TODO: a completer
|
|
||||||
"""
|
|
||||||
logging.info('start')
|
logging.info('start')
|
||||||
|
|
||||||
centreDefaut = shapeFissureParams['centreDefaut']
|
centreDefaut = shapeFissureParams['centreDefaut']
|
||||||
@ -51,7 +49,7 @@ def genereElemsFissureElliptique(shapeFissureParams, \
|
|||||||
allonge = demiGrandAxe/demiPetitAxe
|
allonge = demiGrandAxe/demiPetitAxe
|
||||||
rayonTore = demiPetitAxe/5.0
|
rayonTore = demiPetitAxe/5.0
|
||||||
generatrice, _, Pipe_1, FaceFissure, Plane_1, Pipe1Part = toreFissure(demiPetitAxe, allonge, rayonTore)
|
generatrice, _, Pipe_1, FaceFissure, Plane_1, Pipe1Part = toreFissure(demiPetitAxe, allonge, rayonTore)
|
||||||
ellipsoide = ellipsoideDefaut(demiPetitAxe, allonge, rayonTore)
|
ellipsoide = ellipsoideDefaut(demiPetitAxe, allonge)
|
||||||
|
|
||||||
# --- positionnement sur le bloc defaut de generatrice, tore et plan fissure
|
# --- positionnement sur le bloc defaut de generatrice, tore et plan fissure
|
||||||
|
|
||||||
|
@ -17,13 +17,13 @@
|
|||||||
#
|
#
|
||||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
#
|
#
|
||||||
|
"""Maillage face de fissure pour identification zone de défaut"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
from .geomsmesh import smesh
|
|
||||||
from salome.smesh import smeshBuilder
|
from salome.smesh import smeshBuilder
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
from .geomsmesh import smesh
|
||||||
# --- maillage face de fissure pour identification zone de defaut
|
|
||||||
|
|
||||||
def genereMeshCalculZoneDefaut(facefiss, minSize, maxSize, \
|
def genereMeshCalculZoneDefaut(facefiss, minSize, maxSize, \
|
||||||
mailleur="MeshGems"):
|
mailleur="MeshGems"):
|
||||||
@ -46,7 +46,8 @@ def genereMeshCalculZoneDefaut(facefiss, minSize, maxSize, \
|
|||||||
-SetQuadAllowed = permission quadrangle dans maillage triangle
|
-SetQuadAllowed = permission quadrangle dans maillage triangle
|
||||||
|
|
||||||
-On récupère les coordonnées de chaque noeud de la fissure qu'on stocke
|
-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]"""
|
dans une liste sous la forme : [X0, Y0, Z0, ..., Xn, Yn, Zn]
|
||||||
|
"""
|
||||||
|
|
||||||
logging.info('start')
|
logging.info('start')
|
||||||
|
|
||||||
|
@ -17,10 +17,7 @@
|
|||||||
#
|
#
|
||||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
#
|
#
|
||||||
|
"""Publications dans salome"""
|
||||||
import logging
|
|
||||||
#logging.info('start')
|
|
||||||
from . import initLog
|
|
||||||
|
|
||||||
import salome
|
import salome
|
||||||
salome.salome_init()
|
salome.salome_init()
|
||||||
@ -31,13 +28,14 @@ geompy = geomBuilder.New()
|
|||||||
from salome.smesh import smeshBuilder
|
from salome.smesh import smeshBuilder
|
||||||
smesh = smeshBuilder.New()
|
smesh = smeshBuilder.New()
|
||||||
|
|
||||||
# logging.debug("initialisation de geompy et smesh OK")
|
from . import initLog
|
||||||
|
|
||||||
def geomPublish(level,aShape, aName):
|
def geomPublish(level,aShape, aName):
|
||||||
|
"""Publication d'un objet"""
|
||||||
if initLog.getLogLevel() <= level:
|
if initLog.getLogLevel() <= level:
|
||||||
geompy.addToStudy(aShape, aName)
|
geompy.addToStudy(aShape, aName)
|
||||||
|
|
||||||
def geomPublishInFather(level, aFather, aShape, aName):
|
def geomPublishInFather(level, aFather, aShape, aName):
|
||||||
|
"""Publication d'un objet sous son ascendant"""
|
||||||
if initLog.getLogLevel() <= level:
|
if initLog.getLogLevel() <= level:
|
||||||
geompy.addToStudyInFather(aFather, aShape, aName)
|
geompy.addToStudyInFather(aFather, aShape, aName)
|
||||||
|
|
@ -17,31 +17,34 @@
|
|||||||
#
|
#
|
||||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
#
|
#
|
||||||
|
"""Identification du centre de fond de fissure,"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
import bisect
|
||||||
|
|
||||||
|
from . import initLog
|
||||||
|
|
||||||
from .geomsmesh import geompy
|
from .geomsmesh import geompy
|
||||||
from .geomsmesh import geomPublish
|
from .geomsmesh import geomPublish
|
||||||
from .geomsmesh import geomPublishInFather
|
from .geomsmesh import geomPublishInFather
|
||||||
from . import initLog
|
|
||||||
import bisect
|
|
||||||
|
|
||||||
publie = False
|
publie = False
|
||||||
|
|
||||||
def getCentreFondFiss(shapesFissure):
|
def getCentreFondFiss(shapesFissure):
|
||||||
"""
|
"""Identification du centre de fond de fissure,
|
||||||
identification du centre de fond de fissure,
|
|
||||||
transformation fond de fissure en edge unique (seulement pour la procédure construitFissureGenerale).
|
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.
|
On distingue le cas d'utilisation de la procédure insereFissureLongue par le nombre d'éléments de shapesFissure.
|
||||||
"""
|
"""
|
||||||
global publie
|
global publie
|
||||||
logging.debug("start")
|
logging.debug("start")
|
||||||
|
|
||||||
fondFiss = shapesFissure[4] # groupe d'edges de fond de fissure
|
fondFiss = shapesFissure[4] # groupe d'edges de fond de fissure
|
||||||
if len(shapesFissure) == 6: # procédure construitFissureGenerale, et edge fond de fissure fournie explicitement
|
if len(shapesFissure) == 6: # procédure construitFissureGenerale, et edge fond de fissure fournie explicitement
|
||||||
edgeFondExt = shapesFissure[5]
|
edgeFondExt = shapesFissure[5]
|
||||||
else:
|
else:
|
||||||
edgeFondExt = None
|
edgeFondExt = None
|
||||||
|
|
||||||
if len(shapesFissure) > 6: # procédure insereFissureLongue (fissure plane, plusieurs edges sur le fond de fissure)
|
if len(shapesFissure) > 6: # procédure insereFissureLongue (fissure plane, plusieurs edges sur le fond de fissure)
|
||||||
centreFondFiss = shapesFissure[1]
|
centreFondFiss = shapesFissure[1]
|
||||||
tgtCentre = None
|
tgtCentre = None
|
||||||
@ -57,7 +60,7 @@ def getCentreFondFiss(shapesFissure):
|
|||||||
aWire = geompy.MakeWire([fondFiss], 1e-07)
|
aWire = geompy.MakeWire([fondFiss], 1e-07)
|
||||||
if not publie:
|
if not publie:
|
||||||
geomPublish(initLog.debug, aWire, "wireFondFissExt")
|
geomPublish(initLog.debug, aWire, "wireFondFissExt")
|
||||||
|
|
||||||
lgWire = geompy.BasicProperties(aWire)[0]
|
lgWire = geompy.BasicProperties(aWire)[0]
|
||||||
edges = geompy.ExtractShapes(aWire, geompy.ShapeType["EDGE"], True)
|
edges = geompy.ExtractShapes(aWire, geompy.ShapeType["EDGE"], True)
|
||||||
lgEdges = [geompy.BasicProperties(ed)[0] for ed in edges]
|
lgEdges = [geompy.BasicProperties(ed)[0] for ed in edges]
|
||||||
@ -71,7 +74,7 @@ def getCentreFondFiss(shapesFissure):
|
|||||||
logging.debug("lgsumEdges %s", lgSumEd)
|
logging.debug("lgsumEdges %s", lgSumEd)
|
||||||
logging.debug("id edge: %s, lgOnEdge: %s, lgEdge: %s",iedr, lgOnEdge, lgEdges[iedr])
|
logging.debug("id edge: %s, lgOnEdge: %s, lgEdge: %s",iedr, lgOnEdge, lgEdges[iedr])
|
||||||
if iedr > 0: # il y a une edge avant celle du milieu
|
if iedr > 0: # il y a une edge avant celle du milieu
|
||||||
if geompy.MinDistance(edges[iedr-1], geompy.MakeVertexOnCurve(edges[iedr], 0.0 )) < 1.e-3: # edge orientée croissante
|
if geompy.MinDistance(edges[iedr-1], geompy.MakeVertexOnCurve(edges[iedr], 0.0 )) < 1.e-3: # edge orientée croissante
|
||||||
centreFondFiss = geompy.MakeVertexOnCurve(edges[iedr], lgOnEdge/lgEdges[iedr])
|
centreFondFiss = geompy.MakeVertexOnCurve(edges[iedr], lgOnEdge/lgEdges[iedr])
|
||||||
else:
|
else:
|
||||||
centreFondFiss = geompy.MakeVertexOnCurve(edges[iedr], 1.0 - lgOnEdge/lgEdges[iedr])
|
centreFondFiss = geompy.MakeVertexOnCurve(edges[iedr], 1.0 - lgOnEdge/lgEdges[iedr])
|
||||||
@ -84,7 +87,7 @@ def getCentreFondFiss(shapesFissure):
|
|||||||
centreFondFiss = geompy.MakeVertexOnCurve(edges[iedr], lgOnEdge/lgEdges[iedr])
|
centreFondFiss = geompy.MakeVertexOnCurve(edges[iedr], lgOnEdge/lgEdges[iedr])
|
||||||
geomPublishInFather(initLog.debug,aWire, centreFondFiss, "centreFondFiss")
|
geomPublishInFather(initLog.debug,aWire, centreFondFiss, "centreFondFiss")
|
||||||
tgtCentre = geompy.MakeTangentOnCurve(edges[iedr], lgOnEdge/ lgEdges[iedr])
|
tgtCentre = geompy.MakeTangentOnCurve(edges[iedr], lgOnEdge/ lgEdges[iedr])
|
||||||
|
|
||||||
if edgeFondExt is None: # fond de fissure non fourni explicitement sous forme d'edge
|
if edgeFondExt is None: # fond de fissure non fourni explicitement sous forme d'edge
|
||||||
try:
|
try:
|
||||||
edgeFondExt = geompy.MakeEdgeWire(aWire, 0.0005, 1e-07)
|
edgeFondExt = geompy.MakeEdgeWire(aWire, 0.0005, 1e-07)
|
||||||
@ -93,6 +96,7 @@ def getCentreFondFiss(shapesFissure):
|
|||||||
edgeFondExt = None
|
edgeFondExt = None
|
||||||
if not publie and edgeFondExt is not None:
|
if not publie and edgeFondExt is not None:
|
||||||
geomPublish(initLog.debug, edgeFondExt, "edgeFondExt")
|
geomPublish(initLog.debug, edgeFondExt, "edgeFondExt")
|
||||||
|
|
||||||
publie = True
|
publie = True
|
||||||
|
|
||||||
return edgeFondExt, centreFondFiss, tgtCentre
|
return edgeFondExt, centreFondFiss, tgtCentre
|
||||||
|
@ -17,20 +17,18 @@
|
|||||||
#
|
#
|
||||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
#
|
#
|
||||||
|
"""Transformation d'une liste de subshapes en une liste d'Id"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from .geomsmesh import geompy
|
from .geomsmesh import geompy
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
|
||||||
# --- transformation d'une liste de subshapes en une liste d'Id
|
|
||||||
|
|
||||||
def getSubshapeIds(obj, subshapes):
|
def getSubshapeIds(obj, subshapes):
|
||||||
"""
|
"""Transformation d'une liste de subshapes en une liste d'Id"""
|
||||||
transformation d'une liste de subshapes en une liste d'Id
|
|
||||||
"""
|
|
||||||
logging.debug("start")
|
logging.debug("start")
|
||||||
subshapesId = []
|
subshapesId = list()
|
||||||
for sub in subshapes:
|
for sub in subshapes:
|
||||||
subshapesId.append(geompy.GetSubShapeID(obj, sub))
|
subshapesId.append(geompy.GetSubShapeID(obj, sub))
|
||||||
logging.debug("subshapesId=%s", subshapesId)
|
logging.debug("subshapesId=%s", subshapesId)
|
||||||
|
|
||||||
return subshapesId
|
return subshapesId
|
||||||
|
@ -17,17 +17,21 @@
|
|||||||
#
|
#
|
||||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
#
|
#
|
||||||
|
"""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
|
||||||
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from .geomsmesh import geompy
|
|
||||||
from .geomsmesh import geomPublish
|
|
||||||
from .geomsmesh import geomPublishInFather
|
|
||||||
from . import initLog
|
from . import initLog
|
||||||
|
|
||||||
|
from .geomsmesh import geompy
|
||||||
|
from .geomsmesh import geomPublishInFather
|
||||||
|
|
||||||
from .extractionOrientee import extractionOrientee
|
from .extractionOrientee import extractionOrientee
|
||||||
from .extractionOrienteeMulti import extractionOrienteeMulti
|
from .extractionOrienteeMulti import extractionOrienteeMulti
|
||||||
|
|
||||||
def identifieElementsFissure(ifil, facesDefaut, partitionPeauFissFond,
|
def identifieElementsFissure(ifil, facesDefaut, partitionPeauFissFond,
|
||||||
edgesPipeFiss, edgesFondFiss, aretesVivesC,
|
edgesPipeFiss, edgesFondFiss, aretesVivesC,
|
||||||
fillingFaceExterne, centreFondFiss):
|
fillingFaceExterne, centreFondFiss):
|
||||||
@ -44,34 +48,32 @@ def identifieElementsFissure(ifil, facesDefaut, partitionPeauFissFond,
|
|||||||
geomPublishInFather(initLog.debug, partitionPeauFissFond, edgesPipeC, "edgesPipeFiss")
|
geomPublishInFather(initLog.debug, partitionPeauFissFond, edgesPipeC, "edgesPipeFiss")
|
||||||
edgesFondC = geompy.GetInPlace(partitionPeauFissFond, geompy.MakeCompound(edgesFondFiss))
|
edgesFondC = geompy.GetInPlace(partitionPeauFissFond, geompy.MakeCompound(edgesFondFiss))
|
||||||
geomPublishInFather(initLog.debug, partitionPeauFissFond, edgesFondC, "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):
|
if aretesVivesC is None:
|
||||||
|
[edgesInside, _, _] = extractionOrientee(fillingFaceExterne, partitionPeauFissFond, centreFondFiss, "EDGE", 1.e-3)
|
||||||
|
[facesInside, _, facesOnside] = extractionOrientee(fillingFaceExterne, partitionPeauFissFond, centreFondFiss, "FACE", 1.e-3)
|
||||||
|
else:
|
||||||
|
[edgesInside, _, _] = extractionOrienteeMulti(facesDefaut, ifil, partitionPeauFissFond, centreFondFiss, "EDGE", 1.e-3)
|
||||||
|
[facesInside, _, facesOnside] = extractionOrienteeMulti(facesDefaut, ifil, partitionPeauFissFond, centreFondFiss, "FACE", 1.e-3)
|
||||||
|
|
||||||
|
edgesPipeIn = geompy.GetSharedShapesMulti([edgesPipeC, geompy.MakeCompound(edgesInside)], geompy.ShapeType["EDGE"])
|
||||||
|
verticesPipePeau = list()
|
||||||
|
|
||||||
|
for i_aux, edge in enumerate(edgesPipeIn):
|
||||||
try:
|
try:
|
||||||
vertices = geompy.GetSharedShapesMulti([edge, geompy.MakeCompound(facesOnside)], geompy.ShapeType["VERTEX"])
|
vertices = geompy.GetSharedShapesMulti([edge, geompy.MakeCompound(facesOnside)], geompy.ShapeType["VERTEX"])
|
||||||
verticesPipePeau.append(vertices[0])
|
verticesPipePeau.append(vertices[0])
|
||||||
name = "edgePipeIn%d"%i
|
name = "edgePipeIn{}".format(i_aux)
|
||||||
geomPublishInFather(initLog.debug, partitionPeauFissFond, edge, name)
|
geomPublishInFather(initLog.debug, partitionPeauFissFond, edge, name)
|
||||||
name = "verticePipePeau%d"%i
|
name = "verticePipePeau{}".format(i_aux)
|
||||||
geomPublishInFather(initLog.debug, partitionPeauFissFond, vertices[0], name)
|
geomPublishInFather(initLog.debug, partitionPeauFissFond, vertices[0], name)
|
||||||
logging.debug("edgePipeIn%s coupe les faces OnSide", i)
|
logging.debug("edgePipeIn%s coupe les faces OnSide", i_aux)
|
||||||
except:
|
except:
|
||||||
logging.debug("edgePipeIn%s ne coupe pas les faces OnSide", i)
|
logging.debug("edgePipeIn%s ne coupe pas les faces OnSide", i_aux)
|
||||||
|
|
||||||
edgesFondIn =[]
|
edgesFondIn = list()
|
||||||
if len(verticesPipePeau) > 0: # au moins une extrémité du pipe sur cette face de peau
|
if verticesPipePeau: # 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"])
|
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]
|
edgesFondIn = [ ed for ed in tmp if geompy.MinDistance(ed, geompy.MakeCompound(facesOnside)) < 1.e-3]
|
||||||
|
|
||||||
return (edgesPipeIn, verticesPipePeau, edgesFondIn, facesInside, facesOnside)
|
return (edgesPipeIn, verticesPipePeau, edgesFondIn, facesInside, facesOnside)
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#
|
#
|
||||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
#
|
#
|
||||||
|
"""Identification des éléments géométriques de la face de peau"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
@ -30,8 +31,7 @@ def identifieElementsGeometriquesPeau(ifil, partitionPeauFissFond, edgesPipeFiss
|
|||||||
edgesFondFiss, wireFondFiss, aretesVivesC, \
|
edgesFondFiss, wireFondFiss, aretesVivesC, \
|
||||||
facesDefaut, centreFondFiss, rayonPipe, \
|
facesDefaut, centreFondFiss, rayonPipe, \
|
||||||
aretesVivesCoupees):
|
aretesVivesCoupees):
|
||||||
"""
|
"""Identification des éléments géométriques de la face de peau"""
|
||||||
"""
|
|
||||||
logging.info('start')
|
logging.info('start')
|
||||||
fillingFaceExterne = facesDefaut[ifil]
|
fillingFaceExterne = facesDefaut[ifil]
|
||||||
|
|
||||||
@ -40,17 +40,18 @@ def identifieElementsGeometriquesPeau(ifil, partitionPeauFissFond, edgesPipeFiss
|
|||||||
# --- identification edges fond de fissure, edges pipe sur la face de fissure, edges prolongées
|
# --- 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
|
# edges internes communes pipe et fissure, points communs edges fissure peau et edges circulaires
|
||||||
|
|
||||||
(edgesPipeIn, verticesPipePeau, edgesFondIn, facesInside, facesOnside) = identifieElementsFissure(ifil, facesDefaut, partitionPeauFissFond,
|
(edgesPipeIn, verticesPipePeau, edgesFondIn, facesInside, facesOnside) = \
|
||||||
edgesPipeFiss, edgesFondFiss, aretesVivesC,
|
identifieElementsFissure(ifil, facesDefaut, partitionPeauFissFond, \
|
||||||
fillingFaceExterne, centreFondFiss)
|
edgesPipeFiss, edgesFondFiss, aretesVivesC, \
|
||||||
|
fillingFaceExterne, centreFondFiss)
|
||||||
|
|
||||||
# --- elements débouchants (intersection pipe et peau), indexés selon les edges du fond de fissure (edgesFondIn)
|
# --- elements débouchants (intersection pipe et peau), indexés selon les edges du fond de fissure (edgesFondIn)
|
||||||
|
|
||||||
(verticesEdgesFondIn, pipexts, cercles,
|
(verticesEdgesFondIn, pipexts, cercles,
|
||||||
facesFissExt, edgesFissExtPeau, edgesFissExtPipe) = identifieElementsDebouchants(ifil, facesDefaut, partitionPeauFissFond,
|
facesFissExt, edgesFissExtPeau, edgesFissExtPipe) = identifieElementsDebouchants(ifil, facesDefaut, partitionPeauFissFond, \
|
||||||
edgesFondIn, edgesFondFiss, wireFondFiss,
|
edgesFondIn, edgesFondFiss, wireFondFiss, \
|
||||||
aretesVivesC, fillingFaceExterne,
|
aretesVivesC, fillingFaceExterne, \
|
||||||
edgesPipeIn, verticesPipePeau, rayonPipe,
|
edgesPipeIn, verticesPipePeau, rayonPipe, \
|
||||||
facesInside, facesOnside)
|
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
|
# --- pour les faces de peau sans extremité débouchante de fissure, il faut recenser les edges de fissure sur la face de peau
|
||||||
@ -60,16 +61,16 @@ def identifieElementsGeometriquesPeau(ifil, partitionPeauFissFond, edgesPipeFiss
|
|||||||
|
|
||||||
# --- inventaire des faces de peau : face de peau percée du pipe, extrémités du pipe
|
# --- 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,
|
(facePeau, facesPeauSorted, edgesPeauFondIn) = identifieFacesPeau(ifil, verticesPipePeau, facesOnside, wireFondFiss, \
|
||||||
verticesEdgesFondIn, pipexts, cercles,
|
verticesEdgesFondIn, pipexts, cercles, \
|
||||||
fillingFaceExterne, centreFondFiss)
|
fillingFaceExterne, centreFondFiss)
|
||||||
|
|
||||||
# --- identification précise des edges et disques des faces de peau selon index extremité fissure
|
# --- identification précise des edges et disques des faces de peau selon index extremité fissure
|
||||||
|
|
||||||
(endsEdgeFond, facesPipePeau, edgeRadFacePipePeau,
|
(endsEdgeFond, facesPipePeau, edgeRadFacePipePeau, edgesCircPeau, verticesCircPeau, groupEdgesBordPeau, \
|
||||||
edgesCircPeau, verticesCircPeau, groupEdgesBordPeau,
|
bordsVifs, edgesFissurePeau, aretesVivesCoupees) = \
|
||||||
bordsVifs, edgesFissurePeau, aretesVivesCoupees) = identifieEdgesPeau(edgesFissExtPipe, verticesPipePeau, facePeau, facesPeauSorted,
|
identifieEdgesPeau(edgesFissExtPipe, verticesPipePeau, facePeau, facesPeauSorted, \
|
||||||
edgesPeauFondIn, fillingFaceExterne, aretesVivesC, aretesVivesCoupees)
|
edgesPeauFondIn, fillingFaceExterne, aretesVivesC, aretesVivesCoupees)
|
||||||
|
|
||||||
dataPPFF = dict(endsEdgeFond = endsEdgeFond, # pour chaque face [points edge fond de fissure aux débouchés du pipe]
|
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]
|
facesPipePeau = facesPipePeau, # pour chaque face [faces du pipe débouchantes]
|
||||||
@ -87,4 +88,3 @@ def identifieElementsGeometriquesPeau(ifil, partitionPeauFissFond, edgesPipeFiss
|
|||||||
)
|
)
|
||||||
|
|
||||||
return dataPPFF, aretesVivesCoupees
|
return dataPPFF, aretesVivesCoupees
|
||||||
|
|
||||||
|
@ -17,31 +17,36 @@
|
|||||||
#
|
#
|
||||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
#
|
#
|
||||||
|
"""Identification des faces et edges de fissure externe pour maillage"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
from . import initLog
|
||||||
|
|
||||||
from .geomsmesh import geompy
|
from .geomsmesh import geompy
|
||||||
from .geomsmesh import geomPublish
|
from .geomsmesh import geomPublish
|
||||||
from .geomsmesh import geomPublishInFather
|
from .geomsmesh import geomPublishInFather
|
||||||
from . import initLog
|
|
||||||
|
|
||||||
def identifieFacesEdgesFissureExterne(fsFissuExt, edFisExtPe, edFisExtPi, edgesPipeFiss):
|
def identifieFacesEdgesFissureExterne(fsFissuExt, edFisExtPe, edFisExtPi, edgesPipeFiss):
|
||||||
"""identification des faces et edges de fissure externe pour maillage"""
|
"""Identification des faces et edges de fissure externe pour maillage"""
|
||||||
logging.info('start')
|
logging.info('start')
|
||||||
|
|
||||||
logging.debug("---------------------------- fsFissuExt : {} ".format(fsFissuExt))
|
texte = "---------------------------- fsFissuExt : {} ".format(fsFissuExt)
|
||||||
|
logging.debug(texte)
|
||||||
facesFissExt = list()
|
facesFissExt = list()
|
||||||
edgesFissExtPeau = list()
|
edgesFissExtPeau = list()
|
||||||
edgesFissExtPipe = list()
|
edgesFissExtPipe = list()
|
||||||
for ifil in range(len(fsFissuExt)): # TODO: éliminer les doublons (comparer tous les vertices triés, avec mesure de distance ?)
|
for ifil, face in enumerate(fsFissuExt): # éliminer les doublons (comparer tous les vertices triés, avec mesure de distance ?)
|
||||||
facesFissExt += fsFissuExt[ifil]
|
facesFissExt += face
|
||||||
edgesFissExtPeau += edFisExtPe[ifil]
|
edgesFissExtPeau += edFisExtPe[ifil]
|
||||||
edgesFissExtPipe += edFisExtPi[ifil]
|
edgesFissExtPipe += edFisExtPi[ifil]
|
||||||
logging.debug("---------------------------- identification faces de fissure externes au pipe : {}".format(len(facesFissExt)))
|
texte = "---------------------------- identification faces de fissure externes au pipe : {}".format(len(facesFissExt))
|
||||||
|
logging.debug(texte)
|
||||||
# regroupement des faces de fissure externes au pipe.
|
# regroupement des faces de fissure externes au pipe.
|
||||||
|
|
||||||
if not facesFissExt:
|
if not facesFissExt:
|
||||||
logging.info("---------------------------- fsFissuExt : {} ".format(fsFissuExt))
|
texte = "---------------------------- fsFissuExt : {} ".format(fsFissuExt)
|
||||||
|
logging.info(texte)
|
||||||
raise Exception("stop identifieFacesEdgesFissureExterne ; aucune face de fissure externe au pipe n'a été trouvée.")
|
raise Exception("stop identifieFacesEdgesFissureExterne ; aucune face de fissure externe au pipe n'a été trouvée.")
|
||||||
|
|
||||||
elif len(facesFissExt) > 1:
|
elif len(facesFissExt) > 1:
|
||||||
@ -49,17 +54,20 @@ def identifieFacesEdgesFissureExterne(fsFissuExt, edFisExtPe, edFisExtPi, edgesP
|
|||||||
edgesPipeFissureExterneC = geompy.GetInPlace(faceFissureExterne, geompy.MakeCompound(edgesPipeFiss)) # edgesFissExtPipe peut ne pas couvrir toute la longueur
|
edgesPipeFissureExterneC = geompy.GetInPlace(faceFissureExterne, geompy.MakeCompound(edgesPipeFiss)) # edgesFissExtPipe peut ne pas couvrir toute la longueur
|
||||||
# edgesPeauFissureExterneC = geompy.GetInPlace(faceFissureExterne, geompy.MakeCompound(edgesFissExtPeau))
|
# edgesPeauFissureExterneC = geompy.GetInPlace(faceFissureExterne, geompy.MakeCompound(edgesFissExtPeau))
|
||||||
# il peut manquer des edges de faceFissureExterne en contact avec la peau dans edgesFissExtPeau
|
# il peut manquer des edges de faceFissureExterne en contact avec la peau dans edgesFissExtPeau
|
||||||
(isDone, closedFreeBoundaries, openFreeBoundaries) = geompy.GetFreeBoundary(faceFissureExterne)
|
(_, closedFreeBoundaries, _) = geompy.GetFreeBoundary(faceFissureExterne)
|
||||||
edgesBordFFE = list()
|
edgesBordFFE = list()
|
||||||
for bound in closedFreeBoundaries:
|
for bound in closedFreeBoundaries:
|
||||||
edgesBordFFE += geompy.ExtractShapes(bound, geompy.ShapeType["EDGE"], False)
|
edgesBordFFE += geompy.ExtractShapes(bound, geompy.ShapeType["EDGE"], False)
|
||||||
edgesBordFFEid = [ (ed,geompy.GetSubShapeID(faceFissureExterne, ed)) for ed in edgesBordFFE]
|
edgesBordFFEid = [ (ed,geompy.GetSubShapeID(faceFissureExterne, ed)) for ed in edgesBordFFE]
|
||||||
logging.debug("edgesBordFFEid {}".format(edgesBordFFEid))
|
texte = "edgesBordFFEid {}".format(edgesBordFFEid)
|
||||||
|
logging.debug(texte)
|
||||||
edgesPPE = geompy.ExtractShapes(edgesPipeFissureExterneC, geompy.ShapeType["EDGE"], False)
|
edgesPPE = geompy.ExtractShapes(edgesPipeFissureExterneC, geompy.ShapeType["EDGE"], False)
|
||||||
edgesPPEid = [ geompy.GetSubShapeID(faceFissureExterne, ed) for ed in edgesPPE]
|
edgesPPEid = [ geompy.GetSubShapeID(faceFissureExterne, ed) for ed in edgesPPE]
|
||||||
logging.debug("edgesPPEid {}".format(edgesPPEid))
|
texte = "edgesPPEid {}".format(edgesPPEid)
|
||||||
|
logging.debug(texte)
|
||||||
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
|
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 {}".format(edgesPFE))
|
texte = "edgesPFE {}".format(edgesPFE)
|
||||||
|
logging.debug(texte)
|
||||||
edgesPeauFissureExterneC = geompy.MakeCompound(edgesPFE)
|
edgesPeauFissureExterneC = geompy.MakeCompound(edgesPFE)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
@ -17,13 +17,14 @@
|
|||||||
#
|
#
|
||||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
#
|
#
|
||||||
|
"""Inventaire des faces de peau"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
from . import initLog
|
||||||
|
|
||||||
from .geomsmesh import geompy
|
from .geomsmesh import geompy
|
||||||
from .geomsmesh import geomPublish
|
from .geomsmesh import geomPublish
|
||||||
from .geomsmesh import geomPublishInFather
|
|
||||||
from . import initLog
|
|
||||||
|
|
||||||
from .sortFaces import sortFaces
|
from .sortFaces import sortFaces
|
||||||
from .extractionOrientee import extractionOrientee
|
from .extractionOrientee import extractionOrientee
|
||||||
@ -31,69 +32,64 @@ from .extractionOrientee import extractionOrientee
|
|||||||
def identifieFacesPeau(ifil, verticesPipePeau, facesOnside, wireFondFiss,
|
def identifieFacesPeau(ifil, verticesPipePeau, facesOnside, wireFondFiss,
|
||||||
verticesEdgesFondIn, pipexts, cercles,
|
verticesEdgesFondIn, pipexts, cercles,
|
||||||
fillingFaceExterne, centreFondFiss):
|
fillingFaceExterne, centreFondFiss):
|
||||||
"""
|
"""Inventaire des faces de peau : face de peau percée du pipe, extrémités du pipe
|
||||||
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é,
|
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.
|
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
|
dans ce cas, la projection du cercle sur la face suivie d'une partition permet
|
||||||
d'éviter le point en trop
|
d'éviter le point en trop
|
||||||
"""
|
"""
|
||||||
logging.info('start')
|
logging.info('start')
|
||||||
|
|
||||||
facesAndFond = facesOnside
|
facesAndFond = facesOnside
|
||||||
facesAndFond.append(wireFondFiss)
|
facesAndFond.append(wireFondFiss)
|
||||||
try:
|
try:
|
||||||
partitionPeauByPipe = geompy.MakePartition(facesAndFond, pipexts, [], [], geompy.ShapeType["FACE"], 0, [], 1)
|
partitionPeauByPipe = geompy.MakePartition(facesAndFond, pipexts, [], [], geompy.ShapeType["FACE"], 0, [], 1)
|
||||||
except:
|
except:
|
||||||
logging.debug("probleme partition face pipe, contournement avec MakeSection")
|
logging.debug("probleme partition face pipe, contournement avec MakeSection")
|
||||||
sections = []
|
sections = list()
|
||||||
for pipext in pipexts:
|
for pipext in pipexts:
|
||||||
sections.append(geompy.MakeSection(facesOnside[0], pipext))
|
sections.append(geompy.MakeSection(facesOnside[0], pipext))
|
||||||
partitionPeauByPipe = geompy.MakePartition(facesAndFond, sections, [], [], geompy.ShapeType["FACE"], 0, [], 1)
|
partitionPeauByPipe = geompy.MakePartition(facesAndFond, sections, [], [], geompy.ShapeType["FACE"], 0, [], 1)
|
||||||
|
|
||||||
# contrôle edge en trop sur edges circulaires
|
# contrôle edge en trop sur edges circulaires
|
||||||
if len(verticesPipePeau) > 0: # --- au moins une extrémité du pipe sur cette face de peau
|
if len(verticesPipePeau) > 0: # --- au moins une extrémité du pipe sur cette face de peau
|
||||||
edgeEnTrop = []
|
edgeEnTrop = list()
|
||||||
outilPart = pipexts
|
outilPart = pipexts
|
||||||
facesPeau = geompy.ExtractShapes(partitionPeauByPipe, geompy.ShapeType["FACE"], False)
|
facesPeau = geompy.ExtractShapes(partitionPeauByPipe, geompy.ShapeType["FACE"], False)
|
||||||
facesPeauSorted, minsur, maxsurf = sortFaces(facesPeau)
|
facesPeauSorted, _, _ = sortFaces(facesPeau)
|
||||||
for i, face in enumerate(facesPeauSorted[:-1]): # on ne teste que la ou les petites faces "circulaires"
|
for face in facesPeauSorted[:-1]: # on ne teste que la ou les petites faces "circulaires"
|
||||||
nbv = geompy.NumberOfEdges(face)
|
nbv = geompy.NumberOfEdges(face)
|
||||||
logging.debug("nombre d'edges sur face circulaire: %s", nbv)
|
logging.debug("nombre d'edges sur face circulaire: %s", nbv)
|
||||||
if nbv > 3:
|
edgeEnTrop.append(bool(nbv > 3)) # TODO : distinguer les cas avec deux faces circulaires dont l'une est correcte
|
||||||
edgeEnTrop.append(True) # TODO : distinguer les cas avec deux faces circulaires dont l'une est correcte
|
|
||||||
else:
|
|
||||||
edgeEnTrop.append(False)
|
|
||||||
refaire = sum(edgeEnTrop)
|
refaire = sum(edgeEnTrop)
|
||||||
if refaire > 0:
|
if refaire > 0:
|
||||||
dc = [(geompy.MinDistance(verticesEdgesFondIn[0], fac), i) for i, fac in enumerate(facesPeauSorted[:-1])]
|
l_aux = [(geompy.MinDistance(verticesEdgesFondIn[0], fac), i_aux) for i_aux, fac in enumerate(facesPeauSorted[:-1])]
|
||||||
dc.sort()
|
l_aux.sort()
|
||||||
logging.debug("dc sorted: %s", dc)
|
logging.debug("l_aux sorted: %s", l_aux)
|
||||||
i0 = dc[0][1] # indice de facesPeauSorted qui correspond à verticesEdgesFondIn[0], donc 0 pour cercles
|
direct = bool(l_aux[0][1] == 0) # l_aux[0][1] = indice de facesPeauSorted qui correspond à verticesEdgesFondIn[0], donc 0 pour cercles
|
||||||
direct = (i0 == 0)
|
for i_aux, bad in enumerate(edgeEnTrop):
|
||||||
for i, bad in enumerate(edgeEnTrop):
|
|
||||||
if direct:
|
if direct:
|
||||||
j = i
|
j_aux = i_aux
|
||||||
else:
|
else:
|
||||||
j = 1-i
|
j_aux = 1-i_aux
|
||||||
if bad:
|
if bad:
|
||||||
outilPart[j] = geompy.MakeProjection(cercles[j],facesOnside[0])
|
outilPart[j_aux] = geompy.MakeProjection(cercles[j_aux],facesOnside[0])
|
||||||
pass
|
|
||||||
partitionPeauByPipe = geompy.MakePartition(facesAndFond, outilPart, [], [], geompy.ShapeType["FACE"], 0, [], 1)
|
partitionPeauByPipe = geompy.MakePartition(facesAndFond, outilPart, [], [], geompy.ShapeType["FACE"], 0, [], 1)
|
||||||
pass
|
|
||||||
|
name="partitionPeauByPipe{}".format(ifil)
|
||||||
name="partitionPeauByPipe%d"%ifil
|
|
||||||
geomPublish(initLog.debug, partitionPeauByPipe, name)
|
geomPublish(initLog.debug, partitionPeauByPipe, name)
|
||||||
[edgesPeauFondIn, edgesPeauFondOut, edgesPeauFondOn] = extractionOrientee(fillingFaceExterne, partitionPeauByPipe, centreFondFiss, "EDGE", 1.e-3)
|
[edgesPeauFondIn, _, _] = extractionOrientee(fillingFaceExterne, partitionPeauByPipe, centreFondFiss, "EDGE", 1.e-3)
|
||||||
[facesPeauFondIn, facesPeauFondOut, facesPeauFondOn] = extractionOrientee(fillingFaceExterne, partitionPeauByPipe, centreFondFiss, "FACE", 1.e-3)
|
[_, _, 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
|
if verticesPipePeau: # --- au moins une extrémité du pipe sur cette face de peau
|
||||||
facesPeauSorted, minsur, maxsurf = sortFaces(facesPeauFondOn)
|
facesPeauSorted, _, _ = sortFaces(facesPeauFondOn)
|
||||||
facePeau = facesPeauSorted[-1] # la plus grande face
|
facePeau = facesPeauSorted[-1] # la plus grande face
|
||||||
else:
|
else:
|
||||||
facePeau =geompy.MakePartition(facesPeauFondOn, [], [], [], geompy.ShapeType["FACE"], 0, [], 1)
|
facePeau =geompy.MakePartition(facesPeauFondOn, [], [], [], geompy.ShapeType["FACE"], 0, [], 1)
|
||||||
facesPeauSorted = [facePeau]
|
facesPeauSorted = [facePeau]
|
||||||
name="facePeau%d"%ifil
|
|
||||||
|
name="facePeau{}".format(ifil)
|
||||||
geomPublish(initLog.debug, facePeau, name)
|
geomPublish(initLog.debug, facePeau, name)
|
||||||
|
|
||||||
return (facePeau, facesPeauSorted, edgesPeauFondIn)
|
return (facePeau, facesPeauSorted, edgesPeauFondIn)
|
||||||
|
@ -17,12 +17,10 @@
|
|||||||
#
|
#
|
||||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
#
|
#
|
||||||
|
"""Création d'une nouvelle étude"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
myStudy = None
|
|
||||||
|
|
||||||
def initEtude():
|
def initEtude():
|
||||||
"""
|
"""Création nouvelle etude salome"""
|
||||||
creation nouvelle etude salome
|
|
||||||
"""
|
|
||||||
from . import geomsmesh
|
from . import geomsmesh
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#
|
#
|
||||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
#
|
#
|
||||||
|
"""Initialisations des impressions"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
@ -34,6 +35,7 @@ ch = None
|
|||||||
fh = None
|
fh = None
|
||||||
|
|
||||||
def setLogger(logfile, level, formatter):
|
def setLogger(logfile, level, formatter):
|
||||||
|
"""setLogger"""
|
||||||
global ch, fh
|
global ch, fh
|
||||||
rootLogger = logging.getLogger('')
|
rootLogger = logging.getLogger('')
|
||||||
if fh is not None:
|
if fh is not None:
|
||||||
@ -53,9 +55,9 @@ def setLogger(logfile, level, formatter):
|
|||||||
rootLogger.addHandler(ch)
|
rootLogger.addHandler(ch)
|
||||||
ch.setFormatter(formatter)
|
ch.setFormatter(formatter)
|
||||||
rootLogger.setLevel(level)
|
rootLogger.setLevel(level)
|
||||||
|
|
||||||
|
|
||||||
def setDebug(logfile=None):
|
def setDebug(logfile=None):
|
||||||
|
"""setDebug"""
|
||||||
global loglevel
|
global loglevel
|
||||||
loglevel = debug
|
loglevel = debug
|
||||||
level = logging.DEBUG
|
level = logging.DEBUG
|
||||||
@ -64,6 +66,7 @@ def setDebug(logfile=None):
|
|||||||
logging.info('start Debug %s', loglevel)
|
logging.info('start Debug %s', loglevel)
|
||||||
|
|
||||||
def setVerbose(logfile=None):
|
def setVerbose(logfile=None):
|
||||||
|
"""setVerbose"""
|
||||||
global loglevel
|
global loglevel
|
||||||
loglevel = info
|
loglevel = info
|
||||||
level = logging.INFO
|
level = logging.INFO
|
||||||
@ -72,28 +75,32 @@ def setVerbose(logfile=None):
|
|||||||
logging.info('start Verbose %s', loglevel)
|
logging.info('start Verbose %s', loglevel)
|
||||||
|
|
||||||
def setRelease(logfile=None):
|
def setRelease(logfile=None):
|
||||||
|
"""setRelease"""
|
||||||
global loglevel
|
global loglevel
|
||||||
loglevel = warning
|
loglevel = warning
|
||||||
level = logging.WARNING
|
level = logging.WARNING
|
||||||
formatter = logging.Formatter('%(funcName)s[%(lineno)d] %(message)s')
|
formatter = logging.Formatter('%(funcName)s[%(lineno)d] %(message)s')
|
||||||
setLogger(logfile, level, formatter)
|
setLogger(logfile, level, formatter)
|
||||||
logging.warning('start Release %s', loglevel)
|
logging.warning('start Release %s', loglevel)
|
||||||
|
|
||||||
def setUnitTests(logfile=None):
|
def setUnitTests(logfile=None):
|
||||||
|
"""setUnitTests"""
|
||||||
global loglevel
|
global loglevel
|
||||||
loglevel = critical
|
loglevel = critical
|
||||||
level = logging.CRITICAL
|
level = logging.CRITICAL
|
||||||
formatter = logging.Formatter('%(funcName)s[%(lineno)d] %(message)s')
|
formatter = logging.Formatter('%(funcName)s[%(lineno)d] %(message)s')
|
||||||
setLogger(logfile, level, formatter)
|
setLogger(logfile, level, formatter)
|
||||||
logging.critical('start UnitTests %s', loglevel)
|
logging.critical('start UnitTests %s', loglevel)
|
||||||
|
|
||||||
def setPerfTests(logfile=None):
|
def setPerfTests(logfile=None):
|
||||||
|
"""setPerfTests"""
|
||||||
global loglevel
|
global loglevel
|
||||||
loglevel = critical
|
loglevel = critical
|
||||||
level = logging.CRITICAL
|
level = logging.CRITICAL
|
||||||
formatter = logging.Formatter('%(funcName)s[%(lineno)d] %(message)s')
|
formatter = logging.Formatter('%(funcName)s[%(lineno)d] %(message)s')
|
||||||
setLogger(logfile, level, formatter)
|
setLogger(logfile, level, formatter)
|
||||||
logging.info('start PerfTests %s', loglevel)
|
logging.info('start PerfTests %s', loglevel)
|
||||||
|
|
||||||
def getLogLevel():
|
def getLogLevel():
|
||||||
|
"""getLogLevel"""
|
||||||
return loglevel
|
return loglevel
|
||||||
|
@ -22,14 +22,9 @@
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import salome
|
import salome
|
||||||
from .geomsmesh import geompy
|
|
||||||
from .geomsmesh import geomPublish
|
|
||||||
from .geomsmesh import geomPublishInFather
|
|
||||||
from . import initLog
|
|
||||||
from .geomsmesh import smesh
|
|
||||||
import SMESH
|
import SMESH
|
||||||
import math
|
|
||||||
|
|
||||||
from .partitionBlocDefaut import partitionBlocDefaut
|
from .partitionBlocDefaut import partitionBlocDefaut
|
||||||
from .facesVolumesToriques import facesVolumesToriques
|
from .facesVolumesToriques import facesVolumesToriques
|
||||||
@ -50,17 +45,15 @@ from .putName import putName
|
|||||||
def insereFissureElliptique(geometriesSaines, maillagesSains, \
|
def insereFissureElliptique(geometriesSaines, maillagesSains, \
|
||||||
shapesFissure, shapeFissureParams, \
|
shapesFissure, shapeFissureParams, \
|
||||||
maillageFissureParams, elementsDefaut, step=-1):
|
maillageFissureParams, elementsDefaut, step=-1):
|
||||||
"""
|
"""procedure complete fissure elliptique"""
|
||||||
TODO: a completer
|
|
||||||
"""
|
|
||||||
logging.info('start')
|
logging.info('start')
|
||||||
|
|
||||||
geometrieSaine = geometriesSaines[0]
|
#geometrieSaine = geometriesSaines[0]
|
||||||
maillageSain = maillagesSains[0]
|
maillageSain = maillagesSains[0]
|
||||||
isHexa = maillagesSains[1]
|
isHexa = maillagesSains[1]
|
||||||
shapeDefaut = shapesFissure[0]
|
#shapeDefaut = shapesFissure[0]
|
||||||
tailleDefaut = shapesFissure[2]
|
#tailleDefaut = shapesFissure[2]
|
||||||
pipe0 = shapesFissure[4]
|
#pipe0 = shapesFissure[4]
|
||||||
gener1 = shapesFissure[5]
|
gener1 = shapesFissure[5]
|
||||||
pipe1 = shapesFissure[6]
|
pipe1 = shapesFissure[6]
|
||||||
facefis1 = shapesFissure[7]
|
facefis1 = shapesFissure[7]
|
||||||
@ -68,12 +61,12 @@ def insereFissureElliptique(geometriesSaines, maillagesSains, \
|
|||||||
ellipsoide1 = shapesFissure[9]
|
ellipsoide1 = shapesFissure[9]
|
||||||
|
|
||||||
|
|
||||||
demiGrandAxe = shapeFissureParams['demiGrandAxe']
|
#demiGrandAxe = shapeFissureParams['demiGrandAxe']
|
||||||
demiPetitAxe = shapeFissureParams['demiPetitAxe']
|
#demiPetitAxe = shapeFissureParams['demiPetitAxe']
|
||||||
orientation = shapeFissureParams['orientation']
|
#orientation = shapeFissureParams['orientation']
|
||||||
|
|
||||||
nomRep = maillageFissureParams['nomRep']
|
nomRep = maillageFissureParams['nomRep']
|
||||||
nomFicSain = maillageFissureParams['nomFicSain']
|
#nomFicSain = maillageFissureParams['nomFicSain']
|
||||||
nomFicFissure = maillageFissureParams['nomFicFissure']
|
nomFicFissure = maillageFissureParams['nomFicFissure']
|
||||||
|
|
||||||
nbsegExt = maillageFissureParams['nbsegExt'] # 5
|
nbsegExt = maillageFissureParams['nbsegExt'] # 5
|
||||||
@ -84,18 +77,18 @@ def insereFissureElliptique(geometriesSaines, maillagesSains, \
|
|||||||
nbsegFis = maillageFissureParams['nbsegFis'] # 20
|
nbsegFis = maillageFissureParams['nbsegFis'] # 20
|
||||||
lensegEllipsoide = maillageFissureParams['lensegEllipso'] # 1.0
|
lensegEllipsoide = maillageFissureParams['lensegEllipso'] # 1.0
|
||||||
|
|
||||||
fichierMaillageSain = os.path.join(nomRep, '{}.med'.format(nomFicSain))
|
#fichierMaillageSain = os.path.join(nomRep, '{}.med'.format(nomFicSain))
|
||||||
fichierMaillageFissure = os.path.join(nomRep, '{}.med'.format(nomFicFissure))
|
fichierMaillageFissure = os.path.join(nomRep, '{}.med'.format(nomFicFissure))
|
||||||
|
|
||||||
facesDefaut = elementsDefaut[0]
|
facesDefaut = elementsDefaut[0]
|
||||||
centreDefaut = elementsDefaut[1]
|
#centreDefaut = elementsDefaut[1]
|
||||||
normalDefaut = elementsDefaut[2]
|
#normalDefaut = elementsDefaut[2]
|
||||||
extrusionDefaut = elementsDefaut[3]
|
extrusionDefaut = elementsDefaut[3]
|
||||||
dmoyen = elementsDefaut[4]
|
dmoyen = elementsDefaut[4]
|
||||||
bordsPartages = elementsDefaut[5]
|
#bordsPartages = elementsDefaut[5]
|
||||||
fillconts = elementsDefaut[6]
|
#fillconts = elementsDefaut[6]
|
||||||
idFilToCont = elementsDefaut[7]
|
#idFilToCont = elementsDefaut[7]
|
||||||
maillageSain = elementsDefaut[8]
|
#maillageSain = elementsDefaut[8]
|
||||||
internalBoundary = elementsDefaut[9]
|
internalBoundary = elementsDefaut[9]
|
||||||
zoneDefaut = elementsDefaut[10]
|
zoneDefaut = elementsDefaut[10]
|
||||||
zoneDefaut_skin = elementsDefaut[11]
|
zoneDefaut_skin = elementsDefaut[11]
|
||||||
@ -109,7 +102,7 @@ def insereFissureElliptique(geometriesSaines, maillagesSains, \
|
|||||||
#allonge = demiGrandAxe/demiPetitAxe
|
#allonge = demiGrandAxe/demiPetitAxe
|
||||||
#rayonTore = demiPetitAxe/5.0
|
#rayonTore = demiPetitAxe/5.0
|
||||||
#generatrice, FaceGenFiss, Pipe_1, FaceFissure, Plane_1, Pipe1Part = self.toreFissure(demiPetitAxe, allonge, rayonTore)
|
#generatrice, FaceGenFiss, Pipe_1, FaceFissure, Plane_1, Pipe1Part = self.toreFissure(demiPetitAxe, allonge, rayonTore)
|
||||||
#ellipsoide = self.ellipsoideDefaut(demiPetitAxe, allonge, rayonTore)
|
#ellipsoide = self.ellipsoideDefaut(demiPetitAxe, allonge)
|
||||||
|
|
||||||
## --- positionnement sur le bloc defaut de generatrice, tore et plan fissure
|
## --- positionnement sur le bloc defaut de generatrice, tore et plan fissure
|
||||||
#if step == 6:
|
#if step == 6:
|
||||||
@ -133,7 +126,7 @@ def insereFissureElliptique(geometriesSaines, maillagesSains, \
|
|||||||
if step == 7:
|
if step == 7:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
[ blocPartition, blocp, tore, \
|
[ blocPartition, _, tore, \
|
||||||
faceFissure, facesExternes, facesExtBloc, facesExtElli,
|
faceFissure, facesExternes, facesExtBloc, facesExtElli,
|
||||||
aretesInternes, ellipsoidep, sharedFaces, sharedEdges, edgesBords] = \
|
aretesInternes, ellipsoidep, sharedFaces, sharedEdges, edgesBords] = \
|
||||||
partitionBlocDefaut(extrusionDefaut, facesDefaut, gener1, pipe1, facefis1, ellipsoide1)
|
partitionBlocDefaut(extrusionDefaut, facesDefaut, gener1, pipe1, facefis1, ellipsoide1)
|
||||||
@ -145,7 +138,7 @@ def insereFissureElliptique(geometriesSaines, maillagesSains, \
|
|||||||
if step == 8:
|
if step == 8:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
[facetore1, facetore2, volumeTore1, volumeTore2] = facesVolumesToriques(tore, plane1, facesDefaut)
|
[facetore1, facetore2, _, _] = facesVolumesToriques(tore, plane1, facesDefaut)
|
||||||
|
|
||||||
# --- faces 1/2 circulaires et edges dans le plan de fissure
|
# --- faces 1/2 circulaires et edges dans le plan de fissure
|
||||||
if step == 9:
|
if step == 9:
|
||||||
@ -163,20 +156,20 @@ def insereFissureElliptique(geometriesSaines, maillagesSains, \
|
|||||||
if step == 11:
|
if step == 11:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
[genext, genint, gencnt] = sortGeneratrices(tore, geners)
|
[_, genint, gencnt] = sortGeneratrices(tore, geners)
|
||||||
|
|
||||||
# --- faces fissure dans et hors tore, et edges face hors tore
|
# --- faces fissure dans et hors tore, et edges face hors tore
|
||||||
if step == 12:
|
if step == 12:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
[facefissintore, facefissoutore, edgeint, edgeext, reverext] = \
|
[_, facefissoutore, _, edgeext, reverext] = \
|
||||||
facesFissure(ellipsoidep, faceFissure, extrusionDefaut, genint)
|
facesFissure(ellipsoidep, faceFissure, extrusionDefaut, genint)
|
||||||
|
|
||||||
# --- identification des faces tore et fissure dans le solide hors tore
|
# --- identification des faces tore et fissure dans le solide hors tore
|
||||||
if step == 13:
|
if step == 13:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
[blocFaceFiss, blocFaceTore1, blocFaceTore2] = \
|
[_, _, _] = \
|
||||||
facesToreInBloc(ellipsoidep, facefissoutore, facetore1, facetore2)
|
facesToreInBloc(ellipsoidep, facefissoutore, facetore1, facetore2)
|
||||||
|
|
||||||
# --- identification des shapes modifiées par la duplication des noeuds de la face fissure (d'un coté de la face)
|
# --- identification des shapes modifiées par la duplication des noeuds de la face fissure (d'un coté de la face)
|
||||||
@ -185,14 +178,14 @@ def insereFissureElliptique(geometriesSaines, maillagesSains, \
|
|||||||
if step == 14:
|
if step == 14:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
extrusionFaceFissure, normfiss = shapeSurFissure(plane1)
|
extrusionFaceFissure, _ = shapeSurFissure(plane1)
|
||||||
|
|
||||||
# --- maillage du bloc partitionne
|
# --- maillage du bloc partitionne
|
||||||
|
|
||||||
if step == 15:
|
if step == 15:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
[bloc1, blocComplet] = \
|
[_, blocComplet] = \
|
||||||
meshBlocPart(blocPartition, faceFissure, tore, centres, edges, diams, circles, faces, \
|
meshBlocPart(blocPartition, faceFissure, tore, centres, edges, diams, circles, faces, \
|
||||||
gencnt, facefissoutore, edgeext, facesExternes, facesExtBloc, facesExtElli, \
|
gencnt, facefissoutore, edgeext, facesExternes, facesExtBloc, facesExtElli, \
|
||||||
aretesInternes, internalBoundary, ellipsoidep, sharedFaces, sharedEdges, edgesBords, \
|
aretesInternes, internalBoundary, ellipsoidep, sharedFaces, sharedEdges, edgesBords, \
|
||||||
|
@ -17,23 +17,23 @@
|
|||||||
#
|
#
|
||||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
#
|
#
|
||||||
|
|
||||||
"""procédure complète fissure générale"""
|
"""procédure complète fissure générale"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import math
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
from . import initLog
|
||||||
|
|
||||||
import salome
|
import salome
|
||||||
|
from salome.smesh import smeshBuilder
|
||||||
|
import GEOM
|
||||||
|
import SMESH
|
||||||
|
|
||||||
from .geomsmesh import geompy
|
from .geomsmesh import geompy
|
||||||
from .geomsmesh import geomPublish
|
from .geomsmesh import geomPublish
|
||||||
from .geomsmesh import geomPublishInFather
|
from .geomsmesh import geomPublishInFather
|
||||||
from . import initLog
|
|
||||||
import GEOM
|
|
||||||
from .geomsmesh import smesh
|
from .geomsmesh import smesh
|
||||||
from salome.smesh import smeshBuilder
|
|
||||||
import SMESH
|
|
||||||
import math
|
|
||||||
import bisect
|
|
||||||
|
|
||||||
from .extractionOrientee import extractionOrientee
|
from .extractionOrientee import extractionOrientee
|
||||||
from .extractionOrienteeMulti import extractionOrienteeMulti
|
from .extractionOrienteeMulti import extractionOrienteeMulti
|
||||||
@ -54,7 +54,6 @@ from .whichSide import whichSide
|
|||||||
from .whichSideVertex import whichSideVertex
|
from .whichSideVertex import whichSideVertex
|
||||||
from .projettePointSurCourbe import projettePointSurCourbe
|
from .projettePointSurCourbe import projettePointSurCourbe
|
||||||
from .prolongeWire import prolongeWire
|
from .prolongeWire import prolongeWire
|
||||||
#from getCentreFondFiss import getCentreFondFiss
|
|
||||||
|
|
||||||
def insereFissureGenerale(maillagesSains,
|
def insereFissureGenerale(maillagesSains,
|
||||||
shapesFissure, shapeFissureParams,
|
shapesFissure, shapeFissureParams,
|
||||||
@ -106,15 +105,15 @@ def insereFissureGenerale(maillagesSains,
|
|||||||
#extrusionsDefaut = elementsDefaut[3]
|
#extrusionsDefaut = elementsDefaut[3]
|
||||||
dmoyen = elementsDefaut[4]
|
dmoyen = elementsDefaut[4]
|
||||||
bordsPartages = elementsDefaut[5]
|
bordsPartages = elementsDefaut[5]
|
||||||
fillconts = elementsDefaut[6]
|
#fillconts = elementsDefaut[6]
|
||||||
idFilToCont = elementsDefaut[7]
|
#idFilToCont = elementsDefaut[7]
|
||||||
maillageSain = elementsDefaut[8]
|
maillageSain = elementsDefaut[8]
|
||||||
internalBoundary = elementsDefaut[9]
|
internalBoundary = elementsDefaut[9]
|
||||||
zoneDefaut = elementsDefaut[10]
|
zoneDefaut = elementsDefaut[10]
|
||||||
zoneDefaut_skin = elementsDefaut[11]
|
zoneDefaut_skin = elementsDefaut[11]
|
||||||
zoneDefaut_internalFaces = elementsDefaut[12]
|
zoneDefaut_internalFaces = elementsDefaut[12]
|
||||||
zoneDefaut_internalEdges = elementsDefaut[13]
|
zoneDefaut_internalEdges = elementsDefaut[13]
|
||||||
edgeFondExt = elementsDefaut[14]
|
#edgeFondExt = elementsDefaut[14]
|
||||||
centreFondFiss = elementsDefaut[15]
|
centreFondFiss = elementsDefaut[15]
|
||||||
tgtCentre = elementsDefaut[16]
|
tgtCentre = elementsDefaut[16]
|
||||||
|
|
||||||
@ -136,7 +135,7 @@ def insereFissureGenerale(maillagesSains,
|
|||||||
|
|
||||||
geomPublish(initLog.debug, facesPortFissure, "facesPortFissure")
|
geomPublish(initLog.debug, facesPortFissure, "facesPortFissure")
|
||||||
|
|
||||||
O, OX, OY, OZ = triedreBase()
|
O, _, _, _ = triedreBase()
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# --- pipe de fond de fissure, prolongé, partition face fissure par pipe
|
# --- pipe de fond de fissure, prolongé, partition face fissure par pipe
|
||||||
@ -313,16 +312,16 @@ def insereFissureGenerale(maillagesSains,
|
|||||||
geomPublishInFather(initLog.debug,partitionPeauFissFond, edge, name)
|
geomPublishInFather(initLog.debug,partitionPeauFissFond, edge, name)
|
||||||
dist = [ geompy.MinDistance(pt, edge) for pt in verticesPipePeau]
|
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
|
ptPeau = verticesPipePeau[dist.index(min(dist))] # le point de verticesPipePeau a distance minimale de l'edge
|
||||||
[u, PointOnEdge, EdgeInWireIndex] = geompy.MakeProjectionOnWire(ptPeau, wireFondFiss)
|
[parametre, PointOnEdge, EdgeInWireIndex] = geompy.MakeProjectionOnWire(ptPeau, wireFondFiss)
|
||||||
logging.debug("u:%s, EdgeInWireIndex: %s, len(edgesFondFiss): %s", u, EdgeInWireIndex, len(edgesFondFiss))
|
logging.debug("parametre:%s, EdgeInWireIndex: %s, len(edgesFondFiss): %s", parametre, EdgeInWireIndex, len(edgesFondFiss))
|
||||||
localEdgeInFondFiss = edgesFondFiss[EdgeInWireIndex]
|
localEdgeInFondFiss = edgesFondFiss[EdgeInWireIndex]
|
||||||
centre = PointOnEdge
|
centre = PointOnEdge
|
||||||
centre2 = geompy.MakeVertexOnCurve(localEdgeInFondFiss, u)
|
centre2 = geompy.MakeVertexOnCurve(localEdgeInFondFiss, parametre)
|
||||||
geomPublishInFather(initLog.debug,partitionPeauFissFond, centre2, "centre2_%d"%iedf)
|
geomPublishInFather(initLog.debug,partitionPeauFissFond, centre2, "centre2_%d"%iedf)
|
||||||
verticesEdgesFondIn.append(centre)
|
verticesEdgesFondIn.append(centre)
|
||||||
name = "verticeEdgesFondIn%d"%iedf
|
name = "verticeEdgesFondIn%d"%iedf
|
||||||
geomPublishInFather(initLog.debug,partitionPeauFissFond, centre, name)
|
geomPublishInFather(initLog.debug,partitionPeauFissFond, centre, name)
|
||||||
norm = geompy.MakeTangentOnCurve(localEdgeInFondFiss, u)
|
norm = geompy.MakeTangentOnCurve(localEdgeInFondFiss, parametre)
|
||||||
geomPublishInFather(initLog.debug,partitionPeauFissFond, centre, "norm%d"%iedf)
|
geomPublishInFather(initLog.debug,partitionPeauFissFond, centre, "norm%d"%iedf)
|
||||||
cercle = geompy.MakeCircle(centre, norm, rayonPipe)
|
cercle = geompy.MakeCircle(centre, norm, rayonPipe)
|
||||||
geomPublishInFather(initLog.debug,partitionPeauFissFond, cercle, "cerclorig%d"%iedf)
|
geomPublishInFather(initLog.debug,partitionPeauFissFond, cercle, "cerclorig%d"%iedf)
|
||||||
@ -493,8 +492,8 @@ def insereFissureGenerale(maillagesSains,
|
|||||||
|
|
||||||
name="partitionPeauByPipe%d"%ifil
|
name="partitionPeauByPipe%d"%ifil
|
||||||
geomPublish(initLog.debug, partitionPeauByPipe, name)
|
geomPublish(initLog.debug, partitionPeauByPipe, name)
|
||||||
[edgesPeauFondIn, edgesPeauFondOut, edgesPeauFondOn] = extractionOrientee(fillingFaceExterne, partitionPeauByPipe, centreFondFiss, "EDGE", 1.e-3)
|
[edgesPeauFondIn, _, _] = extractionOrientee(fillingFaceExterne, partitionPeauByPipe, centreFondFiss, "EDGE", 1.e-3)
|
||||||
[facesPeauFondIn, facesPeauFondOut, facesPeauFondOn] = extractionOrientee(fillingFaceExterne, partitionPeauByPipe, centreFondFiss, "FACE", 1.e-3)
|
[_, _, 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
|
if len(verticesPipePeau) > 0: # --- au moins une extrémité du pipe sur cette face de peau
|
||||||
facesPeauSorted, _, _ = sortFaces(facesPeauFondOn)
|
facesPeauSorted, _, _ = sortFaces(facesPeauFondOn)
|
||||||
@ -659,7 +658,7 @@ def insereFissureGenerale(maillagesSains,
|
|||||||
edgesPipeFissureExterneC = geompy.GetInPlace(faceFissureExterne, geompy.MakeCompound(edgesPipeFiss)) # edgesFissExtPipe peut ne pas couvrir toute la longueur
|
edgesPipeFissureExterneC = geompy.GetInPlace(faceFissureExterne, geompy.MakeCompound(edgesPipeFiss)) # edgesFissExtPipe peut ne pas couvrir toute la longueur
|
||||||
# edgesPeauFissureExterneC = geompy.GetInPlace(faceFissureExterne, geompy.MakeCompound(edgesFissExtPeau))
|
# edgesPeauFissureExterneC = geompy.GetInPlace(faceFissureExterne, geompy.MakeCompound(edgesFissExtPeau))
|
||||||
# il peut manquer des edges de faceFissureExterne en contact avec la peau dans edgesFissExtPeau
|
# il peut manquer des edges de faceFissureExterne en contact avec la peau dans edgesFissExtPeau
|
||||||
(isDone, closedFreeBoundaries, openFreeBoundaries) = geompy.GetFreeBoundary(faceFissureExterne)
|
(_, closedFreeBoundaries, _) = geompy.GetFreeBoundary(faceFissureExterne)
|
||||||
edgesBordFFE = list()
|
edgesBordFFE = list()
|
||||||
for bound in closedFreeBoundaries:
|
for bound in closedFreeBoundaries:
|
||||||
edgesBordFFE += geompy.ExtractShapes(bound, geompy.ShapeType["EDGE"], False)
|
edgesBordFFE += geompy.ExtractShapes(bound, geompy.ShapeType["EDGE"], False)
|
||||||
@ -724,10 +723,10 @@ def insereFissureGenerale(maillagesSains,
|
|||||||
xyz = meshFondExt.GetNodeXYZ(nodeId)
|
xyz = meshFondExt.GetNodeXYZ(nodeId)
|
||||||
#logging.debug("nodeId %s, coords %s", nodeId, str(xyz))
|
#logging.debug("nodeId %s, coords %s", nodeId, str(xyz))
|
||||||
pt = geompy.MakeVertex(xyz[0], xyz[1], xyz[2])
|
pt = geompy.MakeVertex(xyz[0], xyz[1], xyz[2])
|
||||||
u, PointOnEdge, EdgeInWireIndex = geompy.MakeProjectionOnWire(pt, wireFondFiss) # u compris entre 0 et 1
|
parametre, PointOnEdge, EdgeInWireIndex = geompy.MakeProjectionOnWire(pt, wireFondFiss) # parametre compris entre 0 et 1
|
||||||
edgeOrder = edgesIdByOrientation[EdgeInWireIndex]
|
edgeOrder = edgesIdByOrientation[EdgeInWireIndex]
|
||||||
ptGSdic[(edgeOrder, EdgeInWireIndex, u)] = pt
|
ptGSdic[(edgeOrder, EdgeInWireIndex, parametre)] = pt
|
||||||
#logging.debug("nodeId %s, u %s", nodeId, str(u))
|
#logging.debug("nodeId %s, parametre %s", nodeId, str(parametre))
|
||||||
usort = sorted(ptGSdic)
|
usort = sorted(ptGSdic)
|
||||||
logging.debug("nombre de points obtenus par deflexion %s",len(usort))
|
logging.debug("nombre de points obtenus par deflexion %s",len(usort))
|
||||||
|
|
||||||
@ -735,10 +734,8 @@ def insereFissureGenerale(maillagesSains,
|
|||||||
origins = list()
|
origins = list()
|
||||||
normals = list()
|
normals = list()
|
||||||
for edu in usort:
|
for edu in usort:
|
||||||
ied = edu[1]
|
|
||||||
u = edu[2]
|
|
||||||
vertcx = ptGSdic[edu]
|
vertcx = ptGSdic[edu]
|
||||||
norm = geompy.MakeTangentOnCurve(edgesFondFiss[ied], u)
|
norm = geompy.MakeTangentOnCurve(edgesFondFiss[edu[1]], edu[2])
|
||||||
plan = geompy.MakePlane(vertcx, norm, 3*rayonPipe)
|
plan = geompy.MakePlane(vertcx, norm, 3*rayonPipe)
|
||||||
part = geompy.MakePartition([plan], [wirePipeFiss], list(), list(), geompy.ShapeType["VERTEX"], 0, list(), 0)
|
part = geompy.MakePartition([plan], [wirePipeFiss], list(), list(), geompy.ShapeType["VERTEX"], 0, list(), 0)
|
||||||
liste = geompy.ExtractShapes(part, geompy.ShapeType["VERTEX"], True)
|
liste = geompy.ExtractShapes(part, geompy.ShapeType["VERTEX"], True)
|
||||||
@ -912,7 +909,7 @@ def insereFissureGenerale(maillagesSains,
|
|||||||
vs = geompy.ExtractShapes(obj, geompy.ShapeType["VERTEX"], False)
|
vs = geompy.ExtractShapes(obj, geompy.ShapeType["VERTEX"], False)
|
||||||
if len(vs) > 2:
|
if len(vs) > 2:
|
||||||
eds = geompy.ExtractShapes(obj, geompy.ShapeType["EDGE"], False)
|
eds = geompy.ExtractShapes(obj, geompy.ShapeType["EDGE"], False)
|
||||||
[edsorted, minl,maxl] = sortEdges(eds)
|
[edsorted, _,maxl] = sortEdges(eds)
|
||||||
edge = edsorted[-1]
|
edge = edsorted[-1]
|
||||||
else:
|
else:
|
||||||
maxl = geompy.BasicProperties(edge)[0]
|
maxl = geompy.BasicProperties(edge)[0]
|
||||||
@ -932,7 +929,7 @@ def insereFissureGenerale(maillagesSains,
|
|||||||
logging.debug(" edges issues de la partition: %s", ednouv)
|
logging.debug(" edges issues de la partition: %s", ednouv)
|
||||||
for ii, ed in enumerate(ednouv):
|
for ii, ed in enumerate(ednouv):
|
||||||
geomPublish(initLog.debug, ed, "ednouv%d"%ii)
|
geomPublish(initLog.debug, ed, "ednouv%d"%ii)
|
||||||
[edsorted, minl,maxl] = sortEdges(ednouv)
|
[edsorted, _,maxl] = sortEdges(ednouv)
|
||||||
logging.debug(" longueur edge trouvée: %s", maxl)
|
logging.debug(" longueur edge trouvée: %s", maxl)
|
||||||
edge = edsorted[-1]
|
edge = edsorted[-1]
|
||||||
edges.append(edge)
|
edges.append(edge)
|
||||||
@ -998,7 +995,7 @@ def insereFissureGenerale(maillagesSains,
|
|||||||
# --- ajustement precis des points sur edgesPipeFissureExterneC
|
# --- ajustement precis des points sur edgesPipeFissureExterneC
|
||||||
|
|
||||||
edgesPFE = geompy.ExtractShapes(edgesPipeFissureExterneC, geompy.ShapeType["EDGE"], False)
|
edgesPFE = geompy.ExtractShapes(edgesPipeFissureExterneC, geompy.ShapeType["EDGE"], False)
|
||||||
verticesPFE = findWireIntermediateVertices(wirePipeFissureExterne) # vertices intermédiaires (des points en trop dans ptsInWireFissExtPipe)
|
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é
|
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é
|
idiskmax = idisklim[1] # on ne prend pas le disque sur la peau, déjà ajusté
|
||||||
idiskint = list()
|
idiskint = list()
|
||||||
@ -1166,9 +1163,9 @@ def insereFissureGenerale(maillagesSains,
|
|||||||
mVols.append(idVols)
|
mVols.append(idVols)
|
||||||
|
|
||||||
pipeFissGroup = meshPipe.CreateEmptyGroup( SMESH.VOLUME, 'PIPEFISS' )
|
pipeFissGroup = meshPipe.CreateEmptyGroup( SMESH.VOLUME, 'PIPEFISS' )
|
||||||
nbAdd = pipeFissGroup.AddFrom( meshPipe.GetMesh() )
|
_ = pipeFissGroup.AddFrom( meshPipe.GetMesh() )
|
||||||
|
|
||||||
nb, _, new_group = meshPipe.MakeBoundaryElements(SMESH.BND_2DFROM3D, "pipeBoundaries")
|
_, _, _ = meshPipe.MakeBoundaryElements(SMESH.BND_2DFROM3D, "pipeBoundaries")
|
||||||
edgesCircPipeGroup = [edgeCircPipe0Group, edgeCircPipe1Group]
|
edgesCircPipeGroup = [edgeCircPipe0Group, edgeCircPipe1Group]
|
||||||
|
|
||||||
# --- fin du maillage du pipe
|
# --- fin du maillage du pipe
|
||||||
@ -1176,7 +1173,7 @@ def insereFissureGenerale(maillagesSains,
|
|||||||
# --- edges de bord, faces défaut à respecter
|
# --- edges de bord, faces défaut à respecter
|
||||||
|
|
||||||
_ = smesh.CreateFilterManager()
|
_ = smesh.CreateFilterManager()
|
||||||
nbAdded, internalBoundary, _NoneGroup = internalBoundary.MakeBoundaryElements( SMESH.BND_1DFROM2D, '', '', 0, [ ])
|
_, internalBoundary, _NoneGroup = internalBoundary.MakeBoundaryElements( SMESH.BND_1DFROM2D, '', '', 0, [ ])
|
||||||
criteres = list()
|
criteres = list()
|
||||||
unCritere = smesh.GetCriterion(SMESH.EDGE,SMESH.FT_FreeBorders,SMESH.FT_Undefined,0)
|
unCritere = smesh.GetCriterion(SMESH.EDGE,SMESH.FT_FreeBorders,SMESH.FT_Undefined,0)
|
||||||
criteres.append(unCritere)
|
criteres.append(unCritere)
|
||||||
@ -1188,7 +1185,7 @@ def insereFissureGenerale(maillagesSains,
|
|||||||
# on désigne les faces de peau en quadrangles par le groupe "skinFaces"
|
# on désigne les faces de peau en quadrangles par le groupe "skinFaces"
|
||||||
|
|
||||||
skinFaces = internalBoundary.CreateEmptyGroup( SMESH.FACE, 'skinFaces' )
|
skinFaces = internalBoundary.CreateEmptyGroup( SMESH.FACE, 'skinFaces' )
|
||||||
nbAdd = skinFaces.AddFrom( internalBoundary.GetMesh() )
|
_ = skinFaces.AddFrom( internalBoundary.GetMesh() )
|
||||||
|
|
||||||
# --- maillage des éventuelles arêtes vives entre faces reconstruites
|
# --- maillage des éventuelles arêtes vives entre faces reconstruites
|
||||||
|
|
||||||
@ -1211,7 +1208,7 @@ def insereFissureGenerale(maillagesSains,
|
|||||||
logging.info(text)
|
logging.info(text)
|
||||||
raise Exception(text)
|
raise Exception(text)
|
||||||
grpAretesVives = meshAretesVives.CreateEmptyGroup( SMESH.EDGE, 'grpAretesVives' )
|
grpAretesVives = meshAretesVives.CreateEmptyGroup( SMESH.EDGE, 'grpAretesVives' )
|
||||||
nbAdd = grpAretesVives.AddFrom( meshAretesVives.GetMesh() )
|
_ = grpAretesVives.AddFrom( meshAretesVives.GetMesh() )
|
||||||
|
|
||||||
# -----------------------------------------------------------------------
|
# -----------------------------------------------------------------------
|
||||||
# --- maillage faces de fissure
|
# --- maillage faces de fissure
|
||||||
@ -1247,9 +1244,9 @@ def insereFissureGenerale(maillagesSains,
|
|||||||
putName(algo1d, "algo1d_edgeFissPeau")
|
putName(algo1d, "algo1d_edgeFissPeau")
|
||||||
putName(hypo1d, "hypo1d_edgeFissPeau")
|
putName(hypo1d, "hypo1d_edgeFissPeau")
|
||||||
|
|
||||||
grpFaceFissureExterne = meshFaceFiss.GroupOnGeom(faceFissureExterne, "fisOutPi", SMESH.FACE)
|
_ = meshFaceFiss.GroupOnGeom(faceFissureExterne, "fisOutPi", SMESH.FACE)
|
||||||
grpEdgesPeauFissureExterne = meshFaceFiss.GroupOnGeom(edgesPeauFissureExterneC,'edgesPeauFissureExterne',SMESH.EDGE)
|
grpEdgesPeauFissureExterne = meshFaceFiss.GroupOnGeom(edgesPeauFissureExterneC,'edgesPeauFissureExterne',SMESH.EDGE)
|
||||||
grpEdgesPipeFissureExterne = meshFaceFiss.GroupOnGeom(edgesPipeFissureExterneC,'edgesPipeFissureExterne',SMESH.EDGE)
|
_ = meshFaceFiss.GroupOnGeom(edgesPipeFissureExterneC,'edgesPipeFissureExterne',SMESH.EDGE)
|
||||||
|
|
||||||
is_done = meshFaceFiss.Compute()
|
is_done = meshFaceFiss.Compute()
|
||||||
text = "meshFaceFiss.Compute"
|
text = "meshFaceFiss.Compute"
|
||||||
@ -1361,7 +1358,7 @@ def insereFissureGenerale(maillagesSains,
|
|||||||
raise Exception(text)
|
raise Exception(text)
|
||||||
|
|
||||||
GroupFaces = meshFacePeau.CreateEmptyGroup( SMESH.FACE, "facePeau%d"%ifil )
|
GroupFaces = meshFacePeau.CreateEmptyGroup( SMESH.FACE, "facePeau%d"%ifil )
|
||||||
nbAdd = GroupFaces.AddFrom( meshFacePeau.GetMesh() )
|
_ = GroupFaces.AddFrom( meshFacePeau.GetMesh() )
|
||||||
meshesFacesPeau.append(meshFacePeau)
|
meshesFacesPeau.append(meshFacePeau)
|
||||||
|
|
||||||
# --- regroupement des maillages du défaut
|
# --- regroupement des maillages du défaut
|
||||||
@ -1415,7 +1412,7 @@ def insereFissureGenerale(maillagesSains,
|
|||||||
maillageSain = enleveDefaut(maillageSain, zoneDefaut, zoneDefaut_skin,
|
maillageSain = enleveDefaut(maillageSain, zoneDefaut, zoneDefaut_skin,
|
||||||
zoneDefaut_internalFaces, zoneDefaut_internalEdges)
|
zoneDefaut_internalFaces, zoneDefaut_internalEdges)
|
||||||
putName(maillageSain, nomFicSain+"_coupe")
|
putName(maillageSain, nomFicSain+"_coupe")
|
||||||
extrusionFaceFissure, normfiss = shapeSurFissure(facesPortFissure)
|
_, normfiss = shapeSurFissure(facesPortFissure)
|
||||||
maillageComplet = RegroupeSainEtDefaut(maillageSain, meshBoiteDefaut,
|
maillageComplet = RegroupeSainEtDefaut(maillageSain, meshBoiteDefaut,
|
||||||
None, None, 'COMPLET', normfiss)
|
None, None, 'COMPLET', normfiss)
|
||||||
|
|
||||||
@ -1428,13 +1425,13 @@ def insereFissureGenerale(maillagesSains,
|
|||||||
|
|
||||||
logging.info("réorientation face de fissure FACE1")
|
logging.info("réorientation face de fissure FACE1")
|
||||||
grps = [ grp for grp in groups if grp.GetName() == 'FACE1']
|
grps = [ grp for grp in groups if grp.GetName() == 'FACE1']
|
||||||
nb = maillageComplet.Reorient2D( grps[0], normfiss, grps[0].GetID(1))
|
_ = maillageComplet.Reorient2D( grps[0], normfiss, grps[0].GetID(1))
|
||||||
|
|
||||||
logging.info("réorientation face de fissure FACE2")
|
logging.info("réorientation face de fissure FACE2")
|
||||||
plansim = geompy.MakePlane(O, normfiss, 10000)
|
plansim = geompy.MakePlane(O, normfiss, 10000)
|
||||||
fissnorm = geompy.MakeMirrorByPlane(normfiss, plansim)
|
fissnorm = geompy.MakeMirrorByPlane(normfiss, plansim)
|
||||||
grps = [ grp for grp in groups if grp.GetName() == 'FACE2']
|
grps = [ grp for grp in groups if grp.GetName() == 'FACE2']
|
||||||
nb = maillageComplet.Reorient2D( grps[0], fissnorm, grps[0].GetID(1))
|
_ = maillageComplet.Reorient2D( grps[0], fissnorm, grps[0].GetID(1))
|
||||||
_ = maillageComplet.GetMesh().CreateDimGroup( grps, SMESH.NODE, 'FACE2' )
|
_ = maillageComplet.GetMesh().CreateDimGroup( grps, SMESH.NODE, 'FACE2' )
|
||||||
|
|
||||||
logging.info("export maillage fini")
|
logging.info("export maillage fini")
|
||||||
|
@ -17,10 +17,9 @@
|
|||||||
#
|
#
|
||||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
#
|
#
|
||||||
|
"""Cette fonction permet de scanner la liste de noeuds qui composent le maillage passé en paramètre
|
||||||
|
|
||||||
"""
|
|
||||||
Created on Mon Jun 23 14:49:36 2014
|
Created on Mon Jun 23 14:49:36 2014
|
||||||
|
|
||||||
@author: I48174 (Olivier HOAREAU)
|
@author: I48174 (Olivier HOAREAU)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@ -29,189 +28,193 @@ import SMESH
|
|||||||
from .geomsmesh import smesh
|
from .geomsmesh import smesh
|
||||||
|
|
||||||
def lookForCorner(maillageAScanner):
|
def lookForCorner(maillageAScanner):
|
||||||
|
|
||||||
""" Cette fonction permet de scanner la liste de noeuds qui composent le
|
""" Cette fonction permet de scanner la liste de noeuds qui composent le
|
||||||
maillage passé en paramètre. On recherche un ou plusieurs coins, ce
|
maillage passé en paramètre. On recherche un ou plusieurs coins, ce
|
||||||
qui implique les caractéristiques suivantes:
|
qui implique les caractéristiques suivantes:
|
||||||
- le noeud doit appartenir au moins à trois éléments distincts
|
- le noeud doit appartenir au moins à trois éléments distincts
|
||||||
- chaque élément doit appartenir à un ensemble distinct
|
- chaque élément doit appartenir à un ensemble distinct
|
||||||
La fonction renvoie une liste de coins par l'intermédiaire de l'IDs
|
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.
|
chaque noeud. La liste contient en général au maximum deux coins.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
logging.info("start")
|
logging.info("start")
|
||||||
|
|
||||||
allNodeIds = maillageAScanner.GetNodesId() # On stocke tout les noeuds
|
allNodeIds = maillageAScanner.GetNodesId() # On stocke tout les noeuds
|
||||||
listOfCorners = []
|
listOfCorners = list()
|
||||||
for ND in allNodeIds:
|
for noeud in allNodeIds:
|
||||||
# On parcours la liste de noeuds
|
# On parcours la liste de noeuds
|
||||||
listOfElements = maillageAScanner.GetNodeInverseElements(ND)
|
listOfElements = maillageAScanner.GetNodeInverseElements(noeud)
|
||||||
if len(listOfElements) >=3:
|
if len(listOfElements) >=3:
|
||||||
# On teste le nombre d'éléments qui partagent le même noeud
|
# On teste le nombre d'éléments qui partagent le même noeud
|
||||||
# --- Filtre selon le critère 'coplanar' --- #
|
# --- Filtre selon le critère 'coplanar' --- #
|
||||||
listOfCriterion = [smesh.GetCriterion(SMESH.FACE, SMESH.FT_CoplanarFaces, \
|
listOfCriterion = [smesh.GetCriterion(SMESH.FACE, SMESH.FT_CoplanarFaces, \
|
||||||
SMESH.FT_Undefined, elem, SMESH.FT_Undefined, SMESH.FT_Undefined, 30) \
|
SMESH.FT_Undefined, elem, SMESH.FT_Undefined, SMESH.FT_Undefined, 30) \
|
||||||
for elem in listOfElements]
|
for elem in listOfElements]
|
||||||
listOfFilters = [smesh.GetFilterFromCriteria([criteria]) for criteria in listOfCriterion]
|
listOfFilters = [smesh.GetFilterFromCriteria([criteria]) for criteria in listOfCriterion]
|
||||||
listOfSets = [maillageAScanner.GetIdsFromFilter(filter) for filter in listOfFilters]
|
listOfSets = [maillageAScanner.GetIdsFromFilter(filtre) for filtre in listOfFilters]
|
||||||
if listOfSets.count(listOfSets[0]) == len(listOfSets):
|
if listOfSets.count(listOfSets[0]) == len(listOfSets):
|
||||||
# Si toutes les listes d'éléments sont similaires, on retourne
|
# Si toutes les listes d'éléments sont similaires, on retourne
|
||||||
# au début pour éviter de travailler sur des éléments inutiles.
|
# au début pour éviter de travailler sur des éléments inutiles.
|
||||||
# Exemple : un noeud appartenant à 4 éléments sur la même face.
|
# Exemple : un noeud appartenant à 4 éléments sur la même face.
|
||||||
continue
|
continue
|
||||||
for s in listOfSets:
|
for l_aux in listOfSets:
|
||||||
while listOfSets.count(s) > 1:
|
while listOfSets.count(l_aux) > 1:
|
||||||
# On supprime tant que la liste d'éléments n'est pas unique.
|
# On supprime tant que la liste d'éléments n'est pas unique.
|
||||||
listOfSets.remove(s)
|
listOfSets.remove(l_aux)
|
||||||
if len(listOfSets) >= 3:
|
if len(listOfSets) >= 3:
|
||||||
# Si on a au moins 3 listes d'élements différentes, on considère
|
# Si on a au moins 3 listes d'élements différentes, on considère
|
||||||
# qu'il y a présence d'un coin.
|
# qu'il y a présence d'un coin.
|
||||||
listOfCorners.append(ND)
|
listOfCorners.append(noeud)
|
||||||
return listOfCorners
|
|
||||||
|
return listOfCorners
|
||||||
|
|
||||||
def createLinesFromMesh(maillageSupport):
|
def createLinesFromMesh(maillageSupport):
|
||||||
|
|
||||||
""" Cette fonction permet de générer une liste de lignes à partir du
|
""" 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
|
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
|
simple et on parcourt tout les noeuds pour former une ligne. Soit la
|
||||||
figure ci-dessous :
|
figure ci-dessous :
|
||||||
|
|
||||||
1_____4_____7 On part du coin N1, et on cherche les noeuds
|
1_____4_____7 On part du coin N1, et on cherche les noeuds
|
||||||
| | | successifs tels que [1, 2, 3]. Lorsqu'on arrive
|
| | | successifs tels que [1, 2, 3]. Lorsqu'on arrive
|
||||||
| 1 | 3 | arrive sur le noeud de fin de ligne N3, on repart
|
| 1 | 3 | arrive sur le noeud de fin de ligne N3, on repart
|
||||||
| | | du noeud précédent du premier élément (E1), à
|
| | | du noeud précédent du premier élément (E1), à
|
||||||
2_____5_____8 savoir le noeud N4. On suit les noeuds succesifs
|
2_____5_____8 savoir le noeud N4. On suit les noeuds succesifs
|
||||||
| | | [4, 5, 6] comme précédemment et ainsi de suite.
|
| | | [4, 5, 6] comme précédemment et ainsi de suite.
|
||||||
| 2 | 4 | Lorsqu'on arrive sur le dernier noeud de la
|
| 2 | 4 | Lorsqu'on arrive sur le dernier noeud de la
|
||||||
| | | dernière ligne, à savoir le noeud N9, on considère
|
| | | dernière ligne, à savoir le noeud N9, on considère
|
||||||
3_____6_____9 que toutes les lignes sont créées.
|
3_____6_____9 que toutes les lignes sont créées.
|
||||||
|
|
||||||
La fonction retourne une liste de lignes utilisées par la suite.
|
La fonction retourne une liste de lignes utilisées par la suite.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
logging.info("start")
|
logging.info("start")
|
||||||
|
|
||||||
allNodeIds = maillageSupport.GetNodesId()
|
allNodeIds = maillageSupport.GetNodesId()
|
||||||
while len(allNodeIds):
|
while len(allNodeIds):
|
||||||
nodeIds = allNodeIds
|
nodeIds = allNodeIds
|
||||||
for idNode in nodeIds: # rechercher un coin
|
for idNode in nodeIds: # rechercher un coin
|
||||||
elems = maillageSupport.GetNodeInverseElements(idNode)
|
elems = maillageSupport.GetNodeInverseElements(idNode)
|
||||||
if len(elems) == 1:
|
if len(elems) == 1:
|
||||||
# un coin: un noeud, un element quadrangle
|
# un coin: un noeud, un element quadrangle
|
||||||
elem = elems[0]
|
elem = elems[0]
|
||||||
break;
|
idNode_c = idNode
|
||||||
idStart = idNode # le noeud de coin
|
break
|
||||||
elemStart = elem # l'élément quadrangle au coin
|
idStart = idNode_c # le noeud de coin
|
||||||
xyz = maillageSupport.GetNodeXYZ(idStart)
|
elemStart = elem # l'élément quadrangle au coin
|
||||||
logging.debug("idStart %s, coords %s", idStart, str(xyz))
|
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
|
nodelines = list() # on va constituer une liste de lignes de points
|
||||||
ligneFinale = False
|
nextLine = True
|
||||||
while nextLine:
|
ligneFinale = False
|
||||||
logging.debug("--- une ligne")
|
while nextLine:
|
||||||
idNode = idStart
|
logging.debug("--- une ligne")
|
||||||
elem = elemStart
|
idNode = idStart
|
||||||
if ligneFinale:
|
elem = elemStart
|
||||||
agauche = False # sens de parcours des 4 noeuds d'un quadrangle
|
if ligneFinale:
|
||||||
nextLine = False
|
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 = list()
|
||||||
|
elemline = list()
|
||||||
|
while ligneIncomplete: # compléter la ligne de points
|
||||||
|
nodeline.append(idNode)
|
||||||
|
allNodeIds.remove(idNode)
|
||||||
|
elemline.append(elem)
|
||||||
|
nodes = maillageSupport.GetElemNodes(elem)
|
||||||
|
i_aux = nodes.index(idNode) # repérer l'index du noeud courant (i_aux) dans l'élément quadrangle (0 a 3)
|
||||||
|
if agauche: # déterminer le noeud suivant (j_aux) et celui opposé (k_aux) dans le quadrangle
|
||||||
|
if i_aux < 3:
|
||||||
|
j_aux = i_aux+1
|
||||||
|
else:
|
||||||
|
j_aux = 0
|
||||||
|
if j_aux < 3:
|
||||||
|
k_aux = j_aux+1
|
||||||
|
else:
|
||||||
|
k_aux = 0
|
||||||
|
else:
|
||||||
|
if i_aux > 0:
|
||||||
|
j_aux = i_aux -1
|
||||||
|
else:
|
||||||
|
j_aux = 3
|
||||||
|
if j_aux > 0:
|
||||||
|
k_aux = j_aux -1
|
||||||
|
else:
|
||||||
|
k_aux = 3
|
||||||
|
isuiv = nodes[j_aux] # noeud suivant
|
||||||
|
iapres = nodes[k_aux] # 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_aux > 0:
|
||||||
|
iprec = nodes[i_aux -1]
|
||||||
else:
|
else:
|
||||||
agauche = True
|
iprec = nodes[3]
|
||||||
ligneIncomplete = True # on commence une ligne de points
|
idStart = iprec
|
||||||
debutLigne = True
|
elems3 = maillageSupport.GetNodeInverseElements(iprec)
|
||||||
nodeline = []
|
if len(elems3) == 1: # autre coin
|
||||||
elemline = []
|
ligneFinale = True
|
||||||
while ligneIncomplete: # compléter la ligne de points
|
else:
|
||||||
nodeline.append(idNode)
|
for elem3 in elems3:
|
||||||
allNodeIds.remove(idNode)
|
if elem3 != elem:
|
||||||
elemline.append(elem)
|
elemStart = elem3
|
||||||
nodes = maillageSupport.GetElemNodes(elem)
|
break
|
||||||
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
|
#print nodes, idNode, isuiv, iapres
|
||||||
if i < 3:
|
elems1 = maillageSupport.GetNodeInverseElements(isuiv)
|
||||||
j = i+1
|
elems2 = maillageSupport.GetNodeInverseElements(iapres)
|
||||||
else:
|
ligneIncomplete = False
|
||||||
j = 0
|
for elem2 in elems2:
|
||||||
if j < 3:
|
if elems1.count(elem2) and elem2 != elem:
|
||||||
k = j+1
|
ligneIncomplete = True
|
||||||
else:
|
idNode = isuiv
|
||||||
k = 0
|
elem = elem2
|
||||||
else:
|
break
|
||||||
if i > 0:
|
if not ligneIncomplete:
|
||||||
j = i -1
|
nodeline.append(isuiv)
|
||||||
else:
|
allNodeIds.remove(isuiv)
|
||||||
j = 3
|
logging.debug("nodeline %s", nodeline)
|
||||||
if j > 0:
|
logging.debug("elemline %s", elemline)
|
||||||
k = j -1
|
nodelines.append(nodeline)
|
||||||
else:
|
|
||||||
k = 3
|
# on a constitué une liste de lignes de points connexes
|
||||||
isuiv = nodes[j] # noeud suivant
|
logging.debug("dimensions [%s, %s]", len(nodelines), len(nodeline))
|
||||||
iapres = nodes[k] # noeud opposé
|
|
||||||
if debutLigne:
|
return nodelines
|
||||||
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):
|
def createNewMeshesFromCorner(maillageSupport, listOfCorners):
|
||||||
|
|
||||||
""" Cette fonction permet de générer un nouveau maillage plus facile à
|
""" 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
|
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
|
auquel le noeud appartient. Grâce à un filtre 'coplanar' sur les trois
|
||||||
éléments, on peut générer des faces distinctes.
|
éléments, on peut générer des faces distinctes.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
logging.info("start")
|
logging.info("start")
|
||||||
|
|
||||||
tmp = []
|
tmp = list()
|
||||||
listOfNewMeshes = []
|
listOfNewMeshes = list()
|
||||||
for corner in listOfCorners:
|
for corner in listOfCorners:
|
||||||
elems = maillageSupport.GetNodeInverseElements(corner)
|
elems = maillageSupport.GetNodeInverseElements(corner)
|
||||||
for i, elem in enumerate(elems):
|
for i_aux, elem in enumerate(elems):
|
||||||
# --- Filtre selon le critère 'coplanar' --- #
|
# --- Filtre selon le critère 'coplanar' --- #
|
||||||
critere = smesh.GetCriterion(SMESH.FACE, SMESH.FT_CoplanarFaces, \
|
critere = smesh.GetCriterion(SMESH.FACE, SMESH.FT_CoplanarFaces, \
|
||||||
SMESH.FT_Undefined, elem, SMESH.FT_Undefined, SMESH.FT_Undefined, 30)
|
SMESH.FT_Undefined, elem, SMESH.FT_Undefined, SMESH.FT_Undefined, 30)
|
||||||
filtre = smesh.GetFilterFromCriteria([critere])
|
filtre = smesh.GetFilterFromCriteria([critere])
|
||||||
grp = maillageSupport.GroupOnFilter(SMESH.FACE, 'grp', filtre)
|
grp = maillageSupport.GroupOnFilter(SMESH.FACE, 'grp', filtre)
|
||||||
# On copie le maillage en fonction du filtre
|
# On copie le maillage en fonction du filtre
|
||||||
msh = smesh.CopyMesh(grp, 'new_{0}'.format(i + 1), False, True)
|
msh = smesh.CopyMesh(grp, 'new_{0}'.format(i_aux+1), False, True)
|
||||||
# On stocke l'ensemble des noeuds du maillage dans tmp
|
# On stocke l'ensemble des noeuds du maillage dans tmp
|
||||||
# On ajoute le maillage à la liste des nouveaux maillages
|
# On ajoute le maillage à la liste des nouveaux maillages
|
||||||
# seulement s'il n'y est pas déjà
|
# seulement s'il n'y est pas déjà
|
||||||
tmp.append(msh.GetNodesId())
|
tmp.append(msh.GetNodesId())
|
||||||
if tmp.count(msh.GetNodesId()) <= 1:
|
if ( tmp.count(msh.GetNodesId()) <= 1 ):
|
||||||
listOfNewMeshes.append(msh)
|
listOfNewMeshes.append(msh)
|
||||||
return listOfNewMeshes
|
|
||||||
|
return listOfNewMeshes
|
||||||
|
@ -17,24 +17,24 @@
|
|||||||
#
|
#
|
||||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
#
|
#
|
||||||
|
"""edges de bord, faces défaut à respecter"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
import SMESH
|
||||||
|
|
||||||
from .geomsmesh import geompy
|
from .geomsmesh import geompy
|
||||||
from .geomsmesh import smesh
|
from .geomsmesh import smesh
|
||||||
import SMESH
|
|
||||||
|
|
||||||
from .putName import putName
|
from .putName import putName
|
||||||
|
|
||||||
def mailleAretesEtJonction(internalBoundary, aretesVivesCoupees, lgAretesVives):
|
def mailleAretesEtJonction(internalBoundary, aretesVivesCoupees, lgAretesVives):
|
||||||
"""
|
"""edges de bord, faces défaut à respecter"""
|
||||||
edges de bord, faces défaut à respecter
|
|
||||||
"""
|
|
||||||
logging.info('start')
|
logging.info('start')
|
||||||
|
|
||||||
aFilterManager = smesh.CreateFilterManager()
|
_ = smesh.CreateFilterManager()
|
||||||
nbAdded, internalBoundary, _NoneGroup = internalBoundary.MakeBoundaryElements( SMESH.BND_1DFROM2D, '', '', 0, [ ])
|
_, internalBoundary, _NoneGroup = internalBoundary.MakeBoundaryElements( SMESH.BND_1DFROM2D, '', '', 0, [ ])
|
||||||
criteres = []
|
criteres = list()
|
||||||
unCritere = smesh.GetCriterion(SMESH.EDGE,SMESH.FT_FreeBorders,SMESH.FT_Undefined,0)
|
unCritere = smesh.GetCriterion(SMESH.EDGE,SMESH.FT_FreeBorders,SMESH.FT_Undefined,0)
|
||||||
criteres.append(unCritere)
|
criteres.append(unCritere)
|
||||||
filtre = smesh.GetFilterFromCriteria(criteres)
|
filtre = smesh.GetFilterFromCriteria(criteres)
|
||||||
@ -45,7 +45,7 @@ def mailleAretesEtJonction(internalBoundary, aretesVivesCoupees, lgAretesVives):
|
|||||||
# on désigne les faces de peau en quadrangles par le groupe "skinFaces"
|
# on désigne les faces de peau en quadrangles par le groupe "skinFaces"
|
||||||
|
|
||||||
skinFaces = internalBoundary.CreateEmptyGroup( SMESH.FACE, 'skinFaces' )
|
skinFaces = internalBoundary.CreateEmptyGroup( SMESH.FACE, 'skinFaces' )
|
||||||
nbAdd = skinFaces.AddFrom( internalBoundary.GetMesh() )
|
_ = skinFaces.AddFrom( internalBoundary.GetMesh() )
|
||||||
|
|
||||||
# --- maillage des éventuelles arêtes vives entre faces reconstruites
|
# --- maillage des éventuelles arêtes vives entre faces reconstruites
|
||||||
|
|
||||||
@ -70,6 +70,6 @@ def mailleAretesEtJonction(internalBoundary, aretesVivesCoupees, lgAretesVives):
|
|||||||
raise Exception(text)
|
raise Exception(text)
|
||||||
|
|
||||||
grpAretesVives = meshAretesVives.CreateEmptyGroup( SMESH.EDGE, 'grpAretesVives' )
|
grpAretesVives = meshAretesVives.CreateEmptyGroup( SMESH.EDGE, 'grpAretesVives' )
|
||||||
nbAdd = grpAretesVives.AddFrom( meshAretesVives.GetMesh() )
|
_ = grpAretesVives.AddFrom( meshAretesVives.GetMesh() )
|
||||||
|
|
||||||
return (internalBoundary, bordsLibres, grpAretesVives)
|
return (internalBoundary, bordsLibres, grpAretesVives)
|
||||||
|
@ -17,13 +17,14 @@
|
|||||||
#
|
#
|
||||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
#
|
#
|
||||||
|
"""maillage faces de fissure"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from .geomsmesh import geompy
|
|
||||||
from .geomsmesh import smesh
|
|
||||||
from salome.smesh import smeshBuilder
|
|
||||||
import SMESH
|
import SMESH
|
||||||
|
from salome.smesh import smeshBuilder
|
||||||
|
|
||||||
|
from .geomsmesh import smesh
|
||||||
|
|
||||||
from .putName import putName
|
from .putName import putName
|
||||||
|
|
||||||
|
@ -22,13 +22,14 @@
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from .geomsmesh import geompy
|
|
||||||
from .geomsmesh import geomPublish
|
|
||||||
from .geomsmesh import geomPublishInFather
|
|
||||||
from . import initLog
|
|
||||||
from .geomsmesh import smesh
|
|
||||||
from salome.smesh import smeshBuilder
|
|
||||||
import SMESH
|
import SMESH
|
||||||
|
from salome.smesh import smeshBuilder
|
||||||
|
|
||||||
|
from .geomsmesh import geompy
|
||||||
|
from .geomsmesh import geomPublishInFather
|
||||||
|
from .geomsmesh import smesh
|
||||||
|
|
||||||
|
from . import initLog
|
||||||
|
|
||||||
from .putName import putName
|
from .putName import putName
|
||||||
|
|
||||||
@ -41,7 +42,7 @@ def mailleFacesPeau(partitionsPeauFissFond, idFillingFromBout, facesDefaut, \
|
|||||||
logging.info('start')
|
logging.info('start')
|
||||||
logging.info(mailleur+" pour le cas n° %d"%nro_cas)
|
logging.info(mailleur+" pour le cas n° %d"%nro_cas)
|
||||||
nbFacesFilling = len(partitionsPeauFissFond)
|
nbFacesFilling = len(partitionsPeauFissFond)
|
||||||
boutFromIfil = [None for i in range(nbFacesFilling)]
|
boutFromIfil = [None for _ in range(nbFacesFilling)]
|
||||||
if idFillingFromBout[0] != idFillingFromBout[1]: # repérage des extremites du pipe quand elles débouchent sur des faces différentes
|
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[0]] = 0
|
||||||
boutFromIfil[idFillingFromBout[1]] = 1
|
boutFromIfil[idFillingFromBout[1]] = 1
|
||||||
@ -102,15 +103,16 @@ def mailleFacesPeau(partitionsPeauFissFond, idFillingFromBout, facesDefaut, \
|
|||||||
putName(algo1d, "algo1d_bordsVifs", ifil, nro_cas)
|
putName(algo1d, "algo1d_bordsVifs", ifil, nro_cas)
|
||||||
putName(hypo1d, "hypo1d_bordsVifs", ifil, nro_cas)
|
putName(hypo1d, "hypo1d_bordsVifs", ifil, nro_cas)
|
||||||
|
|
||||||
for i, edgeCirc in enumerate(edgesCircPeau):
|
for i_aux, edgeCirc in enumerate(edgesCircPeau):
|
||||||
logging.info("i = {}".format(i))
|
texte = "i_aux = {}".format(i_aux)
|
||||||
|
logging.info(texte)
|
||||||
if edgeCirc is not None:
|
if edgeCirc is not None:
|
||||||
algo1d = meshFacePeau.UseExisting1DElements(geom=edgeCirc) # addToStudy() failed ?
|
algo1d = meshFacePeau.UseExisting1DElements(geom=edgeCirc) # addToStudy() failed ?
|
||||||
if boutFromIfil[ifil] is None:
|
if boutFromIfil[ifil] is None:
|
||||||
hypo1d = algo1d.SourceEdges([ edgesCircPipeGroup[i] ],0,0)
|
hypo1d = algo1d.SourceEdges([ edgesCircPipeGroup[i_aux] ],0,0)
|
||||||
else:
|
else:
|
||||||
hypo1d = algo1d.SourceEdges([ edgesCircPipeGroup[boutFromIfil[ifil]] ],0,0)
|
hypo1d = algo1d.SourceEdges([ edgesCircPipeGroup[boutFromIfil[ifil]] ],0,0)
|
||||||
name = "cercle%d"%i
|
name = "cercle{}".format(i_aux)
|
||||||
putName(algo1d.GetSubMesh(), name, ifil, nro_cas)
|
putName(algo1d.GetSubMesh(), name, ifil, nro_cas)
|
||||||
putName(algo1d, "algo1d_" + name, ifil, nro_cas)
|
putName(algo1d, "algo1d_" + name, ifil, nro_cas)
|
||||||
putName(hypo1d, "hypo1d_" + name, ifil, nro_cas)
|
putName(hypo1d, "hypo1d_" + name, ifil, nro_cas)
|
||||||
|
@ -17,33 +17,33 @@
|
|||||||
#
|
#
|
||||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
#
|
#
|
||||||
|
"""Maillage du bloc partitionné"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
import SMESH
|
||||||
|
from salome.smesh import smeshBuilder
|
||||||
|
from salome.StdMeshers import StdMeshersBuilder
|
||||||
|
|
||||||
from .geomsmesh import geompy
|
from .geomsmesh import geompy
|
||||||
from .geomsmesh import smesh
|
from .geomsmesh import smesh
|
||||||
from salome.smesh import smeshBuilder
|
|
||||||
import SMESH
|
|
||||||
from salome.StdMeshers import StdMeshersBuilder
|
|
||||||
from .putName import putName
|
from .putName import putName
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# --- maillage du bloc partitionne
|
|
||||||
|
|
||||||
def meshBlocPart(blocPartition, faceFissure, tore, centres, edges, diams, circles, faces, \
|
def meshBlocPart(blocPartition, faceFissure, tore, centres, edges, diams, circles, faces, \
|
||||||
gencnt, facefissoutore, edgeext, facesExternes, facesExtBloc, facesExtElli, \
|
gencnt, facefissoutore, edgeext, facesExternes, facesExtBloc, facesExtElli, \
|
||||||
aretesInternes, internalBoundary, ellipsoidep, sharedFaces, sharedEdges, edgesBords, \
|
aretesInternes, internalBoundary, ellipsoidep, sharedFaces, sharedEdges, edgesBords, \
|
||||||
nbsegExt, nbsegGen, nbsegRad, scaleRad, reverses, reverext, nbsegCercle, nbsegFis, dmoyen, lensegEllipsoide, \
|
nbsegExt, nbsegGen, nbsegRad, scaleRad, reverses, reverext, nbsegCercle, nbsegFis, dmoyen, lensegEllipsoide, \
|
||||||
mailleur="MeshGems"):
|
mailleur="MeshGems"):
|
||||||
"""Maillage du bloc partitionné
|
"""Maillage du bloc partitionné"""
|
||||||
|
|
||||||
TODO: a completer
|
|
||||||
"""
|
|
||||||
logging.info('start')
|
logging.info('start')
|
||||||
|
|
||||||
# --- edges de bord à respecter
|
# --- edges de bord à respecter
|
||||||
|
|
||||||
aFilterManager = smesh.CreateFilterManager()
|
_ = smesh.CreateFilterManager()
|
||||||
nbAdded, internalBoundary, _NoneGroup = internalBoundary.MakeBoundaryElements( SMESH.BND_1DFROM2D, '', '', 0, [ ])
|
_, internalBoundary, _NoneGroup = internalBoundary.MakeBoundaryElements( SMESH.BND_1DFROM2D, '', '', 0, [ ])
|
||||||
criteres = list()
|
criteres = list()
|
||||||
unCritere = smesh.GetCriterion(SMESH.EDGE,SMESH.FT_FreeBorders,SMESH.FT_Undefined,0)
|
unCritere = smesh.GetCriterion(SMESH.EDGE,SMESH.FT_FreeBorders,SMESH.FT_Undefined,0)
|
||||||
criteres.append(unCritere)
|
criteres.append(unCritere)
|
||||||
@ -55,22 +55,22 @@ def meshBlocPart(blocPartition, faceFissure, tore, centres, edges, diams, circle
|
|||||||
|
|
||||||
bloc1 = smesh.Mesh(blocPartition)
|
bloc1 = smesh.Mesh(blocPartition)
|
||||||
|
|
||||||
for i, sharedFaces_i in enumerate(sharedFaces):
|
for i_aux, sharedFaces_i in enumerate(sharedFaces):
|
||||||
algo2d = bloc1.Triangle(algo=smeshBuilder.NETGEN, geom=sharedFaces_i)
|
algo2d = bloc1.Triangle(algo=smeshBuilder.NETGEN, geom=sharedFaces_i)
|
||||||
hypo2d = algo2d.Parameters(which=smesh.SIMPLE)
|
hypo2d = algo2d.Parameters(which=smesh.SIMPLE)
|
||||||
hypo2d.SetLocalLength(lensegEllipsoide)
|
hypo2d.SetLocalLength(lensegEllipsoide)
|
||||||
hypo2d.LengthFromEdges()
|
hypo2d.LengthFromEdges()
|
||||||
hypo2d.SetAllowQuadrangles(0)
|
hypo2d.SetAllowQuadrangles(0)
|
||||||
putName(algo2d.GetSubMesh(), "sharedFaces", i)
|
putName(algo2d.GetSubMesh(), "sharedFaces", i_aux)
|
||||||
putName(algo2d, "algo2d_sharedFaces", i)
|
putName(algo2d, "algo2d_sharedFaces", i_aux)
|
||||||
putName(hypo2d, "hypo2d_sharedFaces", i)
|
putName(hypo2d, "hypo2d_sharedFaces", i_aux)
|
||||||
|
|
||||||
for i, sharedEdges_i in enumerate(sharedEdges):
|
for i_aux, sharedEdges_i in enumerate(sharedEdges):
|
||||||
algo1d = bloc1.Segment(geom=sharedEdges_i)
|
algo1d = bloc1.Segment(geom=sharedEdges_i)
|
||||||
hypo1d = algo1d.LocalLength(lensegEllipsoide)
|
hypo1d = algo1d.LocalLength(lensegEllipsoide)
|
||||||
putName(algo1d.GetSubMesh(), "sharedEdges", i)
|
putName(algo1d.GetSubMesh(), "sharedEdges", i_aux)
|
||||||
putName(algo1d, "algo1d_sharedEdges", i)
|
putName(algo1d, "algo1d_sharedEdges", i_aux)
|
||||||
putName(hypo1d, "hypo1d_sharedEdges", i)
|
putName(hypo1d, "hypo1d_sharedEdges", i_aux)
|
||||||
|
|
||||||
declareAlgoEllipsoideFirst = False
|
declareAlgoEllipsoideFirst = False
|
||||||
if declareAlgoEllipsoideFirst:
|
if declareAlgoEllipsoideFirst:
|
||||||
@ -90,32 +90,32 @@ def meshBlocPart(blocPartition, faceFissure, tore, centres, edges, diams, circle
|
|||||||
putName(algo1d, "algo1d_tore")
|
putName(algo1d, "algo1d_tore")
|
||||||
putName(hypo1d, "hypo1d_tore")
|
putName(hypo1d, "hypo1d_tore")
|
||||||
|
|
||||||
for i, faces_i in enumerate(faces):
|
for i_aux, faces_i in enumerate(faces):
|
||||||
algo2d = bloc1.Quadrangle(geom=faces_i)
|
algo2d = bloc1.Quadrangle(geom=faces_i)
|
||||||
hypo2d = smesh.CreateHypothesis('QuadrangleParams')
|
hypo2d = smesh.CreateHypothesis('QuadrangleParams')
|
||||||
hypo2d.SetTriaVertex( geompy.GetSubShapeID(blocPartition,centres[i]) )
|
hypo2d.SetTriaVertex( geompy.GetSubShapeID(blocPartition,centres[i_aux]) )
|
||||||
hypo2d.SetQuadType( StdMeshersBuilder.QUAD_STANDARD )
|
hypo2d.SetQuadType( StdMeshersBuilder.QUAD_STANDARD )
|
||||||
status = bloc1.AddHypothesis(hypo2d,faces_i)
|
_ = bloc1.AddHypothesis(hypo2d,faces_i)
|
||||||
putName(algo2d.GetSubMesh(), "faces", i)
|
putName(algo2d.GetSubMesh(), "faces", i_aux)
|
||||||
putName(algo2d, "algo2d_faces", i)
|
putName(algo2d, "algo2d_faces", i_aux)
|
||||||
putName(hypo2d, "hypo2d_faces", i)
|
putName(hypo2d, "hypo2d_faces", i_aux)
|
||||||
|
|
||||||
for i, edges_i in enumerate(edges):
|
for i_aux, edges_i in enumerate(edges):
|
||||||
algo1d = bloc1.Segment(geom=edges_i)
|
algo1d = bloc1.Segment(geom=edges_i)
|
||||||
if reverses[i] > 0:
|
if reverses[i_aux] > 0:
|
||||||
hypo1d = algo1d.NumberOfSegments(nbsegRad, scaleRad,[ geompy.GetSubShapeID(blocPartition,edges_i) ])
|
hypo1d = algo1d.NumberOfSegments(nbsegRad, scaleRad,[ geompy.GetSubShapeID(blocPartition,edges_i) ])
|
||||||
else:
|
else:
|
||||||
hypo1d = algo1d.NumberOfSegments(nbsegRad, scaleRad,[ ])
|
hypo1d = algo1d.NumberOfSegments(nbsegRad, scaleRad,[ ])
|
||||||
putName(algo1d.GetSubMesh(), "edges", i)
|
putName(algo1d.GetSubMesh(), "edges", i_aux)
|
||||||
putName(algo1d, "algo1d_edges", i)
|
putName(algo1d, "algo1d_edges", i_aux)
|
||||||
putName(hypo1d, "hypo1d_edges", i)
|
putName(hypo1d, "hypo1d_edges", i_aux)
|
||||||
|
|
||||||
for i, circles_i in enumerate(circles):
|
for i_aux, circles_i in enumerate(circles):
|
||||||
algo1d = bloc1.Segment(geom=circles_i)
|
algo1d = bloc1.Segment(geom=circles_i)
|
||||||
hypo1d = algo1d.NumberOfSegments(nbsegCercle)
|
hypo1d = algo1d.NumberOfSegments(nbsegCercle)
|
||||||
putName(algo1d.GetSubMesh(), "circles", i)
|
putName(algo1d.GetSubMesh(), "circles", i_aux)
|
||||||
putName(algo1d, "algo1d_circles", i)
|
putName(algo1d, "algo1d_circles", i_aux)
|
||||||
putName(hypo1d, "hypo1d_circles", i)
|
putName(hypo1d, "hypo1d_circles", i_aux)
|
||||||
|
|
||||||
if len(edgeext) == 1:
|
if len(edgeext) == 1:
|
||||||
densite = int(round(nbsegFis/2))
|
densite = int(round(nbsegFis/2))
|
||||||
@ -130,24 +130,23 @@ def meshBlocPart(blocPartition, faceFissure, tore, centres, edges, diams, circle
|
|||||||
else:
|
else:
|
||||||
longTotal = 0
|
longTotal = 0
|
||||||
longEdgeExts = list()
|
longEdgeExts = list()
|
||||||
for i, edgeext_i in enumerate(edgeext):
|
for edgeext_i in edgeext:
|
||||||
props = geompy.BasicProperties(edgeext_i)
|
props = geompy.BasicProperties(edgeext_i)
|
||||||
longEdgeExts.append(props[0])
|
longEdgeExts.append(props[0])
|
||||||
longTotal += props[0]
|
longTotal += props[0]
|
||||||
for i, edgeext_i in enumerate(edgeext):
|
for i_aux, edgeext_i in enumerate(edgeext):
|
||||||
local = longTotal/nbsegFis
|
nbLocal = int(round(nbsegFis*longEdgeExts[i_aux]/longTotal))
|
||||||
nbLocal = int(round(nbsegFis*longEdgeExts[i]/longTotal))
|
|
||||||
densite = int(round(nbLocal/2))
|
densite = int(round(nbLocal/2))
|
||||||
algo1d = bloc1.Segment(geom=edgeext_i)
|
algo1d = bloc1.Segment(geom=edgeext_i)
|
||||||
hypo1d = algo1d.NumberOfSegments(nbLocal)
|
hypo1d = algo1d.NumberOfSegments(nbLocal)
|
||||||
hypo1d.SetDistrType( 2 )
|
hypo1d.SetDistrType( 2 )
|
||||||
hypo1d.SetConversionMode( 1 )
|
hypo1d.SetConversionMode( 1 )
|
||||||
hypo1d.SetTableFunction( [ 0, densite, 0.8, 1, 1, 1 ] )
|
hypo1d.SetTableFunction( [ 0, densite, 0.8, 1, 1, 1 ] )
|
||||||
if reverext[i]:
|
if reverext[i_aux]:
|
||||||
hypo1d.SetReversedEdges([ geompy.GetSubShapeID(blocPartition, edgeext_i) ])
|
hypo1d.SetReversedEdges([ geompy.GetSubShapeID(blocPartition, edgeext_i) ])
|
||||||
putName(algo1d.GetSubMesh(), "edgeext", i)
|
putName(algo1d.GetSubMesh(), "edgeext", i_aux)
|
||||||
putName(algo1d, "algo1d_edgeext", i)
|
putName(algo1d, "algo1d_edgeext", i_aux)
|
||||||
putName(hypo1d, "hypo1d_edgeext", i)
|
putName(hypo1d, "hypo1d_edgeext", i_aux)
|
||||||
|
|
||||||
algo2d = bloc1.Triangle(algo=smeshBuilder.NETGEN_2D, geom=facefissoutore)
|
algo2d = bloc1.Triangle(algo=smeshBuilder.NETGEN_2D, geom=facefissoutore)
|
||||||
hypo2d = algo2d.LengthFromEdges()
|
hypo2d = algo2d.LengthFromEdges()
|
||||||
@ -159,25 +158,25 @@ def meshBlocPart(blocPartition, faceFissure, tore, centres, edges, diams, circle
|
|||||||
maxElemArea = 0.5*dmoyen*dmoyen
|
maxElemArea = 0.5*dmoyen*dmoyen
|
||||||
logging.debug("dmoyen %s, maxElemArea %s", dmoyen, maxElemArea)
|
logging.debug("dmoyen %s, maxElemArea %s", dmoyen, maxElemArea)
|
||||||
|
|
||||||
for i, facesExternes_i in enumerate(facesExternes):
|
for i_aux, facesExternes_i in enumerate(facesExternes):
|
||||||
algo2d = bloc1.Triangle(algo=smeshBuilder.NETGEN_2D, geom=facesExternes_i)
|
algo2d = bloc1.Triangle(algo=smeshBuilder.NETGEN_2D, geom=facesExternes_i)
|
||||||
hypo2d = algo2d.MaxElementArea(maxElemArea)
|
hypo2d = algo2d.MaxElementArea(maxElemArea)
|
||||||
if edgesBords is None:
|
if edgesBords is None:
|
||||||
algo1d = bloc1.Segment(geom=facesExternes_i)
|
algo1d = bloc1.Segment(geom=facesExternes_i)
|
||||||
hypo1d = algo1d.NumberOfSegments(1)
|
hypo1d = algo1d.NumberOfSegments(1)
|
||||||
putName(algo2d.GetSubMesh(), "facesExternes", i)
|
putName(algo2d.GetSubMesh(), "facesExternes", i_aux)
|
||||||
putName(algo2d, "algo2d_facesExternes", i)
|
putName(algo2d, "algo2d_facesExternes", i_aux)
|
||||||
putName(hypo2d, "hypo2d_facesExternes", i)
|
putName(hypo2d, "hypo2d_facesExternes", i_aux)
|
||||||
if edgesBords is None:
|
if edgesBords is None:
|
||||||
putName(algo1d, "algo1d_facesExternes", i)
|
putName(algo1d, "algo1d_facesExternes", i_aux)
|
||||||
putName(hypo1d, "hypo1d_facesExternes", i)
|
putName(hypo1d, "hypo1d_facesExternes", i_aux)
|
||||||
|
|
||||||
for i, aretesInternes_i in enumerate(aretesInternes):
|
for i_aux, aretesInternes_i in enumerate(aretesInternes):
|
||||||
algo1d = bloc1.Segment(geom=aretesInternes_i)
|
algo1d = bloc1.Segment(geom=aretesInternes_i)
|
||||||
hypo1d = algo1d.NumberOfSegments(nbsegExt)
|
hypo1d = algo1d.NumberOfSegments(nbsegExt)
|
||||||
putName(algo1d.GetSubMesh(), "aretesInternes", i)
|
putName(algo1d.GetSubMesh(), "aretesInternes", i_aux)
|
||||||
putName(algo1d, "algo1d_aretesInternes", i)
|
putName(algo1d, "algo1d_aretesInternes", i_aux)
|
||||||
putName(hypo1d, "hypo1d_aretesInternes", i)
|
putName(hypo1d, "hypo1d_aretesInternes", i_aux)
|
||||||
|
|
||||||
if edgesBords is not None:
|
if edgesBords is not None:
|
||||||
algo1d = bloc1.UseExisting1DElements(geom=edgesBords)
|
algo1d = bloc1.UseExisting1DElements(geom=edgesBords)
|
||||||
@ -193,16 +192,16 @@ def meshBlocPart(blocPartition, faceFissure, tore, centres, edges, diams, circle
|
|||||||
putName(algo3d, "algo3d_ellipsoide")
|
putName(algo3d, "algo3d_ellipsoide")
|
||||||
putName(hypo3d, "hypo3d_ellipsoide")
|
putName(hypo3d, "hypo3d_ellipsoide")
|
||||||
|
|
||||||
faceFissure1 = bloc1.GroupOnGeom(faceFissure,'FACE1',SMESH.FACE)
|
_ = bloc1.GroupOnGeom(faceFissure,'FACE1',SMESH.FACE)
|
||||||
noeudsFondFissure = bloc1.GroupOnGeom(gencnt,'nfondfis',SMESH.NODE)
|
_ = bloc1.GroupOnGeom(gencnt,'nfondfis',SMESH.NODE)
|
||||||
|
|
||||||
groups_faceCommuneEllipsoideBloc = list()
|
groups_faceCommuneEllipsoideBloc = list()
|
||||||
for i, sharedFaces_i in enumerate(sharedFaces):
|
for i_aux, sharedFaces_i in enumerate(sharedFaces):
|
||||||
name = "faceCommuneEllipsoideBloc_%d"%i
|
name = "faceCommuneEllipsoideBloc_{}".format(i_aux)
|
||||||
groups_faceCommuneEllipsoideBloc.append(bloc1.GroupOnGeom(sharedFaces_i, name, SMESH.FACE))
|
groups_faceCommuneEllipsoideBloc.append(bloc1.GroupOnGeom(sharedFaces_i, name, SMESH.FACE))
|
||||||
groups_faceExterneBloc = list()
|
groups_faceExterneBloc = list()
|
||||||
for i, facesExtBloc_i in enumerate(facesExtBloc):
|
for i_aux, facesExtBloc_i in enumerate(facesExtBloc):
|
||||||
name = "faceExterneBloc_%d"%i
|
name = "faceExterneBloc_{}".format(i_aux)
|
||||||
groups_faceExterneBloc.append(bloc1.GroupOnGeom(facesExtBloc_i, name, SMESH.FACE))
|
groups_faceExterneBloc.append(bloc1.GroupOnGeom(facesExtBloc_i, name, SMESH.FACE))
|
||||||
|
|
||||||
is_done = bloc1.Compute()
|
is_done = bloc1.Compute()
|
||||||
@ -214,18 +213,18 @@ def meshBlocPart(blocPartition, faceFissure, tore, centres, edges, diams, circle
|
|||||||
logging.info(text)
|
logging.info(text)
|
||||||
raise Exception(text)
|
raise Exception(text)
|
||||||
|
|
||||||
nbRemoved = bloc1.RemoveOrphanNodes()
|
_ = bloc1.RemoveOrphanNodes()
|
||||||
|
|
||||||
skinBlocMeshes = list()
|
skinBlocMeshes = list()
|
||||||
for i, groups_faceCommuneEllipsoideBloc_i in enumerate(groups_faceCommuneEllipsoideBloc):
|
for i_aux, groups_faceCommuneEllipsoideBloc_i in enumerate(groups_faceCommuneEllipsoideBloc):
|
||||||
name = "faceCommuneEllipsoideBloc_%d"%i
|
name = "faceCommuneEllipsoideBloc_{}".format(i_aux)
|
||||||
skinBlocMeshes.append(smesh.CopyMesh(groups_faceCommuneEllipsoideBloc_i, name, 0, 0))
|
skinBlocMeshes.append(smesh.CopyMesh(groups_faceCommuneEllipsoideBloc_i, name, 0, 0))
|
||||||
for i, groups_faceExterneBloc_i in enumerate(groups_faceExterneBloc):
|
for i_aux, groups_faceExterneBloc_i in enumerate(groups_faceExterneBloc):
|
||||||
name = "faceExterneBloc_%d"%i
|
name = "faceExterneBloc_{}".format(i_aux)
|
||||||
skinBlocMeshes.append(smesh.CopyMesh(groups_faceExterneBloc_i, name, 0, 0))
|
skinBlocMeshes.append(smesh.CopyMesh(groups_faceExterneBloc_i, name, 0, 0))
|
||||||
|
|
||||||
meshesBloc = [internalBoundary.GetMesh()]
|
meshesBloc = [internalBoundary.GetMesh()]
|
||||||
for i, skinBlocMeshes_i in enumerate(skinBlocMeshes):
|
for skinBlocMeshes_i in skinBlocMeshes:
|
||||||
meshesBloc.append(skinBlocMeshes_i.GetMesh())
|
meshesBloc.append(skinBlocMeshes_i.GetMesh())
|
||||||
blocMesh = smesh.Concatenate(meshesBloc, 1, 1, 1e-05,False)
|
blocMesh = smesh.Concatenate(meshesBloc, 1, 1, 1e-05,False)
|
||||||
|
|
||||||
|
@ -17,64 +17,61 @@
|
|||||||
#
|
#
|
||||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
#
|
#
|
||||||
|
"""Trouver les vertices intermédiaires d'un wire"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from .geomsmesh import geompy
|
from .geomsmesh import geompy
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
|
||||||
# --- trouver les vertices intermediaires d'un wire
|
|
||||||
|
|
||||||
def orderEdgesFromWire(aWire):
|
def orderEdgesFromWire(aWire):
|
||||||
"""
|
"""Fournit les edges ordonnées d'un wire selon ExtractShapes(,,False),
|
||||||
fournit les edges ordonnées d'un wire selon ExtractShapes(,,False),
|
|
||||||
et l'ordre des edges selon le sens de parcours (ordre des indices de la liste d'edges)
|
et l'ordre des edges selon le sens de parcours (ordre des indices de la liste d'edges)
|
||||||
"""
|
"""
|
||||||
logging.info("start")
|
logging.info("start")
|
||||||
edges = geompy.ExtractShapes(aWire, geompy.ShapeType["EDGE"], False)
|
edges = geompy.ExtractShapes(aWire, geompy.ShapeType["EDGE"], False)
|
||||||
|
|
||||||
idverts = dict()
|
idverts = dict()
|
||||||
for i, edge in enumerate(edges):
|
for i_aux, edge in enumerate(edges):
|
||||||
verts = geompy.ExtractShapes(edge, geompy.ShapeType["VERTEX"], True)
|
verts = geompy.ExtractShapes(edge, geompy.ShapeType["VERTEX"], True)
|
||||||
# idverts[(i,0)] = verts[0]
|
vertex_a = geompy.MakeVertexOnCurve(edge, 0.0)
|
||||||
# idverts[(i,1)] = verts[1]
|
dist = geompy.MinDistance(vertex_a, verts[0])
|
||||||
v0 = geompy.MakeVertexOnCurve(edge, 0.0)
|
|
||||||
dist = geompy.MinDistance(v0, verts[0])
|
|
||||||
if dist < 1.e-4:
|
if dist < 1.e-4:
|
||||||
idverts[(i,0)] = verts[0]
|
idverts[(i_aux,0)] = verts[0]
|
||||||
idverts[(i,1)] = verts[1]
|
idverts[(i_aux,1)] = verts[1]
|
||||||
else:
|
else:
|
||||||
idverts[(i,0)] = verts[1]
|
idverts[(i_aux,0)] = verts[1]
|
||||||
idverts[(i,1)] = verts[0]
|
idverts[(i_aux,1)] = verts[0]
|
||||||
|
|
||||||
idsubs = dict()
|
idsubs = dict()
|
||||||
for kv, sub in idverts.items():
|
for i_aux, sub in idverts.items():
|
||||||
subid = geompy.GetSubShapeID(aWire, sub)
|
subid = geompy.GetSubShapeID(aWire, sub)
|
||||||
if subid in list(idsubs.keys()):
|
if ( subid in idsubs ):
|
||||||
idsubs[subid].append(kv)
|
idsubs[subid].append(i_aux)
|
||||||
else:
|
else:
|
||||||
idsubs[subid] = [kv]
|
idsubs[subid] = [i_aux]
|
||||||
|
|
||||||
debut = -1
|
debut = -1
|
||||||
fin = -1
|
fin = -1
|
||||||
for k, kvs in idsubs.items():
|
for _, kvs in idsubs.items():
|
||||||
if len(kvs) == 1: # une extremité
|
if len(kvs) == 1: # une extremité
|
||||||
kv = kvs[0]
|
kv0 = kvs[0]
|
||||||
if kv[1] == 0:
|
if kv0[1] == 0:
|
||||||
debut = kv[0]
|
debut = kv0[0]
|
||||||
else:
|
else:
|
||||||
fin = kv[0]
|
fin = kv0[0]
|
||||||
logging.debug("nombre d'edges: {}, indice edge début: {}, fin: {}".format(len(edges), debut, fin))
|
texte = "nombre d'edges: {}, indice edge début: {}, fin: {}".format(len(edges), debut, fin)
|
||||||
|
logging.debug(texte)
|
||||||
if debut < 0:
|
if debut < 0:
|
||||||
logging.critical("les edges du wire ne sont pas orientées dans le même sens: pas de début trouvé")
|
logging.critical("les edges du wire ne sont pas orientées dans le même sens: pas de début trouvé")
|
||||||
return edges, list(range(len(edges)))
|
return edges, list(range(len(edges)))
|
||||||
|
|
||||||
orderedList = [debut]
|
orderedList = [debut]
|
||||||
while len(orderedList) < len(edges):
|
while len(orderedList) < len(edges):
|
||||||
bout = orderedList[-1]
|
bout = orderedList[-1]
|
||||||
vertex = idverts[(bout,1)]
|
vertex = idverts[(bout,1)]
|
||||||
for k, v in idverts.items():
|
for k, vertex_a in idverts.items():
|
||||||
if k[0] not in orderedList:
|
if k[0] not in orderedList:
|
||||||
if geompy.MinDistance(vertex, v) < 1.e-4:
|
if geompy.MinDistance(vertex, vertex_a) < 1.e-4:
|
||||||
if k[1] == 0:
|
if k[1] == 0:
|
||||||
orderedList.append(k[0])
|
orderedList.append(k[0])
|
||||||
break
|
break
|
||||||
@ -82,9 +79,12 @@ def orderEdgesFromWire(aWire):
|
|||||||
logging.critical("les edges du wire ne sont pas orientées dans le même sens: une edge à l'envers")
|
logging.critical("les edges du wire ne sont pas orientées dans le même sens: une edge à l'envers")
|
||||||
return edges, list(range(len(edges)))
|
return edges, list(range(len(edges)))
|
||||||
|
|
||||||
logging.debug("liste des edges ordonnées selon le sens de parcours : {}".format(orderedList))
|
texte = "liste des edges ordonnées selon le sens de parcours : {}".format(orderedList)
|
||||||
|
logging.debug(texte)
|
||||||
accessList = list(range(len(orderedList)))
|
accessList = list(range(len(orderedList)))
|
||||||
for i,k in enumerate(orderedList):
|
for i_aux,k_aux in enumerate(orderedList):
|
||||||
accessList[k] = i
|
accessList[k_aux] = i_aux
|
||||||
logging.info("position ordonnée des edges selon le sens de parcours : {}".format(accessList))
|
texte = "position ordonnée des edges selon le sens de parcours : {}".format(accessList)
|
||||||
|
logging.info(texte)
|
||||||
|
|
||||||
return edges, accessList
|
return edges, accessList
|
||||||
|
@ -17,15 +17,17 @@
|
|||||||
#
|
#
|
||||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
#
|
#
|
||||||
|
"""Partition du bloc defaut par generatrice, tore et plan fissure"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
import GEOM
|
||||||
|
|
||||||
from .geomsmesh import geompy
|
from .geomsmesh import geompy
|
||||||
from .geomsmesh import geomPublish
|
from .geomsmesh import geomPublish
|
||||||
from .geomsmesh import geomPublishInFather
|
from .geomsmesh import geomPublishInFather
|
||||||
from . import initLog
|
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
from . import initLog
|
||||||
# --- partition du bloc defaut par generatrice, tore et plan fissure
|
|
||||||
|
|
||||||
def partitionBlocDefaut(volDefaut, facesDefaut, gener, pipe,
|
def partitionBlocDefaut(volDefaut, facesDefaut, gener, pipe,
|
||||||
facefis, ellipsoide):
|
facefis, ellipsoide):
|
||||||
@ -56,9 +58,9 @@ def partitionBlocDefaut(volDefaut, facesDefaut, gener, pipe,
|
|||||||
#geomPublishInFather(initLog.debug, volDefautPart, gencnt, 'generatrice' )
|
#geomPublishInFather(initLog.debug, volDefautPart, gencnt, 'generatrice' )
|
||||||
|
|
||||||
solids = geompy.ExtractShapes(blocp, geompy.ShapeType["SOLID"], True)
|
solids = geompy.ExtractShapes(blocp, geompy.ShapeType["SOLID"], True)
|
||||||
vols = []
|
vols = list()
|
||||||
for i in range(len(solids)):
|
for solid in solids:
|
||||||
props = geompy.BasicProperties(solids[i])
|
props = geompy.BasicProperties(solid)
|
||||||
vols.append(props[2])
|
vols.append(props[2])
|
||||||
maxvol = max(vols)
|
maxvol = max(vols)
|
||||||
imaxvol = vols.index(maxvol)
|
imaxvol = vols.index(maxvol)
|
||||||
@ -72,110 +74,111 @@ def partitionBlocDefaut(volDefaut, facesDefaut, gener, pipe,
|
|||||||
geomPublishInFather(initLog.debug, volDefautPart, ellipsoidep, 'ellipsoide' )
|
geomPublishInFather(initLog.debug, volDefautPart, ellipsoidep, 'ellipsoide' )
|
||||||
|
|
||||||
sharedFaces = geompy.GetSharedShapesMulti([blocp, ellipsoidep], geompy.ShapeType["FACE"])
|
sharedFaces = geompy.GetSharedShapesMulti([blocp, ellipsoidep], geompy.ShapeType["FACE"])
|
||||||
for i in range(len(sharedFaces)):
|
for i_aux, face in enumerate(sharedFaces):
|
||||||
name = "faceCommuneEllipsoideBloc_%d"%i
|
name = "faceCommuneEllipsoideBloc_{}".format(i_aux)
|
||||||
geomPublishInFather(initLog.debug,blocp, sharedFaces[i], name)
|
geomPublishInFather(initLog.debug,blocp, face, name)
|
||||||
|
|
||||||
#sharedEdges = geompy.GetSharedShapesMulti([blocp, ellipsoidep], geompy.ShapeType["EDGE"])
|
#sharedEdges = geompy.GetSharedShapesMulti([blocp, ellipsoidep], geompy.ShapeType["EDGE"])
|
||||||
allSharedEdges = geompy.GetSharedShapesMulti([blocp, ellipsoidep], geompy.ShapeType["EDGE"])
|
allSharedEdges = geompy.GetSharedShapesMulti([blocp, ellipsoidep], geompy.ShapeType["EDGE"])
|
||||||
sharedEdges = []
|
sharedEdges = list()
|
||||||
for i in range(len(allSharedEdges)):
|
for face in allSharedEdges:
|
||||||
if geompy.NbShapes(allSharedEdges[i], geompy.ShapeType["VERTEX"]) > 1: # edge non degeneree
|
if geompy.NbShapes(face, geompy.ShapeType["VERTEX"]) > 1: # edge non degeneree
|
||||||
sharedEdges.append(allSharedEdges[i])
|
sharedEdges.append(face)
|
||||||
for i in range(len(sharedEdges)):
|
for i_aux, edge in enumerate(sharedEdges):
|
||||||
name = "edgeCommuneEllipsoideBloc_%d"%i
|
name = "edgeCommuneEllipsoideBloc_{}".format(i_aux)
|
||||||
geomPublishInFather(initLog.debug,blocp, sharedEdges[i], name)
|
geomPublishInFather(initLog.debug,blocp, edge, name)
|
||||||
|
|
||||||
facesExternes = []
|
facesExternes = list()
|
||||||
facesExtBloc = []
|
facesExtBloc = list()
|
||||||
facesExtElli = []
|
facesExtElli = list()
|
||||||
faces = geompy.ExtractShapes(facesDefaut, geompy.ShapeType["FACE"], True)
|
faces = geompy.ExtractShapes(facesDefaut, geompy.ShapeType["FACE"], True)
|
||||||
if len(faces) == 0:
|
if not faces:
|
||||||
faces = [facesDefaut]
|
faces = [facesDefaut]
|
||||||
for i in range(len(faces)):
|
for i_aux, face in enumerate(faces):
|
||||||
faceExt = geompy.GetInPlace(ellipsoidep, faces[i])
|
faceExt = geompy.GetInPlace(ellipsoidep, face)
|
||||||
if faceExt is not None:
|
if faceExt is not None:
|
||||||
name = "faceExterne_e%d"%i
|
name = "faceExterne_e{}".format(i_aux)
|
||||||
geomPublishInFather(initLog.debug,ellipsoidep, faceExt, name)
|
geomPublishInFather(initLog.debug,ellipsoidep, faceExt, name)
|
||||||
facesExternes.append(faceExt)
|
facesExternes.append(faceExt)
|
||||||
facesExtElli.append(faceExt)
|
facesExtElli.append(faceExt)
|
||||||
|
|
||||||
faceExt = geompy.GetInPlace(blocp, faces[i])
|
faceExt = geompy.GetInPlace(blocp, face)
|
||||||
if faceExt is not None:
|
if faceExt is not None:
|
||||||
name = "faceExterne_b%d"%i
|
name = "faceExterne_b{}".format(i_aux)
|
||||||
geomPublishInFather(initLog.debug,blocp, faceExt, name)
|
geomPublishInFather(initLog.debug,blocp, faceExt, name)
|
||||||
facesExternes.append(faceExt)
|
facesExternes.append(faceExt)
|
||||||
facesExtBloc.append(faceExt)
|
facesExtBloc.append(faceExt)
|
||||||
else:
|
else:
|
||||||
logging.info(" recherche faces externes par GetShapesOnShape")
|
logging.info(" recherche faces externes par GetShapesOnShape")
|
||||||
vertex = geompy.MakeVertexOnSurface(faces[i], 0.5, 0.5)
|
vertex = geompy.MakeVertexOnSurface(face, 0.5, 0.5)
|
||||||
normal = geompy.GetNormal(faces[i], vertex)
|
normal = geompy.GetNormal(face, vertex)
|
||||||
extrusionFace = geompy.MakePrismVecH(faces[i], normal, 1)
|
extrusionFace = geompy.MakePrismVecH(face, normal, 1)
|
||||||
#extrusionFace = geompy.MakePrismVecH2Ways(faces[i], normal, 0.1)
|
#extrusionFace = geompy.MakePrismVecH2Ways(face, normal, 0.1)
|
||||||
#extrusionFace = geompy.MakeScaleTransform(extrusionFace, vertex, 1.01)
|
#extrusionFace = geompy.MakeScaleTransform(extrusionFace, vertex, 1.01)
|
||||||
name = "extrusionFace_b%d"%i
|
name = "extrusionFace_b{}".format(i_aux)
|
||||||
geomPublishInFather(initLog.debug,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_ONIN)
|
||||||
facesExt = geompy.GetShapesOnShape(extrusionFace, blocp, geompy.ShapeType["FACE"], GEOM.ST_ON)
|
facesExt = geompy.GetShapesOnShape(extrusionFace, blocp, geompy.ShapeType["FACE"], GEOM.ST_ON)
|
||||||
for j in range(len(facesExt)):
|
for j_aux, face_ext in enumerate(facesExt):
|
||||||
name = "faceExterne_b%d_%d"%(i,j)
|
name = "faceExterne_b{}_{}".format(i_aux,j_aux)
|
||||||
geomPublishInFather(initLog.debug,blocp, facesExt[j], name)
|
geomPublishInFather(initLog.debug,blocp, face_ext, name)
|
||||||
facesExternes.append(facesExt[j])
|
facesExternes.append(face_ext)
|
||||||
facesExtBloc.append(facesExt[j])
|
facesExtBloc.append(face_ext)
|
||||||
|
|
||||||
if len(facesExtBloc) < len(faces): # toutes les faces externes du bloc n'ont pas été trouvées. TODO eliminer les detections multiples
|
if len(facesExtBloc) < len(faces): # toutes les faces externes du bloc n'ont pas été trouvées. TODO eliminer les detections multiples
|
||||||
logging.info(" recherche faces externes par aretes partagees avec faces externes ellipsoide")
|
logging.info(" recherche faces externes par aretes partagees avec faces externes ellipsoide")
|
||||||
facesBloc = geompy.ExtractShapes(blocp, geompy.ShapeType["FACE"], True)
|
facesBloc = geompy.ExtractShapes(blocp, geompy.ShapeType["FACE"], True)
|
||||||
for i in range(len(facesBloc)):
|
for i_aux, face in enumerate(facesBloc):
|
||||||
notOnEllipsoide = True
|
notOnEllipsoide = True
|
||||||
for j in range(len(sharedFaces)): # eliminer les faces communes avec l'ellipsoide
|
for j_aux, sharedface in enumerate(sharedFaces): # eliminer les faces communes avec l'ellipsoide
|
||||||
if facesBloc[i].IsSame(sharedFaces[j]):
|
if face.IsSame(sharedface):
|
||||||
notOnEllipsoide = False
|
notOnEllipsoide = False
|
||||||
break
|
break
|
||||||
if notOnEllipsoide:
|
if notOnEllipsoide:
|
||||||
for j in range(len(facesExtElli)): # les faces recherchees ont une ou plusieurs edge communes avec la ou les faces externes de l'ellipsoide
|
for j_aux, face_ext_elli in enumerate(facesExtElli): # les faces recherchees ont une ou plusieurs edge communes avec la ou les faces externes de l'ellipsoide
|
||||||
allSharedEdges = []
|
allSharedEdges = list()
|
||||||
try:
|
try:
|
||||||
allSharedEdges += geompy.GetSharedShapesMulti([facesBloc[i], facesExtElli[j]], geompy.ShapeType["EDGE"])
|
allSharedEdges += geompy.GetSharedShapesMulti([face, face_ext_elli], geompy.ShapeType["EDGE"])
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
if len(allSharedEdges) > 0:
|
if allSharedEdges:
|
||||||
name = "faceExterne_b%d_%d"%(i,j)
|
name = "faceExterne_b{}_{}".format(i_aux,j_aux)
|
||||||
geomPublishInFather(initLog.debug,blocp, facesBloc[i], name)
|
geomPublishInFather(initLog.debug,blocp, face, name)
|
||||||
facesExternes.append(facesBloc[i])
|
facesExternes.append(face)
|
||||||
facesExtBloc.append(facesBloc[i])
|
facesExtBloc.append(face)
|
||||||
|
|
||||||
aretesInternes = []
|
aretesInternes = list()
|
||||||
for i in range(len(facesExternes)):
|
for i_aux, face_ext_i in enumerate(facesExternes):
|
||||||
for j in range(i+1,len(facesExternes)):
|
for j_aux, face_ext_j in enumerate(facesExternes[i_aux+1:]):
|
||||||
shared = []
|
shared = list()
|
||||||
try:
|
try:
|
||||||
shared += geompy.GetSharedShapesMulti([facesExternes[i], facesExternes[j]], geompy.ShapeType["EDGE"])
|
shared += geompy.GetSharedShapesMulti([face_ext_i, face_ext_j], geompy.ShapeType["EDGE"])
|
||||||
except:
|
except:
|
||||||
logging.info("no shared edges in %s,%s",i,j)
|
texte = "no shared edges in {},{}".format(i_aux,j_aux)
|
||||||
|
logging.info(texte)
|
||||||
else:
|
else:
|
||||||
aretesInternes += shared
|
aretesInternes += shared
|
||||||
for i in range(len(aretesInternes)):
|
for i_aux, edge in enumerate(aretesInternes):
|
||||||
name = "aretesInternes_%d"%i
|
name = "aretesInternes_{}".format(i_aux)
|
||||||
geomPublishInFather(initLog.debug,blocp, aretesInternes[i], name)
|
geomPublishInFather(initLog.debug,blocp, edge, name)
|
||||||
|
|
||||||
edgesBords = []
|
l_edgesBords = list()
|
||||||
for faceExtB in facesExtBloc:
|
for faceExtB in facesExtBloc:
|
||||||
edges = geompy.ExtractShapes(faceExtB, geompy.ShapeType["EDGE"], True)
|
edges = geompy.ExtractShapes(faceExtB, geompy.ShapeType["EDGE"], True)
|
||||||
for i in range(len(edges)):
|
for i_aux, edge in enumerate(edges):
|
||||||
isInterne = False
|
isInterne = False
|
||||||
for j in range(len(aretesInternes)):
|
for arete in aretesInternes:
|
||||||
if edges[i].IsSame(aretesInternes[j]):
|
if edge.IsSame(arete):
|
||||||
isInterne = True
|
isInterne = True
|
||||||
break
|
break
|
||||||
if not isInterne:
|
if not isInterne:
|
||||||
edgesBords.append(edges[i])
|
l_edgesBords.append(edge)
|
||||||
name = "edgeBord%d"%i
|
name = "edgeBord{}".format(i_aux)
|
||||||
geomPublishInFather(initLog.debug,blocp,edges[i] , name)
|
geomPublishInFather(initLog.debug,blocp,edge , name)
|
||||||
group = None
|
if l_edgesBords:
|
||||||
if len(edgesBords) > 0:
|
edgesBords = geompy.CreateGroup(blocp, geompy.ShapeType["EDGE"])
|
||||||
group = geompy.CreateGroup(blocp, geompy.ShapeType["EDGE"])
|
geompy.UnionList(edgesBords, l_edgesBords)
|
||||||
geompy.UnionList(group, edgesBords)
|
else:
|
||||||
edgesBords = group
|
edgesBords = None
|
||||||
|
|
||||||
return volDefautPart, blocp, tore, faceFissure, facesExternes, facesExtBloc, facesExtElli, aretesInternes, ellipsoidep, sharedFaces, sharedEdges, edgesBords
|
return volDefautPart, blocp, tore, faceFissure, facesExternes, facesExtBloc, facesExtElli, aretesInternes, ellipsoidep, sharedFaces, sharedEdges, edgesBords
|
||||||
|
@ -17,15 +17,15 @@
|
|||||||
#
|
#
|
||||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
#
|
#
|
||||||
|
"""Partition volume sain et bloc, face du bloc recevant la fissure"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from .geomsmesh import geompy
|
from .geomsmesh import geompy
|
||||||
from .geomsmesh import geomPublish
|
from .geomsmesh import geomPublish
|
||||||
from .geomsmesh import geomPublishInFather
|
from .geomsmesh import geomPublishInFather
|
||||||
from . import initLog
|
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
from . import initLog
|
||||||
# --- partition volume sain et bloc, face du bloc recevant la fissure
|
|
||||||
|
|
||||||
def partitionVolumeSain(volumeSain,boiteDefaut):
|
def partitionVolumeSain(volumeSain,boiteDefaut):
|
||||||
"""
|
"""
|
||||||
|
@ -17,16 +17,19 @@
|
|||||||
#
|
#
|
||||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
#
|
#
|
||||||
|
"""Pipe de fond de fissure, prolongé, partition face fissure par pipe"""
|
||||||
|
|
||||||
import math
|
|
||||||
import logging
|
import logging
|
||||||
|
import math
|
||||||
|
import traceback
|
||||||
|
|
||||||
from .geomsmesh import geompy
|
from .geomsmesh import geompy
|
||||||
from .geomsmesh import geomPublish
|
from .geomsmesh import geomPublish
|
||||||
from .geomsmesh import geomPublishInFather
|
from .geomsmesh import geomPublishInFather
|
||||||
|
|
||||||
from . import initLog
|
from . import initLog
|
||||||
from .findWireEndVertices import findWireEndVertices
|
from .findWireEndVertices import findWireEndVertices
|
||||||
from .prolongeWire import prolongeWire
|
from .prolongeWire import prolongeWire
|
||||||
import traceback
|
|
||||||
from .fissError import fissError
|
from .fissError import fissError
|
||||||
|
|
||||||
def partitionneFissureParPipe(shapesFissure, elementsDefaut, rayonPipe):
|
def partitionneFissureParPipe(shapesFissure, elementsDefaut, rayonPipe):
|
||||||
@ -46,7 +49,7 @@ def partitionneFissureParPipe(shapesFissure, elementsDefaut, rayonPipe):
|
|||||||
#fondFissCoupe = geompy.GetInPlaceByHistory(shapeDefaut, fondFiss) #= inutile
|
#fondFissCoupe = geompy.GetInPlaceByHistory(shapeDefaut, fondFiss) #= inutile
|
||||||
geomPublish(initLog.debug, shapeDefaut, 'shapeDefaut_coupe')
|
geomPublish(initLog.debug, shapeDefaut, 'shapeDefaut_coupe')
|
||||||
#geomPublishInFather(initLog.debug,shapeDefaut, fondFissCoupe, 'fondFiss_coupe')
|
#geomPublishInFather(initLog.debug,shapeDefaut, fondFissCoupe, 'fondFiss_coupe')
|
||||||
|
|
||||||
extrem, norms = findWireEndVertices(fondFiss, True)
|
extrem, norms = findWireEndVertices(fondFiss, True)
|
||||||
logging.debug("extrem: %s, norm: %s",extrem, norms)
|
logging.debug("extrem: %s, norm: %s",extrem, norms)
|
||||||
cercle = geompy.MakeCircle(extrem[0], norms[0], rayonPipe)
|
cercle = geompy.MakeCircle(extrem[0], norms[0], rayonPipe)
|
||||||
@ -66,10 +69,10 @@ def partitionneFissureParPipe(shapesFissure, elementsDefaut, rayonPipe):
|
|||||||
geomPublish(initLog.debug, fissPipe, 'fissPipe')
|
geomPublish(initLog.debug, fissPipe, 'fissPipe')
|
||||||
partPipe = geompy.GetInPlaceByHistory(partFissPipe, pipeFiss)
|
partPipe = geompy.GetInPlaceByHistory(partFissPipe, pipeFiss)
|
||||||
geomPublish(initLog.debug, partPipe, 'partPipe')
|
geomPublish(initLog.debug, partPipe, 'partPipe')
|
||||||
|
|
||||||
edgesPipeFiss = geompy.GetSharedShapesMulti([fissPipe, partPipe], geompy.ShapeType["EDGE"])
|
edgesPipeFiss = geompy.GetSharedShapesMulti([fissPipe, partPipe], geompy.ShapeType["EDGE"])
|
||||||
for i, edge in enumerate(edgesPipeFiss):
|
for i_aux, edge in enumerate(edgesPipeFiss):
|
||||||
name = "edgePipe%d"%i
|
name = "edgePipe{}".format(i_aux)
|
||||||
geomPublishInFather(initLog.debug,fissPipe, edge, name)
|
geomPublishInFather(initLog.debug,fissPipe, edge, name)
|
||||||
try:
|
try:
|
||||||
wirePipeFiss = geompy.MakeWire(edgesPipeFiss)
|
wirePipeFiss = geompy.MakeWire(edgesPipeFiss)
|
||||||
@ -77,13 +80,13 @@ def partitionneFissureParPipe(shapesFissure, elementsDefaut, rayonPipe):
|
|||||||
wirePipeFiss = geompy.MakeCompound(edgesPipeFiss)
|
wirePipeFiss = geompy.MakeCompound(edgesPipeFiss)
|
||||||
logging.debug("wirePipeFiss construit sous forme de compound")
|
logging.debug("wirePipeFiss construit sous forme de compound")
|
||||||
geomPublish(initLog.debug, wirePipeFiss, "wirePipeFiss")
|
geomPublish(initLog.debug, wirePipeFiss, "wirePipeFiss")
|
||||||
|
|
||||||
wireFondFiss = geompy.GetInPlace(partFissPipe,fondFiss)
|
wireFondFiss = geompy.GetInPlace(partFissPipe,fondFiss)
|
||||||
edgesFondFiss = geompy.GetSharedShapesMulti([fissPipe, wireFondFiss], geompy.ShapeType["EDGE"])
|
edgesFondFiss = geompy.GetSharedShapesMulti([fissPipe, wireFondFiss], geompy.ShapeType["EDGE"])
|
||||||
for i, edge in enumerate(edgesFondFiss):
|
for i_aux, edge in enumerate(edgesFondFiss):
|
||||||
name = "edgeFondFiss%d"%i
|
name = "edgeFondFiss{}".format(i_aux)
|
||||||
geomPublishInFather(initLog.debug,fissPipe, edge, name)
|
geomPublishInFather(initLog.debug,fissPipe, edge, name)
|
||||||
wireFondFiss = geompy.MakeWire(edgesFondFiss)
|
wireFondFiss = geompy.MakeWire(edgesFondFiss)
|
||||||
geomPublish(initLog.debug, wireFondFiss,"wireFondFiss")
|
geomPublish(initLog.debug, wireFondFiss,"wireFondFiss")
|
||||||
|
|
||||||
return (fissPipe, edgesPipeFiss, edgesFondFiss, wirePipeFiss, wireFondFiss)
|
return (fissPipe, edgesPipeFiss, edgesFondFiss, wirePipeFiss, wireFondFiss)
|
||||||
|
@ -17,19 +17,19 @@
|
|||||||
#
|
#
|
||||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
#
|
#
|
||||||
|
"""Peau interne du defaut dans le maillage sain"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
from .geomsmesh import smesh
|
|
||||||
import SMESH
|
|
||||||
import traceback
|
import traceback
|
||||||
from .fissError import fissError
|
|
||||||
|
|
||||||
|
import SMESH
|
||||||
|
|
||||||
|
from .geomsmesh import smesh
|
||||||
|
|
||||||
|
from .fissError import fissError
|
||||||
from .listOfExtraFunctions import lookForCorner
|
from .listOfExtraFunctions import lookForCorner
|
||||||
from .fusionMaillageAttributionDefaut import fusionMaillageDefaut
|
from .fusionMaillageAttributionDefaut import fusionMaillageDefaut
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
|
||||||
# --- peau interne du defaut dans le maillage sain
|
|
||||||
|
|
||||||
def peauInterne(fichierMaillage, shapeDefaut, nomZones):
|
def peauInterne(fichierMaillage, shapeDefaut, nomZones):
|
||||||
"""Retrouve les groupes de défaut dans le maillage sain modifié par CreateHoleSkin (CreeZoneDefautMaillage)
|
"""Retrouve les groupes de défaut dans le maillage sain modifié par CreateHoleSkin (CreeZoneDefautMaillage)
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ def peauInterne(fichierMaillage, shapeDefaut, nomZones):
|
|||||||
Remarque : intérêt du passage par fichierMaillage plutôt que par maillageSain ?
|
Remarque : intérêt du passage par fichierMaillage plutôt que par maillageSain ?
|
||||||
"""
|
"""
|
||||||
logging.info("start")
|
logging.info("start")
|
||||||
([maillageSain], status) = smesh.CreateMeshesFromMED(fichierMaillage)
|
([maillageSain], _) = smesh.CreateMeshesFromMED(fichierMaillage)
|
||||||
|
|
||||||
groups = maillageSain.GetGroups()
|
groups = maillageSain.GetGroups()
|
||||||
#print ("groupes :")
|
#print ("groupes :")
|
||||||
@ -78,7 +78,7 @@ def peauInterne(fichierMaillage, shapeDefaut, nomZones):
|
|||||||
for entity_type in info:
|
for entity_type in info:
|
||||||
#print (". {} : {})".format(entity_type, info[entity_type]))
|
#print (". {} : {})".format(entity_type, info[entity_type]))
|
||||||
nbelem += info[entity_type]
|
nbelem += info[entity_type]
|
||||||
if ("Entity_Hexa" == str(entity_type)):
|
if ( str(entity_type) == "Entity_Hexa" ):
|
||||||
nbhexa += info[entity_type]
|
nbhexa += info[entity_type]
|
||||||
nbhexa += info[entity_type]
|
nbhexa += info[entity_type]
|
||||||
#print ("==> nbelem = {}, nbhexa = {}".format(nbelem,nbhexa))
|
#print ("==> nbelem = {}, nbhexa = {}".format(nbelem,nbhexa))
|
||||||
@ -92,16 +92,16 @@ def peauInterne(fichierMaillage, shapeDefaut, nomZones):
|
|||||||
texte += "<li>Il n'y a pas que des hexaèdres réglés linéaires dans la zone à remailler (notamment mailles quadratiques, tetraèdres non traités)</li></ul>"
|
texte += "<li>Il n'y a pas que des hexaèdres réglés linéaires dans la zone à remailler (notamment mailles quadratiques, tetraèdres non traités)</li></ul>"
|
||||||
raise fissError(traceback.extract_stack(),texte)
|
raise fissError(traceback.extract_stack(),texte)
|
||||||
|
|
||||||
nbAdded, maillageSain, DefautBoundary = maillageSain.MakeBoundaryElements( SMESH.BND_2DFROM3D, 'DefBound', '', 0, [ zoneDefaut ])
|
_, maillageSain, DefautBoundary = maillageSain.MakeBoundaryElements( SMESH.BND_2DFROM3D, 'DefBound', '', 0, [ zoneDefaut ])
|
||||||
internal = maillageSain.GetMesh().CutListOfGroups( [ DefautBoundary ], [ zoneDefaut_skin ], 'internal' )
|
internal = maillageSain.GetMesh().CutListOfGroups( [ DefautBoundary ], [ zoneDefaut_skin ], 'internal' )
|
||||||
internalBoundary = smesh.CopyMesh( internal, 'internalBoundary', 0, 0)
|
internalBoundary = smesh.CopyMesh( internal, 'internalBoundary', 0, 0)
|
||||||
|
|
||||||
maillageDefautCible = smesh.CopyMesh(zoneDefaut_skin, 'maillageCible', 0, 0)
|
maillageDefautCible = smesh.CopyMesh(zoneDefaut_skin, 'maillageCible', 0, 0)
|
||||||
listOfCorner = lookForCorner(maillageDefautCible)
|
listOfCorner = lookForCorner(maillageDefautCible)
|
||||||
logging.debug("listOfCorner = {}".format(listOfCorner))
|
texte = "listOfCorner = {}".format(listOfCorner)
|
||||||
|
logging.debug(texte)
|
||||||
if listOfCorner:
|
if listOfCorner:
|
||||||
logging.info("présence de coins à la surface externe de la zone à reconstruire")
|
logging.info("présence de coins à la surface externe de la zone à reconstruire")
|
||||||
zoneDefaut_skin, internalBoundary = fusionMaillageDefaut(maillageSain, maillageDefautCible, internalBoundary, zoneDefaut_skin, shapeDefaut, listOfCorner)
|
zoneDefaut_skin, internalBoundary = fusionMaillageDefaut(maillageSain, maillageDefautCible, internalBoundary, zoneDefaut_skin, shapeDefaut, listOfCorner)
|
||||||
|
|
||||||
return maillageSain, internalBoundary, zoneDefaut, zoneDefaut_skin, zoneDefaut_internalFaces, zoneDefaut_internalEdges
|
return maillageSain, internalBoundary, zoneDefaut, zoneDefaut_skin, zoneDefaut_internalFaces, zoneDefaut_internalEdges
|
||||||
|
|
||||||
|
@ -17,25 +17,26 @@
|
|||||||
#
|
#
|
||||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
#
|
#
|
||||||
|
"""Calcul de produit mixte pour orientation"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from .geomsmesh import geompy
|
from .geomsmesh import geompy
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
def produitMixte(origine, point_1, point_2, point_3):
|
||||||
# --- calcul de produit mixte pour orientation
|
"""produit mixte de 3 vecteurs a partir d'une origine et 3 points"""
|
||||||
|
coordo = geompy.PointCoordinates(origine)
|
||||||
|
coord_1 = geompy.PointCoordinates(point_1)
|
||||||
|
coord_2 = geompy.PointCoordinates(point_2)
|
||||||
|
coord_3 = geompy.PointCoordinates(point_3)
|
||||||
|
|
||||||
def produitMixte(o, p1, p2, p3):
|
o_1 = [coord_1[0] - coordo[0], coord_1[1] - coordo[1], coord_1[2] - coordo[2]]
|
||||||
"""
|
o_2 = [coord_2[0] - coordo[0], coord_2[1] - coordo[1], coord_2[2] - coordo[2]]
|
||||||
produit mixte de 3 vecteurs a partir d'une origine et 3 points
|
o_3 = [coord_3[0] - coordo[0], coord_3[1] - coordo[1], coord_3[2] - coordo[2]]
|
||||||
"""
|
|
||||||
coordo = geompy.PointCoordinates(o)
|
|
||||||
coordp1 = geompy.PointCoordinates(p1)
|
|
||||||
coordp2 = geompy.PointCoordinates(p2)
|
|
||||||
coordp3 = geompy.PointCoordinates(p3)
|
|
||||||
u = [coordp1[0] - coordo[0], coordp1[1] - coordo[1], coordp1[2] - coordo[2]]
|
|
||||||
v = [coordp2[0] - coordo[0], coordp2[1] - coordo[1], coordp2[2] - coordo[2]]
|
|
||||||
w = [coordp3[0] - coordo[0], coordp3[1] - coordo[1], coordp3[2] - coordo[2]]
|
|
||||||
pm = (u[0]*v[1]*w[2] + v[0]*w[1]*u[2] + w[0]*u[1]*v[2]) - (u[0]*w[1]*v[2] + v[0]*u[1]*w[2] + w[0]*v[1]*u[2])
|
|
||||||
logging.debug('pm=%s', pm)
|
|
||||||
return pm
|
|
||||||
|
|
||||||
|
prmi = ( o_1[0]*o_2[1]*o_3[2] + o_2[0]*o_3[1]*o_1[2] + o_3[0]*o_1[1]*o_2[2] ) \
|
||||||
|
- ( o_1[0]*o_3[1]*o_2[2] + o_2[0]*o_1[1]*o_3[2] + o_3[0]*o_2[1]*o_1[2] )
|
||||||
|
|
||||||
|
logging.debug('prmi=%s', prmi)
|
||||||
|
|
||||||
|
return prmi
|
||||||
|
@ -17,47 +17,46 @@
|
|||||||
#
|
#
|
||||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
#
|
#
|
||||||
|
"""Projection d'un point sur une courbe."""
|
||||||
|
|
||||||
|
import logging
|
||||||
|
|
||||||
from .geomsmesh import geompy
|
from .geomsmesh import geompy
|
||||||
import logging
|
|
||||||
import math
|
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
def projettePointSurCourbe(point, edge):
|
||||||
# --- projection d'un point sur une courbe.
|
|
||||||
|
|
||||||
def projettePointSurCourbe(pt, edge):
|
|
||||||
"""
|
"""
|
||||||
projection d'un point p sur une courbe c
|
projection d'un point p sur une courbe c
|
||||||
on suppose que la distance (c(u), p) passe par un minimum quand u varie entre 0 et 1
|
on suppose que la distance (c(u), p) passe par un minimum quand u varie entre 0 et 1
|
||||||
et qu'elle presente pas de minimum local
|
et qu'elle presente pas de minimum local
|
||||||
"""
|
"""
|
||||||
#logging.debug("start")
|
#logging.debug("start")
|
||||||
|
|
||||||
dist = []
|
dist = list()
|
||||||
nbSlices = 50
|
nb_slices = 50
|
||||||
du = 1.0/nbSlices
|
delta = 1.0/float(nb_slices)
|
||||||
for i in range(nbSlices + 1):
|
for i_aux in range(nb_slices + 1):
|
||||||
p = geompy.MakeVertexOnCurve(edge, du*i)
|
pti = geompy.MakeVertexOnCurve(edge, delta*float(i_aux))
|
||||||
d = geompy.MinDistance(p,pt)
|
dpti = geompy.MinDistance(pti,point)
|
||||||
dist.append((d,i))
|
dist.append((dpti,i_aux))
|
||||||
dist.sort()
|
dist.sort()
|
||||||
|
|
||||||
#logging.debug("dist %s", dist)
|
#logging.debug("dist %s", dist)
|
||||||
umin = du*dist[0][1]
|
umin = delta*dist[0][1]
|
||||||
umax = du*dist[1][1]
|
umax = delta*dist[1][1]
|
||||||
#umin = 0.0
|
#umin = 0.0
|
||||||
#umax = 1.0
|
#umax = 1.0
|
||||||
tol = 1.e-8
|
tol = 1.e-8
|
||||||
pmin = geompy.MakeVertexOnCurve(edge, umin)
|
pmin = geompy.MakeVertexOnCurve(edge, umin)
|
||||||
pmax = geompy.MakeVertexOnCurve(edge, umax)
|
pmax = geompy.MakeVertexOnCurve(edge, umax)
|
||||||
dmin = geompy.MinDistance(pmin,pt)
|
dmin = geompy.MinDistance(pmin,point)
|
||||||
dmax = geompy.MinDistance(pmax,pt)
|
dmax = geompy.MinDistance(pmax,point)
|
||||||
dext = geompy.MinDistance(pmin,pmax)
|
dext = geompy.MinDistance(pmin,pmax)
|
||||||
i=0
|
i_aux = 0
|
||||||
while dext > tol and i < 100 :
|
while ( ( dext > tol ) and ( i_aux < 100 ) ):
|
||||||
i = i+1
|
i_aux += 1
|
||||||
utest = (umax + umin) / 2.0
|
utest = (umax + umin) / 2.0
|
||||||
ptest = geompy.MakeVertexOnCurve(edge, utest)
|
ptest = geompy.MakeVertexOnCurve(edge, utest)
|
||||||
dtest = geompy.MinDistance(ptest,pt)
|
dtest = geompy.MinDistance(ptest,point)
|
||||||
if dmin < dmax:
|
if dmin < dmax:
|
||||||
umax = utest
|
umax = utest
|
||||||
pmax = ptest
|
pmax = ptest
|
||||||
@ -68,10 +67,11 @@ def projettePointSurCourbe(pt, edge):
|
|||||||
dmin = dtest
|
dmin = dtest
|
||||||
dext = geompy.MinDistance(pmin,pmax)
|
dext = geompy.MinDistance(pmin,pmax)
|
||||||
#logging.debug('umin=%s umax=%s dmin=%s dmax=%s dtest=%s dext=%s', umin,umax,dmin,dmax,dtest,dext)
|
#logging.debug('umin=%s umax=%s dmin=%s dmax=%s dtest=%s dext=%s', umin,umax,dmin,dmax,dtest,dext)
|
||||||
if abs(utest) < 1.e-7:
|
|
||||||
|
if ( abs(utest) < 1.e-7 ):
|
||||||
utest = 0.0
|
utest = 0.0
|
||||||
if abs(1.0-utest) < 1.e-7:
|
elif ( abs(1.0-utest) < 1.e-7 ):
|
||||||
utest = 1.0
|
utest = 1.0
|
||||||
logging.debug('u=%s, nbiter=%s dtest=%s dext=%s',utest,i,dtest,dext)
|
logging.debug('u=%s, nbiter=%s dtest=%s dext=%s',utest,i_aux,dtest,dext)
|
||||||
|
|
||||||
return utest
|
return utest
|
||||||
|
|
@ -17,30 +17,29 @@
|
|||||||
#
|
#
|
||||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
#
|
#
|
||||||
|
"""Prolongation des segments extrémités des polylines, pour la découpe"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
from .geomsmesh import geompy
|
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
from .geomsmesh import geompy
|
||||||
# --- prolongation des segments extremité des polylines, pour la découpe
|
|
||||||
|
|
||||||
def prolongeVertices(vertices):
|
def prolongeVertices(vertices):
|
||||||
"""
|
"""
|
||||||
Prolongation des segments extremité d'une polyline définie par un vecteur de points.
|
Prolongation des segments extremité d'une polyline définie par un vecteur de points.
|
||||||
Chaque nouvelle extremité est obtenue par symétrie point du voisin de cette ancienne extrémité
|
Chaque nouvelle extrémité est obtenue par symétrie point du voisin de cette ancienne extrémité
|
||||||
(symétrie de centre l'ancienne extrémite) : les segments extremes sont doublés.
|
(symétrie de centre l'ancienne extrémite) : les segments extrêmes sont doublés.
|
||||||
@param vertices : liste ordonnée des points (geomObject) de la polyline
|
@param vertices : liste ordonnée des points (geomObject) de la polyline
|
||||||
@return vertices : liste avec les deux extremités modifiées
|
@return vertices : liste avec les deux extremités modifiées
|
||||||
"""
|
"""
|
||||||
logging.info("start")
|
logging.info("start")
|
||||||
if len(vertices) < 2:
|
if len(vertices) < 2:
|
||||||
return vertices
|
return vertices
|
||||||
v0 = vertices[0]
|
|
||||||
v1 = vertices[1]
|
m_0 = geompy.MakeMirrorByPoint(vertices[1], vertices[0])
|
||||||
m0 = geompy.MakeMirrorByPoint(v1, v0)
|
|
||||||
ve = vertices[-1]
|
m_1 = geompy.MakeMirrorByPoint(vertices[-2], vertices[-1])
|
||||||
vd = vertices[-2]
|
|
||||||
m1 = geompy.MakeMirrorByPoint(vd, ve)
|
vertices[0] = m_0
|
||||||
vertices[0] = m0
|
vertices[-1] = m_1
|
||||||
vertices[-1] = m1
|
|
||||||
return vertices
|
return vertices
|
||||||
|
@ -17,38 +17,40 @@
|
|||||||
#
|
#
|
||||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
#
|
#
|
||||||
|
"""Prolongation d'un wire par deux segments tangents"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from .geomsmesh import geompy
|
from .geomsmesh import geompy
|
||||||
from .geomsmesh import geomPublish
|
from .geomsmesh import geomPublish
|
||||||
from .geomsmesh import geomPublishInFather
|
|
||||||
from . import initLog
|
from . import initLog
|
||||||
|
|
||||||
from .orderEdgesFromWire import orderEdgesFromWire
|
from .orderEdgesFromWire import orderEdgesFromWire
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
def prolongeWire(aWire, extrem, norms, longueur):
|
||||||
# --- prolongation d'un wire par deux segments tangents
|
"""Prolongation d'un wire par deux segments tangents"""
|
||||||
|
|
||||||
def prolongeWire(aWire, extrem, norms, lg):
|
|
||||||
"""
|
|
||||||
"""
|
|
||||||
logging.info("start")
|
logging.info("start")
|
||||||
if geompy.NumberOfEdges(aWire) > 1:
|
|
||||||
|
if ( geompy.NumberOfEdges(aWire) > 1 ):
|
||||||
edges = geompy.ExtractShapes(aWire, geompy.ShapeType["EDGE"])
|
edges = geompy.ExtractShapes(aWire, geompy.ShapeType["EDGE"])
|
||||||
uneSeuleEdge = False
|
uneSeuleEdge = False
|
||||||
else:
|
else:
|
||||||
edges = [aWire]
|
edges = [aWire]
|
||||||
uneSeuleEdge = True
|
uneSeuleEdge = True
|
||||||
edgesBout = []
|
|
||||||
for i, v1 in enumerate(extrem):
|
edgesBout = list()
|
||||||
exts = [geompy.MakeTranslationVectorDistance(v1, norms[i], l) for l in (-lg, lg)]
|
for i_aux, v_1 in enumerate(extrem):
|
||||||
dists = [(geompy.MinDistance(v, aWire), i , v) for i, v in enumerate(exts)]
|
exts = [geompy.MakeTranslationVectorDistance(v_1, norms[i_aux], lg_aux) for lg_aux in (-longueur, longueur)]
|
||||||
|
dists = [(geompy.MinDistance(v, aWire), j_aux , v) for j_aux, v in enumerate(exts)]
|
||||||
dists.sort()
|
dists.sort()
|
||||||
v2 = dists[-1][-1]
|
v_2 = dists[-1][-1]
|
||||||
edge = geompy.MakeEdge(v1, v2)
|
edge = geompy.MakeEdge(v_1, v_2)
|
||||||
edges.append(edge)
|
edges.append(edge)
|
||||||
edgesBout.append(edge)
|
edgesBout.append(edge)
|
||||||
name = "extrem%d"%i
|
name = "extrem{}".format(i_aux)
|
||||||
geomPublish(initLog.debug, edge, name)
|
geomPublish(initLog.debug, edge, name)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
wireProlonge = geompy.MakeWire(edges)
|
wireProlonge = geompy.MakeWire(edges)
|
||||||
geomPublish(initLog.debug, wireProlonge, "wireProlonge")
|
geomPublish(initLog.debug, wireProlonge, "wireProlonge")
|
||||||
@ -61,16 +63,19 @@ def prolongeWire(aWire, extrem, norms, lg):
|
|||||||
edgelist, accessList = orderEdgesFromWire(aWire)
|
edgelist, accessList = orderEdgesFromWire(aWire)
|
||||||
edge1 = edgelist[accessList[0]]
|
edge1 = edgelist[accessList[0]]
|
||||||
if geompy.MinDistance(edgesBout[0], edge1) < 1.e-4 :
|
if geompy.MinDistance(edgesBout[0], edge1) < 1.e-4 :
|
||||||
i0 = 0
|
i_0 = 0
|
||||||
i1 = 1
|
i_1 = 1
|
||||||
else:
|
else:
|
||||||
i0 = 1
|
i_0 = 1
|
||||||
i1 = 0
|
i_1 = 0
|
||||||
wireProlonge = edgesBout[i0]
|
wireProlonge = edgesBout[i_0]
|
||||||
for i in range(len(edgelist)):
|
|
||||||
wireProlonge = geompy.MakeWire([wireProlonge, edgelist[accessList[i]]])
|
for i_aux in range(len(edgelist)):
|
||||||
geomPublish(initLog.debug, wireProlonge, "wireProlonge_%d"%i)
|
wireProlonge = geompy.MakeWire([wireProlonge, edgelist[accessList[i_aux]]])
|
||||||
wireProlonge = geompy.MakeWire([wireProlonge,edgesBout[i1]])
|
geomPublish(initLog.debug, wireProlonge, "wireProlonge_{}".format(i_aux))
|
||||||
|
|
||||||
|
wireProlonge = geompy.MakeWire([wireProlonge,edgesBout[i_1]])
|
||||||
geomPublish(initLog.debug, wireProlonge, "wireProlonge")
|
geomPublish(initLog.debug, wireProlonge, "wireProlonge")
|
||||||
logging.warning("prolongation wire pas a pas OK")
|
logging.warning("prolongation wire pas a pas OK")
|
||||||
|
|
||||||
return wireProlonge
|
return wireProlonge
|
||||||
|
Loading…
Reference in New Issue
Block a user