テレインの断面から 3D ジオメトリを作成

Sub GetInterpolateShapeFromTerrain()
    Dim pMxDocument As IMxDocument
    Set pMxDocument = ThisDocument
    
    Dim pTerrainLayer As ITerrainLayer2
    Set pTerrainLayer = pMxDocument.FocusMap.Layer(0)
    
    Dim pTerrain As ITerrain2
    Set pTerrain = pTerrainLayer.Terrain
    
    Dim pDynamicSurface As IDynamicSurface3
    Set pDynamicSurface = pTerrain.CreateDynamicSurface
    
    
    
    Dim pEnumGeometry As IEnumGeometry
    Set pEnumGeometry = GetGraphicElements(pMxDocument.FocusMap)
    
    Dim pInputGeometry As IGeometry
    Set pInputGeometry = pEnumGeometry.Next
    
    Dim pInputCurve As ICurve
    Set pInputCurve = pInputGeometry
    
    Dim pInputCurve3D As ICurve3D
    Set pInputCurve3D = pInputGeometry
    
    Debug.Print "Input:", pInputCurve.Length
    
    Dim pOutGeometry As IGeometry
    
    
    Call pDynamicSurface.InterpolateShape(pInputGeometry, 10, esriLinearInterpolation, Nothing, pOutGeometry)
    
    
    Dim pOutCurve3D As ICurve3D
    Set pOutCurve3D = pOutGeometry
    
    Debug.Print "Output:", pOutCurve3D.Length3D

End Sub