Fichier d'archive à la norme python

This commit is contained in:
GERALD NICOLAS 2021-01-22 18:08:58 +01:00
parent e9ec5b9114
commit b3c9d09a8a
12 changed files with 69 additions and 33 deletions

View File

@ -51,7 +51,7 @@ Vertex_2 = geompy.MakeVertex(-5, -5, 90)
Vertex_3 = geompy.MakeVertex(65, 65, 110)
Box_2 = geompy.MakeBoxTwoPnt(Vertex_3, Vertex_2)
Common_1 = geompy.MakeCommon(Disk_1, Box_2)
geompy.ExportBREP(Common_1, os.path.join(gmu.pathBloc, "materielCasTests/CubeAngleFiss.brep"))
geompy.ExportBREP(Common_1, os.path.join(gmu.pathBloc, "materielCasTests", "CubeAngleFiss.brep"))
geompy.addToStudy( O, 'O' )
geompy.addToStudy( OX, 'OX' )
geompy.addToStudy( OY, 'OY' )
@ -81,7 +81,7 @@ Quadrangle_2D = Mesh_1.Quadrangle(algo=smeshBuilder.QUADRANGLE)
Hexa_3D = Mesh_1.Hexahedron(algo=smeshBuilder.Hexa)
isDone = Mesh_1.Compute()
smesh.SetName(Mesh_1, 'Mesh_1')
Mesh_1.ExportMED(os.path.join(gmu.pathBloc, "materielCasTests/CubeAngle.med"))
Mesh_1.ExportMED(os.path.join(gmu.pathBloc, "materielCasTests", "CubeAngle.med"))
## set object names
smesh.SetName(Mesh_1.GetMesh(), 'Mesh_1')

View File

@ -109,9 +109,9 @@ geompy.addToStudy( O_1, 'O' )
geompy.addToStudy( OX_1, 'OX' )
geompy.addToStudy( OY_1, 'OY' )
geompy.addToStudy( OZ_1, 'OZ' )
geompy.ExportBREP(cubeFin_Transverse, os.path.join(gmu.pathBloc, "materielCasTests/cubeFin_Transverse.brep"))
geompy.ExportBREP(cubeFin_Coin, os.path.join(gmu.pathBloc, "materielCasTests/cubeFin_Coin.brep"))
geompy.ExportBREP(cubeFin_Milieu, os.path.join(gmu.pathBloc, "materielCasTests/cubeFin_Milieu.brep"))
geompy.ExportBREP(cubeFin_Transverse, os.path.join(gmu.pathBloc, "materielCasTests", "cubeFin_Transverse.brep"))
geompy.ExportBREP(cubeFin_Coin, os.path.join(gmu.pathBloc, "materielCasTests", "cubeFin_Coin.brep"))
geompy.ExportBREP(cubeFin_Milieu, os.path.join(gmu.pathBloc, "materielCasTests", "cubeFin_Milieu.brep"))
###
### SMESH component
@ -140,7 +140,7 @@ smesh.SetName(ENCASTR_1, 'ENCASTR')
smesh.SetName(cubeFin_1.GetMesh(), 'cubeFin')
smesh.SetName(Nb_Segments_1, 'Nb. Segments_1')
cubeFin_1.ExportMED(os.path.join(gmu.pathBloc, "materielCasTests/cubeFin.med"))
cubeFin_1.ExportMED(os.path.join(gmu.pathBloc, "materielCasTests", "cubeFin.med"))
if salome.sg.hasDesktop():
salome.sg.updateObjBrowser()

View File

@ -79,14 +79,14 @@ FissInCylindre = geompy.MakeFaceWires([Curve_2, Arc_1], 1)
Divided_Cylinder_1 = geompy.MakeDividedCylinder(145, 800, GEOM.SQUARE)
CylindreSain = geompy.MakeRotation(Divided_Cylinder_1, OZ, 45*math.pi/180.0)
[Compound_1, vertical, radial, Compound_4] = geompy.Propagate(CylindreSain)
geompy.ExportBREP(FissInCylindre, os.path.join(gmu.pathBloc, "materielCasTests/FissInCylindre.brep"))
geompy.ExportBREP(FissInCylindre, os.path.join(gmu.pathBloc, "materielCasTests", "FissInCylindre.brep"))
Vertex_12 = geompy.MakeVertex(0, -145, 500)
Circle_2 = geompy.MakeCircle(Vertex_12, None, 145)
Face_1 = geompy.MakeFaceWires([Circle_2], 1)
Vertex_13 = geompy.MakeVertex(0, 0, 500)
Disk_1 = geompy.MakeDiskPntVecR(Vertex_13, OZ_1, 170)
FissInCylindre2 = geompy.MakeCommon(Face_1, Disk_1)
geompy.ExportBREP(FissInCylindre2, os.path.join(gmu.pathBloc, "materielCasTests/FissInCylindre2.brep"))
geompy.ExportBREP(FissInCylindre2, os.path.join(gmu.pathBloc, "materielCasTests", "FissInCylindre2.brep"))
geompy.addToStudy( O, 'O' )
geompy.addToStudy( OX, 'OX' )
geompy.addToStudy( OY, 'OY' )
@ -161,7 +161,7 @@ Nb_Segments_3 = Regular_1D_2.NumberOfSegments(6,[],[ ])
Nb_Segments_3.SetDistrType( 0 )
isDone = CylindreSain_1.Compute()
smesh.SetName(CylindreSain_1, 'CylindreSain')
CylindreSain_1.ExportMED(os.path.join(gmu.pathBloc, "materielCasTests//CylindreSain.med"))
CylindreSain_1.ExportMED(os.path.join(gmu.pathBloc, "materielCasTests", "CylindreSain.med"))
SubMesh_1 = Regular_1D_1.GetSubMesh()
SubMesh_2 = Regular_1D_2.GetSubMesh()

View File

@ -88,7 +88,7 @@ status = Disque_1.AddHypothesis(Nb_Segments_2,Compound_4)
Quadrangle_2D = Disque_1.Quadrangle(algo=smeshBuilder.QUADRANGLE)
isDone = Disque_1.Compute()
smesh.SetName(Disque_1, 'Disque')
Disque_1.ExportMED(os.path.join(gmu.pathBloc, "materielCasTests/disque.med"))
Disque_1.ExportMED(os.path.join(gmu.pathBloc, "materielCasTests", "disque.med"))
SubMesh_1 = Regular_1D_1.GetSubMesh()
SubMesh_2 = Regular_1D_2.GetSubMesh()

View File

@ -71,7 +71,7 @@ geompy.addToStudy( Vertex_4, 'Vertex_4' )
geompy.addToStudy( Box_1, 'Box_1' )
geompy.addToStudy( ellipse1, 'ellipse1' )
geompy.addToStudyInFather( ellipse1, fondFiss, 'fondFiss' )
geompy.ExportBREP(ellipse1, os.path.join(gmu.pathBloc, "materielCasTests/ellipse1.brep"))
geompy.ExportBREP(ellipse1, os.path.join(gmu.pathBloc, "materielCasTests", "ellipse1.brep"))
if salome.sg.hasDesktop():

View File

@ -51,7 +51,7 @@ Vertex_2 = geompy.MakeVertex(98, -2, -2)
Vertex_3 = geompy.MakeVertex(120, 2, 60)
Box_1 = geompy.MakeBoxTwoPnt(Vertex_3, Vertex_2)
Ellipse_disque = geompy.MakeCommon(Box_1, Scale_1)
geompy.ExportBREP(Ellipse_disque, os.path.join(gmu.pathBloc, "materielCasTests/ellipse_disque.brep"))
geompy.ExportBREP(Ellipse_disque, os.path.join(gmu.pathBloc, "materielCasTests", "ellipse_disque.brep"))
geompy.addToStudy( O, 'O' )
geompy.addToStudy( OX, 'OX' )
geompy.addToStudy( OY, 'OY' )

View File

@ -69,7 +69,7 @@ geompy.addToStudy( Box_1, 'Box_1' )
geompy.addToStudy( Vertex_4, 'Vertex_4' )
geompy.addToStudy( Cut_1, 'Cut_1' )
geompy.addToStudy( ellipse1, 'ellipse1_pb' )
geompy.ExportBREP(ellipse1, os.path.join(gmu.pathBloc, "materielCasTests/ellipse1_pb.brep"))
geompy.ExportBREP(ellipse1, os.path.join(gmu.pathBloc, "materielCasTests", "ellipse1_pb.brep"))
if salome.sg.hasDesktop():

View File

@ -60,7 +60,7 @@ EprouvetteCourbe = geompy.MakeCut(Common_1, Cylinder_3)
geomObj_1 = geompy.MakeMarker(0, 0, 0, 1, 0, 0, 0, 1, 0)
Sketch_1 = geompy.MakeSketcherOnPlane("Sketcher:F -110.000000 85.000000:T 220.000000 0.000000:T 0.000000 75.000000:T -220.000000 0.000000:WW", geomObj_1 )
SectionDroite = geompy.MakeFaceWires([Sketch_1], 1)
geompy.ExportBREP(SectionDroite, os.path.join(gmu.pathBloc, "materielCasTests/EprouvetteCourbeFiss.brep"))
geompy.ExportBREP(SectionDroite, os.path.join(gmu.pathBloc, "materielCasTests", "EprouvetteCourbeFiss.brep"))
geompy.addToStudy( O, 'O' )
geompy.addToStudy( OX, 'OX' )
geompy.addToStudy( OY, 'OY' )
@ -105,7 +105,7 @@ Nb_Segments_3 = Regular_1D_2.NumberOfSegments(25)
Nb_Segments_3.SetDistrType( 0 )
isDone = EprouvetteCourbe_1.Compute()
smesh.SetName(EprouvetteCourbe_1, 'EprouvetteCourbe')
EprouvetteCourbe_1.ExportMED(os.path.join(gmu.pathBloc, "materielCasTests/EprouvetteCourbe.med"))
EprouvetteCourbe_1.ExportMED(os.path.join(gmu.pathBloc, "materielCasTests", "EprouvetteCourbe.med"))
SubMesh_1 = Regular_1D_1.GetSubMesh()
SubMesh_2 = Regular_1D_2.GetSubMesh()

View File

@ -61,8 +61,8 @@ Plane_2 = geompy.MakePlane(Vertex_1, Line_1, 2000)
geomObj_4 = geompy.MakeMarker(0, 0, 0, 1, 0, 0, 0, 1, 0)
Sketch_2 = geompy.MakeSketcherOnPlane("Sketcher:F 0.000000 0.000000:T 120.000000 0.000000:T 0.000000 100.000000:T -120.000000 20.000000:WW", Plane_2 )
SectionInclinee = geompy.MakeFaceWires([Sketch_2], 1)
geompy.ExportBREP(sectionDroite, os.path.join(gmu.pathBloc, "materielCasTests/EprouvetteDroiteFissPb1.brep"))
geompy.ExportBREP(SectionInclinee, os.path.join(gmu.pathBloc, "materielCasTests/EprouvetteDroiteFiss2.brep"))
geompy.ExportBREP(sectionDroite, os.path.join(gmu.pathBloc, "materielCasTests", "EprouvetteDroiteFissPb1.brep"))
geompy.ExportBREP(SectionInclinee, os.path.join(gmu.pathBloc, "materielCasTests", "EprouvetteDroiteFiss2.brep"))
Vertex_2 = geompy.MakeVertex(110, -10, 200)
Vertex_3 = geompy.MakeVertex(110, 80, 200)
Vertex_4 = geompy.MakeVertex(-10, 80, 200)
@ -79,8 +79,8 @@ Line_7 = geompy.MakeLineTwoPnt(Vertex_5, Vertex_6)
Face_1_vertex_9 = geompy.GetSubShape(Face_1, [9])
Line_8 = geompy.MakeLineTwoPnt(Vertex_6, Face_1_vertex_9)
Face_2 = geompy.MakeFaceWires([Line_5, Line_6, Line_7, Line_8], 1)
geompy.ExportBREP(Face_1, os.path.join(gmu.pathBloc, "materielCasTests/EprouvetteDroiteFiss_1.brep"))
geompy.ExportBREP(Face_2, os.path.join(gmu.pathBloc, "materielCasTests/EprouvetteDroiteFiss_2.brep"))
geompy.ExportBREP(Face_1, os.path.join(gmu.pathBloc, "materielCasTests", "EprouvetteDroiteFiss_1.brep"))
geompy.ExportBREP(Face_2, os.path.join(gmu.pathBloc, "materielCasTests", "EprouvetteDroiteFiss_2.brep"))
geompy.addToStudy( O, 'O' )
geompy.addToStudy( OX, 'OX' )
geompy.addToStudy( OY, 'OY' )
@ -139,7 +139,7 @@ Nb_Segments_3 = Regular_1D_2.NumberOfSegments(10,[],[ ])
Nb_Segments_3.SetDistrType( 0 )
isDone = eprouvetteDroite_1.Compute()
smesh.SetName(eprouvetteDroite_1, 'eprouvetteDroite')
eprouvetteDroite_1.ExportMED(os.path.join(gmu.pathBloc, "materielCasTests/eprouvetteDroite.med"))
eprouvetteDroite_1.ExportMED(os.path.join(gmu.pathBloc, "materielCasTests", "eprouvetteDroite.med"))
SubMesh_1 = Regular_1D_1.GetSubMesh()
SubMesh_2 = Regular_1D_2.GetSubMesh()

View File

@ -76,7 +76,7 @@ Box_2 = geompy.MakeBoxTwoPnt(Vertex_7, Vertex_6)
Common_1 = geompy.MakeCommon(Box_2, Cut_2)
objetSain = geompy.MakePartition([Common_1], [Plane_1, Plane_2, Plane_3], [], [], geompy.ShapeType["SOLID"], 0, [], 0)
[hauteurs, epaisseurs, Compound_3, Compound_4, Compound_5, Compound_6] = geompy.Propagate(objetSain)
geompy.ExportBREP(faceFiss1, os.path.join(gmu.pathBloc, "materielCasTests/faceGaucheFiss.brep"))
geompy.ExportBREP(faceFiss1, os.path.join(gmu.pathBloc, "materielCasTests", "faceGaucheFiss.brep"))
geompy.addToStudy( O, 'O' )
geompy.addToStudy( OX, 'OX' )
geompy.addToStudy( OY, 'OY' )
@ -134,7 +134,7 @@ Nb_Segments_3 = Regular_1D_2.NumberOfSegments(5,[],[ ])
Nb_Segments_3.SetDistrType( 0 )
isDone = objetSain_1.Compute()
smesh.SetName(objetSain_1, 'objetSain')
objetSain_1.ExportMED(os.path.join(gmu.pathBloc, "materielCasTests/faceGaucheSain.med"))
objetSain_1.ExportMED(os.path.join(gmu.pathBloc, "materielCasTests", "faceGaucheSain.med"))
SubMesh_1 = Regular_1D_1.GetSubMesh()
SubMesh_2 = Regular_1D_2.GetSubMesh()

View File

@ -53,7 +53,7 @@ Extrusion_2 = geompy.MakePrismVecH(Circle_3, OZ, 1000)
Partition_1 = geompy.MakePartition([Extrusion_1], [Extrusion_2], [], [], geompy.ShapeType["FACE"], 0, [], 0)
[Face_1,Face_2] = geompy.SubShapes(Partition_1, [18, 13])
FaceFissExt = geompy.MakeFuse(Face_2, Face_1)
geompy.ExportBREP(FaceFissExt, os.path.join(gmu.pathBloc, "materielCasTests/faceGauche2Fiss.brep"))
geompy.ExportBREP(FaceFissExt, os.path.join(gmu.pathBloc, "materielCasTests", "faceGauche2Fiss.brep"))
Vertex_2 = geompy.MakeVertex(0, -500, 0)
Vertex_3 = geompy.MakeVertex(400, 500, 800)
objetSain = geompy.MakeBoxTwoPnt(Vertex_3, Vertex_2)
@ -64,7 +64,7 @@ geompy.addToStudy( Partition_2, 'Partition_2' )
geompy.addToStudyInFather( Partition_2, FaceFissExtSimple, 'FaceFissExtSimple' )
Plane_1 = geompy.MakePlaneLCS(None, 2000, 3)
FaceFissExtCoupe = geompy.MakePartition([FaceFissExtSimple], [Plane_1], [], [], geompy.ShapeType["FACE"], 0, [], 0)
geompy.ExportBREP(FaceFissExtCoupe, os.path.join(gmu.pathBloc, "materielCasTests/faceGauche2FissCoupe.brep"))
geompy.ExportBREP(FaceFissExtCoupe, os.path.join(gmu.pathBloc, "materielCasTests", "faceGauche2FissCoupe.brep"))
geompy.addToStudy( O, 'O' )
geompy.addToStudy( OX, 'OX' )
geompy.addToStudy( OY, 'OY' )
@ -102,7 +102,7 @@ Quadrangle_2D = Mesh_1.Quadrangle(algo=smeshBuilder.QUADRANGLE)
Hexa_3D = Mesh_1.Hexahedron(algo=smeshBuilder.Hexa)
isDone = Mesh_1.Compute()
smesh.SetName(Mesh_1, 'Mesh_1')
Mesh_1.ExportMED(os.path.join(gmu.pathBloc, "materielCasTests/boiteSaine.med"))
Mesh_1.ExportMED(os.path.join(gmu.pathBloc, "materielCasTests", "boiteSaine.med"))
## set object names
smesh.SetName(Mesh_1.GetMesh(), 'Mesh_1')

View File

@ -18,6 +18,8 @@
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
import logging
import sys
import salome
@ -29,6 +31,8 @@ notebook = salome_notebook.notebook
import os
from blocFissure import gmu
logging.info('start')
###
### GEOM component
###
@ -115,7 +119,7 @@ Revolution_2 = geompy.MakeRevolution2Ways(generatrice, OY, 65*math.pi/180.0)
Fissure = geompy.MakeCommonList([Extrusion_1, Revolution_2], True)
fondFiss = geompy.CreateGroup(Fissure, geompy.ShapeType["EDGE"])
geompy.UnionIDs(fondFiss, [9, 7, 4])
geompy.ExportBREP(Fissure, os.path.join(gmu.pathBloc, "materielCasTests/visFiss.brep"))
geompy.ExportBREP(Fissure, os.path.join(gmu.pathBloc, "materielCasTests", "visFiss.brep"))
geompy.addToStudy( O, 'O' )
geompy.addToStudy( OX, 'OX' )
@ -181,10 +185,13 @@ geompy.addToStudyInFather( Fissure, fondFiss, 'fondFiss' )
### SMESH component
###
logging.info("Maillage de {}".format(coupe_vis.GetName()))
import SMESH, SALOMEDS
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New()
coupe_vis_1 = smesh.Mesh(coupe_vis)
Regular_1D = coupe_vis_1.Segment()
Nb_Segments_1 = Regular_1D.NumberOfSegments(10)
@ -193,8 +200,7 @@ Regular_1D_1 = coupe_vis_1.Segment(geom=tige)
Nb_Segments_2 = Regular_1D_1.NumberOfSegments(30)
Regular_1D_2 = coupe_vis_1.Segment(geom=section)
Nb_Segments_3 = Regular_1D_2.NumberOfSegments(10,1,[ 7, 11, 16, 23 ])
isDone = coupe_vis_1.Compute()
isDone = coupe_vis_1.SplitQuad( [ 691 ], 1 )
tige_1 = coupe_vis_1.GroupOnGeom(tige,'tige',SMESH.EDGE)
section_1 = coupe_vis_1.GroupOnGeom(section,'section',SMESH.EDGE)
tige_haute_1 = coupe_vis_1.GroupOnGeom(tige_haute,'tige_haute',SMESH.EDGE)
@ -204,14 +210,44 @@ section_tete_1 = coupe_vis_1.GroupOnGeom(section_tete,'section_tete',SMESH.EDGE)
conge_1 = coupe_vis_1.GroupOnGeom(conge,'conge',SMESH.EDGE)
appui_1 = coupe_vis_1.GroupOnGeom(appui,'appui',SMESH.EDGE)
p_imp_1 = coupe_vis_1.GroupOnGeom(p_imp,'p_imp',SMESH.EDGE)
isDone = coupe_vis_1.Compute()
text = "Maillage de {}".format(coupe_vis.GetName())
if isDone:
logging.debug(text+" : OK")
else:
text = "Erreur au calcul du maillage.\n" + text
logging.info(text)
raise Exception(text)
# Découpage en 2 triangles du quadrangle dans l'angle
cg_x=0.972772
cg_y=104.835
cg_z=0.
l_ids = coupe_vis_1.FindElementsByPoint( cg_x,cg_y,cg_z, SMESH.FACE )
if ( len(l_ids) != 1 ):
text = "Maillage {}.\nImpossible de trouver l'élément proche de ({},{},{}).".format(coupe_vis.GetName(),cg_x,cg_y,cg_z)
raise Exception(text)
isDone = coupe_vis_1.SplitQuad( l_ids, 1 )
text = "SplitQuad de l'élément n° {} du maillage de {}".format(l_ids[0],coupe_vis.GetName())
if isDone:
logging.debug(text+" : OK")
else:
text = "Erreur.\n" + text
logging.info(text)
raise Exception(text)
visHex80 = smesh.CopyMesh( coupe_vis_1, 'visHex80', 1, 0)
[ tige_2, section_2, tige_haute_2, rond_2, tete_2, section_tete_2, conge_2, appui_2, p_imp_2 ] = visHex80.GetGroups()
[ tige_rotated, section_rotated, tige_haute_rotated, rond_rotated, tete_rotated, section_tete_rotated, conge_rotated, appui_rotated, p_imp_rotated, tige_top, section_top, tige_haute_top, rond_top, tete_top, section_tete_top, conge_top, appui_top, p_imp_top ] = visHex80.RotationSweepObjects( [ visHex80 ], [ visHex80 ], [ visHex80 ], SMESH.AxisStruct( 0, 0, 0, 0, 10, 0 ), 0.0785398, 40, 1e-05, 1 )
[ tige_2, section_2, tige_haute_2, rond_2, tete_2, section_tete_2, conge_2, appui_2, p_imp_2, tige_rotated, tige_top, section_rotated, section_top, tige_haute_rotated, tige_haute_top, rond_rotated, rond_top, tete_rotated, tete_top, section_tete_rotated, section_tete_top, conge_rotated, conge_top, appui_rotated, appui_top, p_imp_rotated, p_imp_top ] = visHex80.GetGroups()
_ = visHex80.RotationSweepObjects( [ visHex80 ], [ visHex80 ], [ visHex80 ], SMESH.AxisStruct( 0, 0, 0, 0, 10, 0 ), 0.0785398, 40, 1e-05, 1 )
[ tige_2, section_2, tige_haute_2, rond_2, tete_2, section_tete_2, conge_2, appui_2, p_imp_2, \
tige_rotated, tige_top, section_rotated, section_top, tige_haute_rotated, tige_haute_top, \
rond_rotated, rond_top, tete_rotated, tete_top, section_tete_rotated, section_tete_top, \
conge_rotated, conge_top, appui_rotated, appui_top, p_imp_rotated, p_imp_top ] = visHex80.GetGroups()
Sub_mesh_1 = Regular_1D_1.GetSubMesh()
Sub_mesh_2 = Regular_1D_2.GetSubMesh()
visHex80.ExportMED(os.path.join(gmu.pathBloc, "materielCasTests/visSain.med"))
visHex80.ExportMED(os.path.join(gmu.pathBloc, "materielCasTests", "visSain.med"))
## Set names of Mesh objects
smesh.SetName(tige_2, 'tige')