天为DMIS 发表于 2007-3-28 14:14:00

如何用C#.NET读取DWG文件的明细栏和标题栏?

希望能够在将DWG文件导入程序时,同时读取DWG文件中明细栏和标题栏中的信息,从而自动将产品结构信息读取到系统中,不知道怎么实现?各位大侠帮忙指点一下!

tomali 发表于 2007-4-12 15:51:00

我也想知道!

tomali 发表于 2007-4-16 11:41:00

很想知道阿!现在还不知道怎么获取块的属性呢!

boatying 发表于 2007-5-16 19:02:00

mark

sieben 发表于 2007-5-16 20:33:00

<p>using app = Autodesk.AutoCAD.ApplicationServices.Application;</p><p>&nbsp;&nbsp;public static void AddSModelPopupMenu()&nbsp;<br/>&nbsp;&nbsp;{ //Debug.WriteLine("AddSModelPopupMenu start");<br/>&nbsp;&nbsp;&nbsp;try<br/>&nbsp;&nbsp;&nbsp;{ //CurrNameSpace_Intialize();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br/>&nbsp;&nbsp;&nbsp;&nbsp;AcadMenuGroups mnus = (AcadMenuGroups)app.MenuGroups;&nbsp;&nbsp;&nbsp;&nbsp;<br/>&nbsp;&nbsp;&nbsp;&nbsp;AcadPopupMenus pmnus = mnus.Item(1).Menus;<br/>&nbsp;&nbsp;&nbsp;&nbsp;int count =0;<br/>&nbsp;&nbsp;&nbsp;&nbsp;foreach (AcadPopupMenu mnu in pmnus)<br/>&nbsp;&nbsp;&nbsp;&nbsp;{if (mnu.OnMenuBar==true ) count++;}<br/>&nbsp;&nbsp;&nbsp;&nbsp;AcadPopupMenu Menu_SModel=pmnus.Add("&amp;Smodel");&nbsp;&nbsp;<br/>&nbsp;&nbsp;&nbsp;&nbsp;string macro = Convert.ToChar(Keys.Escape).ToString();<br/>&nbsp;&nbsp;&nbsp;&nbsp;//Show main window<br/>&nbsp;&nbsp;&nbsp;&nbsp;AcadPopupMenuItem MenuItem_MainForm=Menu_SModel.AddMenuItem(Menu_SModel.Count,"&amp;MainForm",macro+"SMF ");<br/>&nbsp;&nbsp;&nbsp;&nbsp;MenuItem_MainForm.HelpString="Show main window";<br/>&nbsp;&nbsp;&nbsp;&nbsp;//Show property window<br/>&nbsp;&nbsp;&nbsp;&nbsp;AcadPopupMenuItem MenuItem_PropertyForm=Menu_SModel.AddMenuItem(Menu_SModel.Count,"&amp;PropertyForm",macro+"SPF ");<br/>&nbsp;&nbsp;&nbsp;&nbsp;MenuItem_PropertyForm.HelpString="Show property window";<br/>&nbsp;&nbsp;&nbsp;&nbsp;AcadPopupMenuItem MenuItem_PunchE=Menu_SModel.AddMenuItem(Menu_SModel.Count,"Punch&amp;E",macro+"MPE ");<br/>&nbsp;&nbsp;&nbsp;&nbsp;MenuItem_PunchE.HelpString="Make PunchE";&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br/>&nbsp;&nbsp;&nbsp;&nbsp;AcadPopupMenuItem MenuItem_uc=Menu_SModel.AddMenuItem(Menu_SModel.Count,"Palet&amp;te",macro+"SPS ");<br/>&nbsp;&nbsp;&nbsp;&nbsp;MenuItem_PunchE.HelpString="Palelte";<br/>&nbsp;&nbsp;&nbsp;&nbsp;pmnus.InsertMenuInMenuBar("&amp;Smodel",++count);<br/>&nbsp;&nbsp;&nbsp;}<br/>&nbsp;&nbsp;&nbsp;catch (Exception ex)&nbsp;{smc.ed.WriteMessage (ex.Message);}&nbsp;&nbsp;<br/>&nbsp;&nbsp;&nbsp;<br/>&nbsp;&nbsp;}</p><p>这是增加下拉菜单的代码,希望有帮助!</p>

sieben 发表于 2007-5-16 20:48:00

<p>&nbsp;&nbsp;<br/>&nbsp;&nbsp;using app = Autodesk.AutoCAD.ApplicationServices.Application;</p><p>public void PaneTest()<br/>&nbsp;&nbsp;{<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Autodesk.AutoCAD.Windows.PaneCollection panes = app.StatusBar.Panes;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Pane pane1 = new Pane();<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pane1.Text = "Sieben";<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; panes.Add(pane1);<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; app.StatusBar.Update();<br/>&nbsp;&nbsp;}</p><p>在状态栏增加一项</p>

makegood 发表于 2007-8-25 17:07:00

怎么让AutoCAD设计中心打开我们指定的文件?

hy_feng 发表于 2008-3-20 17:02:00

<p>用DWGDIRECT在不打开DWG文件的情况下即可读取块信息,明细栏与标题栏都是块</p>
页: [1]
查看完整版本: 如何用C#.NET读取DWG文件的明细栏和标题栏?