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