|
TraceMaker
C++ API of the engine
|
#include <route/obstacles.hpp>
Public Member Functions | |
| Obstacles (model::Board &board, const model::DesignRules &rules) | |
| board is the router's working copy; items added later must also be appended to it. | |
| 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 |
| 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 covers all layers. | |
| int | via_state (geom::Point p, Coord d, Coord drill, model::NetId net, Coord margin, bool ignore_routed, std::vector< int > *owners=nullptr) const |
| bool | disk_ok (geom::Point p, int layer, Coord hw, model::NetId net, Coord margin) const |
| bool | segment_ok (geom::Point a, geom::Point b, int layer, Coord width, model::NetId net) const |
| bool | via_ok (geom::Point p, Coord d, Coord drill, model::NetId net, Coord margin) const |
| bool | positional_rules () const |
| Custom disallow rules that depend on position, size or footprint (doc 05 §34), for new copper of net: a track whose copper is s with width on layer, or a via of diameter d spanning [l0, l1]. | |
| bool | track_disallowed (const geom::Shape &s, int layer, Coord width, model::NetId net) const |
| bool | via_disallowed (geom::Point p, Coord d, model::NetId net, int l0, int l1, model::ViaType type) const |
| int | add_track (int index, int owner) |
| Registers committed copper (the board copy must already contain the track/via at index). | |
| int | add_via (int index, int owner) |
| void | remove_item (int item) |
| Rips up a routed item (by copper item index). | |
| std::int32_t | fixed_code (geom::Point p, int layer, Coord hw, Coord margin, model::NetId probe_net, bool via_probe=false) const |
| std::int32_t | fixed_via_code (geom::Point p, Coord d, Coord drill, Coord margin, model::NetId probe_net) const |
| 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 !soft. | |
| 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. | |
| bool | needs_exact_routing () const |
| Rules outside the per-class cache require exact per-point checks. | |
| void | routed_items_in (const geom::Box &box, std::vector< int > &out) const |
| Ids of live routed items whose box meets box. | |
| const drc::CopperModel & | copper () const |
| 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, rectangle). | |
| const drc::RuleEngine & | rules () const |
| index::UniformGrid & | grid () |
| geom::Box | bounds () const |
| const std::vector< geom::Point > & | outline () const |
| Board outline polygon (largest Edge.Cuts loop) when it could be assembled; empty otherwise. | |
| bool | inside_board (geom::Point p, Coord margin) const |
| Coord | via_mask () const |
| Solder-mask expansion the checks give untented vias (0 when the board tents them). | |
| void | set_via_mask (Coord m) |
| void | set_soft_zones (bool on) |
| Zone fills are ignored as obstacles (they are refilled after routing); they remain connection targets. | |
| void | set_soft_mask_graphics (bool on) |
| Net-less solder-mask openings drawn as footprint graphics (a solder-jumper's bridge, a MEMS microphone's pad group) no longer keep copper out; KiCad's mask checks flag what then lies in them (judgement, not a short). | |
| 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 fixed copper that no track may touch, and pins inside it are enclosed; soft, it is ignored like a zone fill (KiCad then flags what touches it). | |
| bool | soft_zones () const |
| 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 another net's copper; larger pads (exposed thermal pads) still take vias. | |
| void | set_pad_via_exempt (bool on) const |
| 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 answers are the same; tests/test_design_rules.cpp). | |
Public Attributes | |
| long | rej_outside = 0 |
| Rejection counters (diagnostics): outside board, copper, holes/edges/keepouts. | |
| long | rej_copper = 0 |
| long | rej_other = 0 |
| long | checks = 0 |
Static Public Attributes | |
| static constexpr std::int32_t | kFree = -1 |
| Fixed-obstacle code of a disk (fixed copper, fixed holes, edges, keepouts, outline), independent of the probe's own net: kFree, kBlocked, or the single net id whose own copper is the only conflict (so the disk is legal for that net only). | |
| static constexpr std::int32_t | kBlocked = -2 |
Definition at line 18 of file obstacles.hpp.
| tmk::route::Obstacles::Obstacles | ( | model::Board & | board, |
| const model::DesignRules & | rules ) |
board is the router's working copy; items added later must also be appended to it.
| int tmk::route::Obstacles::add_track | ( | int | index, |
| int | owner ) |
Registers committed copper (the board copy must already contain the track/via at index).
Returns the copper item index.
| int tmk::route::Obstacles::add_via | ( | int | index, |
| int | owner ) |
|
inline |
Definition at line 81 of file obstacles.hpp.
|
inline |
Definition at line 76 of file obstacles.hpp.
|
inline |
Copper text as the model holds it: one estimated rectangle per line (copper index, rectangle).
Definition at line 78 of file obstacles.hpp.
|
inline |
Definition at line 35 of file obstacles.hpp.
| int tmk::route::Obstacles::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.
Result: 0 = free, 1 = only conflicts with rippable routed copper (owners are appended to owners when given), 2 = blocked by fixed copper, holes, edges or keepouts. With ignore_routed = false, routed copper counts as blocking (result 0 or 2 only).
| std::int32_t tmk::route::Obstacles::fixed_code | ( | geom::Point | p, |
| int | layer, | ||
| Coord | hw, | ||
| Coord | margin, | ||
| model::NetId | probe_net, | ||
| bool | via_probe = false ) const |
| std::int32_t tmk::route::Obstacles::fixed_via_code | ( | geom::Point | p, |
| Coord | d, | ||
| Coord | drill, | ||
| Coord | margin, | ||
| model::NetId | probe_net ) const |
| std::int32_t tmk::route::Obstacles::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.
|
inline |
Definition at line 80 of file obstacles.hpp.
| bool tmk::route::Obstacles::inside_board | ( | geom::Point | p, |
| Coord | margin ) const |
|
inline |
Rules outside the per-class cache require exact per-point checks.
Definition at line 72 of file obstacles.hpp.
|
inline |
Board outline polygon (largest Edge.Cuts loop) when it could be assembled; empty otherwise.
Definition at line 83 of file obstacles.hpp.
|
inline |
Custom disallow rules that depend on position, size or footprint (doc 05 §34), for new copper of net: a track whose copper is s with width on layer, or a via of diameter d spanning [l0, l1].
The state checks above include them (blocked, 2); a disk's rules are judged on its copper, without the margin.
Definition at line 47 of file obstacles.hpp.
| void tmk::route::Obstacles::remove_item | ( | int | item | ) |
Rips up a routed item (by copper item index).
| void tmk::route::Obstacles::routed_items_in | ( | const geom::Box & | box, |
| std::vector< int > & | out ) const |
Ids of live routed items whose box meets box.
| int tmk::route::Obstacles::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 !soft.
| int tmk::route::Obstacles::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.
|
inline |
Definition at line 79 of file obstacles.hpp.
|
inline |
Definition at line 38 of file obstacles.hpp.
| int tmk::route::Obstacles::segment_state | ( | geom::Point | a, |
| geom::Point | b, | ||
| int | layer, | ||
| Coord | width, | ||
| model::NetId | net, | ||
| bool | ignore_routed, | ||
| std::vector< int > * | owners = nullptr ) const |
|
inline |
Reference path: test probes against every edge of a zone fill instead of the fill's edge index (the answers are the same; tests/test_design_rules.cpp).
Definition at line 105 of file obstacles.hpp.
|
inline |
Definition at line 102 of file obstacles.hpp.
|
inline |
Net-less copper drawn as BOARD graphics (an EasyEDA import's pours as polygons on a copper layer) is fixed copper that no track may touch, and pins inside it are enclosed; soft, it is ignored like a zone fill (KiCad then flags what touches it).
Off by default.
Definition at line 96 of file obstacles.hpp.
|
inline |
Net-less solder-mask openings drawn as footprint graphics (a solder-jumper's bridge, a MEMS microphone's pad group) no longer keep copper out; KiCad's mask checks flag what then lies in them (judgement, not a short).
Off by default.
Definition at line 93 of file obstacles.hpp.
|
inline |
Zone fills are ignored as obstacles (they are refilled after routing); they remain connection targets.
Definition at line 90 of file obstacles.hpp.
|
inline |
Definition at line 88 of file obstacles.hpp.
|
inline |
Vias keep clear of SMD pads narrower than max_pad (any net, net-class clearance), as if they were another net's copper; larger pads (exposed thermal pads) still take vias.
set_pad_via_exempt(true) lifts this around the checks of one deliberate via in pad (the router's –via-in-pad).
Definition at line 101 of file obstacles.hpp.
|
inline |
Definition at line 97 of file obstacles.hpp.
| bool tmk::route::Obstacles::track_disallowed | ( | const geom::Shape & | s, |
| int | layer, | ||
| Coord | width, | ||
| model::NetId | net ) const |
| bool tmk::route::Obstacles::via_disallowed | ( | geom::Point | p, |
| Coord | d, | ||
| model::NetId | net, | ||
| int | l0, | ||
| int | l1, | ||
| model::ViaType | type ) const |
|
inline |
Solder-mask expansion the checks give untented vias (0 when the board tents them).
Escape analysis sets it to 0 to ask "would a via fit here if vias were tented?"; routing never changes it.
Definition at line 87 of file obstacles.hpp.
|
inline |
Definition at line 41 of file obstacles.hpp.
| int tmk::route::Obstacles::via_state | ( | geom::Point | p, |
| Coord | d, | ||
| Coord | drill, | ||
| model::NetId | net, | ||
| Coord | margin, | ||
| bool | ignore_routed, | ||
| std::vector< int > * | owners = nullptr ) const |
| int tmk::route::Obstacles::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 covers all layers.
| long tmk::route::Obstacles::checks = 0 |
Definition at line 107 of file obstacles.hpp.
|
static |
Definition at line 61 of file obstacles.hpp.
|
staticconstexpr |
Fixed-obstacle code of a disk (fixed copper, fixed holes, edges, keepouts, outline), independent of the probe's own net: kFree, kBlocked, or the single net id whose own copper is the only conflict (so the disk is legal for that net only).
Clearances use probe_net's class; diff-pair relief is not applied (safe).
Definition at line 61 of file obstacles.hpp.
| long tmk::route::Obstacles::rej_copper = 0 |
Definition at line 107 of file obstacles.hpp.
| long tmk::route::Obstacles::rej_other = 0 |
Definition at line 107 of file obstacles.hpp.
|
mutable |
Rejection counters (diagnostics): outside board, copper, holes/edges/keepouts.
Definition at line 107 of file obstacles.hpp.