]> SALOME platform Git repositories - modules/smesh.git/blob - src/Tools/blocFissure/materielCasTests/eprouvetteCourbe.py
Salome HOME
Install tests.set
[modules/smesh.git] / src / Tools / blocFissure / materielCasTests / eprouvetteCourbe.py
1 # -*- coding: utf-8 -*-
2
3 import sys
4 import salome
5
6 salome.salome_init()
7
8 import salome_notebook
9 notebook = salome_notebook.notebook
10
11 import os
12 from blocFissure import gmu
13
14 ###
15 ### GEOM component
16 ###
17
18 import GEOM
19 from salome.geom import geomBuilder
20 import math
21 import SALOMEDS
22
23
24 geompy = geomBuilder.New()
25
26 O = geompy.MakeVertex(0, 0, 0)
27 OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
28 OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
29 OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
30 Vertex_1 = geompy.MakeVertex(-2000, 0, 0)
31 Cylinder_1 = geompy.MakeCylinder(Vertex_1, OY, 1900, 300)
32 Cylinder_2 = geompy.MakeCylinder(Vertex_1, OY, 2100, 300)
33 Cut_1 = geompy.MakeCut(Cylinder_2, Cylinder_1)
34 Vertex_2 = geompy.MakeVertex(-500, -100, -300)
35 Vertex_3 = geompy.MakeVertex(500, 400, 300)
36 Box_1 = geompy.MakeBoxTwoPnt(Vertex_3, Vertex_2)
37 Common_1 = geompy.MakeCommon(Box_1, Cut_1)
38 Vertex_4 = geompy.MakeVertex(-300, -1000, 0)
39 Cylinder_3 = geompy.MakeCylinder(Vertex_4, OX, 1100, 600)
40 EprouvetteCourbe = geompy.MakeCut(Common_1, Cylinder_3)
41 [Compound_y, Compound_z, Compound_x] = geompy.Propagate(EprouvetteCourbe)
42 geomObj_1 = geompy.MakeMarker(0, 0, 0, 1, 0, 0, 0, 1, 0)
43 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 )
44 SectionDroite = geompy.MakeFaceWires([Sketch_1], 1)
45 geompy.ExportBREP(SectionDroite, os.path.join(gmu.pathBloc, "materielCasTests/EprouvetteCourbeFiss.brep"))
46 geompy.addToStudy( O, 'O' )
47 geompy.addToStudy( OX, 'OX' )
48 geompy.addToStudy( OY, 'OY' )
49 geompy.addToStudy( OZ, 'OZ' )
50 geompy.addToStudy( Vertex_1, 'Vertex_1' )
51 geompy.addToStudy( Cylinder_1, 'Cylinder_1' )
52 geompy.addToStudy( Cylinder_2, 'Cylinder_2' )
53 geompy.addToStudy( Cut_1, 'Cut_1' )
54 geompy.addToStudy( Vertex_2, 'Vertex_2' )
55 geompy.addToStudy( Vertex_3, 'Vertex_3' )
56 geompy.addToStudy( Box_1, 'Box_1' )
57 geompy.addToStudy( Common_1, 'Common_1' )
58 geompy.addToStudy( Cylinder_3, 'Cylinder_3' )
59 geompy.addToStudy( Vertex_4, 'Vertex_4' )
60 geompy.addToStudy( EprouvetteCourbe, 'EprouvetteCourbe' )
61 geompy.addToStudy( Sketch_1, 'Sketch_1' )
62 geompy.addToStudy( SectionDroite, 'SectionDroite' )
63 geompy.addToStudyInFather( EprouvetteCourbe, Compound_y, 'Compound_y' )
64 geompy.addToStudyInFather( EprouvetteCourbe, Compound_z, 'Compound_z' )
65 geompy.addToStudyInFather( EprouvetteCourbe, Compound_x, 'Compound_x' )
66
67 ###
68 ### SMESH component
69 ###
70
71 import  SMESH, SALOMEDS
72 from salome.smesh import smeshBuilder
73
74 smesh = smeshBuilder.New()
75 from salome.StdMeshers import StdMeshersBuilder
76 EprouvetteCourbe_1 = smesh.Mesh(EprouvetteCourbe)
77 Regular_1D = EprouvetteCourbe_1.Segment()
78 Nb_Segments_1 = Regular_1D.NumberOfSegments(50)
79 Nb_Segments_1.SetDistrType( 0 )
80 Quadrangle_2D = EprouvetteCourbe_1.Quadrangle(algo=smeshBuilder.QUADRANGLE)
81 Hexa_3D = EprouvetteCourbe_1.Hexahedron(algo=smeshBuilder.Hexa)
82 Regular_1D_1 = EprouvetteCourbe_1.Segment(geom=Compound_x)
83 Nb_Segments_2 = Regular_1D_1.NumberOfSegments(15)
84 Nb_Segments_2.SetDistrType( 0 )
85 Regular_1D_2 = EprouvetteCourbe_1.Segment(geom=Compound_y)
86 Nb_Segments_3 = Regular_1D_2.NumberOfSegments(25)
87 Nb_Segments_3.SetDistrType( 0 )
88 isDone = EprouvetteCourbe_1.Compute()
89 smesh.SetName(EprouvetteCourbe_1, 'EprouvetteCourbe')
90 EprouvetteCourbe_1.ExportMED( os.path.join(gmu.pathBloc, "materielCasTests/EprouvetteCourbe.med"), 0, SMESH.MED_V2_2, 1 )
91 SubMesh_1 = Regular_1D_1.GetSubMesh()
92 SubMesh_2 = Regular_1D_2.GetSubMesh()
93
94 ## set object names
95 smesh.SetName(EprouvetteCourbe_1.GetMesh(), 'EprouvetteCourbe')
96 smesh.SetName(Regular_1D.GetAlgorithm(), 'Regular_1D')
97 smesh.SetName(Nb_Segments_1, 'Nb. Segments_1')
98 smesh.SetName(Quadrangle_2D.GetAlgorithm(), 'Quadrangle_2D')
99 smesh.SetName(Hexa_3D.GetAlgorithm(), 'Hexa_3D')
100 smesh.SetName(Nb_Segments_2, 'Nb. Segments_2')
101 smesh.SetName(Nb_Segments_3, 'Nb. Segments_3')
102 smesh.SetName(SubMesh_1, 'SubMesh_1')
103 smesh.SetName(SubMesh_2, 'SubMesh_2')
104
105 if salome.sg.hasDesktop():
106   salome.sg.updateObjBrowser()