![]() |
如何在.net开发的代码中遍历所有的图形对象,并判断是什么类型的对象?
如何在.net开发的代码中遍历所有的图形对象,并判断是什么类型的对象?
www.dimcax.com 如何在.net开发的代码中遍历所有的图形对象,并判断是什么类型的对象? 需要对图中的所有图形分类分图层进行对应的各种操作,请问有这方面的文档或技术资料吗?还有,我不能下载所有 中的资源,点击主页的下载后,进入的新的页面中没有有效的链接,是不是我才注册所以没有权限还是别的什么原因?我是才开始学习用.net来作autocad开发的,以前是直接通过读dxf文件来做的,以后请多关照了。谢谢 entity.gettype.name 谢谢“一样”。我知道这个方法可以判断指定的entity是哪一种类型的,但是如何遍历所有的实体呢? foreach (objectid id in btr) { entity ent = (entity)trans.getobject(id, openmode.forread); ed.writemessage("\n" + ent.gettype().name); } 复制代码 thanks! foreach (objectid id in btr) { entity ent = (entity)trans.getobject(id, openmode.forread); ed.writemessage("\n" + ent.gettype().name); } 我是用vb。net的,我没有试过上述例子,但有一问,foreach (objectid id in btr)中btr应该是指blocktablerecord,它能作为一个objectid的集合吗 原帖由 fireangel 于 我是用vb。net的,我没有试过上述例子,但有一问,foreach (objectid id in btr)中btr应该是指blocktablerecord,它能作为一个objectid的集合吗 可以的 dim ed as editor = application.documentmanager.mdiactivedocument.editor dim db as database = application.documentmanager.mdiactivedocument.database using trans as transaction = db.transactionmanager.starttransaction() dim bt as blocktable = trans.getobject(db.blocktableid, openmode.forread) dim btr as blocktablerecord = trans.getobject(bt(blocktablerecord.modelspace), openmode.forread) dim id as objectid for each id in btr dim entity as entity = trans.getobject(id, openmode.forread, true) ed.writemessage(entity.gettype.name) next trans.commit() end using 复制代码 我是用vb。net的,我没有试过上述例子,但有一问,foreach (objectid id in btr)中btr应该是指blocktablerecord,它能作为一个objectid的集合吗 blocktablerecord类中包含的是实体的objectid 集合,而非实体本身。 c#最适合开发autocad,因为它拥有vb容易的特点,却具有vc++的强大功能。 |
| 所有的时间均为北京时间。 现在的时间是 07:30 AM. |