-hyp1=gen.CreateHypothesis("NumberOfSegments")
-hypNbSeg=hyp1._narrow(SMESH.SMESH_NumberOfSegments)
-hypNbSeg.SetNumberOfSegments(numberOfSegments)
-hypNbSegID = hypNbSeg.GetId()
-print hypNbSeg.GetName()
-print hypNbSegID
-print hypNbSeg.GetNumberOfSegments()
-
-idseg = smeshgui.AddNewHypothesis( salome.orb.object_to_string(hypNbSeg) )
-smeshgui.SetName(idseg, "NumberOfSegments")
-
-# ---- create Algorithms
-
-print "-------------------------- create Algorithms"
-
-print "-------------------------- Regular_1D"
-
-hypothesis=gen.CreateHypothesis("Regular_1D")
-regular1D = hypothesis._narrow(SMESH.SMESH_Regular_1D)
-regularID = smeshgui.AddNewAlgorithms( salome.orb.object_to_string(regular1D) )
-smeshgui.SetName(regularID, "Wire Discretisation")
-
-print "-------------------------- Quadrangle_2D"
-
-hypothesis=gen.CreateHypothesis("Quadrangle_2D")
-quad2D = hypothesis._narrow(SMESH.SMESH_Quadrangle_2D)
-quadID = smeshgui.AddNewAlgorithms( salome.orb.object_to_string(quad2D) )
-smeshgui.SetName(quadID, "Quadrangle_2D")
-
-print "-------------------------- Hexa_3D"
-
-hypothesis=gen.CreateHypothesis("Hexa_3D")
-hexa3D = hypothesis._narrow(SMESH.SMESH_Hexa_3D)
-hexaID = smeshgui.AddNewAlgorithms( salome.orb.object_to_string(hexa3D) )
-smeshgui.SetName(hexaID, "Hexa_3D")
-
-# ---- init a Mesh with the compshell
-
-mesh=gen.Init(idcomp)
-idmesh = smeshgui.AddNewMesh( salome.orb.object_to_string(mesh) )
-smeshgui.SetName(idmesh, "MeshcompShel")
-smeshgui.SetShape(idcomp, idmesh)
-
-# ---- add hypothesis to compshell
-
-print "-------------------------- add hypothesis to compshell"
+regular1D = mesh.Segment()
+regular1D.SetName("Wire Discretisation")
+hypNbSeg = regular1D.NumberOfSegments(numberOfSegments)
+print(hypNbSeg.GetName())
+print(hypNbSeg.GetId())
+print(hypNbSeg.GetNumberOfSegments())
+smesh.SetName(hypNbSeg, "NumberOfSegments_" + str(numberOfSegments))