Salome HOME
Join modifications from BR_Dev_For_4_0 tag V4_1_1.
[modules/smesh.git] / src / SMESH_SWIG / PAL_MESH_041_mesh.py
1 #  Copyright (C) 2005  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 #  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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 import salome
21 import geompy
22 import smesh
23
24
25 #-----------------------------GEOM----------------------------------------
26
27 #----------Vertexes------------
28 p1 = geompy.MakeVertex(20.0,30.0,40.0)
29 p2 = geompy.MakeVertex(90.0,80.0,0.0)
30 p3 = geompy.MakeVertex(30.0,80.0,200.0)
31
32 #----------Edges---------------
33 e1 = geompy.MakeEdge(p1,p2)
34 e2 = geompy.MakeEdge(p2,p3)
35 e3 = geompy.MakeEdge(p3,p1)
36
37 #----------Wire----------------
38 ListOfEdges = []
39 ListOfEdges.append(e3)
40 ListOfEdges.append(e2)
41 ListOfEdges.append(e1)
42 wire1 = geompy.MakeWire(ListOfEdges)
43
44
45 #----------Face----------------
46 WantPlanarFace = 1
47 face1 = geompy.MakeFace(wire1,WantPlanarFace)
48
49 Id_face1 = geompy.addToStudy(face1,"Face1")
50
51
52
53 #-----------------------------SMESH-------------------------------------------
54
55
56 # -- Init mesh --
57 plane_mesh = salome.IDToObject( Id_face1)
58
59 mesh = smesh.Mesh(plane_mesh, "Mesh_1")
60
61 print"---------------------Hypothesis and Algorithms"
62
63 #---------------- NumberOfSegments
64
65 numberOfSegment = 9
66
67 algoWireDes = mesh.Segment()
68 listHyp = algoWireDes.GetCompatibleHypothesis()
69 print algoWireDes.GetName()
70 algoWireDes.SetName("Ware descritisation")
71
72 hypNbSeg = algoWireDes.NumberOfSegments(numberOfSegment)
73 print hypNbSeg.GetName()
74 print hypNbSeg.GetNumberOfSegments()
75 smesh.SetName(hypNbSeg, "Nb. Segments")
76
77
78 #--------------------------Max. Element Area
79 maxElementArea = 200
80
81 algoMef = mesh.Triangle()
82 listHyp = algoMef.GetCompatibleHypothesis()
83 print algoMef.GetName()
84 algoMef.SetName("Triangle (Mefisto)")
85
86 hypArea200 = algoMef.MaxElementArea(maxElementArea)
87 print hypArea200.GetName()
88 print hypArea200.GetMaxElementArea()
89 smesh.SetName(hypArea200, "Max. Element Area")
90
91
92 print "---------------------Compute the mesh"
93
94 ret = mesh.Compute()
95 print ret
96
97 salome.sg.updateObjBrowser(1)
98