ade_dwgindexdef

Land Desktop Development ARX CPP SDK

Up a level
ade_dwgindexdef
 
 

Specifies which indexes are to be created or removed.

int

ade_dwgindexdef(

struct resbuf* indexType,

short indexOper,

struct resbuf* indexParams);

Returns RTNORM or an error code.

indextype Type of index to be operated on: "Location", "Property", "EED", "SQLLINKS", "ObjData".
indexoper Index operator: 1 = create, 0 = remove.
indexparams Additional parameters required to specify which index is to be manipulated or NULL if none. Only the Object Data index supports additional parameters.

The list of indexes to be created or removed and associated information constitutes an index operation expression. A list of one or more index operation expressions constitutes an index operation definition. If there is a current index operation definition when you create an index operation expression, the new expression is added to it. When you call ade_dwgindex, indexes in the specified drawing are created or removed in accordance with the current index operation definition.

If you use "" (the empty string) for the indexType argument (in which case the arguments for the other two parameters do not matter so long as they are valid), the current index operation definition is cleared.

The indexparams argument is a list of tables and fields on which object data indexes will be created or removed (depending on the indexoper argument). The list consists of an object data table name followed by the fields to be processed. If this argument is NULL, all object data tables and fields will be processed.

The following sample gets the drawing ID from an attached drawing using ade_dwggetid() then parses the resbuf used by ade_userlist() and prints a status of the type of index created for the specified drawing. Then it releases the resbuf, as required. For more samples, see Creating Index Operation Expressions.

char* pszDwgPathName = "MYDWGS:\\994049-2blk.dwg";
ade_id dwgId = ade_dwggetid (pszDwgPathName);

int indexOper = 1;
struct resbuf* pDwgIndexOnRb = acutBuildList(
                                  RTSTR,"Property",
                                  RTSTR,"Location",
                                  RTSTR,"EED",
                                  0;
struct resbuf* rb = pDwgIndexOnRb;
while(rb != NULL) {
    int returnCode = ade_dwgindexdef(rb->resval.rstring, indexOper, NULL);
    if (RTNORM == returnCode) {
        acutPrintf(
            "\nThe %s index has been successfully created for %s"
            ,rb->resval.rstring, pszDwgPathName);
    }
    else {
        acutPrintf(
            "\nThe index could not be created.");
    }
    rb = rb->rbnext;
}
acutRelRb(pDwgIndexOnRb);