Scoping Design Rules
When defining the scope of a design rule - the extent of its application - you are essentially building a query to define the member objects that are governed by the rule. Use the options available in the dialog to build the query required.Depending on whether the rule is unary or binary, you will need to define one or two scopes respectively. For more information, see the Unary and Binary Design Rules topic.Basic options allow you to quickly generate scope queries that target:
- all design objects
- all objects in a specific net
- all objects in a specific net class
- all objects on a specific layer
- all objects in a specific net and on a specific layer.
The available drop-down fields will populate in accordance with the basic option chosen. When using the Net, Net Class or Layer option, use the top drop-down field to choose from:
- all defined nets in the design,
- all defined net classes in the design or
- all currently enabled layers in the design, respectively.
When using the Net and Layer option, the top drop-down will contain the list of nets in the design, with the bottom drop-down containing the list of enabled layers.As you select an option, the corresponding query will appear in the Full Query region of the dialog.The Advanced (Query) option enables you to write your own, maybe more complex, but also more specific query. Two facilities are available to provide aid in the creation of queries - the Query Builder and the Query Helper. These facilities can be very useful if you are unsure of the syntax of a query or the possible keywords that you may want to use.
Using the Query Builder
Click the Query Builder button to open the Building Query from Board dialog, which enables you to create a query for targeting specific objects in the design document, by simple construction of a string of ANDed and/or ORed conditions.The left-hand section of the dialog is where you specify the condition(s) that you require to target the set of objects needed. Initially the entry in the Condition Type/Operator column will be Add first condition . Clicking on this field will reveal a list of condition types.
The condition types listed will only reflect those relevant to building the scope for the current rule type.
Choose the first condition and click in the Condition Value column to access a drop-down list of possible values for that condition type. As you define a condition in the left-hand section of the dialog, a preview of the currently built query is shown in the right-hand section.Continue to add further conditions to narrow down your target set of design objects as required. Conditions can be ANDed or ORed together. The default logical operator is AND. To change the logical operator between conditions, click on the AND or OR entry in the Condition Type/Operator column and select the required operator. The preview of the query will update accordingly.
When the expression for the query has been defined as required, clicking OK will load the expression into the Full Query region of the PCB Rules and Constraints Editor dialog. Note that the scope option will automatically be switched to Advanced (Query) .
Specifying Precedence
The and buttons at the top of the dialog essentially allow you to add and remove brackets around the presently selected condition (increasing and decreasing indent). This allows you to create precedence for certain logically ANDed or logically ORed conditions. For example, consider the following query:(InNet('+12V') AND (OnLayer('TopLayer') AND IsTrack))
In this case, the first condition has been set to the condition type Belongs to Net , with value +12V. | |
Another condition has then been added, using the condition type Exists on Layer , with the valueTopLayer . | |
At this stage, with the second condition selected in the dialog, the right arrow button has been clicked. Brackets have been added around the second condition and now the possibility to add a condition within that pair of brackets is given. | |
The third condition with condition type Object Kind and value Track is then added within the brackets. |
Use the Show Level list to control the display of levels in your structured string of conditions, essentially expanding/collapsing the display of brackets. Adding brackets creates a new level. You can display levels 1-5. For any further levels added, use the Show All Levels option. Alternatively, click on the expand ( + ) or contract ( - ) symbols (associated with a bracketed condition) to show the next level(s) or hide the current level (and all levels below) respectively. The and buttons can also be used to expand or collapse the currently selected condition.Use the and buttons to move a selected condition in the query string being built. For a condition that has sub-levels (i.e. a bracketed condition), any condition in the level structure can be moved. When levels are expanded, a condition can be moved down or up through the levels. When levels are collapsed, a condition will be moved over the level structure.To delete a condition, select it and either click the button, or use the Delete key.
Using the Query Helper
To use the Query Helper, ensure that the Advanced (Query) option is enabled and then click on the Query Helper button to open the Query Helper dialog. The underlying query engine analyzes the PCB design and lists all available objects, along with generic keywords for use in queries.Use the Query region of the dialog to compose a query expression. You can type directly within the region. As you type, a context-sensitive prompt list of possible keywords or objects will appear as an aid.
The Categories region of the dialog provides access to available PCB Functions, PCB Object Lists and System Functions, which can be used to create the query expression. As you click on a sub-category within each of these three areas, the corresponding list of keywords or objects will be displayed in the region to the right.
Locate the keyword or object that you wish to use in the query string, using the Mask field if need be, and then double-click on the entry. The entry in the Name column will be inserted at the cursor position in the Query region of the dialog.The mid-section of the dialog provides a range of operators (as buttons) for use when constructing an expression. Use the Check Syntax button to verify that an expression is syntactically correct.When the expression for the query has been defined as required, clicking OK will load the expression into the Full Query region of the PCB Rules and Constraints Editor dialog.
{Note} You can type your own specific query for the rule scope directly into the {*}Full Query{*} region of the {_}PCB Rules and Constraints{_} dialog, or elaborate on one of the basic query entries. In either case, the {*}Query Kind{*}option will change to {*}Advanced (Query){*} and access to the {_}Query Helper{_} dialog will be made available, should you wish or need to use it. The Query Builder ( {_}Building Query from Board{_} dialog) is a simpler method of constructing a query, using sensitive condition types and values that only allow you to build using relevant 'building blocks'. For advanced query construction, with full keyword specification and operator syntax, use the {_}Query Helper{_} dialog. When using the {_}Query Helper{_} dialog to construct a query, clicking inside a typed keyword or on a keyword in one of the available lists and pressing {*}F1{*} , will launch help for that particular keyword. When using the Query Builder: * You can adjust any condition in your query string, at any time, by clicking on the entry for that condition in the {*}Condition Type/Operator{*} column and choosing the required new condition from the available entries in the drop-down list. The preview of the query expression will update accordingly * The currently selected condition or logical operator in the left side of the dialog is visually confirmed in the preview section of the dialog by the entry appearing in red text * The {*}CTRL{*} + {*}Up Arrow{*} and {*}CTRL{*} + {*}Down Arrow{*} keyboard shortcuts can also be used to move the selected condition entry up or down in the structure respectively * The {*}CTRL{*} + {*}Right Arrow{*} and {*}CTRL{*} + {*}Left Arrow{*} keyboard shortcuts can also be used to increase or decrease indent at the selected position in the structure (add/remove brackets) respectively. When building query expressions using the Query Helper: * It is highly advisable to use brackets whenever there is any possibility whatsoever that the query might not be correctly interpreted * Brackets have the highest precedence within an order of precedence that has been defined for the various operators provided and which determines how queries are interpreted by the software (whenever the user has not provided brackets). The sequence of this order is as follows: BracketsNot^,* , /, Div, Mod, And+, -, Or, Xor=, <>, <, >, <=, >=&&, ||This order of precedence is similar to that used in Pascal type languages. However, generous usage of brackets removes doubt and makes the resulting queries easier to read by others * Ambiguities are resolved by working from left to right * Parentheses are evaluated from inside to outside and equal levels are done left to right !worddav2efa9613aa2cc25c6eec075bc67f9978.png|height=1,width=368! !worddav6857a3200c7919b85b2d8fd1a1d8e1eb.png|height=207,width=269! The rule scope (Full Query) is checked automatically. If you switch from a rule with an incorrectly defined scope to another rule, the former will appear highlighted in red in the folder-tree pane of the dialog.Similarly, if you close the {_}PCB Rules and Constraints Editor{_} dialog and rules with incorrect scope definitions exist, a dialog will appear alerting you to this fact and asking if you wish to correct them. If you click{*}Yes{*} , the folder-tree pane will be fully expanded, enabling you to glance down and easily catch the offending, red-highlighted rules. {Note}