4 salome.salome_init_without_session()
6 from salome.geom import geomBuilder
7 from salome.smesh import smeshBuilder
9 geom_builder = geomBuilder.New()
10 smesh_builder = smeshBuilder.New()
12 box = geom_builder.MakeBoxDXDYDZ(200, 200, 200)
14 mesh = smesh_builder.Mesh( box )
15 mesh.Segment().AutomaticLength(0.1)
17 if not mesh.Compute(): raise Exception("Error when computing Mesh")
19 # find node at (0,0,0) which is located on a geom vertex
21 for vId in geom_builder.SubShapeAllIDs( box, geom_builder.ShapeType["VERTEX"]):
23 nodeIds = mesh.GetSubMeshNodesId( vId, True )
25 xyz = mesh.GetNodeXYZ( node )
26 if xyz[0] == 0 and xyz[1] == 0 and xyz[2] == 0 :
33 raise Exception("node000 not found")
35 # find node000 using a dedicated function
36 n = mesh.FindNodeClosestTo( -1,-1,-1 )
38 raise Exception("FindNodeClosestTo() returns " + str( n ) + " != " + str( node000 ))
40 # move node000 to a new location
42 n = mesh.MoveNode( n,x,y,z )
44 raise Exception("MoveNode() returns " + n)
46 # check the coordinates of the node000
47 xyz = mesh.GetNodeXYZ( node000 )
48 if not ( xyz[0] == x and xyz[1] == y and xyz[2] == z) :
49 raise Exception("Wrong coordinates: " + str( xyz ) + " != " + str( [x,y,z] ))