lzx838 发表于 2009-11-9 14:04:00
<p> Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;<br/> Database db = HostApplicationServices.WorkingDatabase;<br/> using (DocumentLock docLock = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.LockDocument())<br/> {<br/> //定义过滤器<br/> TypedValue[] filList = new TypedValue;<br/> filList = new TypedValue(0, "Insert");<br/> SelectionFilter filter = new SelectionFilter(filList);<br/> //选择对象<br/> PromptSelectionResult res = ed.GetSelection(filter);<br/> if (res.Status == PromptStatus.OK)<br/> {<br/> intLayerNum = 1;<br/> using (Transaction trans = db.TransactionManager.StartTransaction())<br/> {<br/> //遍历选择集<br/> foreach (ObjectId id in res.Value.GetObjectIds())<br/> {<br/> //获取选择集里的图块<br/> BlockReference blockObject = trans.GetObject(id, OpenMode.ForRead) as BlockReference;<br/> //ed.WriteMessage("***************************************************************\n");<br/> ////获取图块的块名称<br/> //ed.WriteMessage("第" + intLayerNum++.ToString("000") + "层 图块名称:" + blockObject.Name + "\n");<br/> //ed.WriteMessage("===============================================================\n");<br/> //获取图块中的所有实体对象<br/> getBlockSubEntity(ed, trans, blockObject);<br/> //ed.WriteMessage("***************************************************************\n");<br/> }<br/> trans.Commit();<br/> }<br/> }<br/> }</p><p>我自己都忘了是怎么的了,原来是遍历Insert对象.</p><p></p>lubing 发表于 2010-7-18 03:53:00
努力学习中。。。ourtibet 发表于 2016-1-29 10:15:52
明经疯掉了,所有的下载里面,全部是广告,下载的链接啥都没有zzrxtt 发表于 2016-3-8 13:42:36
lzx838 发表于 2009-11-9 14:04 static/image/common/back.gif我自己都忘了是怎么的了,原来是遍历Insert对象.
您好,请问如何遍历当前DWG文件中的尺寸或者文本呢?麻烦您了,
lxw320 发表于 2020-6-7 13:58:42
雪山飞狐_lzh 发表于 2009-11-9 11:07响铃遍历的是Insert实体,块参照种类比较多的时候可能比较慢应该先遍历块表,并生成块嵌套的树结构然后遍历 ...
超版,我最近也遇到遍历慢,想另觅新方法。你这个方法可以贴一下例子出来学习一下吗?
页:
1
[2]