Defining, Scoping & Managing PCB Design Rules

Now reading version 2.0. For the latest, read: Defining, Scoping & Managing PCB Design Rules for version 5

Nexus message

This documentation page references Altium NEXUS/NEXUS Client (part of the deployed NEXUS solution), which has been discontinued. All your PCB design, data management and collaboration needs can now be delivered by Altium Designer and a connected Altium 365 Workspace. Check out the FAQs page for more information.

 

Parent page: Specifying the Design Requirements

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, and so on, 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. And as the PCB Editor is rules-driven, taking the time to set up the rules at the outset 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.

For detailed information on the checking of defined design rules, see Design Rule Checking.

Fundamentals of the PCB Rules System

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:

  • Rules are separate from the objects - a rule is not added as an attribute of an object, but is rather added to the overall rule set and then scoped to apply to that object. This allows rules to be applied to multiple objects, modified, or applied to different objects, which would otherwise be painful to do if having to change rule attributes at the individual object level.
  • Rules are targeted (scoped) by writing a query - instead of using a set of fixed, predefined rule scopes, a flexible query system is used to define the objects that a rule is applied to. This gives precise control over the target of each and every design rule.
  • Rules for any design situation - multiple rules of the same type can be defined and targeted to different sets of objects, allowing complete control over the definition of board constraints. For example, different width rules can be defined to route nets at different widths, on different layers.
  • Each rule has a priority - any design object can be targeted by multiple rules of the same type, catering for general and more specific situations. To resolve any rule contention, the rule priority is used. The system simply goes through the rules from highest to lowest priority, and picks the first one whose scope expression(s) match the object(s) being checked.
  • There are two types of rule - unary rules (rules that define the required behavior of an object) and binary rules (rules that define the interaction between two objects).

Defining and Managing Design Rules

Design rules are defined and managed from within the PCB Rules and Constraints Editor dialog. The dialog has two sections:

  • The tree on the left lists the different rule categories. Expand a category to display the individual rule types available. Expand a rule type to display all rules of that type that are currently defined.
  • The right-hand side of the dialog presents information in relation to what is currently selected in the tree - either a summary of defined rules of the selected rule type or category, all defined rules for the entire system or, if an actual rule is selected, the constraints for that rule.

The PCB Rules and Constraints Editor dialog - command central for managing design rules.The PCB Rules and Constraints Editor dialog - command central for managing design rules.

Creating a New Rule

To add a new design rule from within the PCB Rules and Constraints Editor dialog, simply navigate to, and select the required rule type, within the left-hand tree, and either:

  • click the New Rule button, below the rule summary list, or
  • right-click and 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.

Example creation of a new PCB design rule.Example creation of a new PCB design rule.

When a new rule is added, it will initially be given a default name based on the specific type of rule. If a rule with that name already exists, it will simply be given an incremented numerical suffix (i.e. Width_1, Width_2, and so on).

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.

Accessing the detailed controls for the rule, including scope and constraints.Accessing the detailed controls for the rule, including scope and constraints.

To fully define the new rule, you should:

  • Give the rule a meaningful name to make it identifiable.
  • Define the scope of the rule by selecting scoping options from the drop-down(s), or by entering a query (or queries for a binary rule).
  • Set the constraints of the rule.
  • Set the priority of the rule.

Using the Rule Wizard to Create a 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. Steps involve:

  1. Choosing the required rule type, and giving it a meaningful name (and comment if required).
  2. Defining the scope of the rule. You will have the opportunity to further enhance scoping through an incarnation of the Query Builder - built in to the Wizard.
  3. Setting the rule priority.
If the Launch main design rules dialog option is enabled on the last page of the Wizard, the PCB Rules and Constraints Editor dialog will appear upon clicking the Finish button. This dialog can be used to edit the constraints for your newly-created rule.

Use the Design Rule Wizard to streamline rule creation.Use the Design Rule Wizard to streamline rule creation.

Duplicating an Existing Rule

To quickly create an identical copy of an existing rule, use the duplicate feature. This feature can be accessed in two ways:

  • Use the tree on the left to navigate to the required existing rule, right-click, and choose Duplicate Rule from the context menu.
  • Navigate to the specific rule type in the tree on the left, select the rule to be duplicated in the summary list on the right, then click the Duplicate Rule button below the list.

Streamline creation of similar rules using the rule duplication feature.Streamline creation of similar rules using the rule duplication feature.

The duplicate rule will be named the same as the original, with the addition of a suffix (e.g. _1) to distinguish it. It's 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.

Scoping a Rule

Main page: Scoping Design Rules

For the PCB rules system to know what objects a given rule applies to, it needs to know the scope of that rule - the extent of its application. Scoping, or targeting the rule, is performed in the PCB Rules and Constraints Editor dialog, by configuring the Where the Object Matches options.

The default design rules, or when a new rule 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 switched 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.

Depending on whether the rule is unary or binary, you will need to define one or two scopes respectively.

Learn more about Scoping Design Rules

If there is a syntax error with the query, the rule will be deemed invalid, and 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 are 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 should the designer attempt to close this dialog. A rule scope that has a syntax error can greatly slow the Online and Batch DRC analysis process - be sure to resolve any rule scopes that are not syntactically correct.

Scoping Options

Simple scoping options are provided that allow you to quickly generate scope queries. Simply 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.

Quickly create a query using the simple scoping options.Quickly create a query using the simple scoping options.

When you scope the rule using the simple scoping options, a query is still created. The query is displayed if you select Custom Query in the first drop-down field.

The Custom Query option enables you to write your own, maybe 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 - the Query Builder and the Query Helper. These can be very useful when unsure of the syntax of a query, or the possible keywords available for use.

Use the Custom Query option to craft a more complex query expression for your scoping.Use the Custom Query option to craft a more complex query expression for your scoping.

The Query Builder 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.

Rule Prioritization

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, 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, you 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 targeted 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.

Change rule priorities in the Edit Rule Priorities dialog.Change rule 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 hence 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.

Multiple rules of the same type can be set up. It may arise that a design object is covered by more than one rule with the same scope. In this instance, a contention exists. All contentions are resolved by the priority setting. The system goes through the rules from highest to lowest priority, and picks the first one whose scope expression(s) match the object(s) being checked.

Modifying Existing Rules

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 the scoping, to ensure the target design objects are being 'picked up' by the respective rule(s) as required. Simply 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 bold without an asterisk).

Example of an existing rule that has been modified. An asterisk is used to flag the modification, along with the rule name
being made bold.

When a new rule is created for a particular rule type, it is automatically given priority 1. If any other rules of that type exist, their priorities will be shifted (lowered), by one, accordingly. They are then considered to be modified - even though they may not have been specifically modified at the scope/constraint level. All such existing rules of that type will therefore be displayed in the modified state (bold with asterisk).

Flagging Invalid Rules

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 are 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 should you attempt to close the dialog.

An example of the system flagging an invalid design rule, in this case an erroneous scope query expression.An example of the system flagging an invalid design rule, in this case an erroneous scope query expression.

Disabling Rules

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 perhaps they need to be temporarily disabled to ease the load on the Design Rule Checker (and speeding 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, simply 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 will also appear with a 'greyed-out' appearance.

Example disabled rules, appearing in grey font within a summary list.Example disabled rules, appearing in grey font within a summary list.

Rules can also be disabled/enabled directly from the PCB Rules And Violations panel. Simply toggle the rule's associated On option. This is reflected in the rule's Enable option, back in the PCB Rules and Constraints Editor dialog.

Deleting Rules

To delete a single design rule from within the PCB Rules and Constraints Editor dialog:

  • Use the tree on the left to navigate to the required existing rule, right-click and choose Delete Rule from the context menu.
  • Navigate to the specific rule type in the tree on the left, then select the rule to be deleted in the summary list on the right. Then click the Delete Rule(s) button below the list.

The rule name will appear bold with strike-through highlighting to distinguish it as being a deletion that is yet to be 'applied'.

Deleting a single rule.Deleting a single rule.

If a particular design rule is no longer required but may be used again in the future, then rather than delete it, it can simply be disabled. Do this by toggling the corresponding Enable option for the rule in one of the relevant summary lists, on the right-hand side of the PCB Rules and Constraints Editor dialog.
Multiple rules can be deleted in a single action, from a summary list view. To do so, simply select the rules to be deleted (standard Shift+click and Ctrl+click shortcuts are supported), then click the Delete Rule(s) button below the list.

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.

Checking Rule Application

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 and observing which objects fall under its scope.

From an Object's Perspective

For any placed object in the current design, you can quickly access information about which unary design rules apply to that object. Simply position the cursor over the object, right-click, and 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.

Design rules applicable to a single example design object - unary rules.Design rules applicable to a single example design object - unary rules.

Each rule listed in the dialog will have either a tick () or a cross () next to it. A tick 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.

Any rules that would apply to the object but are currently disabled would also have a cross next to them and would appear using strikethrough highlighting.

In a similar fashion, you can also access information about the binary design rules that apply between two placed objects in a design. Simply position the cursor over any object, right-click and select Applicable Binary Rules. Follow the prompts to select two objects in the design. The Applicable Rules dialog will then appear, displaying all binary design rules that apply between those objects.

Design rules applicable between two example design objects - binary rules.Design rules applicable between two example design objects - binary rules.

From a Rule's Perspective

If, rather than seeing which rules apply to an object (or between two objects) you would prefer to pick a rule and see which objects that rule applies to, this can be achieved 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.

An example of using the PCB Rules And Violations panel to check which objects a selected rule applies to.An example of using the PCB Rules And Violations panel to check which objects a selected rule applies to.

If the highlighting method in the dialog has been set to Mask, adjust the level of masking applied to objects not falling under the scope of the active filter, by using the Masked Objects slider bar - accessed from the Mask and Dim Settings section, on the View Options tab of the View Configuration panel. If the highlighting method in the dialog has been set to Dim, adjust the level of dimming applied to objects not falling under the scope of the active filter, by using the Dimmed Objects slider bar - also available from this section of the panel.

Another approach to examining which objects a rule applies to is the Test Query feature in the PCB Rules and Constraints Editor dialog.

Exporting and Importing Rules

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.

  • To export - right-click anywhere within the tree on the left of the dialog and select Export Rules. Exported rules are stored in a PCB Rule file (*.rul).
  • To import - select Import Rules from the same right-click menu, then browse to and open, the required PCB Rule file.

In both cases, you can choose which types of design rules to export/import.

When importing, if rules of a chosen type already exist, the option will be given to clear the existing rules prior to import. Clicking Yes results in all existing rules of that type being deleted, subsequently replaced with those in the .rul file. Clicking No will keep the existing rules. However, if existing rules and imported rules have the same name, the imported rules will overwrite the existing ones.

Design Rule Reports

A report of currently defined design rules can be generated from within the PCB Rules and Constraints Editor dialog. The report can cater for all rule categories, a specific rule category, or a specific rule type. A report can be generated by:

  • Accessing the required summary list, right-clicking, and choosing the Report command from the context menu, or clicking the Report button below the list.
  • Right-clicking over the respective entry in the folder-tree, and choosing the Report command from the context menu.

The Report Preview dialog will appear, with the appropriate report already loaded. Use this dialog to inspect the report using various page/zoom controls, before ultimately exporting it to file, or printing it.

Generate a PCB Rules Report.Generate a PCB Rules Report.

Defining Rules on the Schematic

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:

  1. Add a parameter as a rule.
  2. Select which rule type to use.
  3. Configure the constraints for the chosen rule type.
When adding design rule parameters to objects on a schematic, a unique ID is given to each rule parameter. The same IDs are given to the corresponding design rules that are created on the PCB. With this Unique ID, the constraints of a rule can be edited on either the schematic or PCB side, and the changes pushed through upon synchronization.

Learn more about Parameter Sets.

Check out an example of using Differential Pair directive together with a Blanket to define design rules on the schematic.

If you find an issue, select the text/image and pressCtrl + Enterto send us your feedback.
Content