Message 1 of 2
Get a group by single-point selection
Not applicable
08-28-2002
02:37 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
The user can get a group by sngle-point selection on the screen,
i try to do that by programming, it seen like this
ads_name entname;
ads_point ptres;
if((acedEntSel("\nSelect an element:",entname,ptres))!=RTNORM)
return;
AcDbObjectId objId;
AcDbObject *pObj;
acdbGetObjectId(objId,entname);
acdbOpenObject(pObj,objId,AcDb::kForRead);
AcDbVoidPtrArray *pReactors;
pReactors=pObj->reactors();
pObj->close();
void *pSomething;
AcDbObjectIdArray objIds;
AcDbObjectId persObjId;
AcDbObject *pPers;
long lCounter=0;
if (pReactors != NULL && pReactors->length() > 0){
for(int i=0;ilength();i++){
pSomething=pReactors->at(i);
if (acdbIsPersistentReactor(pSomething)){
persObjId=acdbPersistentReactorObjectId(pSomething);
acdbOpenObject(pPers,persObjId,AcDb::kForRead);
if(pPers->isA()==AcDbGroup::desc()){
lCounter++;
objIds.append(acdbPersistentReactorObjectId(pSomething));
}
pPers->close();
}
}
}
is it right ? or it has an easy way to do this, thanks for your reading.
i try to do that by programming, it seen like this
ads_name entname;
ads_point ptres;
if((acedEntSel("\nSelect an element:",entname,ptres))!=RTNORM)
return;
AcDbObjectId objId;
AcDbObject *pObj;
acdbGetObjectId(objId,entname);
acdbOpenObject(pObj,objId,AcDb::kForRead);
AcDbVoidPtrArray *pReactors;
pReactors=pObj->reactors();
pObj->close();
void *pSomething;
AcDbObjectIdArray objIds;
AcDbObjectId persObjId;
AcDbObject *pPers;
long lCounter=0;
if (pReactors != NULL && pReactors->length() > 0){
for(int i=0;i
pSomething=pReactors->at(i);
if (acdbIsPersistentReactor(pSomething)){
persObjId=acdbPersistentReactorObjectId(pSomething);
acdbOpenObject(pPers,persObjId,AcDb::kForRead);
if(pPers->isA()==AcDbGroup::desc()){
lCounter++;
objIds.append(acdbPersistentReactorObjectId(pSomething));
}
pPers->close();
}
}
}
is it right ? or it has an easy way to do this, thanks for your reading.