Placed inside ArcScene's VBA, this routine will return an IEnumLayer interface containing pointers to all the layers in the scene.
How to use
- Paste the code into ArcScene's VB Editor.
- Run the function from a calling procedure which sets the return value of GetSceneLayers to an IEnumLayer interface variable.
Public Function GetSceneLayers() As IEnumLayer
Dim pCurrentApp As IApplication
Dim pBasicMap As IBasicMap
Set pCurrentApp = Application
If TypeOf pCurrentApp Is ISxApplication Then
Dim pSxDoc As ISxDocument
Set pSxDoc = pCurrentApp.Document
Set pBasicMap = pSxDoc.Scene
Else
Exit Function
End If
If pBasicMap.layerCount = 0 Then
Set GetSceneLayers = Nothing
Else
Set GetSceneLayers = pBasicMap.Layers
End If
End Function