7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-20 20:21:42 +00:00

Update DRC rules syntax help

This commit is contained in:
JamesJCode 2024-11-18 21:49:56 +00:00
parent ee8d86390e
commit 120b06f916
11 changed files with 147 additions and 93 deletions

View File

@ -848,15 +848,19 @@ void PANEL_SETUP_RULES::OnSyntaxHelp( wxHyperlinkEvent& aEvent )
;
msg.emplace_back( t );
t =
#include "dialogs/panel_setup_rules_help_7expression_functions.h"
#include "dialogs/panel_setup_rules_help_7properties.h"
;
msg.emplace_back( t );
t =
#include "dialogs/panel_setup_rules_help_8more_examples.h"
#include "dialogs/panel_setup_rules_help_8expression_functions.h"
;
msg.emplace_back( t );
t =
#include "dialogs/panel_setup_rules_help_9documentation.h"
#include "dialogs/panel_setup_rules_help_9more_examples.h"
;
msg.emplace_back( t );
t =
#include "dialogs/panel_setup_rules_help_10documentation.h"
;
msg.emplace_back( t );

View File

@ -5,29 +5,29 @@ _HKI( "### Examples\n"
"\n"
" (rule HV\n"
" (constraint clearance (min 1.5mm))\n"
" (condition \"A.NetClass == 'HV'\"))\n"
" (condition \"A.hasNetclass('HV')\"))\n"
"\n"
"\n"
" (rule HV\n"
" (layer outer)\n"
" (constraint clearance (min 1.5mm))\n"
" (condition \"A.NetClass == 'HV'\"))\n"
" (condition \"A.hasNetclass('HV')\"))\n"
"\n"
"\n"
" (rule HV_HV\n"
" # wider clearance between HV tracks\n"
" (constraint clearance (min \"1.5mm + 2.0mm\"))\n"
" (condition \"A.NetClass == 'HV' && B.NetClass == 'HV'\"))\n"
" (condition \"A.hasNetclass('HV') && B.hasNetclass('HV')\"))\n"
"\n"
"\n"
" (rule HV_unshielded\n"
" (constraint clearance (min 2mm))\n"
" (condition \"A.NetClass == 'HV' && !A.enclosedByArea('Shield*')\"))\n"
" (condition \"A.hasNetclass('HV') && !A.enclosedByArea('Shield*')\"))\n"
"\n"
"\n"
" (rule heavy_thermals\n"
" (constraint thermal_spoke_width (min 0.5mm))\n"
" (condition \"A.NetClass == 'HV'\"))\n"
" (condition \"A.hasNetclass('HV')\"))\n"
"<br><br>\n"
"\n"
"" );

View File

@ -4,28 +4,28 @@
(rule HV
(constraint clearance (min 1.5mm))
(condition "A.NetClass == 'HV'"))
(condition "A.hasNetclass('HV')"))
(rule HV
(layer outer)
(constraint clearance (min 1.5mm))
(condition "A.NetClass == 'HV'"))
(condition "A.hasNetclass('HV')"))
(rule HV_HV
# wider clearance between HV tracks
(constraint clearance (min "1.5mm + 2.0mm"))
(condition "A.NetClass == 'HV' && B.NetClass == 'HV'"))
(condition "A.hasNetclass('HV') && B.hasNetclass('HV')"))
(rule HV_unshielded
(constraint clearance (min 2mm))
(condition "A.NetClass == 'HV' && !A.enclosedByArea('Shield*')"))
(condition "A.hasNetclass('HV') && !A.enclosedByArea('Shield*')"))
(rule heavy_thermals
(constraint thermal_spoke_width (min 0.5mm))
(condition "A.NetClass == 'HV'"))
(condition "A.hasNetclass('HV')"))
<br><br>

View File

@ -0,0 +1,7 @@
// Do not edit this file, it is autogenerated by CMake from the .md file
_HKI( "### Properties\n"
"\n"
"Many properties of objects are available for testing in custom rule expressions. See the full documentation at [https://docs.kicad.org](https://docs.kicad.org/GetMajorMinorVersion/en/pcbnew/pcbnew.html#custom_design_rules) for the complete list.\n"
"<br><br><br>\n"
"\n"
"" );

View File

@ -0,0 +1,5 @@
### Properties
Many properties of objects are available for testing in custom rule expressions. See the full documentation at [https://docs.kicad.org](https://docs.kicad.org/GetMajorMinorVersion/en/pcbnew/pcbnew.html#custom_design_rules) for the complete list.
<br><br><br>

View File

@ -4,6 +4,54 @@ _HKI( "### Expression functions\n"
"All function parameters support simple wildcards (`*` and `?`).\n"
"<br><br>\n"
"\n"
" A.enclosedByArea('<zone_name>')\n"
"True if all of `A` lies within the given zone's outline.\n"
"\n"
"NB: this is potentially a more expensive call than `intersectsArea()`. Use `intersectsArea()`\n"
"where possible.\n"
"<br><br>\n"
"\n"
" A.existsOnLayer('<layer_name>')\n"
"True if `A` exists on the given layer. The layer name can be\n"
"either the name assigned in Board Setup > Board Editor Layers or\n"
"the canonical name (ie: `F.Cu`).\n"
"\n"
"NB: this returns true if `A` is on the given layer, independently\n"
"of whether or not the rule is being evaluated for that layer.\n"
"For the latter use a `(layer \"layer_name\")` clause in the rule.\n"
"<br><br>\n"
"\n"
" A.fromTo('x', 'y')\n"
"True if the object exists on the copper path between the given \n"
"pads. `x` and `y` are the full names of pads in the design, such as \n"
"`R1-Pad1`.\n"
"<br><br>\n"
"\n"
" A.getField('<field_name>')\n"
"The value of the given field. Only footprints have fields, so a field is only returned if\n"
"`A` is a footprint.\n"
"<br><br>\n"
"\n"
" A.hasComponentClass('<component_class_name>')\n"
"True if the set of component classes assigned to `A` contains the named \n"
"component class.\n"
"<br><br>\n"
"\n"
" A.hasNetclass('<netclass_name>')\n"
"True if `A` has had the given netclass assigned to it, either by an explicit netclass label\n"
"or through a pattern match assignment.\n"
"<br><br>\n"
"\n"
" A.inDiffPair('<net_name>')\n"
"True if `A` has a net that is part of the specified differential pair.\n"
"`<net_name>` is the base name of the differential pair. For example, `inDiffPair('/CLK')`\n"
"matches items in the `/CLK_P` and `/CLK_N` nets.\n"
"<br><br>\n"
"\n"
" A.intersectsArea('<zone_name>')\n"
"True if any part of `A` lies within the given zone's outline.\n"
"<br><br>\n"
"\n"
" A.intersectsCourtyard('<footprint_identifier>')\n"
"True if any part of `A` lies within the given footprint's principal courtyard.\n"
"<br><br>\n"
@ -27,36 +75,22 @@ _HKI( "### Expression functions\n"
"\n"
"<br>\n"
"\n"
" A.intersectsArea('<zone_name>')\n"
"True if any part of `A` lies within the given zone's outline.\n"
"<br><br>\n"
"\n"
" A.enclosedByArea('<zone_name>')\n"
"True if all of `A` lies within the given zone's outline.\n"
"\n"
"NB: this is potentially a more expensive call than `intersectsArea()`. Use `intersectsArea()`\n"
"where possible.\n"
"<br><br>\n"
"\n"
" A.getField('<field_name>')\n"
"The value of the given field. Only footprints have fields, so a field is only returned if\n"
"`A` is a footprint.\n"
"<br><br>\n"
"\n"
" A.isPlated()\n"
"True if `A` has a hole which is plated.\n"
"<br><br>\n"
"\n"
" A.inDiffPair('<net_name>')\n"
"True if `A` has a net that is part of the specified differential pair.\n"
"`<net_name>` is the base name of the differential pair. For example, `inDiffPair('/CLK')`\n"
"matches items in the `/CLK_P` and `/CLK_N` nets.\n"
" A.isBlindBuriedVia()\n"
"True if `A` is a blind/buried via.\n"
"<br><br>\n"
"\n"
" AB.isCoupledDiffPair()\n"
"True if `A` and `B` are members of the same diff pair.\n"
"<br><br>\n"
"\n"
" A.isMicroVia()\n"
"True if `A` is a microvia.\n"
"<br><br>\n"
"\n"
" A.isPlated()\n"
"True if `A` has a hole which is plated.\n"
"<br><br>\n"
"\n"
" A.memberOfGroup('<group_name>')\n"
"True if `A` is a member of the given group. The name can contain wildcards.\n"
"Includes nested membership.\n"
@ -71,19 +105,4 @@ _HKI( "### Expression functions\n"
"True if `A` is a member of the given schematic sheet. The sheet path can contain wildcards.\n"
"<br><br>\n"
"\n"
" A.existsOnLayer('<layer_name>')\n"
"True if `A` exists on the given layer. The layer name can be\n"
"either the name assigned in Board Setup > Board Editor Layers or\n"
"the canonical name (ie: `F.Cu`).\n"
"\n"
"NB: this returns true if `A` is on the given layer, independently\n"
"of whether or not the rule is being evaluated for that layer.\n"
"For the latter use a `(layer \"layer_name\")` clause in the rule.\n"
"<br><br>\n"
"\n"
" A.hasNetclass('<netclass_name>')\n"
"True if `A` has had the given netclass assigned to it, either by an explicit netclass label \n"
"or through a pattern match assignment.\n"
"<br><br>\n"
"\n"
"" );

View File

@ -1,6 +1,54 @@
### Expression functions
All function parameters support simple wildcards (`*` and `?`).
<br><br>
A.enclosedByArea('<zone_name>')
True if all of `A` lies within the given zone's outline.
NB: this is potentially a more expensive call than `intersectsArea()`. Use `intersectsArea()`
where possible.
<br><br>
A.existsOnLayer('<layer_name>')
True if `A` exists on the given layer. The layer name can be
either the name assigned in Board Setup > Board Editor Layers or
the canonical name (ie: `F.Cu`).
NB: this returns true if `A` is on the given layer, independently
of whether or not the rule is being evaluated for that layer.
For the latter use a `(layer "layer_name")` clause in the rule.
<br><br>
A.fromTo('x', 'y')
True if the object exists on the copper path between the given
pads. `x` and `y` are the full names of pads in the design, such as
`R1-Pad1`.
<br><br>
A.getField('<field_name>')
The value of the given field. Only footprints have fields, so a field is only returned if
`A` is a footprint.
<br><br>
A.hasComponentClass('<component_class_name>')
True if the set of component classes assigned to `A` contains the named
component class.
<br><br>
A.hasNetclass('<netclass_name>')
True if `A` has had the given netclass assigned to it, either by an explicit netclass label
or through a pattern match assignment.
<br><br>
A.inDiffPair('<net_name>')
True if `A` has a net that is part of the specified differential pair.
`<net_name>` is the base name of the differential pair. For example, `inDiffPair('/CLK')`
matches items in the `/CLK_P` and `/CLK_N` nets.
<br><br>
A.intersectsArea('<zone_name>')
True if any part of `A` lies within the given zone's outline.
<br><br>
A.intersectsCourtyard('<footprint_identifier>')
@ -26,34 +74,20 @@ The `footprint_identifier` listed above can be one of the following:
<br>
A.intersectsArea('<zone_name>')
True if any part of `A` lies within the given zone's outline.
<br><br>
A.enclosedByArea('<zone_name>')
True if all of `A` lies within the given zone's outline.
NB: this is potentially a more expensive call than `intersectsArea()`. Use `intersectsArea()`
where possible.
<br><br>
A.getField('<field_name>')
The value of the given field. Only footprints have fields, so a field is only returned if
`A` is a footprint.
<br><br>
A.isPlated()
True if `A` has a hole which is plated.
<br><br>
A.inDiffPair('<net_name>')
True if `A` has a net that is part of the specified differential pair.
`<net_name>` is the base name of the differential pair. For example, `inDiffPair('/CLK')`
matches items in the `/CLK_P` and `/CLK_N` nets.
A.isBlindBuriedVia()
True if `A` is a blind/buried via.
<br><br>
AB.isCoupledDiffPair()
True if `A` and `B` are members of the same diff pair.
<br><br>
A.isMicroVia()
True if `A` is a microvia.
<br><br>
A.isPlated()
True if `A` has a hole which is plated.
<br><br>
A.memberOfGroup('<group_name>')
@ -68,20 +102,5 @@ inside that footprint). The various ways of specifying `footprint_identifier` a
A.memberOfSheet('<sheet_path>')
True if `A` is a member of the given schematic sheet. The sheet path can contain wildcards.
<br><br>
A.existsOnLayer('<layer_name>')
True if `A` exists on the given layer. The layer name can be
either the name assigned in Board Setup > Board Editor Layers or
the canonical name (ie: `F.Cu`).
NB: this returns true if `A` is on the given layer, independently
of whether or not the rule is being evaluated for that layer.
For the latter use a `(layer "layer_name")` clause in the rule.
<br><br>
A.hasNetclass('<netclass_name>')
True if `A` has had the given netclass assigned to it, either by an explicit netclass label
or through a pattern match assignment.
<br><br>

View File

@ -109,7 +109,7 @@ _HKI( "### More Examples\n"
" (rule high-current\n"
" (constraint track_width (min 1.0mm))\n"
" (constraint connection_width (min 0.8mm))\n"
" (condition \"A.NetClass == 'Power'\"))\n"
" (condition \"A.hasNetclass('Power')\"))\n"
"\n"
"\n"
" # Separate drill bit and milling cutter size constraints\n"

View File

@ -108,7 +108,7 @@
(rule high-current
(constraint track_width (min 1.0mm))
(constraint connection_width (min 0.8mm))
(condition "A.NetClass == 'Power'"))
(condition "A.hasNetclass('Power')"))
# Separate drill bit and milling cutter size constraints