This document is archived and information here might be outdated.  Recommended version.


Creating a TIN (ArcObjects .NET 10.6 SDK)
ArcObjects Help for .NET developers > Developing with ArcGIS > Learning ArcObjects > ArcGIS extensions > 3D Analyst > Analysis in 3D > Creating a TIN (ArcObjects .NET 10.6 SDK)

Creating a TIN


About creating a TIN

The following code example shows how to create a triangulated irregular network (TIN), add data to the TIN, then save the TIN to disk:
The CreateTIN geoprocessing tool can be used for this task. Consider using it instead of the ArcObjects application programming interface (API).
A TIN is created in memory without the need for a target workspace. While this code example includes instructions for writing a TIN to disk, TINs can be created and used without being saved. This means TINs can be used as efficient, memory-based data structures for analysis, in addition to providing a means for persisting surface information.
[C#]
// Instantiate a new empty TIN.
ITinEdit TinEdit=new TinClass();

// Initialize the TIN with an envelope. The envelope's extent should be set large enough to 
// encompass all the data that will be added to the TIN. The envelope's spatial reference, if
// if has one, will be used as the TIN's spatial reference. If it is not set, as in this case,
// the TIN's spatial reference will be unknown.
IEnvelope Env=new EnvelopeClass();
Env.PutCoords(0, 0, 10, 10);
TinEdit.InitNew(Env);

// Add points to the TIN. These will become triangle nodes.
IPoint Point=new PointClass();
Point.X=2;
Point.Y=2;
Point.Z=0;
TinEdit.AddPointZ(Point, 0);

Point.Y=7;
TinEdit.AddPointZ(Point, 0);

Point.X=7;
TinEdit.AddPointZ(Point, 0);

// Save the TIN to disk. The overwrite parameter is used to indicate whether an existing
// TIN with the same name is allowed to be replaced with this one.
object overwrite=true;
TinEdit.SaveAs("c:\\data\\my_tin", ref overwrite);
[VB.NET]
' Instantiate a new empty TIN.
Dim TinEdit As ITinEdit=New TinClass()

' Initialize the TIN with an envelope. The envelope's extent should be set large enough to
' encompass all the data that will be added to the TIN. The envelope's spatial reference, if
' if has one, will be used as the TIN's spatial reference. If it is not set, as in this case,
' the TIN's spatial reference will be unknown.
Dim Env As IEnvelope=New EnvelopeClass()
Env.PutCoords(0, 0, 10, 10)
TinEdit.InitNew(Env)

' Add points to the TIN. These will become triangle nodes.
Dim Point As IPoint=New PointClass()
Point.X=2
Point.Y=2
Point.Z=0
TinEdit.AddPointZ(Point, 0)

Point.Y=7
TinEdit.AddPointZ(Point, 0)

Point.X=7
TinEdit.AddPointZ(Point, 0)

' Save the TIN to disk. The overwrite parameter is used to indicate whether an existing
' TIN with the same name is allowed to be replaced with this one.
Dim overwrite As Object=True
TinEdit.SaveAs("c:\data\my_tin", overwrite)






To use the code in this topic, reference the following assemblies in your Visual Studio project. In the code files, you will need using (C#) or Imports (VB .NET) directives for the corresponding namespaces (given in parenthesis below if different from the assembly name):
Development licensing Deployment licensing
Engine Developer Kit Engine: 3D Analyst
ArcGIS Desktop Basic: 3D Analyst ArcGIS Desktop Basic: 3D Analyst
ArcGIS Desktop Standard: 3D Analyst ArcGIS Desktop Standard: 3D Analyst
ArcGIS Desktop Advanced: 3D Analyst ArcGIS Desktop Advanced: 3D Analyst