Seismic traveltime tomographic inversion has played an important role in detecting the internal structure of the solid earth. We use a set of blocks to approximate geologically complex media. The geological body is described as an aggregate of arbitrarily shaped blocks,which are separated by triangulated interfaces. We define the velocities at the given rectangle grid points for each block,and the heterogeneous velocities in each block can be calculated by a linear interpolation algorithm. We implement a segmentally iterative ray tracer(SIRT)to calculate traveltimes in the 3D heterogeneous block models. The simulated annealing method is employed in seismic traveltime inversion of 3D velocity model. Numerical tests indicate the effectiveness of our methods of ray tracing and traveltime inversion.