1 # -*- coding: iso-8859-1 -*-
2 # Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
4 # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
5 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
21 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
24 # File : SMESH_control.py
25 # Author : Sergey LITONIN
31 import SMESH, SALOMEDS
32 from salome.smesh import smeshBuilder
33 smesh = smeshBuilder.New()
34 mesh = SMESH_mechanic.mesh
36 # ---- Criterion : AREA > 100
39 aGroup = mesh.MakeGroup("Area > 100", SMESH.FACE, SMESH.FT_Area, SMESH.FT_MoreThan, 100)
42 anIds = aGroup.GetIDs()
43 print("Criterion: Area > 100 Nb = ", len( anIds ))
44 #for i in range( len( anIds ) ):
48 # ---- Criterion : Taper > 3e-15
51 aGroup = mesh.MakeGroup("Taper > 3e-15", SMESH.FACE, SMESH.FT_Taper, SMESH.FT_MoreThan, 3e-15)
54 anIds = aGroup.GetIDs()
55 print("Criterion: Taper > 3e-15 Nb = ", len( anIds ))
56 #for i in range( len( anIds ) ):
60 # ---- Criterion : ASPECT RATIO > 1.3
63 aGroup = mesh.MakeGroup("Aspect Ratio > 1.3", SMESH.FACE, SMESH.FT_AspectRatio, SMESH.FT_MoreThan, 1.3)
66 anIds = aGroup.GetIDs()
67 print("Criterion: Aspect Ratio > 1.3 Nb = ", len( anIds ))
68 #for i in range( len( anIds ) ):
72 # ---- Criterion : MINIMUM ANGLE < 30
75 aGroup = mesh.MakeGroup("Minimum Angle < 30", SMESH.FACE, SMESH.FT_MinimumAngle, SMESH.FT_LessThan, 30)
78 anIds = aGroup.GetIDs()
79 print("Criterion: Minimum Angle < 30 Nb = ", len( anIds ))
80 #for i in range( len( anIds ) ):
84 # ---- Criterion : Warp > 2e-13
87 aGroup = mesh.MakeGroup("Warp > 2e-13", SMESH.FACE, SMESH.FT_Warping, SMESH.FT_MoreThan, 2e-13 )
90 anIds = aGroup.GetIDs()
91 print("Criterion: Warp > 2e-13 Nb = ", len( anIds ))
92 #for i in range( len( anIds ) ):
96 # ---- Criterion : Skew > 18
99 aGroup = mesh.MakeGroup("Skew > 18", SMESH.FACE, SMESH.FT_Skew, SMESH.FT_MoreThan, 18 )
102 anIds = aGroup.GetIDs()
103 print("Criterion: Skew > 18 Nb = ", len( anIds ))
104 #for i in range( len( anIds ) ):
108 # Criterion : Length > 10
111 aGroup = mesh.MakeGroup("Length > 10", SMESH.FACE, SMESH.FT_Length, SMESH.FT_MoreThan, 10 )
114 anIds = aGroup.GetIDs()
115 print("Criterion: Length > 10 Nb = ", len( anIds ))
116 #for i in range( len( anIds ) ):
120 # Criterion : Borders at multi-connections = 2
123 aGroup = mesh.MakeGroup("Borders at multi-connections = 2", SMESH.EDGE, SMESH.FT_MultiConnection, SMESH.FT_EqualTo, 2)
126 anIds = aGroup.GetIDs()
127 print("Criterion: Borders at multi-connections = 2 Nb = ", len( anIds ))
128 #for i in range( len( anIds ) ):
132 # Criterion : Element Diameter 2D > 10
135 aGroup = mesh.MakeGroup("Element Diameter 2D > 10", SMESH.FACE, SMESH.FT_MaxElementLength2D, SMESH.FT_MoreThan, 10 )
138 anIds = aGroup.GetIDs()
139 print("Criterion: Element Diameter 2D > 10 Nb = ", len( anIds ))
140 #for i in range( len( anIds ) ):
144 salome.sg.updateObjBrowser()