2008-03-07 12:47:05 +05:00
|
|
|
/*!
|
|
|
|
|
|
|
|
\page tui_viewing_meshes_page Viewing Meshes
|
|
|
|
|
|
|
|
<br>
|
|
|
|
\anchor tui_viewing_mesh_infos
|
|
|
|
<h2>Viewing Mesh Infos</h2>
|
|
|
|
|
|
|
|
\code
|
|
|
|
import geompy
|
|
|
|
import smesh
|
2009-11-06 15:29:17 +05:00
|
|
|
import SMESH
|
2008-03-07 12:47:05 +05:00
|
|
|
|
|
|
|
# create a box
|
|
|
|
box = geompy.MakeBox(0., 0., 0., 20., 20., 20.)
|
|
|
|
geompy.addToStudy(box, "box")
|
|
|
|
|
|
|
|
# create a mesh
|
|
|
|
tetra = smesh.Mesh(box, "MeshBox")
|
|
|
|
|
|
|
|
algo1D = tetra.Segment()
|
|
|
|
algo1D.NumberOfSegments(3)
|
|
|
|
|
|
|
|
algo2D = tetra.Triangle()
|
|
|
|
algo2D.MaxElementArea(10.)
|
|
|
|
|
|
|
|
algo3D = tetra.Tetrahedron(smesh.NETGEN)
|
|
|
|
algo3D.MaxElementVolume(900.)
|
|
|
|
|
|
|
|
# compute the mesh
|
|
|
|
tetra.Compute()
|
|
|
|
|
|
|
|
# print information about the mesh
|
|
|
|
print "Information about mesh:"
|
|
|
|
print "Number of nodes : ", tetra.NbNodes()
|
|
|
|
print "Number of edges : ", tetra.NbEdges()
|
|
|
|
print "Number of faces : ", tetra.NbFaces()
|
|
|
|
print " triangles : ", tetra.NbTriangles()
|
|
|
|
print " quadrangles : ", tetra.NbQuadrangles()
|
|
|
|
print " polygons : ", tetra.NbPolygons()
|
|
|
|
print "Number of volumes : ", tetra.NbVolumes()
|
|
|
|
print " tetrahedrons: ", tetra.NbTetras()
|
|
|
|
print " hexahedrons : ", tetra.NbHexas()
|
|
|
|
print " prisms : ", tetra.NbPrisms()
|
|
|
|
print " pyramids : ", tetra.NbPyramids()
|
|
|
|
print " polyhedrons : ", tetra.NbPolyhedrons()
|
2009-11-06 15:29:17 +05:00
|
|
|
|
|
|
|
# Get Information About Mesh by GetMeshInfo
|
|
|
|
print "\nInformation about mesh by GetMeshInfo:"
|
|
|
|
info = smesh.GetMeshInfo(tetra)
|
|
|
|
for i in info:
|
|
|
|
print " %s : %d" % ( i, info[i] )
|
|
|
|
pass
|
|
|
|
|
|
|
|
# Creation of group
|
|
|
|
group = tetra.CreateEmptyGroup( SMESH.FACE, 'Group' )
|
|
|
|
nbAdd = group.Add( [ 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76 ] )
|
|
|
|
|
|
|
|
# Get Information About Group by GetMeshInfo
|
|
|
|
print "\nInformation about group by GetMeshInfo:"
|
|
|
|
info = smesh.GetMeshInfo(group)
|
|
|
|
for i in info:
|
|
|
|
print " %s : %d" % ( i, info[i] )
|
|
|
|
pass
|
|
|
|
|
|
|
|
# Creation of SubMesh
|
|
|
|
Regular_1D_1_1 = tetra.Segment(geom=Face)
|
|
|
|
Nb_Segments_1 = Regular_1D_1_1.NumberOfSegments(5)
|
|
|
|
Nb_Segments_1.SetDistrType( 0 )
|
|
|
|
Quadrangle_2D = tetra.Quadrangle(geom=Face)
|
|
|
|
isDone = tetra.Compute()
|
|
|
|
submesh = Regular_1D_1_1.GetSubMesh()
|
|
|
|
|
|
|
|
# Get Information About SubMesh by GetMeshInfo
|
|
|
|
print "\nInformation about Submesh by GetMeshInfo:"
|
|
|
|
info = smesh.GetMeshInfo(submesh)
|
|
|
|
for i in info:
|
|
|
|
print " %s : %d" % ( i, info[i] )
|
|
|
|
pass
|
|
|
|
|
2008-03-07 12:47:05 +05:00
|
|
|
\endcode
|
|
|
|
*/
|