using Autodesk.AutoCAD.Interop; //autocad 安装目录
using Autodesk.AutoCAD.Interop.Common;
namespace DWGT
{
internal class Program
{
static void Main(string[] args)
{
var path = @"rac_basic_sample_project.dwg";
var app = new AcadApplication();
var dd = app.Documents.Open(path,true);
var ms = dd.ModelSpace;
var c1 = ms.Count;
for (int i = 0; i < c1; i++)
{
var it = ms.Item(i);
if(it.EntityName == "AcDbMText")
{
var tt = it as AcadMText;
Console.WriteLine(tt.TextString);
//Console.WriteLine(tt.);
}
Console.WriteLine(it.EntityName);
}
dd.Close();
Console.WriteLine("Hello, World!");
app.Quit();
}
}
}