How to get the globe's camera


This routine when called will return the IGlobeCamera interface of the current globe's sceneviewer.

How to use

  1. Paste the code into VBA.
  2. Run the function from a calling procedure which sets the return value of GetGlobeCamera to an IGlobeCamera interface variable.
[VBA]
Public Function GetGlobeCamera() As IGlobeCamera
    ' Returns the IGlobeCamera interface of the current globe
    
    Dim pGMxDoc As IGMxDocument
    Set pGMxDoc = Application.Document
    
    Dim pScene As IScene
    Set pScene = pGMxDoc.Scene
    
    Dim pGlobe As IGlobe
    Set pGlobe = pScene
    
    Dim pGlobeDisp As IGlobeDisplay
    Set pGlobeDisp = pGlobe.GlobeDisplay
    
    Dim pViewer As ISceneViewer
    Set pViewer = pGlobeDisp.ActiveViewer
    
    Set GetGlobeCamera = pViewer.Camera
    
End Function