X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=doc%2Fsalome%2Fexamples%2F3dmesh.py;h=47383fee949f4dd77b97f7b85292073caff4e7e3;hp=57a1440e0c554951fd92a49147ae2d8e8bb94216;hb=e8173b4ff130ddb26d165c92403ef847fdfb8be2;hpb=a17b36970bc61da1d664453c615754997c925b18 diff --git a/doc/salome/examples/3dmesh.py b/doc/salome/examples/3dmesh.py index 57a1440e0..47383fee9 100644 --- a/doc/salome/examples/3dmesh.py +++ b/doc/salome/examples/3dmesh.py @@ -1,4 +1,4 @@ -# 3d mesh generation +# 3d mesh generation and mesh exploration import salome salome.salome_init() @@ -76,3 +76,29 @@ tetra.Compute() # Create a mesh group of all triangles generated on geom faces present in faces_group group = tetra.Group(faces_group) + +### +# Explore the mesh +### + +# Retrieve coordinates of nodes +coordStr = "" +for node in tetra.GetNodesId(): + x,y,z = tetra.GetNodeXYZ( node ) + coordStr += "%s (%s, %s, %s) " % ( node, x,y,z ) + pass + +# Retrieve nodal connectivity of triangles +triaStr = "" +for tria in tetra.GetElementsByType( SMESH.FACE ): + nodes = tetra.GetElemNodes( tria ) + triaStr += "%s (%s, %s, %s) " % ( tria, nodes[0], nodes[1], nodes[2] ) + +# Retrieve group contents +groupStr = "" +for group in tetra.GetGroups(): + ids = group.GetIDs() + name = group.GetName() + eType = group.GetType() + groupStr += "'%s' %s: %s \n" % ( name, eType, ids ) +