Configuring 3D and Schematic Standards > Defining Attribute Rules
  
Defining Attribute Rules
Attribute Rules (<attr_rules>) are optional rules that define when an attribute appears in the attributes list. Use attribute rules to hide or to lock attributes, and to enable localization of attributes in illustrations. A standard can contain rules to control the visibility of attributes in the source data as well as to lock attributes at different levels. A list of attributes rules can be empty.
type—Sets the attribute type. Currently schematics is the only supported type.
<if>—The existence of an <if> statement is optional. A statement can contain one or no <if> and exactly one <then> argument. When <if> isn’t defined, <then> appears to all items.
and|or|not—You can combine conditions with boolean tags.
item—A condition that applies to items only.
item arguments
Description
type
The type of the item. You can use regexpr if regexpr=true (optional).
name
The name of the item. You can use regexpr if regexpr=true (optional).
regexpr
Use regular expressions in the condition.
equal
The values of arguments (type/name) must be equal for the condition to be true.
caseins
Case sensitive when the statement is true.
This is an example of an attribute applied to an item:
attribute—A condition that is applied to the attributes of items.
attribute arguments
Description
name
The name of the attribute. You can use regexpr if regexpr=true (optional).
value
The value of the attribute. You can use regexpr if regexpr=true (optional).
regexpr
Use regular expressions in the condition.
caseins
Case sensitive when the statement is true.
then—A rule must have a then argument. Only add the argument when you want to apply the rule. It contains everything that the rule applies to.
then arguments
Description
attribute
Add any number of effects to attributes (optional).
lock
Set the lock attribute to true to lock it.
visible
Set the attribute to false to hide it.
localize
Enables localization of attributes.
This is an example of a then argument:
<attr_rules>
<rule type="schematics">
<if>
<item type="co*" name="*1*" regexpr="true"/>
</if>
<then>
<attribute visible="false"/>
</then>
</rule>
<rule type="schematics">
<if>
<attribute name="*name*" regexpr="true"/>
</if>
<then>
<attribute lock="true"/>
</then>
</rule>
<rule type="schematics">
<if>
<and>
<attribute name="name"/>
<attribute value="*2*" regexpr="true"/>
</and>
</if>
<then>
<attribute localize="true" lock="false" visible="true"/>
</then>
</rule>
</attr_rules>
Continue to the next section for information on defining profiles.