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.4.2516.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
CopyC#
1
2
3
4
5[CommandMethod("CreateFromDEM")]
6public void CreateFromDEM()
7{
8 using (Transaction ts = Application.DocumentManager.MdiActiveDocument.Database.TransactionManager.StartTransaction())
9 {
10
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
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
24 editor.WriteMessage("Import failed: {0}", e.Message);
25 }
26
27
28 ts.Commit();
29 }
30}
Exceptions
Exception | Condition |
---|
System..::..ArgumentException |
Thrown when:
- The DEMFileName is empty.
- The styleId is invalid or its type is not Autodesk.Civil.DatabaseServices.Styles.SurfaceStyle.
|
Autodesk.Civil..::..SurfaceException |
Thrown when the create operation fails.
|
See Also