ボロノイ ポリゴン フィーチャの作成

'ArcGIS 3D Analystが必要
Priavte Sub AAA()
    Dim pMxDocument As IMxDocument
    Set pMxDocument = ThisDocument
    
    Dim pTinLayer As ITinLayer
    Set pTinLayer = pMxDocument.FocusMap.Layer(1)
    
    Dim pTinNodeCollection As ITinNodeCollection
    Set pTinNodeCollection = pTinLayer.Dataset

    Dim pClipLayer  As IFeatureLayer
    Set pClipLayer = pMxDocument.FocusMap.Layer(2)
    
    Dim pPolygon As IPolygon
    Set pPolygon = pClipLayer.FeatureClass.GetFeature(1).Shape
    
    Dim pResultLayer As IFeatureLayer
    Set pResultLayer = pMxDocument.FocusMap.Layer(3)
    
    Dim pResultFeatureClass As IFeatureClass
    Set pResultFeatureClass = pResultLayer.FeatureClass
    
    pTinNodeCollection.ConvertToVoronoiRegions pResultFeatureClass, Nothing, pPolygon, "", ""
    
    MsgBox "処理が終了しました。"
    
    pMxDocument.ActiveView.Refresh
  
End Sub