BOOL CTest::getEntityByLayerName( const CString& strLayerName, AcDbObjectIdArray& objIds ) { TCHAR *pValue = new TCHAR[strLayerName.GetLength()+1]; _tcscpy(pValue, strLayerName); resbuf* resTmp = acutNewRb(AcDb::kDxfLayerName); resTmp->resval.rstring = pValue; ads_name name; int nRes = acedSSGet(_T("_X"), NULL, NULL, resTmp, name); acutRelRb(resTmp); if (nRes != RTNORM) return FALSE; long sslen = 0; if (acedSSLength(name, &sslen) != RTNORM) { acedSSFree(name); return FALSE; } int ret; AcDbObjectId objId; for (long i=0L; i<sslen; i++) { ads_name ent; ret = acedSSName(name, i, ent); ASSERT(ret == RTNORM); Acad::ErrorStatus es = acdbGetObjectId(objId, ent); acedSSFree(ent); ASSERT(es == Acad::eOk); objIds.append(objId); } acedSSFree(name); return TRUE; }