KB: Using Room-Based Query Functions in PCB Filters and Design Rules
Updated: November 25, 2026
Room-based query functions allow PCB objects to be filtered, selected, and targeted by design rules based on their relationship to a defined PCB room. Use TouchesRoom() when objects that touch or cross a room boundary should be included, and use WithinRoom() when only objects fully contained within the room should be considered. Rooms can also define areas in which specific PCB design constraints apply, making these functions useful for applications such as BGA escape routing, area-specific constraints, and object selection.
Solution Details
Target Objects in Defined PCB Areas
You may need to identify, select, or apply design rules to PCB objects located within a specific room. Common examples include selecting vias in a BGA escape region, limiting routing constraints to a defined area, or excluding objects outside a controlled design region.
Understand How Room Queries Evaluate Objects
Room-based query functions evaluate the relationship between a PCB object and a room boundary. TouchesRoom() returns objects that are fully or partially within the room, while WithinRoom() returns only objects that are completely enclosed by the room. PCB design rules use queries to define which objects a rule targets, allowing room-based queries to be used for both object filtering and design rule scoping.
Choose the Appropriate Room Query
- Use TouchesRoom('Room Name') when objects crossing or touching the room boundary should be included.
- Use WithinRoom('Room Name') when only fully enclosed objects should be included.
- Combine room queries with And, Or, and Not to target more specific object sets.
- Use the Query Helper or Query Builder when constructing or validating more complex query expressions.
Apply Room Queries to Filters and Rules
- To find all objects that touch or reside within a room, enter:
TouchesRoom('BGA-Room') - To find only objects completely contained within a room, enter:
WithinRoom('BGA-Room') - To restrict either query to vias, combine it with IsVia:
IsVia And TouchesRoom('BGA-Room')or
IsVia And WithinRoom('BGA-Room') - To scope a design rule, such as Minimum Annular Ring, Minimum Hole Size, Routing Width, or Clearance, enter the required room query in the rule scope field.
- For help with a query keyword, place the cursor on the keyword in the Query Helper, a Filter panel, or the Query field of a PCB design rule, then press F1 to open the corresponding documentation.
Other object types can be targeted in the same way. For example:
| Query | Result |
| Tracks fully contained within the room. |
| Pads touching or residing within the room. |
Additional Notes
- The room name must exactly match the room name defined in the PCB document and must be enclosed in single quotes.
- Room-based queries can be used in both the PCB Filter panel and PCB design rule scopes.