There is a template script: operator_modal_view3d_raycast.py That show how use the ray_cast() to find the the coordinates of hit face. But I want to measure the distance of the opposite face from the hit face. The depth of the object from the 3d view.
You can use mathutils.geometry.intersect_ray_tri to check any intersections with object triangles.
You can use the raycast method and then again with normals inverted to get the opposite face