Salome HOME
correct previous integration (Porting to Python 2.6)
[modules/smesh.git] / src / SMESH_SWIG / PAL_MESH_041_mesh.py
1 #  -*- coding: iso-8859-1 -*-
2 #  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
3 #
4 #  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
5 #  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 #
7 #  This library is free software; you can redistribute it and/or
8 #  modify it under the terms of the GNU Lesser General Public
9 #  License as published by the Free Software Foundation; either
10 #  version 2.1 of the License.
11 #
12 #  This library is distributed in the hope that it will be useful,
13 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
14 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 #  Lesser General Public License for more details.
16 #
17 #  You should have received a copy of the GNU Lesser General Public
18 #  License along with this library; if not, write to the Free Software
19 #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
20 #
21 #  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 #
23 import salome
24 import geompy
25 import smesh
26
27
28 #-----------------------------GEOM----------------------------------------
29
30 #----------Vertexes------------
31 p1 = geompy.MakeVertex(20.0,30.0,40.0)
32 p2 = geompy.MakeVertex(90.0,80.0,0.0)
33 p3 = geompy.MakeVertex(30.0,80.0,200.0)
34
35 #----------Edges---------------
36 e1 = geompy.MakeEdge(p1,p2)
37 e2 = geompy.MakeEdge(p2,p3)
38 e3 = geompy.MakeEdge(p3,p1)
39
40 #----------Wire----------------
41 ListOfEdges = []
42 ListOfEdges.append(e3)
43 ListOfEdges.append(e2)
44 ListOfEdges.append(e1)
45 wire1 = geompy.MakeWire(ListOfEdges)
46
47
48 #----------Face----------------
49 WantPlanarFace = 1
50 face1 = geompy.MakeFace(wire1,WantPlanarFace)
51
52 Id_face1 = geompy.addToStudy(face1,"Face1")
53
54
55
56 #-----------------------------SMESH-------------------------------------------
57
58
59 # -- Init mesh --
60 plane_mesh = salome.IDToObject( Id_face1)
61
62 mesh = smesh.Mesh(plane_mesh, "Mesh_1")
63
64 print"---------------------Hypothesis and Algorithms"
65
66 #---------------- NumberOfSegments
67
68 numberOfSegment = 9
69
70 algoWireDes = mesh.Segment()
71 listHyp = algoWireDes.GetCompatibleHypothesis()
72 print algoWireDes.GetName()
73 algoWireDes.SetName("Ware descritisation")
74
75 hypNbSeg = algoWireDes.NumberOfSegments(numberOfSegment)
76 print hypNbSeg.GetName()
77 print hypNbSeg.GetNumberOfSegments()
78 smesh.SetName(hypNbSeg, "Nb. Segments")
79
80
81 #--------------------------Max. Element Area
82 maxElementArea = 200
83
84 algoMef = mesh.Triangle()
85 listHyp = algoMef.GetCompatibleHypothesis()
86 print algoMef.GetName()
87 algoMef.SetName("Triangle (Mefisto)")
88
89 hypArea200 = algoMef.MaxElementArea(maxElementArea)
90 print hypArea200.GetName()
91 print hypArea200.GetMaxElementArea()
92 smesh.SetName(hypArea200, "Max. Element Area")
93
94
95 print "---------------------Compute the mesh"
96
97 ret = mesh.Compute()
98 print ret
99
100 salome.sg.updateObjBrowser(1)
101