ChimeraX docs icon

Command: setattr

Usage:
setattr  spec   level  attr-name   value  [ create  true | false ]

Setattr is a general, multipurpose attribute-setting command. It sets an attribute named attr-name (existing or new) of the specified items at the indicated level to a single user-supplied value. Following the usual convention, a blank specification means “all.” A new attribute will not be created unless create is true (default false). See also: info

The level can be any one of the following:

Regardless of whether the attribute already exists, the data type is discerned as follows:

  1. the value is parsed to identify data type in the order: Boolean, integer, floating-point (real), character string
  2. if the data type is character string and attr-name ends in “color,” the value is interpreted as a color specifier

Although setattr does not restrict which attributes it can affect, using it for certain attributes may not make sense. In some cases, a simpler command may already exist to perform the same task, for example:

setattr /a res ribbon_color orange
– is equivalent to –
color /a orange targ r

UCSF Resource for Biocomputing, Visualization, and Informatics / November 2017