Creates a new instance of a TinSurface and adds it to the database that contains styleId.

Namespace: Autodesk.Civil.DatabaseServices
Assembly: AeccDbMgd (in AeccDbMgd.dll) Version: 13.4.2516.0

Syntax

C#
public static ObjectId Create(
	string surfaceName,
	ObjectId styleId
)
Visual Basic
Public Shared Function Create ( _
	surfaceName As String, _
	styleId As ObjectId _
) As ObjectId
Visual C++
public:
static ObjectId Create(
	String^ surfaceName, 
	ObjectId styleId
)

Parameters

surfaceName
Type: System..::..String
The name of the surface.
styleId
Type: ObjectId
The ObjectId of the style for the surface.

Examples

CopyC#
 1[CommandMethod("CreateFromTIN")]
 2public void CreateFromTin()
 3{
 4    using (Transaction ts = Application.DocumentManager.MdiActiveDocument.Database.TransactionManager.StartTransaction())
 5    {
 6        // Example TIN surface from Civil Tutorials:
 7        string tinFile = @"C:\Program Files\Autodesk\AutoCAD Civil 3D 2012\Help\Civil Tutorials\Corridor surface.tin";
 8        try
 9        {
10            Database db = Application.DocumentManager.MdiActiveDocument.Database;
11
12            // surface style 3 is "slope banding" in the default template
13            ObjectId surfaceStyleId = doc.Styles.SurfaceStyles[3];
14            ObjectId tinSurfaceId = TinSurface.CreateFromTin(db, tinFile);
15            editor.WriteMessage("Import succeeded: {0} \n {1}", tinSurfaceId.ToString(), db.Filename);
16        }
17        catch (System.Exception e)
18        {
19            // handle bad file path 
20            editor.WriteMessage("Import failed: {0}", e.Message);
21        }
22
23        // commit the transaction
24        ts.Commit();
25    }
26}

Exceptions

ExceptionCondition
System..::..ArgumentException Thrown when :
  1. The surfaceName is empty.
  2. The styleId is invalid or its type is not Autodesk.Civil.DatabaseServices.Styles.SurfaceStyle.

See Also