过滤器使用通配符来实现模糊选择集
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>")
好像可以省略?