TraceMaker
C++ API of the engine
Loading...
Searching...
No Matches
tmk::drc::RuleEngine Class Reference

compiled custom-rule condition More...

#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).
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.
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
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

Detailed Description

compiled custom-rule condition

Definition at line 22 of file rule_engine.hpp.

Constructor & Destructor Documentation

◆ RuleEngine()

tmk::drc::RuleEngine::RuleEngine ( const model::Board & b,
const model::DesignRules & r )

◆ ~RuleEngine()

tmk::drc::RuleEngine::~RuleEngine ( )

Member Function Documentation

◆ annular_width_min()

Coord tmk::drc::RuleEngine::annular_width_min ( const CopperItem & v) const

◆ any_physical_hole_clearance()

bool tmk::drc::RuleEngine::any_physical_hole_clearance ( ) const
inline

Definition at line 70 of file rule_engine.hpp.

◆ clearance()

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.

◆ coupled_diff_pair()

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.

◆ disallowed()

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).

◆ edge_clearance()

Coord tmk::drc::RuleEngine::edge_clearance ( const CopperItem & a,
int layer ) const

◆ hole_clearance()

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.

◆ hole_size_min()

Coord tmk::drc::RuleEngine::hole_size_min ( const CopperItem * owner) const

◆ hole_to_hole()

Coord tmk::drc::RuleEngine::hole_to_hole ( const CopperItem * a,
const CopperItem * b ) const

◆ length_constraint()

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.

◆ max_clearance()

Coord tmk::drc::RuleEngine::max_clearance ( ) const
inline

Largest clearance any pair could need (for spatial-index inflation).

Definition at line 39 of file rule_engine.hpp.

◆ max_physical_hole_clearance()

Coord tmk::drc::RuleEngine::max_physical_hole_clearance ( ) const
inline

Definition at line 74 of file rule_engine.hpp.

◆ needs_exact_routing()

bool tmk::drc::RuleEngine::needs_exact_routing ( ) const
inline

Custom rules that the per-class obstacle cache cannot represent require exact per-point checks.

Definition at line 76 of file rule_engine.hpp.

◆ net_constraint()

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.

◆ netclass()

const model::NetClass & tmk::drc::RuleEngine::netclass ( const CopperItem & it) const

◆ physical_hole_clearance()

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).

◆ positional_disallow()

bool tmk::drc::RuleEngine::positional_disallow ( ) const
inline

A disallow rule on tracks or vias depends on position, size or footprint: the router asks probe_disallowed.

Definition at line 64 of file rule_engine.hpp.

◆ probe_disallowed()

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().

◆ skew_constraint()

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.

◆ track_allowed()

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).

◆ track_width()

std::pair< Coord, Coord > tmk::drc::RuleEngine::track_width ( const CopperItem & t,
int layer ) const

Minimum and maximum track width (max = 0: none).

◆ use_zone_clearance_overrides()

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).

◆ via_allowed()

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.

◆ via_diameter_min()

Coord tmk::drc::RuleEngine::via_diameter_min ( const CopperItem & v) const

◆ via_hole_rule_hits_own_tracks()

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.

◆ warnings()

const std::vector< std::string > & tmk::drc::RuleEngine::warnings ( ) const
inline

Definition at line 77 of file rule_engine.hpp.

◆ Condition

friend class Condition
friend

Definition at line 117 of file rule_engine.hpp.


The documentation for this class was generated from the following file: