Filtering for Extended Data

Extended data (xdata) are text strings, numeric values, 3D points, distances, layer names, or other data attached to an object, typically by an external application.

The size of extended data is 16K bytes.

You can retrieve extended data for a particular application by specifying its name in a filter list, using the -3 group code. The acedSSGet() function returns entities with extended data registered to the specified name; acedSSGet() does not retrieve individual extended data items (with group codes in the range 1000–2000).

The following sample code fragment selects all circles that have extended data registered to the application whose ID is “APPNAME”.

eb1.restype = 0; // Entity type
strcpy(sbuf1, "CIRCLE"); 
eb1.resval.rstring = sbuf1; // Circle
eb1.rbnext = &eb2; 
eb2.restype = -3; // Extended data
eb2.rbnext = &eb3; 
eb3.restype = 1001; 
strcpy(sbuf2, "APPNAME"); 
eb3.resval.rstring = sbuf2; // APPNAME application
eb3.rbnext = NULL; 
// Select circles with XDATA registered to APPNAME.
acedSSGet("X", NULL, NULL, &eb1, ssname1); 

If more than one application name is included in the list, acedSSGet() includes an entity in the selection set only if it has extended data for all the specified applications. For example, the following code selects circles with extended data registered to “APP1” and “APP2”.

eb1.restype = 0; // Entity type
strcpy(sbuf1, "CIRCLE"); 
eb1.resval.rstring = sbuf1; // Circle
eb1.rbnext = &eb2; 
eb2.restype = -3; // Extended data
eb2.rbnext = &eb3; 
eb3.restype = 1001; 
strcpy(sbuf2, "APP1"); 
eb2.resval.rstring = sbuf2; // APP1 application
eb2.rbnext = &eb4; 
eb4.restype = 1001; // Extended data
strcpy(sbuf3, "APP2"); 
eb4.resval.rstring = sbuf3; // APP2 application
eb4.rbnext = NULL; 
// Select circles with XDATA registered to APP1 & APP2.
acedSSGet("X", NULL, NULL, &eb1, ssname1); 

You can specify application names using wild-card strings, so you can search for the data of multiple applications at one time. For example, the following code selects all circles with extended data registered to “APP1” or “APP2” (or both).

eb1.restype = 0; // Entity type
strcpy(sbuf1, "CIRCLE"); 
eb1.resval.rstring = sbuf1; // Circle
eb1.rbnext = &eb2; 
eb2.restype = -3; // Extended data
eb2.rbnext = &eb3; 
eb3.restype = 1001; // Extended data
strcpy(sbuf2, "APP1,APP2"); 
eb3.resval.rstring = sbuf2; // Application names
eb3.rbnext = NULL; 
// Select circles with XDATA registered to APP1 or APP2.
acedSSGet("X", NULL, NULL, &eb1, ssname1); 

The following string finds extended data of the same application.

strcpy(sbuf2, "APP[12]");