Parent page: Laying out Your PCB in Altium Designer
The PCB Editor uses the concept of Design Rules to define the requirements of a design. These rules collectively form an 'instruction set' for the PCB editor to follow. They cover every aspect of the design – from routing widths, clearances, plane connection styles, routing via styles, etc., and many of the rules can be monitored in real-time by the online Design Rule Checker (DRC).
Design rules target specific objects and are applied in a hierarchical fashion, for example, there is a clearance rule for the entire board, then perhaps a clearance rule for a class of nets, then perhaps another for one of the pads in a class. Using the rule priority and the scope, the PCB editor can determine which rule applies to each object in the design.
With a well-defined set of design rules, you can successfully complete board designs with varying and often stringent design requirements. Additionally, since the PCB Editor is rules-driven, taking the time to set up the rules at the beginning of the design will enable you to effectively get on with the job of designing, safe in the knowledge that the rules system is working hard to ensure that success.
The rules system built into the software's PCB editor has several fundamental features that set it apart from most other design rule systems employed by other PCB editing environments:
The dialog has two sections:
To add a new design rule from within the PCB Rules and Constraints Editor dialog, navigate to and select the required rule type within the left-hand tree then click the New Rule button below the rule summary list, or right-click over the required rule type then select New Rule from the context menu.
The new rule will be added to the folder tree and will also appear in the summary list for that rule type.
To access the scope and constraint attributes for the rule, either click on the entry for the rule in the folder-tree pane or double-click on its entry in a summary list. The main editing window of the dialog will change to give access to the controls for defining the scope and constraint attributes for that rule.
To fully define the new rule:
A new rule can also be created using the Design Rule Wizard. Access is made directly using the Design » Rule Wizard command or by clicking the Rule Wizard button at the bottom of the PCB Rules and Constraints Editor dialog.
Use the pages of the Wizard to create a new design rule. The steps are:
To quickly create an identical copy of an existing rule, use the duplicate feature. This feature can be accessed in two ways:
The duplicate rule will be named the same as the original, with the addition of a suffix (e.g.,
_1) to distinguish it. Its definition (scope, constraints, etc.,) will be identical to that of the original. In terms of priority, it will be given the next priority below that of the original rule. So, for example, if the original rule has priority 1, the duplicate will be given priority 2.
Since a design rule is scoped to apply to a target set of design objects, it can be easier (and faster) to first identify those objects then create a design rule that targets them. The PCB Filter panel provides the facility for creating a design rule, the scope of which uses the currently defined query expression in the panel. So rather than struggling to visualize what your query expression might target, use the PCB Filter panel to test and tweak a query expression until only those required objects are filtered. By then creating a rule that uses that query expression, you are guaranteed to be targeting the correct set of objects.
To add a new design rule:
Over time, a number of useful query expressions will be constructed in the course of laying out various boards. Typically, you will want to apply and re-apply the same queries, not only in the same design but across different designs. To allow this, the PCB Filter panel supports the notion of Historical and Favorite queries.
As a query is entered and applied from the panel, it will be added to a query 'history list'. In addition, that query can be added to a query 'favorites list' by clicking the Add To Favorites button. Use the History and Favorites buttons in the panel to access the corresponding tabs of the same name within the Expression Manager dialog to see these lists.
To use an expression in either list, double-click on its entry or select its entry and click the Apply Expression button. The Expression Manager dialog will close and the expression will be loaded into the Filter region of the PCB Filter panel.
This functionality streamlines (and expedites) the creation of rules with requisite scoping – retrieve a historical or favorite query expression, check that it still targets the required object set (apply the filter) then create a rule that utilizes that expression in its scoping, as detailed in the previous section.
Altium Designer's PCB editor is a rules-driven environment. Design requirements are enforced through a well-defined set of design rules that collectively define the constraints for the board. Design rules target specific objects within a design. For the PCB rules system to know for which objects a given rule applies, it needs to know the scope of that rule, i.e. the extent of its application. Scoping, or targeting the rule, is performed in the PCB Rules and Constraints Editor dialog.
The default design rules, or a new rule that is added, will have the default rule scope of
All, meaning it will be applied to all objects on the board. Using the drop-down, a simple rule scope can be quickly configured.
Rather than being restricted to a predefined list of possible target options, each design rule can be more tightly scoped by writing what is called a Query.
To enter a query, set the first Where the Object Matches drop-down to
Custom Query. It will display the query currently being used by the rules engine for this rule based on the current drop-down settings.
A query is essentially an instruction to the software that defines the set of design objects to be targeted. Queries are written using query keywords. In the same way that a query can be written in a Filter panel to find a specific set of objects, a query also can be written to define the objects that each rule targets. An example might be:
InNet('VBAT') And OnLayer('Bottom Layer')
If this query were to be used as the scope for a Width rule, whenever you route the VBAT net and switch to the bottom layer, the track width would automatically change to the width specified as part of that rule's constraints. Also, upon running a design rule check, any VBAT net routing on the bottom layer would have to have the specified width or it would be flagged as a violation.
Simple scoping options are provided that allow you to quickly generate scope queries. Select one of the options from the first drop-down field and, if required, use the subsequent drop-down list(s) to select the appropriate target, such as a Net, Layer, Footprint, Package, and so on. The scoping options presented are focused according to rule type.
Custom Query option enables you to write your own, perhaps more complex but also more specific query. You can type your own specific query for the rule scope directly into the query region to the right. Alternatively, two features are available to help in the creation of logical query expressions. They are the Query Builder and the Query Helper. These can be useful when you are unsure of the syntax of a query or the keywords that are available.
Click the 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 the simple construction of a string of conditional statements.
The left-hand section of the dialog is used to specify the condition(s) required to target the set of objects needed. Each condition is made up of a Condition Type and a Condition Value. Drop-down fields for these populate with entries that are relevant to building a scope for the current rule type and values for the chosen condition type, respectively.
As a condition is defined, a preview of the currently built query is shown in the right-hand section of the dialog. Conditions can be ANDed and/or ORed together, and also precedence incorporated (through the use of brackets/indenting) to refine the target set of objects. When the expression for the query has been defined as required, clicking OK will load the expression into the query region of the PCB Rules and Constraints Editor dialog.
With the Custom Query option enabled, click the button to access 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.
Working with the Query Helper is fairly intuitive, even more so when you break it down into three distinct areas as shown in the image below:
These areas are:
Use the button (bottom-left of the dialog) 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 query region of the PCB Rules and Constraints Editor dialog.
Before leaving this area, it is worth taking a look at the order of precedence in place for the operators used in logical Query expressions. After all, without such knowledge, an expression may not target the objects required.
Brackets have the highest precedence within an order of precedence that has been defined for the various operators, and which determines how queries are interpreted by the software (whenever the user has not provided brackets). The sequence of this order from highest to lowest is as follows:
To simplify the process of defining and managing rules, the idea is to define general rules that cover broad requirements and then override these with specific rules in specific situations. For this to be possible, you need to be able to prioritize the rules in order to indicate which one to use when an object is targeted by multiple rules of the same type.
For example, to specify the most commonly used routing width on the board, define a single rule that applies to every net on the board. This rule can then be overridden for a specific net (or a class of nets for that matter) by adding another rule of the same type, but with a higher priority.
Another example could be the solder mask requirements. Here you would define one mask rule that targets every pad and via on the board, which could then be overridden for the pads in a specific footprint-kind. This footprint-specific rule could further be overridden for a specific pad in that footprint if required.
An important aspect of managing the rules is ensuring that all the priorities are set appropriately. When a new rule is created, it defaults to the highest priority. Use the Priorities button at the bottom of the PCB Rules and Constraints Editor dialog to configure the priorities in the Edit Rule Priorities dialog.
Initially, the dialog will list all rule instances for the rule type that is currently selected in the PCB Rules and Constraints Editor dialog. Use the Rule Type field to change the rule type and list the specific rules defined for that type. The defined rules are listed in order of current priority – from 1 (highest priority) downwards. Select a rule entry and use the Increase Priority and Decrease Priority buttons to move it up or down in the priority order respectively.
Rules, of course, can be modified at any time. Indeed, to arrive at the final working set of rules often involves a few key refinements here and there. Typically this involves scoping to ensure the target design objects are being 'picked up' by the respective rule(s) as required. Select an existing rule in the PCB Rules and Constraints Editor dialog and make changes as necessary to its scoping and constraint attributes.
Changes made to existing rule definitions are highlighted in both the folder-tree pane and the applicable summary lists. Such entries are distinguished by the rule name becoming bold and an asterisk displayed to the right of the name. The asterisk is used to reflect that the rule is an existing rule that has been modified, rather than a newly-created rule (which is displayed in bold without an asterisk).
If a rule is detected as being invalid by the system – for example, it has an issue with its scoping query expression or a value for a constraint that is not allowed – it will be flagged as being invalid. Such a rule will be highlighted in red within the PCB Rules and Constraints Editor dialog both in the left-hand rule tree, and any summary view (rule category or rule type) in which the rule appears. In addition, the text for the rule type and rule category is also presented in red within the left-hand rule tree. So if you have collapsed an area of the rule tree that contains an invalid rule, you will still be alerted to it at a higher level in the hierarchy. A warning message will also appear if you attempt to close the dialog.
In the rules-driven environment of the software's PCB editor, it is not uncommon to build up a rather impressive and comprehensive array of rules with which to successfully constrain your boards. For whatever reason along the way, you may wish to disable some rules; perhaps they are not applicable to the board in question or they need to be temporarily disabled to ease the load on the Design Rule Checker (and speed up its performance as a result!). Disabling is a good way of keeping such rules just in case they are needed again in the future.
To disable a rule, toggle the corresponding Enable option for that rule in one of the relevant summary lists on the right-hand side of the PCB Rules and Constraints Editor dialog. A disabled rule also will appear 'grayed-out'.
To delete a single design rule from within the PCB Rules and Constraints Editor dialog:
The rule name will appear bold with strike-through highlighting to distinguish it as being a deletion that is yet to be 'applied'.
Many rule types have default rules created when a new PCB document is created. In a similar fashion, if all specific rules for one of those rule types are deleted, the default rule will be re-added automatically the next time the PCB Rules and Constraints Editor dialog is accessed. Alternatively, default rules can be created again by clicking the Create Default Rules button at the bottom of the dialog.
Design rules can be exported from and imported to the PCB Rules and Constraints Editor dialog. This allows you to save and load favorite rule definitions between different designs.
A report of currently defined design rules can be generated from within the PCB Rules and Constraints Editor dialog. The report can cater to all rule categories, a specific rule category, or a specific rule type. A report can be generated by:
The Report Preview dialog will open with the appropriate report already loaded. Use this dialog to inspect the report using various page/zoom controls before ultimately exporting it to a file or printing it.
The Constraints Editor is a document-based user interface that offers an alternative approach for viewing, creating and managing the design constraint rules used for your PCB layouts. The editor is arranged into six selectable rule sections of increasing priority – Nets, Diff Pairs, xSignals, Polygons, Components, and Advanced. In this arrangement, the first five sections (Nets to Components) represent a design object view of the rules, while the Advanced view section applies to more complex rules (typically using queries) that cannot be expressed as the simpler design object-orientated rules.
The Constraints Editor is accessed by clicking the Switch to Document View button in the PCB Rules and Constraints Editor dialog.
Some of the advantages of using the editor are:
In the Constraints Editor, existing rules that feature more complex query expressions in their matching scope are considered Advanced Rules (or Custom Rules) while simpler rules are re-expressed as the object-type Basic Rules, i.e. rules based on the type of design objects being checked.
Most rules in the Advanced (query-based) format can be converted to the simpler Basic rules by dragging and dropping the rule onto the Basic Rules listing or by selecting the Move Custom Rule to Basic option from the Advanced rule's right-click menu. When converted, the advanced rule's query-based scope will be interpreted to the basic rule's object type qualification.
In general, the priority of Rules is dealt with automatically by the system. This is indicated by the arrangement of the rules view buttons in the interface, which are positioned by rule priority from left to right – Nets having the lowest priority.
Creating a new rule in the editor's default Advanced mode (as indicated and selected using the button) is similar to constructing a rule in the PCB Rules and Constraints Editor dialog. Select Add Custom Rule from the right-click context menu (or the button), add a query-based matching scope if required () then enter the constraint parameters in the column grid or the lower graphical representation.
To simplify the repeated process of creating advanced/custom type rules, the Constraints Editor allows you to store query-based object matching scopes in the Scopes Library dialog (access using the menu). The library is presented in the Properties panel where custom scopes can be imported, managed and exported for reuse in other custom constraint rules. The use of a library-based scope in a rule is indicated by an icon in the rule's Object Match column entry.
To take a simpler design-object orientation approach to constraint rule creation, select a suitable object mode button at the top of the rules grid to change from the default Advanced mode. Conceptually, these modes present a more integrated rule interface that focuses on constraining (limiting) how design objects can be applied rather than the creation of breakable design rules. The positional sequence of the design object buttons relates to increasing object complexity (and rule priority), from basic Nets (and classes) to unified Components up to the Advanced mode.
When in Advanced mode (), the rules are grouped by type, such as the basic
Width constraint rules shown in the below images. Further rule specificity can be created by adding a further rule and/or including a query language element.
Conversely, the object-orientated views (Nets to Components) organize the rules by design objects (e.g., Nets) or classes (e.g., Net Class) and as a result, provide a direct overview of how the rules apply to the design. To see an overview of rules that apply to an object type, select an object or class in the left column to see all associated rules, or select All to see all rules associated with the object type. The below example shows the overview of rules associated with Nets ().
When using the design object orientated approach, for example, with the Nets object type selected as shown below, the basic Via and Width rules are integrated into one composite entry. The grid layout also offers provision for more constraints to be added by (Net) object and class.
Adding further, more specific constraints in this example requires only that a Net or Net Class is selected and suitable values entered in the grid cells that correspond to the desired type of constraint rule. As shown below, a larger Via size has been permitted for
Power nets (defined by its class), and an increased maximum track width is assigned to the
5V supply rail net. In effect, four rules are encompassed in one simple grid view, i.e. a width constraint for the 5V net, a width constraint for all other nets, a Via size constraint for the Power nets, and a Via size constraint for all other net classes.
Use the button to add a variation of the currently selected constraint rule, such as in the example shown below, where an additional
5V net rule sets a preferred width for the
Note that the availability of rule types within the grid entries is set by the available columns, which is, in turn, specified by those enabled in the Properties panel Rule Visibility listing. For example, enabling the Clearance entry in the Rule Visibility list will add the Clearance column to the Nets object type, as shown below. Adding an applicable clearance rule then involves just entering a net or class scope and suitable distance parameters.
The validity of all active rules can be checked in the Rules/Constraints Checks region of the Properties panel by clicking the button. This action detects rules for likely errors such as duplicated rules, rules of the same scope with different values, rules with overlapping class members (such as nets), and rules with unresolved scopes. Each violation type entry can be expanded to show its violating rule(s), which when selected, will open the specific rule entry.
Enabled design constraint rules are applied to the current board design through a range of mechanisms, such as live Online Design Rule Checking, the batch Design Rule Checker or selectively run from the PCB Rules And Violations panel. Violations of those constraint Rules – where the specified and scoped limits are exceeded – are indicated through board graphics, panel entries and reports, as well as alert icons in the Constraints Editor. Additionally, as a bonus, violations can be inspected, analyzed and corrected while the Constraints Editor is open thanks to its design document (rather than dialog) format.
Design constraints (rules) can be defined prior to PCB layout by adding Parameter Set directives to the schematic source document(s) with configured rule(s). The scope of the corresponding PCB design rule, created when the design is transferred to the PCB document, is determined by the nature of the object to which the parameter is assigned. The following table summarizes the schematic parameter-to-PCB rule scope options that are supported.
|Add a rule to a...||From...||For a PCB Rule Scope of...|
|Wire||the Properties panel (when browsing the properties of the selected parameter set object), after placing a Parameter Set object on the wire using the Place » Directives » Parameter Set command.||Net|
|Bus||the Properties panel (when browsing the properties of the selected parameter set object), after placing a Parameter Set object on the bus using the Place » Directives » Parameter Set command.||Net Class|
|Harness||the Properties panel (when browsing the properties of the selected parameter set object), after placing a Parameter Set object on the harness using the Place » Directives » Parameter Set command.||Net Class|
|Blanket||the Properties panel (when browsing the properties of the selected parameter set object), after placing a Parameter Set object on the edge of the blanket using the Place » Directives » Parameter Set command. Include a class with the required name, to create a net class for all nets covered by the blanket, which will then be used for the rule scope.||Net Class|
In each case, the method of adding a rule-based parameter is the same:
Depending on the board design, a fair number of design rules may need to be defined with scopes that range from the very simple to the very complex. It is a good idea to check that the rules defined do indeed target their intended objects. Care at the rule definition stage can save wasted time and effort tracing violations caused through incorrect rule scoping.
There are essentially two methods for verifying rule scopes – either by selecting design objects and interrogating the rules that currently apply to them or by taking a rule (in different locations or the software) and observing which objects fall under its scope.
For any placed object in the current design, you can quickly access information about which unary design rules apply to that object. Position the cursor over the object, right-click then select Applicable Unary Rules. All defined design rules that could be applied to the selected object are analyzed and listed in the Applicable Rules dialog.
Each rule listed in the dialog will have either a check () or a cross () next to it. A check indicates the rule with the highest priority out of all applicable rules of the same type; this is the rule currently applied. Lower priority rules of the same type are listed with a cross next to them, indicating that they are applicable but, as they are not the highest priority rule, they are not currently applied.
In a similar fashion, you also can access information about the binary design rules that applies between two placed objects in a design. Position the cursor over any object, right-click then select Applicable Binary Rules. Follow the prompts to select two objects in the design. The Applicable Rules dialog will then open and display all binary design rules that apply between those objects.
You can also quickly see what objects a particular rule applies to from the PCB Rules And Violations panel. The panel lists all currently defined rules for the design. All rules can be viewed or you can browse specifically by rule type – provided at least one rule of any given type has been defined for the active design. As you click on a specific rule in the Rules region of the panel, filtering will be applied using the rule as the scope of the filter. Only those design objects that fall under the scope of the rule will be filtered. By employing the Mask (or Dim) highlighting feature, you can quickly see the resulting objects targeted by the rule.
Using the PCB Rules And Violations panel to interrogate which objects a rule applies to is particularly useful when creating a query for a rule’s scope(s) since a rule can be edited directly from the panel and therefore, the query can be 'tweaked' until the desired objects are captured by the scope(s).
To edit the scope(s) for a rule as well as its constraints, either double-click on the rule's entry in the panel or right-click and choose Properties from the context menu. The relevant Edit PCB Rule dialog will appear from where the changes can be made.
The PCB Rules and Constraints Editor dialog includes a query testing facility, allowing you to quickly see what objects a particular rule applies to. Click the button at the top-right of the main editing window for the rule you want to test. The Test Queries Result dialog will appear. This dialog reflects the number of objects falling under the scope of the expression, how many are applicable to the current rule, and how many are applicable based on the rule's current priority (where multiple applicable rules exist). By clicking on a link to the right, you can quickly filter to see the applicable objects in each case directly in the workspace.
The Constraints Editor includes a cross-probe feature that will show a constraint rule's object scope by visually highlighting the net and connections in the corresponding PCB layout. To cross probe to any rule in the editor's grid listing, right-click on its entry then choose the Cross Probe option from the context menu or select Cross Probe from an advanced rule's menu.
Set the Cross Probe View Settings (the Zoom and Select options) in the Properties panel and use the PCB editor Clear Filter option to reset cross probe highlighting.