How to dump camera animation images


Here's a VBA macro that you can use with your ArcGlobe document. It gets the first animation track and dumps out sequential images for each of its keyframes. The assumption is that it's a camera animation track.

How to use

  1. Paste the code into ArcGlobe's VBA IDE.
  2. Run the macro either from ArcGlobe UI or from within the VBA IDE.
[VBA]
Sub AnimationImageDumping()
    
    Dim pDoc As IGMxDocument
    Set pDoc = ThisDocument
    Dim pScene As IScene
    Set pScene = pDoc.Scene
    Dim pAnimTracks As IAnimationTracks
    Set pAnimTracks = pScene
    Dim pAnimTrack As IAnimationTrack
    Set pAnimTrack = pAnimTracks.Tracks.Element(0) 'the first track
    Dim pGlobe As IGlobe
    Set pGlobe = pScene
    Dim pViewer As I3DViewer
    Set pViewer = pGlobe.GlobeDisplay.ActiveViewer
    Dim pCam As ICamera
    Set pCam = pViewer.Camera
    
    Dim i As Integer, pKeyframe As IKeyframe
    For i = 0 To pAnimTrack.KeyframeCount - 1
        Set pKeyframe = pAnimTrack.Keyframe(i)
        pKeyframe.Apply pScene, pCam
        pViewer.Redraw True
        pViewer.GetScreenShot JPEG, "D:\temp\dump" & i + 1 & ".jpg"
    Next i
    
End Sub