7 from salome.geom import geomBuilder
8 geompy = geomBuilder.New()
10 import SMESH, SALOMEDS
11 from salome.smesh import smeshBuilder
12 smesh = smeshBuilder.New()
15 box = geompy.MakeBoxDXDYDZ(200, 200, 200)
17 mesh = smesh.Mesh( box )
18 mesh.Segment().AutomaticLength(0.1)
22 # find node at (0,0,0) which is located on a geom vertex
24 for vId in geompy.SubShapeAllIDs( box, geompy.ShapeType["VERTEX"]):
26 nodeIds = mesh.GetSubMeshNodesId( vId, True )
28 xyz = mesh.GetNodeXYZ( node )
29 if xyz[0] == 0 and xyz[1] == 0 and xyz[2] == 0 :
36 raise Exception("node000 not found")
38 # find node000 using a dedicated function
39 n = mesh.FindNodeClosestTo( -1,-1,-1 )
41 raise Exception("FindNodeClosestTo() returns " + str( n ) + " != " + str( node000 ))
43 # move node000 to a new location
45 n = mesh.MoveNode( n,x,y,z )
47 raise Exception("MoveNode() returns " + n)
49 # check the coordinates of the node000
50 xyz = mesh.GetNodeXYZ( node000 )
51 if not ( xyz[0] == x and xyz[1] == y and xyz[2] == z) :
52 raise Exception("Wrong coordinates: " + str( xyz ) + " != " + str( [x,y,z] ))