HOW TO
This article contains a code sample that shows how to add a tin to ArcMap using VBA and ArcObjects
Note:
Code in ThisDocument code module will only run in the current map document. To store the code in all map documents, open the code in the Normal.mxt ThisDocument code module.
Code:
Sub AddATin()
Dim pMxDoc As IMxDocument
Dim pMap As IMap
Dim pLayer As ITinLayer
Dim pWSF As IWorkspaceFactory
Dim pWS As ITinWorkspace
Dim pTin As ITin
Dim pDataset As IDataset
'Open the tin workspace
Set pMxDoc = ThisDocument
Set pMap = pMxDoc.FocusMap
Set pWSF = New TinWorkspaceFactory
Set pWS = pWSF.OpenFromFile("c:\testdata\tin", 0)
Set pTin = pWS.OpenTin("testtin")
'Add the tin to ArcMap
Set pLayer = New TinLayer
Set pLayer.Dataset = pTin
Set pDataset = pTin
pLayer.Name = pDataset.Name 'Name layer to match dataset
pMap.AddLayer pLayer 'Add the tin layer to the map.
End Sub
Article ID:000004976
Get help from ArcGIS experts
Download the Esri Support App