标签:des style blog http io ar color os sp
调用Navisworks的 Api . 我这里是基于.NET 开发的.
我主要是尝试着获取一下工程量的API。不过还在研究。
插件的启动入口. //插件描述 [PluginAttribute("BJYTTakeOff","ADSK",DisplayName = "工程量查看")] public class AddinActvitor : AddInPlugin { //执行 public override int Execute(params string[] parameters) { FrmTakeOff takeOff=new FrmTakeOff(); takeOff.ShowDialog(); return 0; } }
try { //获取工程量对象 if (Autodesk.Navisworks.Api.Application.MainDocument != null) { DocumentTakeoff docTakeoff = Autodesk.Navisworks.Api.Application.MainDocument.GetTakeoff(); //获取条目表 // ItemTable table = docTakeoff.Items; //开始数据库操作 if (docTakeoff != null) { using (NavisworksCommand cmd = docTakeoff.Database.Value.CreateCommand()) { //SQL句法 // TK_ITEM是条目表在数据库中的名字 cmd.CommandText = "SELECT ID,Parent,Name FROM TK_ITEM"; //读取数据库 DataTable dt = new DataTable(); NavisworksDataAdapter sdAdapter = new NavisworksDataAdapter(cmd); sdAdapter.Fill(dt); if (dt.Rows.Count > 0) { treeList1.DataSource = dt; } } } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); }
标签:des style blog http io ar color os sp
原文地址:http://www.cnblogs.com/w2011/p/4150726.html