Salome HOME
Porting to Python 2.6 - add coding page specification for Python scripts
[modules/smesh.git] / src / SMESH_SWIG / SMESH_controls.py
1 #! /usr/bin/python
2 #  -*- coding: iso-8859-1 -*-
3 #  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
4 #
5 #  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
6 #  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
7 #
8 #  This library is free software; you can redistribute it and/or
9 #  modify it under the terms of the GNU Lesser General Public
10 #  License as published by the Free Software Foundation; either
11 #  version 2.1 of the License.
12 #
13 #  This library is distributed in the hope that it will be useful,
14 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
15 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16 #  Lesser General Public License for more details.
17 #
18 #  You should have received a copy of the GNU Lesser General Public
19 #  License along with this library; if not, write to the Free Software
20 #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
21 #
22 #  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 #
24 #  File   : SMESH_control.py
25 #  Author : Sergey LITONIN
26 #  Module : SMESH
27 #
28 import smesh
29 import SMESH_mechanic
30
31 salome = smesh.salome
32 mesh   = SMESH_mechanic.mesh
33
34
35 # ---- Criterion : AREA > 100
36
37 # create group
38 aGroup = mesh.MakeGroup("Area > 100", smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, 100)
39
40 # print result
41 anIds = aGroup.GetIDs()
42 print "Criterion: Area > 100 Nb = ", len( anIds )
43 #for i in range( len( anIds ) ):
44   #print anIds[ i ]
45
46
47 # ----  Criterion : Taper > 3e-15
48
49 # create group
50 aGroup = mesh.MakeGroup("Taper > 3e-15", smesh.FACE, smesh.FT_Taper, smesh.FT_MoreThan, 3e-15)
51
52 # print result
53 anIds = aGroup.GetIDs()
54 print "Criterion: Taper > 3e-15 Nb = ", len( anIds )
55 #for i in range( len( anIds ) ):
56   #print anIds[ i ]
57
58
59 # ----  Criterion : ASPECT RATIO > 1.3
60
61 # create group
62 aGroup = mesh.MakeGroup("Aspect Ratio > 1.3", smesh.FACE, smesh.FT_AspectRatio, smesh.FT_MoreThan, 1.3)
63
64 # print result
65 anIds = aGroup.GetIDs()
66 print "Criterion: Aspect Ratio > 1.3 Nb = ", len( anIds )
67 #for i in range( len( anIds ) ):
68   #print anIds[ i ]
69
70
71 # ----  Criterion : MINIMUM ANGLE < 30
72
73 # create group
74 aGroup = mesh.MakeGroup("Minimum Angle < 30", smesh.FACE, smesh.FT_MinimumAngle, smesh.FT_LessThan, 30)
75
76 # print result
77 anIds = aGroup.GetIDs()
78 print "Criterion: Minimum Angle < 30 Nb = ", len( anIds )
79 #for i in range( len( anIds ) ):
80   #print anIds[ i ]
81
82
83 # ---- Criterion : Warp > 2e-13
84
85 # create group
86 aGroup = mesh.MakeGroup("Warp > 2e-13", smesh.FACE, smesh.FT_Warping, smesh.FT_MoreThan, 2e-13 )
87
88 # print result
89 anIds = aGroup.GetIDs()
90 print "Criterion: Warp > 2e-13 Nb = ", len( anIds )
91 #for i in range( len( anIds ) ):
92   #print anIds[ i ]
93
94
95 # ---- Criterion : Skew > 18
96
97 # create group
98 aGroup = mesh.MakeGroup("Skew > 18", smesh.FACE, smesh.FT_Skew, smesh.FT_MoreThan, 18 )
99
100 # print result
101 anIds = aGroup.GetIDs()
102 print "Criterion: Skew > 18 Nb = ", len( anIds )
103 #for i in range( len( anIds ) ):
104   #print anIds[ i ]
105
106
107 # Criterion : Length > 10
108
109 # create group
110 aGroup = mesh.MakeGroup("Length > 10", smesh.FACE, smesh.FT_Length, smesh.FT_MoreThan, 10 )
111
112 # print result
113 anIds = aGroup.GetIDs()
114 print "Criterion: Length > 10 Nb = ", len( anIds )
115 #for i in range( len( anIds ) ):
116   #print anIds[ i ]
117
118
119 # Criterion : Borders at multi-connections = 2
120
121 # create group
122 aGroup = mesh.MakeGroup("Borders at multi-connections = 2", smesh.EDGE, smesh.FT_MultiConnection, smesh.FT_EqualTo, 2)
123
124 # print result
125 anIds = aGroup.GetIDs()
126 print "Criterion: Borders at multi-connections = 2 Nb = ", len( anIds )
127 #for i in range( len( anIds ) ):
128   #print anIds[ i ]
129
130
131 salome.sg.updateObjBrowser(1)