One correction. You still would get the “clearance to mounting holes” error seen in your latest screenshot. That’s not a bug but logical: the pad is near the board edge and the rule checks if one or the other item is an edge, nothing else. It should work with for example this:
Apologies for being a pain in the arse, but I still cannot get it to work. The following tests were carried out using 6.99.0-1665-g4ee6cfe5b6 which, if I understand correctly, should work:
Apparently “A.memberOf(‘mountingholes’)” isn’t satisfied, probably there’s a bug which doesn’t take a pad of a footprint as a member of the group to which the footprint belongs.
EDIT: wait a second, I’ll have to check again…
EDIT2: I was wrong. The problem is in the “unrealistic” example board file. The track and the pad have no net, so they are handled as being in the same net, right? It’s unclear how nonplated holes should be handled logically in this case. But when the track is given a net, the problem disappears.
I can understand that a hole edge is a board edge, kind of, because a hole could be drawn in edge.cuts and routed as well. But considering a drill hole for edge clearance isn’t helpful IMO.
This is intentional. Drilling into full copper has the risk of inter-plane shorts, especially with 0.2mm prepregs. Or think of conductive screws shearing the edge and shorting planes. Long story short: NPTHs are no different to board edges when it comes to the risks.
[EDIT] Ok, it need not necessarily be the edge clearance parameter, the NPTH hole clearance would be ok as well.
Same problems as before: The track can still be routed in the area it shouldn’t. And I’m still getting DRC errors/warnings for the mounting hole.
The hole on the edge layer however works perfectly, it throws no DRC error and it prevents the track from being routed. I’d like this same behaviour for the MountingHole as well.
The track routes in to the area you don’t want because of the last rule: since the type of object is a pad, it sets the mechanical_hole_clearance to 1mm.
The board edge violation is because you have overridden the mechanical_hole_clearance of the pad, but not the edge_clearance.
If you change that last rule from mechanical_hole_clearance to edge_clearance it might fix both.
I think you can conflate the rules 1 and 2 into one because the condition is identical and there are three different constraints for that same condition; just put all three constraints under one rule.