SelectByPolygon的FilterType怎样设置
小弟最近接触ObjectARX编程遇到一个难题,需求如下
用SelectByPolygon选择某一个框内的图元,但是要把BB和BB1图层上的图元过滤掉.
当FilterType和FilterData没有值的时候,可以全部都选择到,但是当我设置了FilterType时,就什么也选择不到了,代码如下.
VARIANT filterType;
VARIANT filterData;
SAFEARRAYBOUND mSAB1;
mSAB1.lLbound = 0;
mSAB1.cElements = 5;
SAFEARRAYBOUND mSAB2;
mSAB2.lLbound = 0;
mSAB2.cElements = 5;
VariantInit(&filterType);
filterType.vt = VT_ARRAY | VT_R8;
filterType.parray = SafeArrayCreate(VT_R8, 1, mSAB1);
VariantInit(&filterData);
filterData.vt = VT_ARRAY | VT_BSTR;
filterData.parray = SafeArrayCreate(VT_R8, 1, mSAB2);
short ft;
CString fd;
ft = -4;
fd = _T("<NOT");
ft = 8;
fd = _T("BB1");
ft = 8;
fd = _T("BB");
ft = 8;
fd = _T("轴线尺寸");
ft = -4;
fd = _T("NOT>");
i = 0;
for(i = 0; i < mSAB1.cElements; i++)
{
SafeArrayPutElement(filterType.parray, &i, &ft);
}
i = 0;
for(i = 0; i < mSAB2.cElements; i++)
{
SafeArrayPutElement(filterData.parray, &i, &fd);
}
acadSelSet->SelectByPolygon(acSelectionSetWindowPolygon, VAR, filterType, filterData);
不知道我这么写到底对不对,请各位大大指点
找到办法了,用acdeSSGet,然后再通过document接口获取活动选择集
页:
[1]