Used to create, change, retrieve, or view attributes of database objects. The arguments for "set" and "append" subcommands are attribute name/value pairs. The arguments for "get," "rm," and "show" subcommands are attribute names. The arguments for the "sort" subcommand sets the sort type for the attributes of the object: 'case' (default), 'nocase', 'value', and 'value-nocase'. The "append" subcommand appends the provided value to an existing attribute, or creates a new attribute if it does not already exist. The "get" subcommand retrieves and displays the specified attributes. The "rm" subcommand deletes the specified attributes. The "show" subcommand does a "get" and displays the results in a user readable format. Note that the attribute names may not contain embedded white space, and if attribute values contain embedded white space, they must be surrounded by {} or double quotes.
Note that a newly formed region always has four attributes assigned to it:
los
material_id
region
region_id
The 'region' attribute is the 'region flag' mentioned in the edcomb command. Somewhat confusingly though, immediately upon completing the 'r' (region) command in mged a message like this is displayed:
Defaulting item number to 1001 Creating region with attrs: region_id=1000, air=0, los=0, material_id=1
However, the air attribute will not show in a 'attr show' command unless it is set to a non-zero value.
The examples demonstrate the use of the attr command and subcommands to assign and list attributes of database objects.
Example 1. Assigns an attribute to an object.
mged>
attr set region_1 material_id 10
Assigns an attribute name "material_id" to region_1. Its value is 10.
Example 2. Assigns an attribute (with embedded white space in its value) to an object.
mged>
attr set region_1 comment {This is a comment for region_1}
Assigns an attribute named "comment" to region_1. Its value is "This is a comment for region_1."
Example 3. List all the attributes for an object
mged>
attr show region_1 comment
Lists all the attributes for region_1.