Salome HOME
Move "SpherePadding plugin user's guide" to a dedicated sub-page and add it to Help...
[modules/smesh.git] / doc / salome / gui / SMESH / input / tui_grouping_elements.doc
index 8b9f6391cf0ebb605672267459b9a8bedf944051..535c47640697a323290b0493fdb79f8f559e5b0f 100644 (file)
 
 \page tui_grouping_elements_page Grouping Elements
 
-<br>
-\anchor tui_create_standalone_group
-<h2>Create a Standalone Group</h2>
-
-\code
-import SMESH_mechanic
-
-smesh  = SMESH_mechanic.smesh
-mesh   = SMESH_mechanic.mesh
-salome = SMESH_mechanic.salome
-
-# Get ids of all faces with area > 100 
-aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, 100.)
-
-anIds = mesh.GetIdsFromFilter(aFilter) 
+\tableofcontents
 
-# create a group consisting of faces with area > 100
-aGroup = mesh.MakeGroupByIds("Area > 100", smesh.FACE, anIds)
-
-salome.sg.updateObjBrowser(1)
-\endcode
+<br>
+\section tui_create_standalone_group Create a Standalone Group
+\tui_script{grouping_elements_ex01.py}
 
 \image html create_group.png
 
 <br>
-\anchor tui_create_group_on_geometry
-<h2>Create a Group on Geometry</h2>
-
-\code
-import salome
-import geompy
-import smesh
-
-# create a box
-box = geompy.MakeBox(0., 0., 0., 100., 100., 100.)
-geompy.addToStudy(box, "box")
-
-# add the first face of the box to the study
-subShapeList = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
-face = subShapeList[0]
-geompy.addToStudyInFather(box, face, "face 1") 
-
-# create group of edges on the face
-aGeomGroupE = geompy.CreateGroup(face, geompy.ShapeType["EDGE"])
-geompy.AddObject(aGeomGroupE, 3)
-geompy.AddObject(aGeomGroupE, 6)
-geompy.AddObject(aGeomGroupE, 8)
-geompy.AddObject(aGeomGroupE, 10)
-geompy.addToStudyInFather(face, aGeomGroupE, "Group of Edges")
-
-# create quadrangle 2D mesh on the box
-quadra = smesh.Mesh(box, "Box : quadrangle 2D mesh")
-algo1D = quadra.Segment()
-quadra.Quadrangle()
-algo1D.NumberOfSegments(7) 
-
-# compute the mesh
-quadra.Compute()
-
-# create SMESH group on the face with name "SMESHGroup1"
-aSmeshGroup1 = quadra.GroupOnGeom(face, "SMESHGroup1")
-
-# create SMESH group on <aGeomGroupE> with default name
-aSmeshGroup2 = quadra.GroupOnGeom(aGeomGroupE) 
-
-salome.sg.updateObjBrowser(1)
-\endcode
+\section tui_create_group_on_geometry Create a Group on Geometry
+\tui_script{grouping_elements_ex02.py}
 
 <br>
-\anchor tui_edit_group
-<h2>Edit a Group</h2>
-
-\code
-import SMESH_mechanic
-
-smesh  = SMESH_mechanic.smesh
-mesh   = SMESH_mechanic.mesh
-salome = SMESH_mechanic.salome
+\section tui_create_group_on_filter Create a Group on Filter
+\tui_script{grouping_elements_ex03.py}
 
-# Get ids of all faces with area > 35
-aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, 35.)
-
-anIds = mesh.GetIdsFromFilter(aFilter) 
-
-print "Criterion: Area > 35, Nb = ", len(anIds)
-
-# create a group by adding elements with area > 35
-aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Area > 35")
-aGroup.Add(anIds) 
-
-# Get ids of all faces with area > 40
-aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, 40.)
-
-anIds = mesh.GetIdsFromFilter(aFilter)
-
-print "Criterion: Area > 40, Nb = ", len(anIds) 
-
-# create a group of elements with area [35; 40] by removing elements with area > 40 from group aGroup
-aGroup.Remove(anIds) 
-
-# print the result
-aGroupElemIDs = aGroup.GetListOfID()
-
-print "Criterion: 35 < Area < 40, Nb = ", len(aGroupElemIDs)
-
-j = 1
-for i in range(len(aGroupElemIDs)):
-  if j > 20: j = 1; print ""
-  print aGroupElemIDs[i],
-  j = j + 1
-  pass
-print ""
-
-salome.sg.updateObjBrowser(1)
-\endcode
+<br>
+\section tui_edit_group Edit a Group
+\tui_script{grouping_elements_ex04.py}
 
 \image html editing_groups1.png
 
 \image html editing_groups2.png
 
 <br>
-\anchor tui_union_of_two_groups
-<h2>Union of two groups</h2>
-
-\code
-import SMESH_mechanic
-
-smesh  = SMESH_mechanic.smesh
-mesh   = SMESH_mechanic.mesh
-salome = SMESH_mechanic.salome
-
-# Criterion : AREA > 20
-aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, 20.)
-
-anIds = mesh.GetIdsFromFilter(aFilter)
-
-print "Criterion: Area > 20, Nb = ", len( anIds ) 
-
-# create a group by adding elements with area > 20
-aGroup1 = mesh.CreateEmptyGroup(SMESH.FACE, "Area > 20")
-aGroup1.Add(anIds)
-
-# Criterion : AREA = 20
-aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_EqualTo, 20.)
-
-anIds = mesh.GetIdsFromFilter(aFilter)
-
-print "Criterion: Area = 20, Nb = ", len( anIds ) 
-
-# create a group by adding elements with area = 20
-aGroup2 = mesh.CreateEmptyGroup( smesh.FACE, "Area = 20" )
-
-aGroup2.Add(anIds)
-
-# create union group : area >= 20
-aGroup3 = mesh.UnionGroups(aGroup1, aGroup2, "Area >= 20")
-print "Criterion: Area >= 20, Nb = ", len(aGroup3.GetListOfID())
-
-# Criterion : AREA < 20
-aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_LessThan, 20.)
-
-anIds = mesh.GetIdsFromFilter(aFilter)
-
-print "Criterion: Area < 20, Nb = ", len(anIds)
-
-# create a group by adding elements with area < 20
-aGroup4 = mesh.CreateEmptyGroup(smesh.FACE, "Area < 20")
-aGroup4.Add(anIds)
-
-# create union group : area >= 20 and area < 20
-aGroup5 = mesh.UnionGroups(aGroup3, aGroup4, "Any Area")
-print "Criterion: Any Area, Nb = ", len(aGroup5.GetListOfID())
-
-salome.sg.updateObjBrowser(1)
-\endcode
+\section tui_union_of_groups Union of groups
+\tui_script{grouping_elements_ex05.py}
 
 \image html union_groups1.png
 
@@ -185,44 +37,8 @@ salome.sg.updateObjBrowser(1)
 \image html union_groups3.png
 
 <br>
-\anchor tui_intersection_of_two_groups
-<h2>Intersection of two groups</h2>
-
-\code
-import SMESH_mechanic
-
-smesh  = SMESH_mechanic.smesh
-mesh   = SMESH_mechanic.mesh
-salome = SMESH_mechanic.salome
-
-# Criterion : AREA > 20
-aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, 20.)
-
-anIds = mesh.GetIdsFromFilter(aFilter)
-
-print "Criterion: Area > 20, Nb = ", len(anIds) 
-
-# create a group by adding elements with area > 20
-aGroup1 = mesh.CreateEmptyGroup(SMESH.FACE, "Area > 20")
-aGroup1.Add(anIds)
-
-# Criterion : AREA < 60
-aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_LessThan, 60.)
-
-anIds = mesh.GetIdsFromFilter(aFilter)
-
-print "Criterion: Area < 60, Nb = ", len(anIds) 
-
-# create a group by adding elements with area < 60
-aGroup2 = mesh.CreateEmptyGroup(SMESH.FACE, "Area < 60")
-aGroup2.Add(anIds)
-
-# create an intersection of groups : 20 < area < 60
-aGroup3 = mesh.IntersectGroups(aGroup1, aGroup2, "20 < Area < 60")
-print "Criterion: 20 < Area < 60, Nb = ", len(aGroup3.GetListOfID())
-
-salome.sg.updateObjBrowser(1)
-\endcode
+\section tui_intersection_of_groups Intersection of groups
+\tui_script{grouping_elements_ex06.py}
 
 \image html intersect_groups1.png
 
@@ -231,47 +47,27 @@ salome.sg.updateObjBrowser(1)
 \image html intersect_groups3.png
 
 <br>
-\anchor tui_cut_of_two_groups
-<h2>Cut of two groups</h2>
-
-\code
-import SMESH_mechanic
-
-smesh  = SMESH_mechanic.smesh
-mesh   = SMESH_mechanic.mesh
-salome = SMESH_mechanic.salome
-
-# Criterion : AREA > 20
-aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, 20.)
+\section tui_cut_of_groups Cut of groups
+\tui_script{grouping_elements_ex07.py}
 
-anIds = mesh.GetIdsFromFilter(aFilter)
-
-print "Criterion: Area > 20, Nb = ", len(anIds) 
+\image html cut_groups1.png
 
-# create a group by adding elements with area > 20
-aGroupMain = mesh.MakeGroupByIds("Area > 20", smesh.FACE, anIds)
+\image html cut_groups2.png
 
-# Criterion : AREA < 60
-aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_LessThan, 60.)
+\image html cut_groups3.png
 
-anIds = mesh.GetIdsFromFilter(aFilter)
+<br>
+\section tui_create_dim_group Creating groups of entities from existing groups of superior dimensions
+\tui_script{grouping_elements_ex08.py}
 
-print "Criterion: Area < 60, Nb = ", len(anIds) 
+\image html dimgroup_tui1.png
+<center>Source groups of faces</center>
 
-# create a group by adding elements with area < 60
-aGroupTool = mesh.MakeGroupByIds("Area < 60", smesh.FACE, anIds)
-# create a cut of groups : area >= 60
-aGroupRes = mesh.CutGroups(aGroupMain, aGroupTool, "Area >= 60")
-print "Criterion: Area >= 60, Nb = ", len(aGroupRes.GetListOfID())
+\image html dimgroup_tui2.png
+<center>Result groups of edges and nodes</center>
 
-salome.sg.updateObjBrowser(1)
-\endcode
 
-\image html cut_groups1.png
 
-\image html cut_groups2.png
 
-\image html cut_groups3.png
 
-*/
\ No newline at end of file
+*/