TinSurfaceCreate(String, ObjectId) Method

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.8.0.292
Syntax
public static ObjectId Create(
	string surfaceName,
	ObjectId styleId
)

Parameters

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

Return Value

ObjectId
Exceptions
ExceptionCondition
ArgumentException Thrown when :
  1. The surfaceName is empty.
  2. The styleId is invalid or its type is not Autodesk.Civil.DatabaseServices.Styles.SurfaceStyle.
Example
C#
 1[CommandMethod("CreateTINSurface")]
 2public void CreateTINSurface()
 3{
 4    using (Transaction ts = Application.DocumentManager.MdiActiveDocument.Database.TransactionManager.StartTransaction())
 5    {
 6        string surfaceName = "ExampleTINSurface";
 7        // Select a style to use 
 8        ObjectId surfaceStyleId = doc.Styles.SurfaceStyles[3];
 9
10        // Create the surface
11        ObjectId surfaceId = TinSurface.Create(surfaceName, surfaceStyleId);
12
13        TinSurface surface = surfaceId.GetObject(OpenMode.ForWrite) as TinSurface;
14
15        // Add some random points
16        Point3dCollection points = new Point3dCollection();
17        Random generator = new Random();
18        for (int i = 0; i < 10; i++)
19        {
20            double x = generator.NextDouble() * 250;
21            double y = generator.NextDouble() * 250;
22            double z = generator.NextDouble() * 100;
23            points.Add(new Point3d(x, y, z));
24        }
25
26        surface.AddVertices(points);
27
28        // commit the create action
29        ts.Commit();
30    }
31}
See Also