Salome HOME
Merge branch 'V9_2_2_BR'
[modules/smesh.git] / src / Tools / blocFissure / materielCasTests / cubeAngle.py
1 # -*- coding: utf-8 -*-
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
28 import os
29 from blocFissure import gmu
30
31 ###
32 ### GEOM component
33 ###
34
35 import GEOM
36 from salome.geom import geomBuilder
37 import math
38 import SALOMEDS
39
40
41 geompy = geomBuilder.New()
42
43 O = geompy.MakeVertex(0, 0, 0)
44 OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
45 OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
46 OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
47 Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
48 Vertex_1 = geompy.MakeVertex(0, 0, 100)
49 Disk_1 = geompy.MakeDiskPntVecR(Vertex_1, OZ, 60)
50 Vertex_2 = geompy.MakeVertex(-5, -5, 90)
51 Vertex_3 = geompy.MakeVertex(65, 65, 110)
52 Box_2 = geompy.MakeBoxTwoPnt(Vertex_3, Vertex_2)
53 Common_1 = geompy.MakeCommon(Disk_1, Box_2)
54 geompy.ExportBREP(Common_1, os.path.join(gmu.pathBloc, "materielCasTests/CubeAngleFiss.brep"))
55 geompy.addToStudy( O, 'O' )
56 geompy.addToStudy( OX, 'OX' )
57 geompy.addToStudy( OY, 'OY' )
58 geompy.addToStudy( OZ, 'OZ' )
59 geompy.addToStudy( Box_1, 'Box_1' )
60 geompy.addToStudy( Vertex_1, 'Vertex_1' )
61 geompy.addToStudy( Disk_1, 'Disk_1' )
62 geompy.addToStudy( Vertex_2, 'Vertex_2' )
63 geompy.addToStudy( Vertex_3, 'Vertex_3' )
64 geompy.addToStudy( Box_2, 'Box_2' )
65 geompy.addToStudy( Common_1, 'Common_1' )
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 Mesh_1 = smesh.Mesh(Box_1)
77 Regular_1D = Mesh_1.Segment()
78 Nb_Segments_1 = Regular_1D.NumberOfSegments(15)
79 Nb_Segments_1.SetDistrType( 0 )
80 Quadrangle_2D = Mesh_1.Quadrangle(algo=smeshBuilder.QUADRANGLE)
81 Hexa_3D = Mesh_1.Hexahedron(algo=smeshBuilder.Hexa)
82 isDone = Mesh_1.Compute()
83 smesh.SetName(Mesh_1, 'Mesh_1')
84 Mesh_1.ExportMED(os.path.join(gmu.pathBloc, "materielCasTests/CubeAngle.med"))
85
86 ## set object names
87 smesh.SetName(Mesh_1.GetMesh(), 'Mesh_1')
88 smesh.SetName(Regular_1D.GetAlgorithm(), 'Regular_1D')
89 smesh.SetName(Nb_Segments_1, 'Nb. Segments_1')
90 smesh.SetName(Quadrangle_2D.GetAlgorithm(), 'Quadrangle_2D')
91 smesh.SetName(Hexa_3D.GetAlgorithm(), 'Hexa_3D')
92
93 if salome.sg.hasDesktop():
94   salome.sg.updateObjBrowser()