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