Smart Edit (PCB)
Summary
The Smart Edit dialog offers designers two different methods for performing string modification, accessed from the Batch Replace and Formula tabs respectively.
Access
From the:
- PCB List or PCBLIB List panel, select cell entries pertaining to an attribute you wish to modify for all required objects, right-click, and select Smart Edit from the context menu.
- PCB Inspector or the PCBLIB Inspector panel, when there are multiple objects selected that have a string property an elipsis button
will appear in the string field, click this to open the Smart Edit dialog.
Options/Controls
Batch Replace Tab
This tab provides simple straightforward substitution. Click inside the From field and enter the portion of the current string that you wish to replace. Then click inside the To field and enter the string to be used as the replacement. The familiar string substitution syntax is displayed at the bottom of the tab.
For example consider the designators of three header components that currently have the prefix P, but you need to change them to have prefix HDR instead. In this case, select the Name attribute for each of the components in the panel and access the Smart Edit dialog. Then on the Batch Replace tab, enter P in the From field and HDR in the To field (the replacement string is therefore {P=HDR}
). After clicking OK, the designators will be modified accordingly. The Batch Replace tab also provides for replacement of multiple, differing string portions in the same target string. Enter the various substitutions as distinct From-To entries.
Formula Tab
This tab provides for more advanced modification, allowing you to apply a specific expression to the selected string objects. The expression can include any built-in arithmetic operators and functions that apply to strings (found in Pascal). Once again, if you wish to use the current value for the attribute as part of the expression, you will need to make reference to this original value, either by using the full name of the attribute, or by using the exclamation character (the supported substitute for the name of the attribute currently being modified). When using attribute names, if any names contain spaces, these must be replaced by the underscore character. So, for example, use of the Component Comment field within a formula should be entered as Component_Comment
.
Consider for example three selected memory components specified in a design, with designators U1, U3 and U5. You might want to extend the designators of these components by including some indication of their role. First select the cell entries for the Name attributes of these components. Then, using the addition operator, you could write an expression to add to the existing string value of the Name attribute. This would take the existing (original) string value and concatenate it with a specified new string, as illustrated below:
Name + '_MEM'
or, in shortened form:
! + '_MEM'
Note that the spaces are optional. After clicking OK the designators of the components will be updated to U1_MEM, U3_MEM and U5_MEM respectively.
Expressions entered in the Formula tab of the Smart Edit dialog are saved so they can easily be used again in the future. To re-use previously entered expressions, click the button at the right end of the text field and select an expression from the drop-down menu.