查看单个帖子
旧 2009-04-22, 03:02 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 过滤器使用通配符来实现模糊选择集

过滤器使用通配符来实现模糊选择集
www.dimcax.com
过滤器使用通配符来实现模糊选择集
, ,
例: 层名包含"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 sf= new selectionfilter(ftv);
全码:
public objectid[] getdocumentents( )//模糊选择过滤集
{
using (documentlock doclock = autodesk.autocad.applicationservices.application.documentmanager.mdiactivedocument.lockdocument())
{
editor ed = autodesk.autocad.applicationservices.application.documentmanager.mdiactivedocument.editor;

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 sf = new selectionfilter(ftv);
promptselectionresult sp = ed.selectall(sf);
if (sp.status != promptstatus.ok)
{
return new objectid[0] ;
}
else
{
return sp.value.getobjectids();
}

}
}
复制代码
new typedvalue((int)dxfcode.operator , "<and")
new typedvalue((int)dxfcode.operator , "and>")
好像可以省略?
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)