ade_qrygetentlist

Land Desktop Development ARX CPP SDK

Up a level
ade_qrygetentlist
 
 

Returns the list of entity handles for all objects that satisfy the current query in a specific drawing.

struct resbuf*

ade_qrygetentlist(

ade_id dwg_id);

Returns a list of the handles of selected objects or NULL.

dwg_id Drawing ID of the drawing to query.

This function executes the current query and finds all objects that satisfy it in the drawing specified by the dwg_id argument. The entity handles of the objects are returned to the calling function.

Once you have the handle to an object, you can get the entity name with the ade_qryhandent function and use it to perform other functions. For example, you could use entget (and ads_entget) to retrieve the entity and its definition data.

You must release the resbuf.

The following sample populates a resbuf with attached drawing id's using ade_qllistctgy(). This resbuf contains the input parameter used by ade_qrygetentlist() to populate a resbuf containing queried entity id's. Those id's are displayed, and the resbufs, are released as required.

struct resbuf* pQueriedObjHandlesRb = NULL;
struct resbuf* pDsDwgIdRb = ade_dslist(ADE_NULLID, ADE_FALSE);
if (NULL != pDsDwgIdRb) {
    struct resbuf* rb = pDsDwgIdRb;
    while(NULL != rb) {
        struct resbuf* pQueriedObjHandlesRb = ade_qrygetentlist(rb->resval.rreal);
        if (NULL != pQueriedObjHandlesRb) {
            struct resbuf* rbHand = pQueriedObjHandlesRb;
            while(NULL != rbHand) {
                acutPrintf(
                    "\nThis queried objects entity handle is: %s"
                    , rbHand->resval.rstring);
                rbHand = rbHand->rbnext;
            }
            rb = rb->rbnext;
        }
        else{
            acutPrintf(
                "\nNo information could be retrieved.");
        }
    }
}
else {
    acutPrintf(
        "\nNo queried objects were returned for this project.");
}
acutRelRb(pDsDwgIdRb);
acutRelRb(pQueriedObjHandlesRb);