어떤 좌표에 위치한 엔터티 구하기



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;


}



답글 남기기

이메일 주소는 공개되지 않습니다.