Salome HOME
[PY3] 2to3 results
[modules/smesh.git] / src / SMESH_SWIG / SMESH_Nut.py
index 3e27b57ce9bf61c20ce2c6b4cd44cf97a7a10fa3..32330467488ad838552751907e79e7749f17d05d 100755 (executable)
@@ -40,36 +40,36 @@ import os
 import math
 
 #Sketcher_1 creation
-print "Sketcher creation..."
+print("Sketcher creation...")
 Sketcher_1 = geompy.MakeSketcher("Sketcher:F 100 -57.7:TT 100 57.7:TT 0 115.47:TT -100 57.7:TT -100 -57.7:TT 0 -115.47:WW") 
 geompy.addToStudy(Sketcher_1, "Sketcher_1")
 Face_1 = geompy.MakeFace(Sketcher_1, 1)
 geompy.addToStudy(Face_1, "Face_1")
 
 #Line creation
-print "Line  creation..."
+print("Line  creation...")
 Line_1 = geompy.MakeLineTwoPnt(geompy.MakeVertex(0,0,0), geompy.MakeVertex(0,0,100))
 geompy.addToStudy(Line_1, "Line_1")
 
 #Prism creation
-print "Prism creation..."
+print("Prism creation...")
 Prism_1 = geompy.MakePrismVecH(Face_1, Line_1, 100)
 geompy.addToStudy(Prism_1, "Prism_1")
 
 #Sketcher_2 creation
-print "Sketcher creation..."
+print("Sketcher creation...")
 Sketcher_2 = geompy.MakeSketcher("Sketcher:F 50 0:TT 80 0:TT 112 13:TT 112 48:TT 80 63:TT 80 90:TT 50 90:WW", [0,0,0, 1,0,0, 0,1,0]) 
 geompy.addToStudy(Sketcher_2, "Sketcher_2")
 Face_2 = geompy.MakeFace(Sketcher_2, 1)
 geompy.addToStudy(Face_2, "Face_2")
 
 #Revolution creation
-print "Revolution creation..."
+print("Revolution creation...")
 Revolution_1 = geompy.MakeRevolution(Face_2, Line_1, 2*math.pi)
 geompy.addToStudy(Revolution_1, "Revolution_1")
 
 #Common applying
-print "Common of Revolution and Prism..."
+print("Common of Revolution and Prism...")
 Common_1 = geompy.MakeBoolean(Revolution_1, Prism_1, 1)
 geompy.addToStudy(Common_1, "Common_1")
 
@@ -80,12 +80,12 @@ for i in range(0, len(CommonExplodedListEdges)):
     geompy.addToStudyInFather(Common_1, CommonExplodedListEdges[i], name)
 
 #Fillet applying
-print "Fillet creation..."
+print("Fillet creation...")
 Fillet_1 = geompy.MakeFillet(Common_1, 10, geompy.ShapeType["EDGE"], [5])
 geompy.addToStudy(Fillet_1, "Fillet_1")
 
 #Chamfer applying
-print "Chamfer creation..."
+print("Chamfer creation...")
 cyl_face = geompy.GetFaceNearPoint( Fillet_1, geompy.MakeVertex( 50, 0, 45 ), theName='cyl_face')
 cyl_face_id = geompy.GetSubShapeID( Fillet_1, cyl_face )
 top_face = geompy.GetFaceNearPoint( Fillet_1, geompy.MakeVertex( 60, 0, 90 ), theName='top_face')
@@ -99,14 +99,14 @@ top_face_id = geompy.GetSubShapeID( Chamfer_1, top_face )
 Chamfer_2 = geompy.MakeChamferEdge(Chamfer_1, 10, 10, cyl_face_id, top_face_id, theName='Chamfer_2' )
 
 #Import of the shape from "slots.brep"
-print "Import multi-rotation from the DATA_DIR/Shapes/Brep/slots.brep"
+print("Import multi-rotation from the DATA_DIR/Shapes/Brep/slots.brep")
 thePath = os.getenv("DATA_DIR")
 theFileName = os.path.join( thePath,"Shapes","Brep","slots.brep")
 theShapeForCut = geompy.ImportBREP(theFileName)
 geompy.addToStudy(theShapeForCut, "slot.brep_1")
 
 #Cut applying
-print "Cut..."
+print("Cut...")
 Cut_1 = geompy.MakeBoolean(Chamfer_2, theShapeForCut, 2)
 Cut_1_ID = geompy.addToStudy(Cut_1, "Cut_1")
 
@@ -118,44 +118,44 @@ shape_mesh = salome.IDToObject( Cut_1_ID )
 mesh = smesh.Mesh(shape_mesh, "Nut")
 
 #HYPOTHESIS CREATION
-print "-------------------------- Average length"
+print("-------------------------- Average length")
 theAverageLength = 5
 algoReg1D = mesh.Segment()
 hAvLength = algoReg1D.LocalLength(theAverageLength)
-print hAvLength.GetName()
-print hAvLength.GetId()
-print hAvLength.GetLength()
+print(hAvLength.GetName())
+print(hAvLength.GetId())
+print(hAvLength.GetLength())
 smesh.SetName(hAvLength, "AverageLength_"+str(theAverageLength))
 
-print "-------------------------- MaxElementArea"
+print("-------------------------- MaxElementArea")
 theMaxElementArea = 20
 algoMef = mesh.Triangle(smeshBuilder.MEFISTO)
 hArea = algoMef.MaxElementArea( theMaxElementArea )
-print hArea.GetName()
-print hArea.GetId()
-print hArea.GetMaxElementArea()
+print(hArea.GetName())
+print(hArea.GetId())
+print(hArea.GetMaxElementArea())
 smesh.SetName(hArea, "MaxElementArea_"+str(theMaxElementArea))
 
-print "-------------------------- MaxElementVolume"
+print("-------------------------- MaxElementVolume")
 theMaxElementVolume = 150
 algoNg = mesh.Tetrahedron(smeshBuilder.NETGEN)
 hVolume = algoNg.MaxElementVolume( theMaxElementVolume )
-print hVolume.GetName()
-print hVolume.GetId()
-print hVolume.GetMaxElementVolume()
+print(hVolume.GetName())
+print(hVolume.GetId())
+print(hVolume.GetMaxElementVolume())
 smesh.SetName(hVolume, "MaxElementVolume_"+str(theMaxElementVolume))
 
 
-print "-------------------------- compute the mesh of the mechanic piece"
+print("-------------------------- compute the mesh of the mechanic piece")
 mesh.Compute()
 
-print "Information about the Nut:"
-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()
+print("Information about the Nut:")
+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(True)