SketchUp Camera to Blender Camera Script

I posted a related question yesterday concerning SketchUp’s Photo Match function.

My outstanding issue seems to be:

How is it possible to convert a SketchUp camera to a Blender camera?

The sketchup api http://code.google.com/apis/sketchup/docs/developers_guide/classes/Sketchup/Camera.htmlprovides access to camera object, and now my only problem is translating it to Blender.

Here’s my code so far, but when I punch it into Blender it’s not quite right.

Note: the text output is only for reference!


  # Get camera position
  eye = camera.eye
  vx = eye.x
  vy = eye.y
  vz = eye.z

  # Get camera direction
  direction = camera.direction
  dx = direction.x
  dy = direction.y
  dz = direction.z

  rx = Math.atan2(dy,dz).radians
  rz = Math.atan2(dy,dx).radians
  ry = Math.atan2(dz,dx).radians

  # Write camera details to script 
  camscript.puts("loc x:" + vx.to_s)
  camscript.puts("loc y:" + vy.to_s)
  camscript.puts("loc z:" + vz.to_s)
  
  camscript.puts("rot x:" + rx.to_s)
  camscript.puts("rot y:" + ry.to_s)
  camscript.puts("rot z:" + rz.to_s)

Bit stuck!

Thanks.