SurfaceDefinitionDEMFiles.AddDEMFile() allows us to add DEM data to a Civil 3D Surface. This function has few overloaded method. In this example we will explore the simplest one of using a DEM file to create a TIN Surface in AutoCAD Civil 3D. Here is the relevant C# .NET code snippet :
try
{
// Select a Surface style to use
ObjectId styleId = civilDoc.Styles.SurfaceStyles[0];
// Create an empty TIN Surface
ObjectId surfaceId = TinSurface.Create("DEM_Surface", styleId);
TinSurface surface = trans.GetObject(surfaceId, OpenMode.ForWrite) as TinSurface;
// Path of the DEM file
String demFilePath = @"C:\Civil3D_Data\DEMs\Munich.dem";
surface.DEMFilesDefinition.AddDEMFile(demFilePath);
surface.Description = "Created from DEM File";
trans.Commit();
}