Salome HOME
correct previous integration (Porting to Python 2.6)
[modules/smesh.git] / src / SMESH_SWIG / SMESH_controls.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 #  File   : SMESH_control.py
24 #  Author : Sergey LITONIN
25 #  Module : SMESH
26 #
27 import smesh
28 import SMESH_mechanic
29
30 salome = smesh.salome
31 mesh   = SMESH_mechanic.mesh
32
33
34 # ---- Criterion : AREA > 100
35
36 # create group
37 aGroup = mesh.MakeGroup("Area > 100", smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, 100)
38
39 # print result
40 anIds = aGroup.GetIDs()
41 print "Criterion: Area > 100 Nb = ", len( anIds )
42 #for i in range( len( anIds ) ):
43   #print anIds[ i ]
44
45
46 # ----  Criterion : Taper > 3e-15
47
48 # create group
49 aGroup = mesh.MakeGroup("Taper > 3e-15", smesh.FACE, smesh.FT_Taper, smesh.FT_MoreThan, 3e-15)
50
51 # print result
52 anIds = aGroup.GetIDs()
53 print "Criterion: Taper > 3e-15 Nb = ", len( anIds )
54 #for i in range( len( anIds ) ):
55   #print anIds[ i ]
56
57
58 # ----  Criterion : ASPECT RATIO > 1.3
59
60 # create group
61 aGroup = mesh.MakeGroup("Aspect Ratio > 1.3", smesh.FACE, smesh.FT_AspectRatio, smesh.FT_MoreThan, 1.3)
62
63 # print result
64 anIds = aGroup.GetIDs()
65 print "Criterion: Aspect Ratio > 1.3 Nb = ", len( anIds )
66 #for i in range( len( anIds ) ):
67   #print anIds[ i ]
68
69
70 # ----  Criterion : MINIMUM ANGLE < 30
71
72 # create group
73 aGroup = mesh.MakeGroup("Minimum Angle < 30", smesh.FACE, smesh.FT_MinimumAngle, smesh.FT_LessThan, 30)
74
75 # print result
76 anIds = aGroup.GetIDs()
77 print "Criterion: Minimum Angle < 30 Nb = ", len( anIds )
78 #for i in range( len( anIds ) ):
79   #print anIds[ i ]
80
81
82 # ---- Criterion : Warp > 2e-13
83
84 # create group
85 aGroup = mesh.MakeGroup("Warp > 2e-13", smesh.FACE, smesh.FT_Warping, smesh.FT_MoreThan, 2e-13 )
86
87 # print result
88 anIds = aGroup.GetIDs()
89 print "Criterion: Warp > 2e-13 Nb = ", len( anIds )
90 #for i in range( len( anIds ) ):
91   #print anIds[ i ]
92
93
94 # ---- Criterion : Skew > 18
95
96 # create group
97 aGroup = mesh.MakeGroup("Skew > 18", smesh.FACE, smesh.FT_Skew, smesh.FT_MoreThan, 18 )
98
99 # print result
100 anIds = aGroup.GetIDs()
101 print "Criterion: Skew > 18 Nb = ", len( anIds )
102 #for i in range( len( anIds ) ):
103   #print anIds[ i ]
104
105
106 # Criterion : Length > 10
107
108 # create group
109 aGroup = mesh.MakeGroup("Length > 10", smesh.FACE, smesh.FT_Length, smesh.FT_MoreThan, 10 )
110
111 # print result
112 anIds = aGroup.GetIDs()
113 print "Criterion: Length > 10 Nb = ", len( anIds )
114 #for i in range( len( anIds ) ):
115   #print anIds[ i ]
116
117
118 # Criterion : Borders at multi-connections = 2
119
120 # create group
121 aGroup = mesh.MakeGroup("Borders at multi-connections = 2", smesh.EDGE, smesh.FT_MultiConnection, smesh.FT_EqualTo, 2)
122
123 # print result
124 anIds = aGroup.GetIDs()
125 print "Criterion: Borders at multi-connections = 2 Nb = ", len( anIds )
126 #for i in range( len( anIds ) ):
127   #print anIds[ i ]
128
129
130 salome.sg.updateObjBrowser(1)