77 const std::vector<std::string>&
warnings()
const {
return warnings_; }
81 enum : std::uint16_t {
82 kTrack = 1, kVia = 2, kThroughVia = 4, kMicroVia = 8, kBlindVia = 16, kBuriedVia = 32, kPad = 64, kZone = 128, kGraphic = 256,
83 kRouted = kTrack | kVia | kThroughVia | kMicroVia | kBlindVia | kBuriedVia,
87 std::unique_ptr<Condition> cond;
89 bool positional =
false;
90 std::uint16_t words = 0;
92 bool words_match(std::uint16_t words,
const CopperItem& it,
const model::ViaType* via_type,
bool span)
const;
94 bool disallow_hit(
const Compiled& c,
const CopperItem& it,
int layer,
const model::ViaType* via_type =
nullptr,
bool span =
false)
const;
96 std::optional<Coord> custom_min(
const char* type,
const CopperItem* a,
const CopperItem* b,
int layer)
const;
97 bool layer_matches(
const std::string& sel,
int layer)
const;
99 const model::Board& b_;
100 const model::DesignRules& r_;
101 std::vector<Compiled> rules_;
102 std::vector<std::string> warnings_;
103 Coord max_clearance_ = 0;
104 std::vector<const model::NetClass*> net_class_;
105 std::vector<model::NetId> dp_partner_;
108 mutable std::map<std::tuple<const void*, int, int>,
bool> area_cache_;
109 mutable std::mutex area_mutex_;
110 CourtyardCache courtyards_;
111 std::vector<geom::Box> zone_box_;
112 bool positional_disallow_ =
false;
113 bool any_custom_clearance_ =
false;
114 bool zone_overrides_ =
false;
115 bool needs_exact_ =
false;
116 Coord max_physical_hole_ = 0;
The board model (design doc 02 §3): every object TraceMaker reads from a .kicad_pcb,...
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 ite...
Coord max_clearance() const
Largest clearance any pair could need (for spatial-index inflation).
bool needs_exact_routing() const
Custom rules that the per-class obstacle cache cannot represent require exact per-point checks.
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 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 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 ...
void use_zone_clearance_overrides()
KiCad applies a copper zone's own clearance to its fill (ZONE::GetLocalClearance): the larger of it a...
const std::vector< std::string > & warnings() const
Coord hole_clearance(const CopperItem *hole_owner, const CopperItem &other, int layer) const
Required clearance between a hole and a copper item.
Coord max_physical_hole_clearance() const
bool positional_disallow() const
A disallow rule on tracks or vias depends on position, size or footprint: the router asks probe_disal...
std::pair< Coord, Coord > track_width(const CopperItem &t, int layer) const
Minimum and maximum track width (max = 0: none).
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,...
Coord annular_width_min(const CopperItem &v) 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,...
Coord clearance(const CopperItem &a, const CopperItem &b, int layer) const
Required copper-to-copper clearance between two items on a copper layer.
bool any_physical_hole_clearance() const
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).
Coord hole_size_min(const CopperItem *owner) const
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 o...
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,...
Coord hole_to_hole(const CopperItem *a, const CopperItem *b) const
Coord edge_clearance(const CopperItem &a, int layer) const
RuleEngine(const model::Board &b, const model::DesignRules &r)
Coord via_diameter_min(const CopperItem &v) const
const model::NetClass & netclass(const CopperItem &it) const
Copper items with exact shapes, built from the board model, for DRC and routing obstacles.
std::int32_t NetId
0 = no net
std::int64_t Coord
Engine coordinate: signed 64-bit nanometres.
Positional custom-rule predicates.
Design rules as KiCad defines them (design doc 08 §3–4): board minimums and net classes from the ....