X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=doc%2Fsalome%2Fexamples%2Fgrouping_elements_ex01.py;h=0bb1b9a2f9321571a12c41620dbfe5995773017d;hb=67312ab966a7c21fe835917978028643ffadd99e;hp=013332766144e40577810032d3cf215f79bf48c4;hpb=54182913fbb9df65a3f4cc96f55db3618835ecd8;p=modules%2Fsmesh.git diff --git a/doc/salome/examples/grouping_elements_ex01.py b/doc/salome/examples/grouping_elements_ex01.py index 013332766..0bb1b9a2f 100644 --- a/doc/salome/examples/grouping_elements_ex01.py +++ b/doc/salome/examples/grouping_elements_ex01.py @@ -19,4 +19,62 @@ aGroup1 = mesh.MakeGroupByIds("Area > 100", SMESH.FACE, anIds) aGroup2 = mesh.CreateEmptyGroup(SMESH.NODE, "all nodes") aGroup2.AddFrom(mesh.mesh) -salome.sg.updateObjBrowser(1) + +# ==================================== +# Various methods of the Group object +# ==================================== + +aGroup = mesh.CreateEmptyGroup(SMESH.NODE, "aGroup") + +# set/get group name +aGroup.SetName( "new name" ) +print "name", aGroup.GetName() + +# get group type (type of entities in the group, SMESH.NODE in our case) +print "type", aGroup.GetType() + +# get number of entities (nodes in our case) in the group +print "size", aGroup.Size() + +# check of emptiness +print "is empty", aGroup.IsEmpty() + +# check of presence of an entity in the group +aGroup.Add([1,2]) # Add() method is specific to the standalone group +print "contains node 2", aGroup.Contains(2) + +# get an entity by index +print "1st node", aGroup.GetID(1) + +# get all entities +print "all", aGroup.GetIDs() + +# get number of nodes (actual for groups of elements) +print "nb nodes", aGroup.GetNumberOfNodes() + +# get underlying nodes (actual for groups of elements) +print "nodes", aGroup.GetNodeIDs() + +# set/get color +import SALOMEDS +aGroup.SetColor( SALOMEDS.Color(1.,1.,0.)); +print "color", aGroup.GetColor() + +# ---------------------------------------------------------------------------- +# methods specific to the standalone group and not present in GroupOnGeometry +# and GroupOnFilter +# ---------------------------------------------------------------------------- + +# clear the group's contents +aGroup.Clear() + +# add contents of other object (group, sub-mesh, filter) +aGroup.AddFrom( aGroup2 ) + +# removes entities +aGroup.Remove( [2,3,4] ) + + + + +salome.sg.updateObjBrowser(True)