空の TIN サーフェスを作成し、TinSurface.Create() メソッドを使用してドキュメントのサーフェス コレクションに追加することができます。このメソッドは 2 つのオーバーロードを備えています。1 つは適用する SurfaceStyle を指定するオーバーロード、もう 1 つは既定のスタイルを使用するオーバーロードです。
次の例では、指定したスタイルで新しい TIN サーフェスを作成し、次にいくつかのランダム ポイント データを追加します。
[CommandMethod("CreateTINSurface")] public void CreateTINSurface() { using (Transaction ts = Application.DocumentManager.MdiActiveDocument.Database.TransactionManager.StartTransaction()) { string surfaceName = "ExampleTINSurface"; // Select a style to use ObjectId surfaceStyleId = doc.Styles.SurfaceStyles[3]; // Create the surface ObjectId surfaceId = TinSurface.Create(surfaceName, surfaceStyleId); TinSurface surface = surfaceId.GetObject(OpenMode.ForWrite) as TinSurface; // Add some random points Point3dCollection points = new Point3dCollection(); Random generator = new Random(); for (int i = 0; i < 10; i++) { double x = generator.NextDouble() * 250; double y = generator.NextDouble() * 250; double z = generator.NextDouble() * 100; points.Add(new Point3d(x, y, z)); } surface.AddVertices(points); // commit the create action ts.Commit(); } }