Selector-Based Layout Rules
As opposed to Object-Specific Layout Rules, selector-based rules can apply to more than one object. Selectors choose the objects that a rule applies to. The selector syntax is based on the CSS Selector Syntax. If you use other PCB design tools, selectors are similar to queries.
Adding a selector-based rule
Ask Flux to create a ruleset. Describe the objects that the rules apply to and the rule values.
You can also do it in the editor.
To create a ruleset:
Navigate to the PCB editor of your project
Select the "Rules" tab in panel on the left of the screen
Choose the "New Ruleset" button and new item will appear underneath the project rules titled "New Ruleset"

Once you select that new ruleset, you will notice that a new panel appears on the right side of the canvas. This is where you will determine the selectors that determine what objects are affected and the rules that will apply to the objects
Select "Edit" under the "Layout Rules" section of the right-hand panel and then click "Add".
Add the rules that you wish to define in your currently selected ruleset.
Select the value for each of the added rules.
Highlighting
To help you understand what you're selecting, Flux will highlight objects that match your selector. Once you finish typing, bounding boxes will appear on the canvas and in the Objects list.

Case Sensitive
Selectors are case sensitive. For example, in the above screenshot, only trace will select all traces for you, but Trace will not select anything.
Selector types
Type Selector
Syntax | What it selects |
|---|---|
objectname | Selects all objects that have the specified object type. |
Example
This PCB project has two resistors and a trace. Since the object type of the resistors is element, the element selector is selecting them and applying a rule, which is rotating them. The trace, however, is unaffected, since it isn't an element type.

You must use specific object types, such as layoutor trace. See a full list of all the object type.
Designator Selector
Syntax | What it selects |
|---|---|
| Selects an object based on the value of its designator. There should be only one object with a given designator in a project. This is similar to the CSS #id Selector. |
Example: #R2 will match the object that has the designator "R2".

Note: Use unique designators. If both of these resistors have the designator "R2", #R2 selects both of them.

Property Selector
Selects all objects that have the specified property.
This kind of selector has different operations that let you customize selections.
Direct Select
Exact Value Match
Partial Match - One word
Partial Match - Whole word or followed by a hyphen
Partial Match - Prefix
Partial Match - Suffix
Partial Match - Occurrence
Configure case sensitivity for matching
1. Direct Select
Syntax | What is selects |
|---|---|
| Selects objects that have a property named |
Details: Only properties with set values will be selected. For example, if you had a resistor with property "Resistance" but with an empty value, then [Resistance] does not select the resistor.

To select properties with multiple words, omit the spaces between the words. For example, to select objects that have set values for "Manufacturer Name" property, type [ManufacturerName] .

2. Exact Value Match
Syntax | What it selects |
|---|---|
| Selects objects that have a property named |
Example
Two resistors come from different manufacturers. To select only one of them:
R1 with "Manufacturer Name" = "Microchip"
R2 with "Manufacturer Name" = "Texas Instruments"
Typing [ManufacturerName="Texas Instruments"] will select R2.

If the value has multiple words, you must wrap it inside a double quote. However, if the value is a single word (i.e. with no space in between), you can omit the double quotes. For example, to select R1 in the above example, both selectors work:
[ManufacturerName="Microchip"][ManufacturerName=Microchip]Always wrap the value in double quotes, so that the value is distinct from the case sensitivity indicator (see the last two topics of this section below)
3. Partial Match - One word
Syntax | What it selects |
|---|---|
| Selects objects that have a property named |
Example
Set up R1 and R2 as follows:
R1 with "Manufacturer Name" = "Microchip"
R2 with "Manufacturer Name" = "Texas Instruments"
Typing [ManufacturerName~="Texas"] will select R2 because "Texas Instruments" contains the word "Texas".

Important Notes:
You must wrap the value in double quotes. In other words,
[ManufacturerName~=Texas]might not always work.This syntax only matches complete words. So an incomplete word like
ManufacturerName~="Texa"]won't select anything because "Texas Instruments" doesn't contain word "Texa".
4. Partial Match - Whole word or followed by a hyphen
Syntax | What it selects |
|---|---|
| Selects objects that have a property named |
Example
Set up R1 and R2 as follows:
R1 with "Manufacturer Name" = "Microchip", and no other properties
R2 with
"Manufacturer Name" = "Texas Instruments"
"Manufacturer Part Number" = "N-123"
"Datasheet URL" = "Texas" - just for demoing purpose
[ManufacturerName|="Texas"] will NOT select R2, because the value of "Manufacturer Name" is not "Texas"

[ManufacturerPartNumber|="N"] will select R2.

[DatasheetURL|="Texas"] will select R2.

Important Notes:
You must wrap the value in double quotes. In other words,
[DatasheetURL|=Texas]might not always work.The
valuehas to be a whole word, either alone, or followed by a hyphen (-).
5. Partial Match - Prefix
Syntax | What it selects |
|---|---|
| Selects objects that have a property named |
Example
Set up R1 and R2 as follows:
R1 with "Manufacturer Name" = "Microchip"
R2 with "Manufacturer Name" = "Texas Instruments"
Then, [ManufacturerName^="Tex"] will select R2.

Important Notes
Since this is a prefix match, it is not required to match the whole word. Any
valuethat begins with the specified prefix will match.Spaces can be included in the prefix. For example,
[ManufacturerName^="Texas "]will also select R2 in this case.
6. Partial Match - Suffix
Syntax | What this selects |
|---|---|
| Selects objects with a property named |
Example
Set up R1 and R2 as follows:
R1 with "Manufacturer Name" = "Microchip"
R2 with "Manufacturer Name" = "Texas Instruments"
Then, [ManufacturerName$="ments"] will select R2.

Since this is a suffix match, it is not required to match the whole word. Any value ending with the specified suffix will match.
7. Partial Match - Occurrence
Syntax | What this selects |
|---|---|
| Selects objects with a property named |
Example
Set up R1 and R2 as follows:
R1 with "Manufacturer Name" = "Microchip"
R2 with "Manufacturer Name" = "Texas Instruments"
Then, [ManufacturerName*="c"] will select R1, because "Microchip" contains the letter "c".

Details
Since this is an occurrence match, it is not required to match the whole word. Any
valuecontaining the specified string will match.Any length of
valuemay be used. This example uses "c".
8. Configure case sensitivity for matching
Syntax | What this selects |
|---|---|
| Adding an |
| Adding an |
Explanation
By default, value matches are case sensitive. For example, set up R1 and R2 as follows:
R1 with "Manufacturer Name" = "Microchip"
R2 with "Manufacturer Name" = "Texas Instruments"
[ManufacturerName*="i"] will only match R1 but not R2. R2 has an uppercase letter "I", which does not match. And because this is the default setting, [ManufacturerName*="i"] is equivalent to [ManufacturerName*="i"s] .

If you add an "i" at the end, [ManufacturerName*="i"i] will select both R1 and R2.

Grouping Selectors
Selector List
Syntax | What this selects |
|---|---|
| The |
Example
Set up R1 and R2 as follows:
R1 with "Manufacturer Name" = "Microchip"
R2 with "Manufacturer Name" = "Texas Instruments"
#R1, [ManufacturerName="Texas Instruments"] will select both R1 and R2.

Combinators
Descendant Combinator
Syntax | What this selects |
|---|---|
| The " " (space) combinator selects objects that are descendants of the first object. |
Example
The following example has three pads on a board. One of them is under "Components" (which is a container object), and the other two are under the Layout object. There are also two resistors under "Components", and each resistor has two pads in their sub-layouts.
Typing #R1 pad will only select the pad under resistor R1, because it selects all pads that are descendants of the component with designator "R1".

This selector selects descendants of the first object. In the example above, layout pad selects all three pads because all three pads are descendants of the Layout node.

Child Combinator
Syntax | What this selects |
|---|---|
| The |
Example
This example uses the setup from Descendant Combinator above.
The selector layout > pad selects only the two pads that are directly under the Layout node, because it looks for direct children.

Basic Examples
Below is a series of basic examples that involve using selector syntax. See further below for more advanced examples that may involve multiple syntax points.
Setting Text Size for Selected Capacitors
Ask Flux to create this ruleset:
To create it in the editor, use this selector and rule:
Selector input: #C2 text, #C4 text, C6 text
Applied rules: Font Size
This sets the text size for components C2, C4, and C6
The space between C2 and text signifies the children of the C2 elements
The comma acts as a logical addition or inclusive disjunction, essentially adding more elements to select
Objects that can be selected in this method include: net, trace, pad, text

Setting Trace Width for All Nets
Ask Flux to create this ruleset:
To create it in the editor, use this selector and rule:
Selector input: net
Applied rules: Trace Width
This selects all net objects in the layout and applies the Trace Width Rule
Setting Font Size of Specific Text
Ask Flux to create this ruleset:
To create it in the editor, use this selector and rule:
Selector input: [name*=VALUE]
Applied rules: Font Size
This finds all objects with a property called name that contains the word VALUE
The designer added this property to these objects earlier
Setting Keep Out Clearances for a Component’s Pads
Ask Flux to create this ruleset:
To create it in the editor, use this selector and rule:
Selector input: #C1 pad
Applied rules: Keep Out, Keep Out Minimum
This sets the keep out values only for the pads of C1
C1 was selected using the #, all of its children were selected using the space, and then just the pads was selected using the pad input
Selecting Based off Components’ Other Properties
Ask Flux to create this ruleset:
To create it in the editor, use this selector and rule:
Selector input: [Manufacturer Name*=Hirose]
This will select all component’s that have a Manufacturer Name property, that contains the text Hirose

Setting Trace Width and Keep Out for Microstrip Traces
Ask Flux to create this ruleset:
To create it in the editor, use this selector and rule:
Selector input: #RF1,#RF2
Applied rules: Keep Out, Trace Width
Nets RF1 and RF2 were specifically named as they are microstrip traces and need special care
Another method: adding an RF property set to TRUE for necessary components, then create a selector rule with selector input:
[RF*=TRUE]

Setting Custom Solder Mask for all Component-Unrelated Pads
Ask Flux to create this ruleset:
To create it in the editor, use this selector and rule:
Selector input: layout>pad
This selector input selects all direct children of the layout that are pads. Because pads that are part of components are children of the components, which in turn are children of the layout, they are NOT selected. Rather, going one step down the hierarchy from the layout root, all designer-added additional pads will be selected, NOT related to components.
Component pads are children of the components themselves
If instead was a space between
layoutandpadthen all pads in the layout (regardless of location in the hierarchy) will be selected.
Advanced Examples
Setting Custom Size of Text for Specific Manufacturers
Selector input: [ManufacturerName$="ments"] text
Applied rules: Font size
This will select the text size of all components with a manufacturer name that contains "ments" .