Viewing Meshes

Viewing Mesh Infos

import geompy

import smesh

 

# 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 informations about the mesh

mesh = tetra.GetMesh()

print "Information about mesh:"

print "Number of nodes       : ", mesh.NbNodes()

print "Number of edges       : ", mesh.NbEdges()

print "Number of faces       : ", mesh.NbFaces()

print "          triangles   : ", mesh.NbTriangles()

print "          quadrangles : ", mesh.NbQuadrangles()

print "          polygons    : ", mesh.NbPolygons()

print "Number of volumes     : ", mesh.NbVolumes()

print "          tetrahedrons: ", mesh.NbTetras()

print "          hexahedrons : ", mesh.NbHexas()

print "          prisms      : ", mesh.NbPrisms()

print "          pyramids    : ", mesh.NbPyramids()

print "          polyhedrons : ", mesh.NbPolyhedrons()