Salome HOME
b57138a1c5aa3ba04bd2f1891a6c0eecd4b439a3
[modules/smesh.git] / src / SMESH_SWIG / SMESH_box.py
1 #  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 #
3 #  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 #  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 #
6 #  This library is free software; you can redistribute it and/or
7 #  modify it under the terms of the GNU Lesser General Public
8 #  License as published by the Free Software Foundation; either
9 #  version 2.1 of the License.
10 #
11 #  This library is distributed in the hope that it will be useful,
12 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 #  Lesser General Public License for more details.
15 #
16 #  You should have received a copy of the GNU Lesser General Public
17 #  License along with this library; if not, write to the Free Software
18 #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 #
20 #  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 #
22 #==============================================================================
23 #  Info.
24 #  Bug (from script, bug)   : box.py, PAL5223
25 #  Modified                 : 25/11/2004
26 #  Author                   : Kovaltchuk Alexey
27 #  Project                  : PAL/SALOME
28 #==============================================================================
29 # Salome geometry and meshing for a box
30 #
31 import salome
32 from salome import sg
33 import geompy
34 import smesh
35
36
37 # ---- launch GEOM
38
39 geom          = salome.lcc.FindOrLoadComponent("FactoryServer", "GEOM")
40
41 ###geom.GetCurrentStudy(salome.myStudy._get_StudyId())
42
43 # Plate
44
45 box    = geompy.MakeBox(0.,0.,0.,1.,1.,1.)
46 boxId  = geompy.addToStudy(box,"box")
47
48 # ---- SMESH
49
50 # ---- init a Mesh
51
52 box_mesh=smesh.Mesh(box, "box_mesh")
53
54 # set Hypothesis and Algorithm
55
56 alg1D = box_mesh.Segment()
57 alg1D.SetName("algo1D")
58 hypL1 = alg1D.LocalLength(0.25)
59 smesh.SetName(hypL1, "LocalLength")
60     
61 alg2D = box_mesh.Quadrangle()
62 alg2D.SetName("algo2D")
63
64 alg3D = box_mesh.Hexahedron()
65 alg3D.SetName("algo3D")
66
67 # compute mesh
68
69 box_mesh.Compute()
70
71 sg.updateObjBrowser(1)