How to create a custom rule for hole_clearance

For high voltage nets, I would like to have a hole clearance of 1.5mm between the polygon copper pour and holes belonging to different nets. Inside the same net, I would like just a clearance of 0.5mm. How can this be done? I currently have the following:
(rule HV_hole
(condition “A.NetClass == ‘HV’”)
(constraint hole_clearance (min 1.5mm))
)

prerequiste: I’m no expert in custom design rules, so take this statement carefully, it might be wrong.

I think what you try to do will not work. Holes in itself don’t have a net assigned, so it’s hard to distinguish between hole in HV netclass and hole in other net.
I see 3 variants:

  • hole is a NPTH - so no copper around the hole, your “hole_clearance value” is taken
  • NPTH hole with annular copper, connected to high voltage: the copper-copper clearance value for high<–>high voltage should apply
  • NPTH hole with annular copper, connected to other voltage: the copper-copper clearance value for high<–>low voltage should apply

sidenote: please add the used kicad version, as the possibilities of the CAD programm evolve over time. And therefore the answer often depends on the used kicad version.