int ArxGetEntUnderPos(AcDbObjectIdArray& ids , const AcGePoint3d& pt)
{
ads_point ptUnder = {pt.x, pt.y, pt.z};
ads_name ss;
int res;
if (RTNORM != (res = acedSSGet(“:E”, ptUnder, NULL, NULL, ss)))
{
// There is probably nothing under the cursor,
// so return and let AutoCAD process the message
return RTFAIL;
}
long length = 0L;
acedSSLength(ss, &length);
if (0 == length)
{
// There is nothing under the cursor,
// so there is no need to show the context menu.
// Let AutoCAD process the message.
acedSSFree(ss);
return RTFAIL;
}
ads_name ename;
for(int i = 0;i < length;i++)
{
acedSSName(ss, i, ename);
AcDbObjectId entId;
if(Acad::eOk != acdbGetObjectId(entId, ename)) continue;
ids.append(entId);
}
acedSSFree(ss);
return RTNORM;
}
[출처] 어떤 좌표에 위치한 엔터티 구하기|작성자 행복사냥