From 67bf00baefd1b4b15bf06cc30ef56c7c6f532399 Mon Sep 17 00:00:00 2001 From: sln Date: Fri, 28 Nov 2008 09:13:07 +0000 Subject: [PATCH] 0019939: EDF 762 SMESH : Definition of groups from other existing groups. Script for creating group of underlying entities added Scripts for boolean operations updated with new method calls --- .../gui/SMESH/input/tui_grouping_elements.doc | 77 ++++++++++++++++--- 1 file changed, 65 insertions(+), 12 deletions(-) diff --git a/doc/salome/gui/SMESH/input/tui_grouping_elements.doc b/doc/salome/gui/SMESH/input/tui_grouping_elements.doc index 8b9f6391c..e03433f1c 100644 --- a/doc/salome/gui/SMESH/input/tui_grouping_elements.doc +++ b/doc/salome/gui/SMESH/input/tui_grouping_elements.doc @@ -123,8 +123,8 @@ salome.sg.updateObjBrowser(1) \image html editing_groups2.png
-\anchor tui_union_of_two_groups -

Union of two groups

+\anchor tui_union_of_groups +

Union of groups

\code import SMESH_mechanic @@ -141,7 +141,7 @@ 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 = mesh.CreateEmptyGroup(smesh.FACE, "Area > 20") aGroup1.Add(anIds) # Criterion : AREA = 20 @@ -157,8 +157,9 @@ aGroup2 = mesh.CreateEmptyGroup( smesh.FACE, "Area = 20" ) aGroup2.Add(anIds) # create union group : area >= 20 -aGroup3 = mesh.UnionGroups(aGroup1, aGroup2, "Area >= 20") +aGroup3 = mesh.UnionListOfGroups([aGroup1, aGroup2], "Area >= 20") print "Criterion: Area >= 20, Nb = ", len(aGroup3.GetListOfID()) +# Please note that also there is UnionGroups() method which works with two groups only # Criterion : AREA < 20 aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_LessThan, 20.) @@ -172,7 +173,7 @@ 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") +aGroup5 = mesh.UnionListOfGroups([aGroup3, aGroup4], "Any Area") print "Criterion: Any Area, Nb = ", len(aGroup5.GetListOfID()) salome.sg.updateObjBrowser(1) @@ -185,8 +186,8 @@ salome.sg.updateObjBrowser(1) \image html union_groups3.png
-\anchor tui_intersection_of_two_groups -

Intersection of two groups

+\anchor tui_intersection_of_groups +

Intersection of groups

\code import SMESH_mechanic @@ -203,7 +204,7 @@ 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 = mesh.CreateEmptyGroup(smesh.FACE, "Area > 20") aGroup1.Add(anIds) # Criterion : AREA < 60 @@ -214,12 +215,13 @@ 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 = 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") +aGroup3 = mesh.IntersectListOfGroups([aGroup1, aGroup2], "20 < Area < 60") print "Criterion: 20 < Area < 60, Nb = ", len(aGroup3.GetListOfID()) +# Please note that also there is IntersectGroups() method which works with two groups only salome.sg.updateObjBrowser(1) \endcode @@ -231,8 +233,8 @@ salome.sg.updateObjBrowser(1) \image html intersect_groups3.png
-\anchor tui_cut_of_two_groups -

Cut of two groups

+\anchor tui_cut_of_groups +

Cut of groups

\code import SMESH_mechanic @@ -264,6 +266,7 @@ 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()) +# Please note that also there is CutListOfGroups() method which works with lists of groups of any lengths salome.sg.updateObjBrowser(1) \endcode @@ -274,4 +277,54 @@ salome.sg.updateObjBrowser(1) \image html cut_groups3.png +
+\anchor tui_create_dim_group +

Creating groups of entities from existing groups of superior dimensions

+ +\code +import SMESH_mechanic + +smesh = SMESH_mechanic.smesh +mesh = SMESH_mechanic.mesh +salome = SMESH_mechanic.salome + +# Criterion : AREA > 100 +aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, 100.) + +anIds = mesh.GetIdsFromFilter(aFilter) + +print "Criterion: Area > 100, Nb = ", len(anIds) + +# create a group by adding elements with area > 100 +aSrcGroup1 = mesh.MakeGroupByIds("Area > 100", smesh.FACE, anIds) + +# Criterion : AREA < 30 +aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_LessThan, 30.) + +anIds = mesh.GetIdsFromFilter(aFilter) + +print "Criterion: Area < 30, Nb = ", len(anIds) + +# create a group by adding elements with area < 30 +aSrcGroup2 = mesh.MakeGroupByIds("Area < 30", smesh.FACE, anIds) + +# Create group of edges using source groups of faces +aGrp = mesh.CreateDimGroup( [aSrcGroup1, aSrcGroup2], smesh.EDGE, "Edges" ) + +# Create group of nodes using source groups of faces +aGrp = mesh.CreateDimGroup( [aSrcGroup1, aSrcGroup2], smesh.NODE, "Nodes" ) + +salome.sg.updateObjBrowser(1) +\endcode + +\image html dimgroup_tui1.png +
Source groups of faces<\center> + +\image html dimgroup_tui2.png +
Result groups of edges and nodes<\center> + + + + + */ \ No newline at end of file