X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=doc%2Fsalome%2Fexamples%2Fmodifying_meshes_ex15.py;h=2656ea300bc2d625d2cb0ca2cc4ccfece26793ca;hb=refs%2Ftags%2FV9_1_0;hp=ae6d5eae77087c1052a026c7ef894f9730e712c8;hpb=54182913fbb9df65a3f4cc96f55db3618835ecd8;p=modules%2Fsmesh.git diff --git a/doc/salome/examples/modifying_meshes_ex15.py b/doc/salome/examples/modifying_meshes_ex15.py index ae6d5eae7..2656ea300 100644 --- a/doc/salome/examples/modifying_meshes_ex15.py +++ b/doc/salome/examples/modifying_meshes_ex15.py @@ -3,14 +3,13 @@ import salome salome.salome_init() -import GEOM + from salome.geom import geomBuilder -geompy = geomBuilder.New(salome.myStudy) +geompy = geomBuilder.New() import SMESH, SALOMEDS from salome.smesh import smeshBuilder -smesh = smeshBuilder.New(salome.myStudy) -import salome_notebook +smesh = smeshBuilder.New() box = geompy.MakeBoxDXDYDZ(200, 200, 200) @@ -20,7 +19,7 @@ mesh.Segment().AutomaticLength(0.1) mesh.Quadrangle() mesh.Compute() -# find node at (0,0,0) +# find node at (0,0,0) which is located on a geom vertex node000 = None for vId in geompy.SubShapeAllIDs( box, geompy.ShapeType["VERTEX"]): if node000: break @@ -34,20 +33,20 @@ for vId in geompy.SubShapeAllIDs( box, geompy.ShapeType["VERTEX"]): pass if not node000: - raise "node000 not found" + raise Exception("node000 not found") -# find node000 using the tested function +# find node000 using a dedicated function n = mesh.FindNodeClosestTo( -1,-1,-1 ) if not n == node000: - raise "FindNodeClosestTo() returns " + str( n ) + " != " + str( node000 ) + raise Exception("FindNodeClosestTo() returns " + str( n ) + " != " + str( node000 )) # move node000 to a new location x,y,z = -10, -10, -10 n = mesh.MoveNode( n,x,y,z ) if not n: - raise "MoveNode() returns " + n + raise Exception("MoveNode() returns " + n) # check the coordinates of the node000 xyz = mesh.GetNodeXYZ( node000 ) if not ( xyz[0] == x and xyz[1] == y and xyz[2] == z) : - raise "Wrong coordinates: " + str( xyz ) + " != " + str( [x,y,z] ) + raise Exception("Wrong coordinates: " + str( xyz ) + " != " + str( [x,y,z] ))