Salome HOME
Update copyrights
[modules/smesh.git] / src / Tools / blocFissure / materielCasTests / disque_perce.py
1 # -*- coding: iso-8859-1 -*-
2 # Copyright (C) 2014-2019  CEA/DEN, EDF R&D
3 #
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License, or (at your option) any later version.
8 #
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 # Lesser General Public License for more details.
13 #
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17 #
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #
20
21 import sys
22 import salome
23
24 salome.salome_init()
25
26 import salome_notebook
27 notebook = salome_notebook.notebook
28
29 import os
30 from blocFissure import gmu
31
32
33 ###
34 ### GEOM component
35 ###
36
37 import GEOM
38 from salome.geom import geomBuilder
39 import math
40 import SALOMEDS
41
42
43 geompy = geomBuilder.New()
44
45 O = geompy.MakeVertex(0, 0, 0)
46 OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
47 OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
48 OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
49 Cylinder_1 = geompy.MakeCylinderRH(100, 300)
50 Cylinder_2 = geompy.MakeCylinderRH(600, 200)
51 Cut_1 = geompy.MakeCut(Cylinder_2, Cylinder_1)
52 Face_1 = geompy.MakeFaceHW(500, 1500, 3)
53 Disque = geompy.MakePartition([Cut_1], [Face_1], [], [], geompy.ShapeType["SOLID"], 0, [], 0)
54 [Compound_1, Compound_2, Compound_3, Compound_4] = geompy.Propagate(Disque)
55 geompy.addToStudy( O, 'O' )
56 geompy.addToStudy( OX, 'OX' )
57 geompy.addToStudy( OY, 'OY' )
58 geompy.addToStudy( OZ, 'OZ' )
59 geompy.addToStudy( Cylinder_1, 'Cylinder_1' )
60 geompy.addToStudy( Cylinder_2, 'Cylinder_2' )
61 geompy.addToStudy( Cut_1, 'Cut_1' )
62 geompy.addToStudy( Face_1, 'Face_1' )
63 geompy.addToStudy( Disque, 'Disque' )
64 geompy.addToStudyInFather( Disque, Compound_1, 'Compound_1' )
65 geompy.addToStudyInFather( Disque, Compound_2, 'Compound_2' )
66 geompy.addToStudyInFather( Disque, Compound_3, 'Compound_3' )
67 geompy.addToStudyInFather( Disque, Compound_4, 'Compound_4' )
68
69 ###
70 ### SMESH component
71 ###
72
73 import  SMESH, SALOMEDS
74 from salome.smesh import smeshBuilder
75
76 smesh = smeshBuilder.New()
77 from salome.StdMeshers import StdMeshersBuilder
78 Disque_1 = smesh.Mesh(Disque)
79 Regular_1D = Disque_1.Segment()
80 Nb_Segments_1 = Regular_1D.NumberOfSegments(10)
81 Nb_Segments_1.SetDistrType( 0 )
82 Hexa_3D = Disque_1.Hexahedron(algo=smeshBuilder.Hexa)
83 Regular_1D_1 = Disque_1.Segment(geom=Compound_3)
84 Nb_Segments_2 = Regular_1D_1.NumberOfSegments(20)
85 Nb_Segments_2.SetDistrType( 0 )
86 Regular_1D_2 = Disque_1.Segment(geom=Compound_4)
87 status = Disque_1.AddHypothesis(Nb_Segments_2,Compound_4)
88 Quadrangle_2D = Disque_1.Quadrangle(algo=smeshBuilder.QUADRANGLE)
89 isDone = Disque_1.Compute()
90 smesh.SetName(Disque_1, 'Disque')
91 Disque_1.ExportMED(os.path.join(gmu.pathBloc, "materielCasTests/disque.med"))
92 SubMesh_1 = Regular_1D_1.GetSubMesh()
93 SubMesh_2 = Regular_1D_2.GetSubMesh()
94
95 ## set object names
96 smesh.SetName(Disque_1.GetMesh(), 'Disque')
97 smesh.SetName(Regular_1D.GetAlgorithm(), 'Regular_1D')
98 smesh.SetName(Nb_Segments_1, 'Nb. Segments_1')
99 smesh.SetName(Hexa_3D.GetAlgorithm(), 'Hexa_3D')
100 smesh.SetName(Nb_Segments_2, 'Nb. Segments_2')
101 smesh.SetName(Quadrangle_2D.GetAlgorithm(), 'Quadrangle_2D')
102 smesh.SetName(SubMesh_1, 'SubMesh_1')
103 smesh.SetName(SubMesh_2, 'SubMesh_2')
104
105 if salome.sg.hasDesktop():
106   salome.sg.updateObjBrowser()