Creates a new instance of a GridSurface from a DEM file and adds it to the database that contains styleId.
Namespace: Autodesk.Civil.DatabaseServicesAssembly: AeccDbMgd (in AeccDbMgd.dll) Version: 13.3.1717.0
Syntax
C#
public static ObjectId CreateFromDEM( string DEMFileName, ObjectId styleId )
Visual Basic
Public Shared Function CreateFromDEM ( _ DEMFileName As String, _ styleId As ObjectId _ ) As ObjectId
Visual C++
public: static ObjectId CreateFromDEM( String^ DEMFileName, ObjectId styleId )
Parameters
- DEMFileName
- Type: System.String
The path of the DEM file.
- styleId
- Type: ObjectId
The ObjectId of the SurfaceStyle for the GridSurface.
Examples

1/// <summary> 2/// Creates a new surface from a DEM file. 3/// </summary> 4/// <remarks></remarks> 5[CommandMethod("CreateFromDEM")] 6public void CreateFromDEM() 7{ 8 using (Transaction ts = Application.DocumentManager.MdiActiveDocument.Database.TransactionManager.StartTransaction()) 9 { 10 // Prompt user for a DEM file: 11 PromptFileNameResult demResult = editor.GetFileNameForOpen("Enter the path and name of the DEM file to import:"); 12 editor.WriteMessage("Importing: {0}", demResult.StringResult); 13 14 try 15 { 16 // surface style #3 is "slope banding" in the default template 17 ObjectId surfaceStyleId = doc.Styles.SurfaceStyles[3]; 18 ObjectId gridSurfaceId = GridSurface.CreateFromDEM(demResult.StringResult, surfaceStyleId); 19 editor.WriteMessage("Import succeeded: {0} \n", gridSurfaceId.ToString()); 20 } 21 catch (System.Exception e) 22 { 23 // handle bad file data or other errors 24 editor.WriteMessage("Import failed: {0}", e.Message); 25 } 26 27 // commit the transaction 28 ts.Commit(); 29 } 30}
Exceptions
Exception | Condition |
---|---|
System.ArgumentException |
Thrown when:
|
Autodesk.Civil.SurfaceException | Thrown when the create operation fails. |