Gets a record ID.
ade_id
ade_odgetrecord(
ads_name ename,
char* table,
int recnum);
Returns a record ID or ADE_NULLID.
ename | AutoCAD object name. |
table | Table name. |
recnum | Record number; the first record number is 0. |
The function assigns an ID to the record uniquely determined by the three arguments. Later you can use this record ID with ade_odgetrecfield to return the value of a particular field of this record. This means of getting an object data field value is generally faster than any other.
Three arguments are necessary because an AutoCAD object can be associated with more than one record in a table, in which case the records are distinguished by their record numbers. If there is only one record, its number is 0. For more information about records and record numbers, see ade_odaddrecord.
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_odgetrecord() with all required parameters, the results are checked for value and displayed.
ads_name selectionSet; ads_name ename; char* pszOdTable = "Table1"; int recnum = 0; acedSSGet("_x", NULL, NULL, NULL, selectionSet); long ssLength; acedSSLength( selectionSet, &ssLength; ); ade_id recordId; for( int i = 0; i < ssLength; ++i ) { if( acedSSName(selectionSet, i, ename) == RTNORM ) { recordId = ade_odgetrecord(ename, pszOdTable, recnum); if (0 == recordId) { acutPrintf( "\nNo record id could be obtained."); } else { acutPrintf( "\nade_odgetrecord() returned: %.0lf" , recordId); } } }