Rules : match designator or match footprint name in rule

HI
I need to write rules specific to some PCB designator , and or PCB footprint name.
Can be a match or a simple match / wildcard *, or REGEX.
I cant find in the syntax helper or doco the description for the syntax for this, I cant seem to make it work.

Any suggestions / assistance much appreciated.
Specific instance is different types of connection to the copper zone are required. (relief, solid) and on different layers , based on match with a component designator or footprint name

you can match a reference designator, or multiple reference designators, with a condition clause like (condition "A.Reference =='R1'). There’s an example with wildcards:

(rule "Distance between test points"
	(constraint courtyard_clearance (min 1.5mm))
	(condition "A.Reference =='TP*' && B.Reference == 'TP*"))

However this applies the rule to the footprint, whereas it sounds like you want to apply the rule to the pads of the footprint.

For that you could use the memberOfFootprint() function, which would be a condition clause like this:
(condition A.memberOfFootprint('R1')). This function is new in v8. There are ways to achieve this in v7, too, but it’s a little harder.

1 Like

thanks very much
ah ha. I am using 8.0 rc1 … I was not able to find mention of “memberOfFootprint” in the doco .

It’s not in the syntax helper.
and I could not find it at
docs. kicad. org/ 7.0/ en/ pcbnew/ pcbnew.html#custom_design_rules [because it is in 8 :slight_smile: ]

cheers. glen.

Ah, you’re reading the 7.0 documentation but you should be reading the 8.0 documentation (currently called “master” but that will change when 8.0 is fully released). Change the little 7.0 dropdown in the top right of the documentation to master.

I just checked, it’s in the syntax help too, towards the bottom of the the “expression functions” section. I hope we can do some reformatting of that dialog for v9 - it’s getting pretty long.

1 Like

" Nightly " . OK there it is. sorry, still learning how to find my way around.
image

1 Like

oh, sorry - it’s “nightly”, not “master”. You figured it out :slight_smile:

Wow, the custom constraint section has expanded… enormously … since 7…

If that is needed, there was a thread going on yesterday: Rule with Library_link condition doesn't work

The custom constraints were brand spanking new in KiCad V6. About 3 years of development went into KiCad V6. It was a huge leap forward, but also a long wait for a lot of users. After that it was decided to switch to a (roughly) yearly release cycle.

There is also a tradition to create a “Post Vx new featers and development news” thread each year, in which features are posted when they get added to KiCad-Nightly Vx.99. It’s a nice log to see the development speed in KiCad, and to have an overview for when you update your own KiCad version.

Post-v5 new features and development news
Post-v6 new features and development news
Post-v7 new features and development news

thanks for that.
I might end up with 20 pages of custom constraints. I will write some sort of Python based WX tool ( I write in WX for Python for my PnP processes) to break up the rules into sections. Otherwise, chaos reigns. I found the dru file.

OK, so can someone please help with with this one.
The 1st rule worked, the 2nd rule did not. In the 2nd rule, I am trying to ensure that pads that connect to the zone are solid , always for this type of component. thanks !


(version 1)
(rule 'polycon1'
(condition "A.Reference == 'R1'")
(constraint zone_connection  solid))

(rule 'polycon2'
(condition "A.memberOfFootprint('Resistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P10.16mm_Horizontal')")
(constraint zone_connection  solid))

image

MemberOfFootprint requires a reference designator.

See Rule with Library_link condition doesn't work.

OK, read the library link discussion, thanks.
So it doesnt work, (bug) or not the way I think it works ?
"Member of Footprint " for me means, it’s a pad of a footprint xyz.
This is essential for say, mounting holes that have a library namne “MH_M3WIDE” etc, without having to resort to designator specifically. Although I gather wildcards work (like MH* instead of MH1, MH2, MH3 etc) -g

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.