不好意思,我只是个超级菜鸟;只会这个了 你看下不知道有没有用!!!! 这个是针对CAD里扩展菜单的操作,也就是说已经打开CAD的图纸,在内容菜单中获取该图的文本信息!!! 只会这个,不好意思了! DocumentLock doc=Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.LockDocument();//获取当前打开文档对象 Database db=HostApplicationServices.WorkDatabase//获取当前文档对象工作数据库 using(Transaction trans=db.TransactionManager.StartTransaction())//开始事务 { BlockTable bt = (BlockTable)trans.GetObject(HostApplicationServices.WorkingDatabase.BlockTableId, OpenMode.ForRead);//块表; BlockTableRecord btr = (BlockTableRecord)trans.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForRead);//图元记录 foreach (ObjectId id in btr)// 遍历图元 { Autodesk.AutoCAD.DatabaseServices.Entity _ent = (Autodesk.AutoCAD.DatabaseServices.Entity)trans.GetObject(id, OpenMode.ForRead, false); if (_ent.GetType().ToString() == "Autodesk.AutoCAD.DatabaseServices.DBText") //单行文本; {////这里是你要进行的操作,这些就是DBText对象} } |