|
TraceMaker
C++ API of the engine
|
Classes | |
| struct | UnionFind |
| struct | Connectivity |
| struct | ItemGraph |
| KiCad 10's item graph (pcbnew/connectivity, CN_VISITOR): items of any nets are linked when their copper touches on a common layer, except two items that cannot change net (pads, zone fills, free vias) on different nets. More... | |
| struct | ZoneFills |
| Edge buckets of every zone fill (geom::PolygonIndex), so the zone questions below cost the nearby edges only. More... | |
| struct | CopperItem |
| struct | Hole |
| struct | CopperModel |
| struct | Flashing |
| The copper layers of each via (vias) and pad (pads) as KiCad 10.0.6 flashes them (PCB_VIA::FlashLayer, PAD::FlashLayer): a layer keeps its copper unless the padstack removes unconnected copper there and neither a zone connection (zone_layers) nor a track, arc, via or pad of the net (not of the pad's own footprint) touches it. More... | |
| struct | Coupling |
| struct | ViolationItem |
| struct | Violation |
| struct | DrcOptions |
| struct | DrcReport |
| struct | ViaHeights |
| The length a via adds to its net in KiCad's length calculation (KiCad 10, BOARD_STACKUP::GetLayerDistance): the stackup between the two copper layers the via joins, with the copper of an outer layer in full and of an inner layer by half. More... | |
| struct | LengthItems |
| The items of one net that a length or skew rule matched: indices into the board's pads, tracks, arcs and vias. More... | |
| struct | NetLength |
| KiCad's LENGTH_DELAY_STATS. Lengths in nm, delays in attoseconds. More... | |
| struct | RefillResult |
| struct | StarvedThermal |
| A thermal relief KiCad's DRC reports as starved_thermal (DRC_TEST_PROVIDER_ZONE_CONNECTIONS::testZoneLayer): fewer spokes reach the zone's fill than the board's minimum (min_resolved_spokes, 2 by default), counting tracks that run from the pad into the fill; spokes into a fill island that touches nothing but this pad do not count unless the pad has no other. More... | |
| struct | DpSuffix |
| compiled custom-rule condition More... | |
| class | RuleEngine |
| struct | CourtyardRegion |
| struct | CourtyardEntry |
| struct | CourtyardCache |
Enumerations | |
| enum class | ItemKind : std::uint8_t { Pad , Track , Arc , Via , Zone , Graphic } |
Functions | |
| Connectivity | compute_connectivity (const model::Board &b, const CopperModel &cm, index::UniformGrid &grid, bool overlap_links=false, const ZoneFills *fills=nullptr) |
| bool | in_item_graph (const CopperItem &it) |
| bool | can_change_net (const CopperItem &it) |
| ItemGraph | item_graph (const model::Board &b, const CopperModel &cm, index::UniformGrid &grid) |
| std::vector< int > | zones_touching (const CopperModel &cm, const ZoneFills &zf, index::UniformGrid &grid, const geom::Shape &s, model::LayerMask layers, Coord clearance=0) |
| Zone-fill items on layers whose copper is closer than clearance to s (0, the default: overlap only, as KiCad's SHAPE::Collide; 1: touching counts), ascending item indices. | |
| std::vector< model::NetId > | propagate_nets (const CopperModel &cm, const ItemGraph &g, const ZoneFills &zf, index::UniformGrid &grid) |
| The nets KiCad's DRC sees after loading a board (CN_CONNECTIVITY_ALGO::PropagateNets, run by every connectivity build): a via touching only zone fills takes a zone's net (its own if one of the zones has it, else the lowest); then in every cluster of the graph without zones whose pads carry one net only, tracks, arcs, vias and board graphics take that net (a stray via on a track joins the track's net; a track bridging two nets keeps its own). | |
| const char * | kind_name (ItemKind k) |
| KiCad expression type names: Pad, Track, Arc, Via, Zone, Graphic. | |
| std::vector< geom::Shape > | pad_shapes (const model::Pad &pad) |
| Pad copper shape in absolute coordinates. | |
| CopperModel | build_copper (const model::Board &b) |
| model::LayerMask | conditional_layers (const model::Via &v) |
| KiCad's ConditionallyFlashed: the layers of a via, or of a plated through-hole pad on a board of copper_count layers, whose copper depends on what connects there. | |
| model::LayerMask | conditional_layers (const model::Pad &p, int copper_count) |
| Flashing | flash_layers (const model::Board &b) |
| std::vector< std::vector< model::Point > > | edge_loops (const std::vector< geom::Shape > &edges, Coord tol=2 '000, bool *all_closed=nullptr) |
| Closed loops chained from Edge.Cuts pieces whose ends meet within tol; pieces that close no loop are dropped (all_closed, if given, tells whether any was). | |
| std::optional< Coupling > | couple (model::Point p0, model::Point p1, Coord wp, model::Point n0, model::Point n1, Coord wn) |
| The two centrelines (a P track from p0 to p1 of width wp, an N track likewise) coupled as KiCad couples them, or nothing: both longer than about 1 nm, exactly parallel (a zero cross product) and not collinear, with overlapping projections. | |
| DrcReport | run_drc (const model::Board &b, const model::DesignRules &r, const DrcOptions &opt={}) |
| void | write_drc_json (const DrcReport &rep, const std::string &path) |
| Writes the report in kicad-cli's JSON layout (violations, unconnected_items; positions in mm). | |
| ViaHeights | via_heights (const model::Board &b, const model::DesignRules &rules) |
| NetLength | net_length (const model::Board &b, const model::DesignRules &rules, const ViaHeights &vh, const LengthItems &items, const model::TuningProfile *profile) |
| Length and delay of items, all of one net. | |
| RefillResult | refill_zones (const model::Board &b, const model::DesignRules &r) |
| Follows ZONE_FILLER::fillCopperZone: outline within the board, thermal gaps around same-net pads, every other item knocked out at its clearance, spokes that reach the fill, minimum-width pruning, then islands without a pad removed by each zone's island_removal_mode. | |
| std::vector< StarvedThermal > | starved_thermals (const model::Board &filled, const model::DesignRules &r) |
| On a board whose fills are current (refill_zones' board): every pad KiCad would report, in pad then zone order. | |
| std::vector< geom::Ring > | thermal_spokes (const model::Pad &pad, const model::Zone &zone) |
| The four spoke polygons of a pad's thermal relief to a zone, as the zone filler draws them (buildThermalSpokes). | |
| DpSuffix | match_dp_suffix (std::string_view name) |
| bool | area_matches (const CopperItem &item, const model::Zone &area, bool enclosed) |
| Requires a common copper layer. | |
| CourtyardCache | build_courtyards (const model::Board &board) |
| Build once per board; invalid/unclosed contours leave the corresponding side empty and marked unreadable. | |
| bool | footprint_selected (const std::string &selector, const std::string &reference, const std::string &lib_id) |
| KiCad's footprint selector (testFootprintSelector): a reference wildcard, or, when the selector contains ':', a library-id wildcard. | |
| bool | courtyard_matches (const CopperItem &item, const CourtyardCache &courtyards, const std::string &selector, const std::string &function) |
| Function is intersectsCourtyard/intersectsFrontCourtyard/intersectsBackCourtyard. | |
| std::vector< int > | courtyard_entries (const CourtyardCache &courtyards, const std::string &selector) |
| The entries a footprint selector picks, in entry order, and the same test against them. | |
| bool | courtyard_matches (const CopperItem &item, const CourtyardCache &courtyards, const std::vector< int > &entries, const std::string &function) |
|
strong |
| Enumerator | |
|---|---|
| Pad | |
| Track | |
| Arc | |
| Via | |
| Zone | |
| Graphic | |
Definition at line 11 of file copper.hpp.
| bool tmk::drc::area_matches | ( | const CopperItem & | item, |
| const model::Zone & | area, | ||
| bool | enclosed ) |
Requires a common copper layer.
Outline rings use even/odd filling (holes and disjoint contours); enclosed requires every copper shape to be wholly inside. The caller selects/caches zones; insideArea and intersectsArea both pass false.
| CopperModel tmk::drc::build_copper | ( | const model::Board & | b | ) |
| CourtyardCache tmk::drc::build_courtyards | ( | const model::Board & | board | ) |
Build once per board; invalid/unclosed contours leave the corresponding side empty and marked unreadable.
| bool tmk::drc::can_change_net | ( | const CopperItem & | it | ) |
| Connectivity tmk::drc::compute_connectivity | ( | const model::Board & | b, |
| const CopperModel & | cm, | ||
| index::UniformGrid & | grid, | ||
| bool | overlap_links = false, | ||
| const ZoneFills * | fills = nullptr ) |
| model::LayerMask tmk::drc::conditional_layers | ( | const model::Pad & | p, |
| int | copper_count ) |
| model::LayerMask tmk::drc::conditional_layers | ( | const model::Via & | v | ) |
KiCad's ConditionallyFlashed: the layers of a via, or of a plated through-hole pad on a board of copper_count layers, whose copper depends on what connects there.
| std::optional< Coupling > tmk::drc::couple | ( | model::Point | p0, |
| model::Point | p1, | ||
| Coord | wp, | ||
| model::Point | n0, | ||
| model::Point | n1, | ||
| Coord | wn ) |
The two centrelines (a P track from p0 to p1 of width wp, an N track likewise) coupled as KiCad couples them, or nothing: both longer than about 1 nm, exactly parallel (a zero cross product) and not collinear, with overlapping projections.
| std::vector< int > tmk::drc::courtyard_entries | ( | const CourtyardCache & | courtyards, |
| const std::string & | selector ) |
The entries a footprint selector picks, in entry order, and the same test against them.
The rule engine resolves each selector once when the rules are compiled (Condition::bind): a rule is evaluated for every pair of items the DRC compares and for every lattice point the router visits, and matching the selector against every footprint each time made a courtyard clearance rule dominate the DRC of a large board.
| bool tmk::drc::courtyard_matches | ( | const CopperItem & | item, |
| const CourtyardCache & | courtyards, | ||
| const std::string & | selector, | ||
| const std::string & | function ) |
Function is intersectsCourtyard/intersectsFrontCourtyard/intersectsBackCourtyard.
Front and back are the footprint's own sides (KiCad: GetCourtyard(fp->IsFlipped() ? B_Cu : F_Cu)): the front courtyard of a flipped footprint is its B.CrtYd outline. The item's copper side does not matter. This overload matches the selector against every footprint for each query: the reference path.
| bool tmk::drc::courtyard_matches | ( | const CopperItem & | item, |
| const CourtyardCache & | courtyards, | ||
| const std::vector< int > & | entries, | ||
| const std::string & | function ) |
| std::vector< std::vector< model::Point > > tmk::drc::edge_loops | ( | const std::vector< geom::Shape > & | edges, |
| Coord | tol = 2 '000, | ||
| bool * | all_closed = nullptr ) |
Closed loops chained from Edge.Cuts pieces whose ends meet within tol; pieces that close no loop are dropped (all_closed, if given, tells whether any was).
| Flashing tmk::drc::flash_layers | ( | const model::Board & | b | ) |
| bool tmk::drc::footprint_selected | ( | const std::string & | selector, |
| const std::string & | reference, | ||
| const std::string & | lib_id ) |
KiCad's footprint selector (testFootprintSelector): a reference wildcard, or, when the selector contains ':', a library-id wildcard.
Case-sensitive, like wxString::Matches.
| bool tmk::drc::in_item_graph | ( | const CopperItem & | it | ) |
| ItemGraph tmk::drc::item_graph | ( | const model::Board & | b, |
| const CopperModel & | cm, | ||
| index::UniformGrid & | grid ) |
| const char * tmk::drc::kind_name | ( | ItemKind | k | ) |
KiCad expression type names: Pad, Track, Arc, Via, Zone, Graphic.
| DpSuffix tmk::drc::match_dp_suffix | ( | std::string_view | name | ) |
| NetLength tmk::drc::net_length | ( | const model::Board & | b, |
| const model::DesignRules & | rules, | ||
| const ViaHeights & | vh, | ||
| const LengthItems & | items, | ||
| const model::TuningProfile * | profile ) |
Length and delay of items, all of one net.
profile is the tuning profile of the net's class (null: every delay is 0, as in KiCad).
| std::vector< geom::Shape > tmk::drc::pad_shapes | ( | const model::Pad & | pad | ) |
Pad copper shape in absolute coordinates.
| std::vector< model::NetId > tmk::drc::propagate_nets | ( | const CopperModel & | cm, |
| const ItemGraph & | g, | ||
| const ZoneFills & | zf, | ||
| index::UniformGrid & | grid ) |
The nets KiCad's DRC sees after loading a board (CN_CONNECTIVITY_ALGO::PropagateNets, run by every connectivity build): a via touching only zone fills takes a zone's net (its own if one of the zones has it, else the lowest); then in every cluster of the graph without zones whose pads carry one net only, tracks, arcs, vias and board graphics take that net (a stray via on a track joins the track's net; a track bridging two nets keeps its own).
Clusters without pads take the net of their first item with a net. Returns one net per copper item.
| RefillResult tmk::drc::refill_zones | ( | const model::Board & | b, |
| const model::DesignRules & | r ) |
Follows ZONE_FILLER::fillCopperZone: outline within the board, thermal gaps around same-net pads, every other item knocked out at its clearance, spokes that reach the fill, minimum-width pruning, then islands without a pad removed by each zone's island_removal_mode.
Teardrop zones lose their fill: kicad-cli's refill first rebuilds teardrops (TEARDROP_MANAGER::UpdateTeardrops), and a rebuilt teardrop joins a pad to a track that already touches it. Hatched zones are not redrawn: their stored fill is kept where the new solid fill still is (warning).
| DrcReport tmk::drc::run_drc | ( | const model::Board & | b, |
| const model::DesignRules & | r, | ||
| const DrcOptions & | opt = {} ) |
| std::vector< StarvedThermal > tmk::drc::starved_thermals | ( | const model::Board & | filled, |
| const model::DesignRules & | r ) |
On a board whose fills are current (refill_zones' board): every pad KiCad would report, in pad then zone order.
Not covered: custom-pad spoke primitives and min_resolved_spokes constraints in custom rules (the board setup's applies).
| std::vector< geom::Ring > tmk::drc::thermal_spokes | ( | const model::Pad & | pad, |
| const model::Zone & | zone ) |
The four spoke polygons of a pad's thermal relief to a zone, as the zone filler draws them (buildThermalSpokes).
| ViaHeights tmk::drc::via_heights | ( | const model::Board & | b, |
| const model::DesignRules & | rules ) |
| void tmk::drc::write_drc_json | ( | const DrcReport & | rep, |
| const std::string & | path ) |
Writes the report in kicad-cli's JSON layout (violations, unconnected_items; positions in mm).
| std::vector< int > tmk::drc::zones_touching | ( | const CopperModel & | cm, |
| const ZoneFills & | zf, | ||
| index::UniformGrid & | grid, | ||
| const geom::Shape & | s, | ||
| model::LayerMask | layers, | ||
| Coord | clearance = 0 ) |
Zone-fill items on layers whose copper is closer than clearance to s (0, the default: overlap only, as KiCad's SHAPE::Collide; 1: touching counts), ascending item indices.