-hypMaxElementVolume = gen.CreateHypothesis( "MaxElementVolume" )
-hypVolume = hypMaxElementVolume._narrow( SMESH.SMESH_MaxElementVolume )
-hypVolume.SetMaxElementVolume(maxElementVolume)
-print hypVolume.GetName()
-print hypVolume.GetId()
-print hypVolume.GetMaxElementVolume()
-
-idVolume = smeshgui.AddNewHypothesis( salome.orb.object_to_string(hypVolume) )
-smeshgui.SetName(idVolume, "MaxElementArea")
-
-print "-------------------------- Regular_1D"
-
-alg1D = gen.CreateHypothesis( "Regular_1D" )
-algo1D = alg1D._narrow( SMESH.SMESH_Algo )
-listHyp =algo1D.GetCompatibleHypothesis()
-for hyp in listHyp:
- print hyp
-algoReg1D = alg1D._narrow( SMESH.SMESH_Regular_1D )
-print algoReg1D.GetName()
-print algoReg1D.GetId()
-
-idReg1D = smeshgui.AddNewAlgorithms( salome.orb.object_to_string(algoReg1D) )
-smeshgui.SetName( idReg1D, "Regular_1D" )
-
-print "-------------------------- MEFISTO_2D"
-
-alg2D = gen.CreateHypothesis( "MEFISTO_2D" )
-algo2D = alg2D._narrow( SMESH.SMESH_Algo )
-listHyp = algo2D.GetCompatibleHypothesis()
-for hyp in listHyp:
- print hyp
-algoMef = alg2D._narrow( SMESH.SMESH_MEFISTO_2D )
-print algoMef.GetName()
-print algoMef.GetId()
-
-idMef = smeshgui.AddNewAlgorithms( salome.orb.object_to_string(algoMef) )
-smeshgui.SetName( idMef, "MEFISTO_2D" )
-
-print "-------------------------- NETGEN_3D"
-
-alg3D = gen.CreateHypothesis( "NETGEN_3D" )
-algo3D = alg3D._narrow( SMESH.SMESH_Algo )
-listHyp = algo3D.GetCompatibleHypothesis()
-for hyp in listHyp:
- print hyp
-algoNg = alg3D._narrow( SMESH.SMESH_NETGEN_3D )
-print algoNg.GetName()
-print algoNg.GetId()
-
-idNg = smeshgui.AddNewAlgorithms( salome.orb.object_to_string(algoNg) )
-smeshgui.SetName( idNg, "NETGEN_2D" )
-
-print "-------------------------- add hypothesis to main mechanic"
-
-shape_mesh = salome.IDToObject( idMechanic )
-submesh = mesh.GetElementsOnShape( shape_mesh )
-
-ret = mesh.AddHypothesis( shape_mesh, algoReg1D ) # Regular 1D/wire discretisation
-print ret
-ret = mesh.AddHypothesis( shape_mesh, algoMef ) # MEFISTO 2D
-print ret
-ret = mesh.AddHypothesis( shape_mesh, algoNg ) # NETGEN 3D
-print ret
-ret = mesh.AddHypothesis( shape_mesh, hypNbSeg ) # nb segments
-print ret
-ret = mesh.AddHypothesis( shape_mesh, hypArea ) # max area
-print ret
-ret = mesh.AddHypothesis( shape_mesh, hypVolume ) # max volume
-print ret
-
-smeshgui.SetAlgorithms( idmesh, idReg1D ); # Regular 1D/wire discretisation
-smeshgui.SetAlgorithms( idmesh, idMef ); # MEFISTO 2D
-smeshgui.SetAlgorithms( idmesh, idNg ); # NETGEN 3D
-smeshgui.SetHypothesis( idmesh, idSeg ); # nb segments
-smeshgui.SetHypothesis( idmesh, idArea ); # max area
-smeshgui.SetHypothesis( idmesh, idVolume ); # max volume
-
-sg.updateObjBrowser(1);
-
-print "-------------------------- compute the mesh of the mechanic piece"
-ret=gen.Compute(mesh,idMechanic)
-print ret
-log=mesh.GetLog(0) # no erase trace
-for linelog in log:
- print linelog
-
-sg.updateObjBrowser(1)
+algo3 = mesh.Tetrahedron(smeshBuilder.NETGEN)
+hypVolume = algo3.MaxElementVolume(maxElementVolume)
+print(hypVolume.GetName())
+print(hypVolume.GetId())
+print(hypVolume.GetMaxElementVolume())
+smesh.SetName(hypVolume, "maxElementVolume_" + str(maxElementVolume))
+
+
+print("-------------------------- compute the mesh of the mechanic piece")
+mesh.Compute()
+
+print("Information about the Mesh_mechanic_tetra:")
+print("Number of nodes : ", mesh.NbNodes())
+print("Number of edges : ", mesh.NbEdges())
+print("Number of faces : ", mesh.NbFaces())
+print("Number of triangles : ", mesh.NbTriangles())
+print("Number of quadrangles: ", mesh.NbQuadrangles())
+print("Number of volumes : ", mesh.NbVolumes())
+print("Number of tetrahedrons: ", mesh.NbTetras())
+
+salome.sg.updateObjBrowser()