What I use quite often is the following function to read an ascii vtk file, process the points and write it again to a new file.
def offsetVTK(infilename, outfilename, offset):
outfil = open(outfilename,'w')
with open(infilename,'r') as infil:
lin = 1
while lin:
lin = infil.readline()
if lin.lower().startswith('points'):
numpt = int(lin.split()[1])
outfil.write(lin)
for i in xrange(numpt):
outfil.write('{0[0]} {0[1]} {0[2]}\n'.format(
np.array(infil.readline().split(),dtype=float) + offset))
else:
outfil.write(lin)
outfil.close()
offsetVTK('ray.vtk','ray_off.vtk', np.array([100,0,0]))
Originally, I used it to rotate and shear the grid, however applying an offset is even easier.