TinSurface.CreateFromTin() メソッドを使用して、バイナリ .TIN ファイルから新しい TIN サーフェスを作成することができます。このメソッドは、2 つの引数を文字列として受け取ります。1 つは TIN サーフェスが追加される図面のデータベース、もう 1 つは.TIN ファイルへのパスです。
[CommandMethod("CreateFromTIN")]
public void CreateFromTin()
{
using (Transaction ts = Application.DocumentManager.MdiActiveDocument.Database.TransactionManager.StartTransaction())
{
// Example TIN surface from Civil Tutorials:
string tinFile = @"C:\Program Files\Autodesk\AutoCAD Civil 3D 2013\Help\Civil Tutorials\Corridor surface.tin";
try
{
Database db = Application.DocumentManager.MdiActiveDocument.Database;
ObjectId tinSurfaceId = TinSurface.CreateFromTin(db, tinFile);
editor.WriteMessage("Import succeeded: {0} \n {1}", tinSurfaceId.ToString(), db.Filename);
}
catch (System.Exception e)
{
// handle bad file path
editor.WriteMessage("Import failed: {0}", e.Message);
}
// commit the transaction
ts.Commit();
}
}