TraceMaker
C++ API of the engine
Loading...
Searching...
No Matches
refill.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-3.0-or-later
2#pragma once
3// Zone refill in the engine (doc 05 §36): the fills KiCad 10's zone filler would draw for the board's current
4// copper, so connectivity can be judged as `kicad-cli pcb drc --refill-zones` judges it. The fills are not
5// written to files.
6#include <string>
7#include <vector>
8
9#include "geom/clip.hpp"
10#include "model/board.hpp"
11#include "model/rules.hpp"
12
13namespace tmk::drc {
14
16 model::Board board; // the input with every copper zone refilled
17 int zones = 0; // copper zones refilled
18 int islands_removed = 0; // fill islands no pad reaches, removed by the zones' island settings
19 std::vector<std::string> warnings;
20};
21
22// Follows ZONE_FILLER::fillCopperZone: outline within the board, thermal gaps around same-net pads, every other
23// item knocked out at its clearance, spokes that reach the fill, minimum-width pruning, then islands without a pad
24// removed by each zone's island_removal_mode. Teardrop zones lose their fill: kicad-cli's refill first rebuilds
25// teardrops (TEARDROP_MANAGER::UpdateTeardrops), and a rebuilt teardrop joins a pad to a track that already
26// touches it. Hatched zones are not redrawn: their stored fill is kept where the new solid fill still is (warning).
28
29// A thermal relief KiCad's DRC reports as starved_thermal (DRC_TEST_PROVIDER_ZONE_CONNECTIONS::testZoneLayer): fewer
30// spokes reach the zone's fill than the board's minimum (min_resolved_spokes, 2 by default), counting tracks that run from
31// 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.
33 int pad = -1, zone = -1, layer = -1; // board indices; layer is a copper index
34 int spokes = 0; // spokes into fill that connects to something else, plus track spokes
35 int island_spokes = 0; // spokes into an island only this pad touches
36};
37// On a board whose fills are current (refill_zones' board): every pad KiCad would report, in pad then zone order.
38// Not covered: custom-pad spoke primitives and min_resolved_spokes constraints in custom rules (the board setup's applies).
39std::vector<StarvedThermal> starved_thermals(const model::Board& filled, const model::DesignRules& r);
40
41// The four spoke polygons of a pad's thermal relief to a zone, as the zone filler draws them (buildThermalSpokes).
42std::vector<geom::Ring> thermal_spokes(const model::Pad& pad, const model::Zone& zone);
43
44} // namespace tmk::drc
The board model (design doc 02 §3): every object TraceMaker reads from a .kicad_pcb,...
Polygon booleans and offsets on integer nanometres, a thin wrapper over Clipper2 (Angus Johnson,...
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 (buildTher...
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,...
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,...
Design rules as KiCad defines them (design doc 08 §3–4): board minimums and net classes from the ....
int zones
copper zones refilled
Definition refill.hpp:17
int islands_removed
fill islands no pad reaches, removed by the zones' island settings
Definition refill.hpp:18
model::Board board
the input with every copper zone refilled
Definition refill.hpp:16
std::vector< std::string > warnings
Definition refill.hpp:19
A thermal relief KiCad's DRC reports as starved_thermal (DRC_TEST_PROVIDER_ZONE_CONNECTIONS::testZone...
Definition refill.hpp:32
int island_spokes
spokes into an island only this pad touches
Definition refill.hpp:35
int spokes
spokes into fill that connects to something else, plus track spokes
Definition refill.hpp:34
int layer
board indices; layer is a copper index
Definition refill.hpp:33