![]() |
(获取实体id集合时)过滤器的使用及检测(过滤器引用)对象的类型名称 - 精华帖集合
(获取实体id集合时)过滤器的使用及检测(过滤器引用)对象的类型名称 - 精华帖集合
www.dimcax.com (获取实体id集合时)过滤器的使用及检测(过滤器引用)对象的类型名称 , , , , 1.过滤器常用操作符组合 (1) a或b 操作符:"<or" "a" "b" "or>" 例集合包含 多断线(对像类型名称为lwpolyline) 或 块参照(对像类型名称为insert) typedvalue[] ftv = new typedvalue[] { new typedvalue((int)dxfcode.operator , "<or"), new typedvalue((int)dxfcode.start, "lwpolyline") , new typedvalue((int)dxfcode.start, "insert"), new typedvalue((int)dxfcode.operator , "or>") }; selectionfilter xfilter= new selectionfilter(ftv); (2) a和b 操作符:"<and" "a" "b" "and>" 例: 在“ping"层的直线。(是直线并且所在层名称为“ping“) typedvalue[] ftv = new typedvalue[] { new typedvalue((int)dxfcode.operator , "<and"), new typedvalue((int)dxfcode.start, "line") , new typedvalue((int)dxfcode.layername, "ping"), new typedvalue((int)dxfcode.operator , "and>") }; selectionfilter xfilter= new selectionfilter(ftv); (3)其它如 (a和b)或者(c和d)的,模式为: "<or" "<and" “ a” “ b ” "and>" "<and" “ c” “ d ” "and>" "or>" 2.在使用过滤器过滤指定对象时,需要设置对象类型名称,如参照块“insert”,多段线“lwpolyline” 不知dxfname时可以如下做测试来获取 [commandmethod("getentsdxfanme", commandflags.session)] public void getentsdxfanme() { using (documentlock doclock = autodesk.autocad.applicationservices.application.documentmanager.mdiactivedocument.lockdocument()) { objectid obt = getselectfirstentityid(); if (!obt.isnull) { database db = hostapplicationservices.workingdatabase; using (transaction trans = db.transactionmanager.starttransaction()) { entity ent = (entity)trans.getobject(obt , openmode.forwrite); ed.writemessage(ent.getrxclass().dxfname .tostring () ); trans.commit(); } } } } public static objectid getselectfirstentityid() //通过鼠标获取单个实体id { using (documentlock doclock = autodesk.autocad.applicationservices.application.documentmanager.mdiactivedocument.lockdocument()) { editor ed = application.documentmanager.mdiactivedocument.editor; database db = hostapplicationservices.workingdatabase; objectid o1 = new objectid(); promptselectionoptions selectionop = new promptselectionoptions(); promptselectionresult ssres = ed.getselection(selectionop); if (ssres.status == promptstatus.ok) { o1 = ssres.value[0].objectid; } return o1; } } 复制代码 3.cad开发需要不继学习哈,以上算为论坛添块瓦,为初学者抛块砖哈 很好,大家一起学习. 好文! 路漫漫其修远兮,吾将上下而求索! |
| 所有的时间均为北京时间。 现在的时间是 02:20 AM. |