]> SALOME platform Git repositories - modules/smesh.git/blob - src/Tools/blocFissure/materielCasTests/disque_perce.py
Salome HOME
Install tests.set
[modules/smesh.git] / src / Tools / blocFissure / materielCasTests / disque_perce.py
1 # -*- coding: iso-8859-1 -*-
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 ###
16 ### GEOM component
17 ###
18
19 import GEOM
20 from salome.geom import geomBuilder
21 import math
22 import SALOMEDS
23
24
25 geompy = geomBuilder.New()
26
27 O = geompy.MakeVertex(0, 0, 0)
28 OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
29 OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
30 OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
31 Cylinder_1 = geompy.MakeCylinderRH(100, 300)
32 Cylinder_2 = geompy.MakeCylinderRH(600, 200)
33 Cut_1 = geompy.MakeCut(Cylinder_2, Cylinder_1)
34 Face_1 = geompy.MakeFaceHW(500, 1500, 3)
35 Disque = geompy.MakePartition([Cut_1], [Face_1], [], [], geompy.ShapeType["SOLID"], 0, [], 0)
36 [Compound_1, Compound_2, Compound_3, Compound_4] = geompy.Propagate(Disque)
37 geompy.addToStudy( O, 'O' )
38 geompy.addToStudy( OX, 'OX' )
39 geompy.addToStudy( OY, 'OY' )
40 geompy.addToStudy( OZ, 'OZ' )
41 geompy.addToStudy( Cylinder_1, 'Cylinder_1' )
42 geompy.addToStudy( Cylinder_2, 'Cylinder_2' )
43 geompy.addToStudy( Cut_1, 'Cut_1' )
44 geompy.addToStudy( Face_1, 'Face_1' )
45 geompy.addToStudy( Disque, 'Disque' )
46 geompy.addToStudyInFather( Disque, Compound_1, 'Compound_1' )
47 geompy.addToStudyInFather( Disque, Compound_2, 'Compound_2' )
48 geompy.addToStudyInFather( Disque, Compound_3, 'Compound_3' )
49 geompy.addToStudyInFather( Disque, Compound_4, 'Compound_4' )
50
51 ###
52 ### SMESH component
53 ###
54
55 import  SMESH, SALOMEDS
56 from salome.smesh import smeshBuilder
57
58 smesh = smeshBuilder.New()
59 from salome.StdMeshers import StdMeshersBuilder
60 Disque_1 = smesh.Mesh(Disque)
61 Regular_1D = Disque_1.Segment()
62 Nb_Segments_1 = Regular_1D.NumberOfSegments(10)
63 Nb_Segments_1.SetDistrType( 0 )
64 Hexa_3D = Disque_1.Hexahedron(algo=smeshBuilder.Hexa)
65 Regular_1D_1 = Disque_1.Segment(geom=Compound_3)
66 Nb_Segments_2 = Regular_1D_1.NumberOfSegments(20)
67 Nb_Segments_2.SetDistrType( 0 )
68 Regular_1D_2 = Disque_1.Segment(geom=Compound_4)
69 status = Disque_1.AddHypothesis(Nb_Segments_2,Compound_4)
70 Quadrangle_2D = Disque_1.Quadrangle(algo=smeshBuilder.QUADRANGLE)
71 isDone = Disque_1.Compute()
72 smesh.SetName(Disque_1, 'Disque')
73 Disque_1.ExportMED( os.path.join(gmu.pathBloc, "materielCasTests/disque.med"), 0, SMESH.MED_V2_2, 1 )
74 SubMesh_1 = Regular_1D_1.GetSubMesh()
75 SubMesh_2 = Regular_1D_2.GetSubMesh()
76
77 ## set object names
78 smesh.SetName(Disque_1.GetMesh(), 'Disque')
79 smesh.SetName(Regular_1D.GetAlgorithm(), 'Regular_1D')
80 smesh.SetName(Nb_Segments_1, 'Nb. Segments_1')
81 smesh.SetName(Hexa_3D.GetAlgorithm(), 'Hexa_3D')
82 smesh.SetName(Nb_Segments_2, 'Nb. Segments_2')
83 smesh.SetName(Quadrangle_2D.GetAlgorithm(), 'Quadrangle_2D')
84 smesh.SetName(SubMesh_1, 'SubMesh_1')
85 smesh.SetName(SubMesh_2, 'SubMesh_2')
86
87 if salome.sg.hasDesktop():
88   salome.sg.updateObjBrowser()