Name

attr — Used to create, change, retrieve, or view attributes of database objects.

Synopsis

attr [get] [set] [rm] [append] [list] [show] [sort] {object_name_pattern} [arguments]

DESCRIPTION

Used to create, change, retrieve, or view attributes of database objects. 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.

A newly formed region always has four attributes automatically assigned to it:

  • los

  • material_id

  • region

  • region_id

The 'region' attribute is the 'region flag' mentioned in the edcomb command.

SUB-COMMANDS

get

Retrieve and display the specified attributes from the object or objects matched by the pattern. The arguments for the "get" sub-command are attribute names. If no arguments are provided all attributes are displayed.

set

Assigned the value provided for the specified attribute to the object or objects matched by the pattern. The arguments for "set" sub-command are attribute name/value pairs.

rm

Removes the specified attribute from the object or objects matched by the pattern. The arguments for the "rm" sub-command are attribute names.

append

Adds the attribute and value provied for the specified attribute to the object or objects matched by the pattern, or sets the value if the attribute already exists. The arguments for the "append" sub-command are attribute name/value pairs.

list

Lists the attributes assigned to the object or objects matched by the pattern. If multiple objects are matched, the list returned is a consolidated list of all attribute types present on one or more of the matched objects. This option is useful when investigating what attributes are present in objects in a database. The "list" sub-command takes no arguments.

show

Pretty print the specified attributes for the object or objects matching the pattern. If no attributes are listed, all attributes are printed for each object. The arguments for the "rm" sub-command are attribute names.

sort

Pretty prints all attributes on each object matched by the pattern. Attributes are sorted into alphabetical order before printing. The arguments for the "sort" sub-command set the sort type for the attributes: 'case' (default), 'nocase', 'value', and 'value-nocase'.

EXAMPLES

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.


Example 4. List all the attribute types present on one or more objects in a database

mged> attr list *

Lists all the attributes found in the database. It may be necessary to place a '\' character before the asterisk to quote it on the MGED tcl prompt so that it reaches the attr command unexpanded.


SEE ALSO

attributes(5).

AUTHOR

BRL-CAD Team

COPYRIGHT

This software is Copyright (c) 2008-2016 United States Government as represented by the U.S. Army Research Laboratory.

BUG REPORTS

Reports of bugs or problems should be submitted via electronic mail to <devs@brlcad.org>, or via the "cadbug.sh" script.