mise à jour de cas-tests

This commit is contained in:
GERALD NICOLAS 2021-01-28 16:13:36 +01:00
parent 53fe7cd1a7
commit 0ec0a6a841
3 changed files with 53 additions and 58 deletions

View File

@ -58,7 +58,7 @@ class tube(fissureGenerique):
""" """
texte = "genereMaillageSain pour '{}'".format(self.nomCas) texte = "genereMaillageSain pour '{}'".format(self.nomCas)
logging.info(texte) logging.info(texte)
self.shapeFissureParams = dict(lgInfluence = 1., self.shapeFissureParams = dict(lgInfluence = 0.6,
rayonPipe = 0.05) rayonPipe = 0.05)
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
@ -79,7 +79,7 @@ class tube(fissureGenerique):
geompy.addToStudy( shellFiss, 'shellFiss' ) geompy.addToStudy( shellFiss, 'shellFiss' )
geompy.addToStudyInFather( shellFiss, fondFiss, 'fondFiss' ) geompy.addToStudyInFather( shellFiss, fondFiss, 'fondFiss' )
coordsNoeudsFissure = genereMeshCalculZoneDefaut(shellFiss, 0.05, 0.2) coordsNoeudsFissure = genereMeshCalculZoneDefaut(shellFiss, 0.025, 0.1)
centre = None centre = None

View File

@ -18,31 +18,32 @@
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
# #
import logging """Cas-test de blocFissure pour un cube"""
import logging
import os
from blocFissure import gmu
import sys
import salome import salome
import GEOM
from salome.geom import geomBuilder
import SMESH
from salome.smesh import smeshBuilder
#=============== Options ====================
# 1. NOM_OBJET = nom de l'objet
NOM_OBJET = "CubeAngle"
#============================================
salome.salome_init() salome.salome_init()
import os
from blocFissure import gmu
### ###
### GEOM component ### GEOM component
### ###
import GEOM
from salome.geom import geomBuilder
import math
import SALOMEDS
geompy = geomBuilder.New() geompy = geomBuilder.New()
O = geompy.MakeVertex(0, 0, 0)
OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
OZ = geompy.MakeVectorDXDYDZ(0, 0, 1) OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200) Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
Vertex_1 = geompy.MakeVertex(0, 0, 100) Vertex_1 = geompy.MakeVertex(0, 0, 100)
@ -51,10 +52,7 @@ Vertex_2 = geompy.MakeVertex(-5, -5, 90)
Vertex_3 = geompy.MakeVertex(65, 65, 110) Vertex_3 = geompy.MakeVertex(65, 65, 110)
Box_2 = geompy.MakeBoxTwoPnt(Vertex_3, Vertex_2) Box_2 = geompy.MakeBoxTwoPnt(Vertex_3, Vertex_2)
Common_1 = geompy.MakeCommon(Disk_1, Box_2) Common_1 = geompy.MakeCommon(Disk_1, Box_2)
geompy.ExportBREP(Common_1, os.path.join(gmu.pathBloc, "materielCasTests", "CubeAngleFiss.brep"))
geompy.addToStudy( O, 'O' )
geompy.addToStudy( OX, 'OX' )
geompy.addToStudy( OY, 'OY' )
geompy.addToStudy( OZ, 'OZ' ) geompy.addToStudy( OZ, 'OZ' )
geompy.addToStudy( Box_1, 'Box_1' ) geompy.addToStudy( Box_1, 'Box_1' )
geompy.addToStudy( Vertex_1, 'Vertex_1' ) geompy.addToStudy( Vertex_1, 'Vertex_1' )
@ -62,19 +60,21 @@ geompy.addToStudy( Disk_1, 'Disk_1' )
geompy.addToStudy( Vertex_2, 'Vertex_2' ) geompy.addToStudy( Vertex_2, 'Vertex_2' )
geompy.addToStudy( Vertex_3, 'Vertex_3' ) geompy.addToStudy( Vertex_3, 'Vertex_3' )
geompy.addToStudy( Box_2, 'Box_2' ) geompy.addToStudy( Box_2, 'Box_2' )
geompy.addToStudy( Common_1, 'Common_1' ) geompy.addToStudy( Common_1, NOM_OBJET )
ficcao = os.path.join(gmu.pathBloc, "materielCasTests", "{}Fiss.brep".format(NOM_OBJET))
text = ".. Exportation de la géométrie de la fissure dans le fichier '{}'".format(ficcao)
logging.info(text)
geompy.ExportBREP(Common_1, ficcao)
### ###
### SMESH component ### SMESH component
### ###
import SMESH, SALOMEDS
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New() smesh = smeshBuilder.New()
from salome.StdMeshers import StdMeshersBuilder
Mesh_1 = smesh.Mesh(Box_1) Mesh_1 = smesh.Mesh(Box_1)
smesh.SetName(Mesh_1, 'Mesh_1') smesh.SetName(Mesh_1, NOM_OBJET)
Regular_1D = Mesh_1.Segment() Regular_1D = Mesh_1.Segment()
Nb_Segments_1 = Regular_1D.NumberOfSegments(15) Nb_Segments_1 = Regular_1D.NumberOfSegments(15)
Nb_Segments_1.SetDistrType( 0 ) Nb_Segments_1.SetDistrType( 0 )
@ -90,10 +90,12 @@ else:
logging.info(text) logging.info(text)
raise Exception(text) raise Exception(text)
Mesh_1.ExportMED(os.path.join(gmu.pathBloc, "materielCasTests", "CubeAngle.med")) ficmed = os.path.join(gmu.pathBloc, "materielCasTests","{}.med".format(NOM_OBJET))
text = ".. Archivage du maillage dans le fichier '{}'".format(ficmed)
logging.info(text)
Mesh_1.ExportMED(ficmed)
## set object names ## set object names
smesh.SetName(Mesh_1.GetMesh(), 'Mesh_1')
smesh.SetName(Regular_1D.GetAlgorithm(), 'Regular_1D') smesh.SetName(Regular_1D.GetAlgorithm(), 'Regular_1D')
smesh.SetName(Nb_Segments_1, 'Nb. Segments_1') smesh.SetName(Nb_Segments_1, 'Nb. Segments_1')
smesh.SetName(Quadrangle_2D.GetAlgorithm(), 'Quadrangle_2D') smesh.SetName(Quadrangle_2D.GetAlgorithm(), 'Quadrangle_2D')

View File

@ -19,7 +19,7 @@
# #
"""Cas-test de blocFissure sur un tube""" """Cas-test de blocFissure sur un tube"""
__revision__ = "V02.05" __revision__ = "V02.06"
import logging import logging
import os import os
@ -46,6 +46,7 @@ F_L_1 = 80.
F_THETA_1 = 3. F_THETA_1 = 3.
F_C_1 = 1.04 F_C_1 = 1.04
F_L_2 = 20. F_L_2 = 20.
F_C_3 = 0.99
# 3. Maillage # 3. Maillage
# Nombre de segments du tube # Nombre de segments du tube
NB_S_E = 4 NB_S_E = 4
@ -72,6 +73,7 @@ model.addParameter(Part_1_doc, "F_L_1", "{}".format(F_L_1))
model.addParameter(Part_1_doc, "F_THETA_1", "{}".format(F_THETA_1)) model.addParameter(Part_1_doc, "F_THETA_1", "{}".format(F_THETA_1))
model.addParameter(Part_1_doc, "F_R_1", "{}*{}".format(F_C_1,RAYON_INT)) model.addParameter(Part_1_doc, "F_R_1", "{}*{}".format(F_C_1,RAYON_INT))
model.addParameter(Part_1_doc, "F_L_2", "{}".format(F_L_2)) model.addParameter(Part_1_doc, "F_L_2", "{}".format(F_L_2))
model.addParameter(Part_1_doc, "F_D_3", "{}*{}".format(F_C_3,RAYON_INT))
### Create Sketch ### Create Sketch
Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ"))
@ -107,7 +109,7 @@ model.do()
### Create Revolution ### Create Revolution
Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], model.selection("EDGE", "PartSet/OZ"), 180, 0) Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], model.selection("EDGE", "PartSet/OZ"), 180, 0)
Revolution_1.result().setName("Tube") Revolution_1.result().setName("Tube")
Revolution_1.result().setTransparency(0.9399999999999999) Revolution_1.result().setTransparency(0.37)
### Create Sketch ### Create Sketch
Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("YOZ")) Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("YOZ"))
@ -146,47 +148,39 @@ Sketch_2.setCoincident(SketchArc_1.startPoint(), SketchLine_6.endPoint())
### Create SketchConstraintAngle ### Create SketchConstraintAngle
Sketch_2.setAngle(SketchLine_5.result(), SketchLine_6.result(), "F_THETA_1", type = "Direct") Sketch_2.setAngle(SketchLine_5.result(), SketchLine_6.result(), "F_THETA_1", type = "Direct")
### Create SketchProjection
SketchProjection_5 = Sketch_2.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
SketchPoint_5 = SketchProjection_5.createdFeature()
### Create SketchEllipticArc ### Create SketchEllipticArc
SketchEllipticArc_1 = Sketch_2.addEllipticArc(-20, 8.956370781951521e-27, -10.21629725685072, 9.783702743149284, 10.10993798723031, 4.722461741243296, 9.440921421952831, 9.565935245237778, False) SketchEllipticArc_1 = Sketch_2.addEllipticArc(-20, 8.956370781951521e-27, -10.21629725685072, 9.783702743149284, 10.10993798723031, 4.722461741243296, 9.7416, 8.052073253504034, False)
[SketchPoint_6, SketchPoint_7, SketchPoint_8, SketchPoint_9, SketchPoint_10, SketchPoint_11, SketchPoint_12, SketchLine_7, SketchLine_8] = \ [SketchPoint_5, SketchPoint_6, SketchPoint_7, SketchPoint_8, SketchPoint_9, SketchPoint_10, SketchPoint_11, SketchLine_7, SketchLine_8] = \
SketchEllipticArc_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux") SketchEllipticArc_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux")
Sketch_2.setCoincident(SketchEllipticArc_1.startPoint(), SketchLine_6.endPoint()) Sketch_2.setCoincident(SketchEllipticArc_1.startPoint(), SketchLine_6.endPoint())
Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_6).coordinates(), SketchLine_5.result()) Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_5).coordinates(), SketchLine_5.result())
Sketch_2.setTangent(SketchEllipticArc_1.result(), SketchArc_1.results()[1]) Sketch_2.setTangent(SketchEllipticArc_1.result(), SketchArc_1.results()[1])
### Create SketchProjection
SketchProjection_5 = Sketch_2.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
SketchPoint_12 = SketchProjection_5.createdFeature()
Sketch_2.setHorizontalDistance(SketchAPI_Point(SketchPoint_5).coordinates(), SketchAPI_Point(SketchPoint_12).coordinates(), "F_L_2")
### Create SketchConstraintAngle
Sketch_2.setAngle(SketchLine_5.result(), SketchLine_7.result(), 45, type = "Supplementary")
### Create SketchProjection ### Create SketchProjection
SketchProjection_6 = Sketch_2.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) SketchProjection_6 = Sketch_2.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
SketchPoint_13 = SketchProjection_6.createdFeature() SketchPoint_13 = SketchProjection_6.createdFeature()
Sketch_2.setHorizontalDistance(SketchAPI_Point(SketchPoint_6).coordinates(), SketchAPI_Point(SketchPoint_13).coordinates(), "F_L_2") Sketch_2.setHorizontalDistance(SketchEllipticArc_1.endPoint(), SketchAPI_Point(SketchPoint_13).coordinates(), "F_D_3")
### Create SketchLine
SketchLine_9 = Sketch_2.addLine(-20, 8.956370781951521e-27, 9.440921421952831, 9.565935245237778)
SketchLine_9.setAuxiliary(True)
Sketch_2.setCoincident(SketchEllipticArc_1.center(), SketchLine_9.startPoint())
Sketch_2.setCoincident(SketchEllipticArc_1.endPoint(), SketchLine_9.endPoint())
### Create SketchConstraintAngle
Sketch_2.setAngle(SketchLine_9.result(), SketchLine_5.result(), "6.*F_THETA_1", type = "Direct")
### Create SketchConstraintAngle
Sketch_2.setAngle(SketchLine_5.result(), SketchLine_7.result(), 45, type = "Supplementary")
### Create SketchConstraintMirror ### Create SketchConstraintMirror
SketchConstraintMirror_1 = Sketch_2.addMirror(SketchLine_5.result(), [SketchEllipticArc_1.result()]) SketchConstraintMirror_1 = Sketch_2.addMirror(SketchLine_5.result(), [SketchEllipticArc_1.result()])
[SketchEllipticArc_2] = SketchConstraintMirror_1.mirrored() [SketchEllipticArc_2] = SketchConstraintMirror_1.mirrored()
### Create SketchLine ### Create SketchLine
SketchLine_10 = Sketch_2.addLine(9.440921421952831, 9.565935245237778, 9.440921421952837, -9.565935245237783) SketchLine_9 = Sketch_2.addLine(9.7416, 8.052073253504034, 9.7416, -8.052073253504034)
Sketch_2.setCoincident(SketchEllipticArc_1.endPoint(), SketchLine_10.startPoint()) Sketch_2.setCoincident(SketchEllipticArc_1.endPoint(), SketchLine_9.startPoint())
Sketch_2.setCoincident(SketchAPI_EllipticArc(SketchEllipticArc_2).endPoint(), SketchLine_10.endPoint()) Sketch_2.setCoincident(SketchAPI_EllipticArc(SketchEllipticArc_2).endPoint(), SketchLine_9.endPoint())
model.do() model.do()
### Create Face ### Create Face
Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchArc_1_2r-SketchEllipticArc_1f-SketchLine_10f-SketchEllipticArc_2f")]) Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchArc_1_2r-SketchEllipticArc_1f-SketchLine_9f-SketchEllipticArc_2f")])
Face_1.result().setName("Fissure") Face_1.result().setName("Fissure")
### Create Group ### Create Group
@ -199,7 +193,7 @@ Group_2 = model.addGroup(Part_1_doc, "Edges", [model.selection("EDGE", "Fissure/
Group_3 = model.addGroup(Part_1_doc, "Edges", [model.selection("EDGE", "Fissure/Modified_Edge&Sketch_2/SketchEllipticArc_2")]) Group_3 = model.addGroup(Part_1_doc, "Edges", [model.selection("EDGE", "Fissure/Modified_Edge&Sketch_2/SketchEllipticArc_2")])
### Create Group ### Create Group
Group_4 = model.addGroup(Part_1_doc, "Edges", [model.selection("EDGE", "Fissure/Modified_Edge&Sketch_2/SketchLine_10")]) Group_4 = model.addGroup(Part_1_doc, "Edges", [model.selection("EDGE", "Fissure/Modified_Edge&Sketch_2/SketchLine_9")])
### Create Group ### Create Group
Group_5 = model.addGroup(Part_1_doc, "Edges", [model.selection("EDGE", "[Tube/Generated_Face&Sketch_1/SketchLine_1][Tube/From_Face]")]) Group_5 = model.addGroup(Part_1_doc, "Edges", [model.selection("EDGE", "[Tube/Generated_Face&Sketch_1/SketchLine_1][Tube/From_Face]")])
@ -217,10 +211,10 @@ Group_7.setName("Peripherie")
Group_7.result().setName("Peripherie") Group_7.result().setName("Peripherie")
### Create Export ### Create Export
ficxao = os.path.join(gmu.pathBloc, "materielCasTests", "{}Fiss.xao".format(NOM_OBJET)) ficcao = os.path.join(gmu.pathBloc, "materielCasTests", "{}Fiss.xao".format(NOM_OBJET))
text = ".. Exportation de la géométrie de la fissure dans le fichier '{}'".format(ficxao) text = ".. Exportation de la géométrie de la fissure dans le fichier '{}'".format(ficcao)
logging.info(text) logging.info(text)
_ = model.exportToXAO(Part_1_doc, ficxao, model.selection("FACE", "Fissure"), 'XAO') _ = model.exportToXAO(Part_1_doc, ficcao, model.selection("FACE", "Fissure"), 'XAO')
model.end() model.end()
@ -281,7 +275,6 @@ logging.info(text)
Maillage_tube.ExportMED(ficmed) Maillage_tube.ExportMED(ficmed)
## set object names ## set object names
smesh.SetName(Maillage_tube.GetMesh(), 'Maillage_tube')
smesh.SetName(Regular_1D.GetAlgorithm(), 'Regular_1D') smesh.SetName(Regular_1D.GetAlgorithm(), 'Regular_1D')
smesh.SetName(Nb_Segments_1, 'Nb. Segments_1') smesh.SetName(Nb_Segments_1, 'Nb. Segments_1')
smesh.SetName(Quadrangle_2D.GetAlgorithm(), 'Quadrangle_2D') smesh.SetName(Quadrangle_2D.GetAlgorithm(), 'Quadrangle_2D')