ade_odgetfield

Land Desktop Development ARX CPP SDK

Up a level
ade_odgetfield
 
 

Gets a field value.

struct resbuf*

ade_odgetfield(

ads_name ename,

char* table,

char* field,

int recnum);

Returns a field value or NULL.

ename AutoCAD object name.
table Table name can be up to 25 characters long. Must be unique, contain no spaces, and start with an alphanumeric character.
field Field name can be up to 31 characters long. Must be unique, contain no spaces, and start with an alphanumeric character.
recnum Record number. The number of the first record is 0.

To identify a unique record, you need to specify the table to which it belongs, the object to which it is attached, and its record number. The record number is necessary because more than one record from the same table can be attached to an object. For more information about records and record numbers, see ade_odaddrecord.

The field value returned can be one of four data types: integer, character, point, or real.

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_odgetfield() with all required parameters, the results are stored in a resbuf which is displayed. Then it releases the resbuf, as required.

struct resbuf* pGetFieldsRb = NULL;
ads_name selectionSet;
ads_name ename;
char* pszOdTable = "table1";
char* pszOdField = "field1";
int recnum = 0;
acedSSGet("x", NULL, NULL, NULL, selectionSet);
long ssLength;
acedSSLength( selectionSet, &ssLength; );
for( int i = 0; i < ssLength; ++i )
{
    if( acedSSName(selectionSet, i, ename) == RTNORM )
    {
        pGetFieldsRb = ade_odgetfield(ename, pszOdTable, pszOdField, recnum);
        struct resbuf* rb = pGetFieldsRb;
        while(rb != NULL) {
            acutPrintf(
                "\nThe current entity has %s object data with a %s value of: %s"
                , pszOdTable, pszOdField, rb->resval.rstring);
            rb = rb->rbnext;
        }
    }
}
acutRelRb(pGetFieldsRb);