27 std::vector<int>* owners =
nullptr)
const;
29 std::vector<int>* owners =
nullptr)
const;
34 std::vector<int>* owners =
nullptr)
const;
36 return disk_state(p, layer, hw, net, margin,
false) == 0;
42 return via_state(p, d, drill, net, margin,
false) == 0;
68 bool via_hole =
false,
Coord hole_r = 0)
const;
78 const std::vector<std::pair<int, geom::Shape>>&
copper_texts()
const {
return texts_; }
83 const std::vector<geom::Point>&
outline()
const {
return outline_; }
110 int copper_state(
const geom::Shape& s,
const drc::CopperItem& probe,
int layer,
bool ignore_routed, std::vector<int>* owners)
const;
115 std::vector<int>* owners)
const;
119 std::vector<int>* owners)
const;
120 int physical_hole_state(
const geom::Shape& hole,
model::NetId net,
int layer,
bool fixed,
bool routed,
bool soft, std::vector<int>* owners)
const;
124 int routed_hole_to_hole_part(
const geom::Shape& hole,
bool soft, std::vector<int>* owners)
const;
130 std::unique_ptr<drc::RuleEngine> re_;
131 std::unique_ptr<drc::ZoneFills> fills_;
132 bool linear_zone_tests_ =
false;
133 std::unique_ptr<index::UniformGrid> grid_;
134 std::unique_ptr<index::UniformGrid> rgrid_;
135 std::unique_ptr<index::UniformGrid> hgrid_;
136 std::unique_ptr<index::UniformGrid> egrid_;
137 std::vector<geom::Shape> edge_segs_;
140 std::vector<geom::Point> outline_;
141 std::vector<std::vector<geom::Point>> cutouts_;
143 std::vector<std::uint8_t> inside_raster_;
144 int ir_w_ = 0, ir_h_ = 0;
145 Coord ir_cell_ = 250'000;
147 bool soft_zones_ =
false;
148 bool soft_mask_graphics_ =
false;
149 bool soft_copper_graphics_ =
false;
153 bool vias_off_pads_ =
false;
154 Coord vias_off_pads_max_ = 2'000'000;
155 mutable bool pad_via_exempt_ =
false;
157 std::vector<std::pair<geom::Shape, const model::Zone*>> keepouts_;
158 std::vector<geom::Shape> mask_open_[2];
160 std::vector<geom::Shape> shapes;
165 std::vector<Aperture> apertures_[2];
166 std::unique_ptr<index::UniformGrid> agrid_[2];
167 std::vector<std::pair<int, geom::Shape>> texts_;
169 Coord max_hole_local_ = 0;
171 void aperture_codes(
const geom::Shape& s,
int layer,
bool via_probe,
const std::function<
void(
model::NetId)>& hit)
const;
The board model (design doc 02 §3): every object TraceMaker reads from a .kicad_pcb,...
compiled custom-rule condition
void set_soft_zones(bool on)
Zone fills are ignored as obstacles (they are refilled after routing); they remain connection targets...
bool via_disallowed(geom::Point p, Coord d, model::NetId net, int l0, int l1, model::ViaType type) const
void set_soft_copper_graphics(bool on)
Net-less copper drawn as BOARD graphics (an EasyEDA import's pours as polygons on a copper layer) is ...
bool positional_rules() const
Custom disallow rules that depend on position, size or footprint (doc 05 §34), for new copper of net:...
int add_via(int index, int owner)
bool needs_exact_routing() const
Rules outside the per-class cache require exact per-point checks.
std::int32_t fixed_via_code(geom::Point p, Coord d, Coord drill, Coord margin, model::NetId probe_net) const
static constexpr std::int32_t kFree
Fixed-obstacle code of a disk (fixed copper, fixed holes, edges, keepouts, outline),...
int add_track(int index, int owner)
Registers committed copper (the board copy must already contain the track/via at index).
void set_vias_off_pads(bool on, Coord max_pad)
Vias keep clear of SMD pads narrower than max_pad (any net, net-class clearance), as if they were ano...
std::int32_t fixed_via_code_reference(geom::Point p, Coord d, Coord drill, Coord margin, model::NetId probe_net) const
Per-layer reference for fixed_via_code.
int routed_state(const geom::Shape &s, int layer, model::NetId net, drc::ItemKind kind, bool soft, std::vector< int > *owners, bool via_hole=false, Coord hole_r=0) const
Routed (rippable) copper only: 0 free, 1 conflicts (owners appended), 2 blocked when !...
void set_linear_zone_tests(bool on)
Reference path: test probes against every edge of a zone fill instead of the fill's edge index (the a...
const std::vector< std::pair< int, geom::Shape > > & copper_texts() const
Copper text as the model holds it: one estimated rectangle per line (copper index,...
const std::vector< geom::Point > & outline() const
Board outline polygon (largest Edge.Cuts loop) when it could be assembled; empty otherwise.
static constexpr std::int32_t kBlocked
Obstacles(model::Board &board, const model::DesignRules &rules)
board is the router's working copy; items added later must also be appended to it.
void set_pad_via_exempt(bool on) const
bool track_disallowed(const geom::Shape &s, int layer, Coord width, model::NetId net) const
bool disk_ok(geom::Point p, int layer, Coord hw, model::NetId net, Coord margin) const
bool via_ok(geom::Point p, Coord d, Coord drill, model::NetId net, Coord margin) const
void routed_items_in(const geom::Box &box, std::vector< int > &out) const
Ids of live routed items whose box meets box.
int disk_state(geom::Point p, int layer, Coord hw, model::NetId net, Coord margin, bool ignore_routed, std::vector< int > *owners=nullptr) const
Legality of a probe shape.
int segment_state(geom::Point a, geom::Point b, int layer, Coord width, model::NetId net, bool ignore_routed, std::vector< int > *owners=nullptr) const
Coord via_mask() const
Solder-mask expansion the checks give untented vias (0 when the board tents them).
void set_soft_mask_graphics(bool on)
Net-less solder-mask openings drawn as footprint graphics (a solder-jumper's bridge,...
bool segment_ok(geom::Point a, geom::Point b, int layer, Coord width, model::NetId net) const
index::UniformGrid & grid()
void set_via_mask(Coord m)
const drc::RuleEngine & rules() const
int via_state(geom::Point p, Coord d, Coord drill, model::NetId net, Coord margin, bool ignore_routed, std::vector< int > *owners=nullptr) const
int routed_via_state(const geom::Shape &s, model::LayerMask layers, model::NetId net, bool soft, Coord hole_r) const
Maximum routed_state over layers for a via and its hole; layer-independent hole checks run once.
void remove_item(int item)
Rips up a routed item (by copper item index).
bool inside_board(geom::Point p, Coord margin) const
std::int32_t fixed_code(geom::Point p, int layer, Coord hw, Coord margin, model::NetId probe_net, bool via_probe=false) const
long rej_outside
Rejection counters (diagnostics): outside board, copper, holes/edges/keepouts.
int via_state_span(geom::Point p, Coord d, Coord drill, model::NetId net, Coord margin, bool ignore_routed, std::vector< int > *owners, int l0, int l1, model::ViaType type=model::ViaType::Blind) const
A via on copper layers [l0, l1] only (blind or buried via, or a micro via with type); via_state cover...
const drc::CopperModel & copper() const
Copper connectivity with KiCad's semantics, shared by the DRC (unconnected/dangling checks) and the r...
Copper items with exact shapes, built from the board model, for DRC and routing obstacles.
std::int32_t NetId
0 = no net
std::uint64_t LayerMask
bit i = copper layer i in stack order (0 = F.Cu, last = B.Cu)
constexpr long double kPlaneTargetArea
With soft zones a fill of at least this area that no pad touches is its net's plane: a connection tar...
long double zone_fill_area(const drc::CopperModel &cm, const std::vector< int > &items)
Filled area of zone fill items (nm^2), shoelace over each item's outline.
std::int64_t Coord
Engine coordinate: signed 64-bit nanometres.
Resolves KiCad constraints for pairs of copper items (design doc 03 §6): net-class clearances,...
Design rules as KiCad defines them (design doc 08 §3–4): board minimums and net classes from the ....