KB: Layer-Specific Design Rules with Through-Hole Pads and Vias
Solution Details
Unexpected Rule Behavior on Specific Layers
You defined a layer-specific rule, such as a clearance rule, and noticed that through-hole pads or vias are not being treated as expected. This can occur when the query used in the rule scope does not correctly include Multi-Layer objects.
Multi-Layer Objects Are Not On a Single Layer
Vias and through-hole pads are Multi-Layer objects. When a rule scope uses a query such as OnLayer('Top Layer'), the query only returns objects whose Layer property is explicitly set to Top Layer. Since through-hole pads and vias have their Layer property set to Multi-Layer, they are not returned by the OnLayer membership check.
However, although these objects are classified as Multi-Layer, they physically exist on the Top Layer and can therefore be returned using the ExistsOnLayer('Top Layer') membership check.
Select the Appropriate Layer Query Function
- Use OnLayer('Top Layer') when you want to target only objects whose layer property is explicitly assigned to the specified layer.
- Use ExistsOnLayer('Top Layer') when you want to include objects that exist on the specified layer, including through-hole pads and vias.
For layer-specific clearance rules involving through-hole pads and vias, use ExistsOnLayer in the rule scope.
Configure Rules to Include Multi-Layer Objects
- Open the PCB design rule that requires layer-specific behavior.
- Review the query expression used in the rule scope.
- If the query uses OnLayer('Top Layer'), verify whether through-hole pads and vias need to be included.
- Replace or adjust the query to use ExistsOnLayer('Top Layer') where appropriate.
- Validate the rule behavior and confirm that through-hole pads and vias are now included in the rule evaluation.
The following example shows a clearance rule for NetA and NetB for the Top Layer with and without the ExistsOnLayer check:


Please see the documentation for the ExistsOnLayer and OnLayer membership checks.