|
TraceMaker
C++ API of the engine
|
#include <drc/rule_engine.hpp>
Public Member Functions | |
| RuleEngine (const model::Board &b, const model::DesignRules &r) | |
| ~RuleEngine () | |
| Coord | clearance (const CopperItem &a, const CopperItem &b, int layer) const |
| Required copper-to-copper clearance between two items on a copper layer. | |
| Coord | hole_clearance (const CopperItem *hole_owner, const CopperItem &other, int layer) const |
| Required clearance between a hole and a copper item. | |
| Coord | hole_to_hole (const CopperItem *a, const CopperItem *b) const |
| Coord | edge_clearance (const CopperItem &a, int layer) const |
| std::pair< Coord, Coord > | track_width (const CopperItem &t, int layer) const |
| Minimum and maximum track width (max = 0: none). | |
| std::string | track_width_severity (const CopperItem &t, int layer) const |
| The severity of the last rule with a track_width constraint that matches the track ("" when none matches or it sets none): in KiCad that rule decides the track's width check, so an ignored rule hides the board minimum too (tuning profiles, doc 05 §58). | |
| Coord | via_diameter_min (const CopperItem &v) const |
| Coord | annular_width_min (const CopperItem &v) const |
| Coord | hole_size_min (const CopperItem *owner) const |
| Coord | max_clearance () const |
| Largest clearance any pair could need (for spatial-index inflation). | |
| void | use_zone_clearance_overrides () |
| KiCad applies a copper zone's own clearance to its fill (ZONE::GetLocalClearance): the larger of it and the net-class clearance, unless a pad override or custom rule decides. | |
| const model::NetClass & | netclass (const CopperItem &it) const |
| bool | coupled_diff_pair (model::NetId a, model::NetId b) const |
| True if the two nets are the P/N (or +/-) halves of one differential pair. | |
| std::pair< std::optional< Coord >, std::optional< Coord > > | length_constraint (model::NetId net) const |
| Length constraint (min, max) of the last custom rule whose condition matches a track of net, if any. | |
| std::optional< Coord > | skew_constraint (model::NetId net) const |
| Maximum skew of the last custom rule with a skew constraint matching a track of net, if any. | |
| std::optional< model::Constraint > | net_constraint (model::NetId net, const std::string &type) const |
| Last custom constraint of type (e.g. diff_pair_gap, diff_pair_uncoupled) whose rule matches a track of net. | |
| int | last_rule_with (const CopperItem &it, int layer, const std::string &type) const |
| KiCad's matched-length check groups items by the rule that gives them a constraint (DRC_ENGINE::EvalRules' parent rule; doc 05 §59): the position in rule order of the last rule with a type constraint matching it on layer, or -1. | |
| const model::CustomRule & | rule (int i) const |
| int | net_rule_with (model::NetId net, const std::string &type) const |
| The same for a net as a whole (a track of net on any layer), as length_constraint and net_constraint see it. | |
| model::NetId | dp_partner (model::NetId net) const |
| The other half of net's differential pair (KiCad's DpCoupledNet), or 0. | |
| bool | dp_positive (model::NetId net) const |
| True when net is the positive half of a pair (P or +, match_dp_suffix); only meaningful when dp_partner(net) is set. | |
| std::optional< std::string > | disallowed (const CopperItem &it, int layer) const |
| Name of the last rule disallowing it on layer, if any (KiCad: items_not_allowed). | |
| bool | track_allowed (model::NetId net, int layer) const |
| Router fast paths for a new track or via of net, from rules whose conditions do not depend on the item's position, size or footprint (per-net layer and via-type masks). | |
| bool | via_allowed (model::NetId net, model::ViaType type=model::ViaType::Through) const |
| Blind router probes have no span yet, so either blind/buried keyword conservatively forbids them. | |
| bool | positional_disallow () const |
| A disallow rule on tracks or vias depends on position, size or footprint: the router asks probe_disallowed. | |
| bool | probe_disallowed (const CopperItem &it, model::ViaType type=model::ViaType::Through) const |
| A new track or via (index -1, actual shape, width and layers; a via's layers are its span, which tells blind from buried) is disallowed on one of its layers, every custom rule applied in order as in disallowed(). | |
| Coord | physical_hole_clearance (const CopperItem *hole_owner, const CopperItem &other, int layer) const |
| Hole-to-copper clearance on layer, any net; -1 when no rule matches (KiCad: hole_clearance). | |
| bool | any_physical_hole_clearance () const |
| bool | via_hole_rule_hits_own_tracks (model::NetId net) const |
| True when a physical_hole_clearance rule holds between a via of net and a track of the same net: the tracks that end in a via touch its hole, so every via of that net would break the rule. | |
| Coord | max_physical_hole_clearance () const |
| Coord | router_hole_clearance () const |
| Hole-to-copper clearance the router keeps between a hole and other nets' copper: the board minimum raised to every applied custom hole_clearance rule. | |
| bool | needs_exact_routing () const |
| Custom rules that the per-class obstacle cache cannot represent require exact per-point checks. | |
| const std::vector< std::string > & | warnings () const |
Friends | |
| class | Condition |
Definition at line 32 of file rule_engine.hpp.
| tmk::drc::RuleEngine::RuleEngine | ( | const model::Board & | b, |
| const model::DesignRules & | r ) |
| tmk::drc::RuleEngine::~RuleEngine | ( | ) |
| Coord tmk::drc::RuleEngine::annular_width_min | ( | const CopperItem & | v | ) | const |
|
inline |
Definition at line 98 of file rule_engine.hpp.
| Coord tmk::drc::RuleEngine::clearance | ( | const CopperItem & | a, |
| const CopperItem & | b, | ||
| int | layer ) const |
Required copper-to-copper clearance between two items on a copper layer.
| bool tmk::drc::RuleEngine::coupled_diff_pair | ( | model::NetId | a, |
| model::NetId | b ) const |
True if the two nets are the P/N (or +/-) halves of one differential pair.
| std::optional< std::string > tmk::drc::RuleEngine::disallowed | ( | const CopperItem & | it, |
| int | layer ) const |
Name of the last rule disallowing it on layer, if any (KiCad: items_not_allowed).
|
inline |
The other half of net's differential pair (KiCad's DpCoupledNet), or 0.
Definition at line 75 of file rule_engine.hpp.
|
inline |
True when net is the positive half of a pair (P or +, match_dp_suffix); only meaningful when dp_partner(net) is set.
Definition at line 79 of file rule_engine.hpp.
| Coord tmk::drc::RuleEngine::edge_clearance | ( | const CopperItem & | a, |
| int | layer ) const |
| Coord tmk::drc::RuleEngine::hole_clearance | ( | const CopperItem * | hole_owner, |
| const CopperItem & | other, | ||
| int | layer ) const |
Required clearance between a hole and a copper item.
| Coord tmk::drc::RuleEngine::hole_size_min | ( | const CopperItem * | owner | ) | const |
| Coord tmk::drc::RuleEngine::hole_to_hole | ( | const CopperItem * | a, |
| const CopperItem * | b ) const |
| int tmk::drc::RuleEngine::last_rule_with | ( | const CopperItem & | it, |
| int | layer, | ||
| const std::string & | type ) const |
KiCad's matched-length check groups items by the rule that gives them a constraint (DRC_ENGINE::EvalRules' parent rule; doc 05 §59): the position in rule order of the last rule with a type constraint matching it on layer, or -1.
rule(i) is that rule.
| std::pair< std::optional< Coord >, std::optional< Coord > > tmk::drc::RuleEngine::length_constraint | ( | model::NetId | net | ) | const |
Length constraint (min, max) of the last custom rule whose condition matches a track of net, if any.
|
inline |
Largest clearance any pair could need (for spatial-index inflation).
Definition at line 52 of file rule_engine.hpp.
|
inline |
Definition at line 102 of file rule_engine.hpp.
|
inline |
Custom rules that the per-class obstacle cache cannot represent require exact per-point checks.
Definition at line 109 of file rule_engine.hpp.
| std::optional< model::Constraint > tmk::drc::RuleEngine::net_constraint | ( | model::NetId | net, |
| const std::string & | type ) const |
Last custom constraint of type (e.g. diff_pair_gap, diff_pair_uncoupled) whose rule matches a track of net.
| int tmk::drc::RuleEngine::net_rule_with | ( | model::NetId | net, |
| const std::string & | type ) const |
The same for a net as a whole (a track of net on any layer), as length_constraint and net_constraint see it.
| const model::NetClass & tmk::drc::RuleEngine::netclass | ( | const CopperItem & | it | ) | const |
| Coord tmk::drc::RuleEngine::physical_hole_clearance | ( | const CopperItem * | hole_owner, |
| const CopperItem & | other, | ||
| int | layer ) const |
Hole-to-copper clearance on layer, any net; -1 when no rule matches (KiCad: hole_clearance).
|
inline |
A disallow rule on tracks or vias depends on position, size or footprint: the router asks probe_disallowed.
Definition at line 92 of file rule_engine.hpp.
| bool tmk::drc::RuleEngine::probe_disallowed | ( | const CopperItem & | it, |
| model::ViaType | type = model::ViaType::Through ) const |
A new track or via (index -1, actual shape, width and layers; a via's layers are its span, which tells blind from buried) is disallowed on one of its layers, every custom rule applied in order as in disallowed().
|
inline |
Hole-to-copper clearance the router keeps between a hole and other nets' copper: the board minimum raised to every applied custom hole_clearance rule.
The router's checks and caches have no per-pair hole rule, so a rule with a condition or a layer is kept everywhere (conservative, rule 6; a warning says so). The DRC stays exact (hole_clearance above).
Definition at line 107 of file rule_engine.hpp.
|
inline |
Definition at line 71 of file rule_engine.hpp.
| std::optional< Coord > tmk::drc::RuleEngine::skew_constraint | ( | model::NetId | net | ) | const |
Maximum skew of the last custom rule with a skew constraint matching a track of net, if any.
| bool tmk::drc::RuleEngine::track_allowed | ( | model::NetId | net, |
| int | layer ) const |
Router fast paths for a new track or via of net, from rules whose conditions do not depend on the item's position, size or footprint (per-net layer and via-type masks).
| std::pair< Coord, Coord > tmk::drc::RuleEngine::track_width | ( | const CopperItem & | t, |
| int | layer ) const |
Minimum and maximum track width (max = 0: none).
| std::string tmk::drc::RuleEngine::track_width_severity | ( | const CopperItem & | t, |
| int | layer ) const |
The severity of the last rule with a track_width constraint that matches the track ("" when none matches or it sets none): in KiCad that rule decides the track's width check, so an ignored rule hides the board minimum too (tuning profiles, doc 05 §58).
| void tmk::drc::RuleEngine::use_zone_clearance_overrides | ( | ) |
KiCad applies a copper zone's own clearance to its fill (ZONE::GetLocalClearance): the larger of it and the net-class clearance, unless a pad override or custom rule decides.
The DRC enables it; the router does not yet (D51: changing it needs a routing benchmark run).
| bool tmk::drc::RuleEngine::via_allowed | ( | model::NetId | net, |
| model::ViaType | type = model::ViaType::Through ) const |
Blind router probes have no span yet, so either blind/buried keyword conservatively forbids them.
Board items are distinguished exactly by whether their span touches an outer copper layer.
| Coord tmk::drc::RuleEngine::via_diameter_min | ( | const CopperItem & | v | ) | const |
| bool tmk::drc::RuleEngine::via_hole_rule_hits_own_tracks | ( | model::NetId | net | ) | const |
True when a physical_hole_clearance rule holds between a via of net and a track of the same net: the tracks that end in a via touch its hole, so every via of that net would break the rule.
|
inline |
Definition at line 110 of file rule_engine.hpp.
|
friend |
Definition at line 154 of file rule_engine.hpp.