Gets the source drawing ID and original handle of a queried object.
struct resbuf*
ade_qrygetdwgandhandle(
ads_name ename);
Returns the drawing ID and handle for the queried object or NULL.
ename | AutoCAD entity name. |
You must release the resbuf.
This function returns the ID of the source drawing from which the object was queried and the handle by which the object is known in that drawing.
The following sample creates a selection set of all entities in the current drawing using acedSSGet(). Each entity in the selection set is passed to ade_qrygetdwgandhandle() with all required parameters, the results of which populate a resbuf. The resbuf values are displayed and then released, as required.
ads_name ename; ads_name selectionSet; struct resbuf* pQueriedObjInfoRb = NULL; acedSSGet("_x", NULL, NULL, NULL, selectionSet); long ssLength; acedSSLength( selectionSet, &ssLength; ); for( int i = 0; i < ssLength; ++i ) { if( acedSSName(selectionSet, i, ename) == RTNORM ) { pQueriedObjInfoRb = ade_qrygetdwgandhandle(ename); if(NULL != pQueriedObjInfoRb) { struct resbuf* rb = pQueriedObjInfoRb; while(NULL != rb) { switch(rb->restype) { case RTREAL: acutPrintf( "\n\n\nThe queried objects drawing Id is: %.0lf" , rb->resval.rreal); break; case RTSTR: acutPrintf( "\nThe queried objects entity handle is: %s" , rb->resval.rstring); break; default: acutPrintf( "\nCould not determine the value"); break; } rb = rb->rbnext; } } } } acutRelRb(pQueriedObjInfoRb);