Entity and Selection Set Names

In AutoLISP, the names of entities and selection sets are pairs of long integers. ObjectARX preserves this standard by defining such names as an array type, as follows:

typedef long ads_name[2]; 

As with ads_point variables, ads_name variables are always passed by reference but must be assigned element by element.

You can also copy an entity or selection set name by calling the ads_name_set() macro. As with ads_point_set() and ObjectARX functions, the result is the second argument to the macro.

The following sample code sets the name newname to equal oldname.

ads_name oldname, newname; 
 
if (acdbEntNext(NULL, oldname) == RTNORM) 
ads_name_set(oldname, newname); 
Note: This macro, like the ads_point_set() macro, is defined differently, depending on whether or not the symbol __STDC__ (which stands for standard C) is defined. The standard C version of ads_name_set() requires your program to include string.h.

The ads_name_equal() macro compares the names in the following example:

if (ads_name_equal(oldname, newname)) 
... 

To assign a null value to a name, call the ads_name_clear() macro, and test for a null entity or selection set name with the macro ads_name_nil().

The following sample code clears the oldname set in a previous example:

ads_name_clear(oldname); 

And the following code tests whether the name is NULL:

if (ads_name_nil(oldname)) 
... 

ObjectARX creates the following data type for situations that require a name to be a pointer rather than an array:

typedef long *ads_namep;