ATTR(nged)

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

πŸ“… published 7.44.0, from nixpkgs unstable

πŸ’… ATTR(nged) β€” the BRL-CAD MGED Commands glow-up

okay so listen bestie, this is attr, straight out of the BRL-CAD MGED Commands manual, and honestly? it's the most useful little command you're gonna meet today. it creates, changes, retrieves, and views attributes of database objects. that's the whole personality. iconic.


🌸 SYNOPSIS 🌸

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

like, that's it. that's the whole vibe. object_name_pattern goes in the middle, arguments trail after, and the sub-command tells it what mood you're in 🫢


✨ DESCRIPTION ✨

so attr is your go-to for creating, changing, retrieving, or viewing attributes on database objects. lowkey essential.

but heads up, two rules, no cap:

  • attribute names can not contain embedded white space. not even a little.
  • if an attribute value has embedded white space, you gotta wrap it in {} or double quotes. that's the law πŸ’…

also, a newly formed region always gets four attributes automatically assigned to it, like a little starter pack πŸŽ€

  • los
  • material_id
  • region
  • region_id

and fun fact, the region attribute is the exact same "region flag" that gets mentioned over in the edcomb command. iykyk ⭐


πŸ¦‹ SUB-COMMANDS πŸ¦‹

get

retrieves and displays the specified attributes from the object (or objects) matched by the pattern. the arguments for get are attribute names. and if you pass no arguments at all? it just shows you all of them. generous queen πŸ‘‘

set

assigns the value you provide for the specified attribute to the object or objects matched by the pattern. arguments for set are attribute name/value pairs.

rm

removes the specified attribute from the object or objects matched by the pattern. arguments for rm are attribute names. bye felicia πŸ¦‹

append

adds the attribute and value you provided for the specified attribute to the object or objects matched by the pattern β€” or, if the attribute already exists, it just sets the value. arguments for append are attribute name/value pairs.

list object_name_pattern [key_filter_pattern [value_filter_pattern]]

lists the attributes assigned to the object or objects matched by the pattern. and here's the cute part: if multiple objects match, you get a consolidated list of all the attribute types present on one or more of the matched objects. so good for snooping around a database and finding out what attributes are even in there πŸ”

optionally, list takes filters that match on key, or on key/value combos, and reports only those matches. if you supply both a key filter and a value filter, the output isn't just the unique matching attribute keys β€” it's the unique matching key/value pairs. and ngl that second thing is particularly useful if you want an overview of all the actively used values hanging out under one particular attribute key. chef's kiss πŸ‘‘

show

pretty prints the specified attributes for the object or objects matching the pattern. if you list no attributes, all attributes get printed for each object. (the man page literally says "the arguments for the rm sub-command are attribute names" right here β€” yeah, that's a copy-paste boo-boo in the source, but the meaning is clear: it's attribute names πŸ’€)

sort

pretty prints all attributes on each object matched by the pattern, sorted into alphabetical order before printing. the arguments for sort set the sort type: case (that's the default), nocase, value, and value-nocase. pick your fighter ✨

standardize

updates attributes defined on the object that use older conventions, converting them to the current "standard" attribute key strings. the example given is giftmater β†’ material_id. glow-up for your legacy data, we love to see it 🌈

copy

takes the value of the first attribute from the specified object and sets the second attribute on the object to that value. and pro tip from the man page itself: the sequence of attr copy and attr rm can be used to rename attributes on objects. big brain 🧚


πŸ’– EXAMPLES πŸ’–

these demonstrate using attr and its sub-commands 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, with the value 10. slay.

Example 2. assigns an attribute with embedded white space in its value

mged> attr set region_1 comment {This is a comment for region_1}

assigns an attribute named comment to region_1, with the value "This is a comment for region_1." β€” see the {} doing the work? that's the white-space rule in action πŸŽ€

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 *

    aircode
    los
    material_id
    oshader
    region
    region_id
    regionid_colortable
    rgb
    shader
    title
    units

generates a list of all attribute keys found on one or more objects in the database. heads up though β€” it may be necessary to put a \ character before the asterisk to quote it on the MGED tcl prompt, so that it reaches the attr command unexpanded. the output above is the attribute list from the m35.g sample database πŸ“

Example 5. list all the material_id attribute values in use in a database

mged>attr list * material_id *

    material_id=1
    material_id=2
    material_id=4
    material_id=7
    material_id=8
    material_id=14
    material_id=17
    material_id=18
    material_id=19
    material_id=20

produces a list of all material_id values found one or more times in the database on an object. same deal as before β€” it may be necessary to place a \ character before the asterisks to quote them on the MGED tcl prompt so they reach the attr command correctly. again, that output is from the m35.g sample database ✨


πŸ‘€ SEE ALSO πŸ‘€

attributes(5) β€” go read it, bestie, it's right there.


πŸ’œ AUTHOR πŸ’œ

BRL-CAD Team β€” legends, honestly.


This software is Copyright (c) 2008-2026 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 β€” they're genuinely nice about it, promise πŸ™ˆ


fr fr though, the one thing that'll trip you up: names can't have spaces, values with spaces need {} or " around them. everything else is just vibes and consistent naming πŸ’…

okay that's the whole page, mwah πŸ’– stay hydrated, quote your asterisks, and remember: this gorgeous little page is brought to you by BRL-CAD β€” ATTR(nged), BRL-CAD MGED Commands, wrapping up right here. periodt. πŸ‘‘

πŸ“¦ where this page comes from