165 Commits

Author SHA1 Message Date
Seth Hillbrand
6e2b20ed0e Update BS Threadpool to 5.0 2025-09-10 13:02:24 -07:00
John Beard
2bf2e30af6 Pcbnew: squash shadowed variable warning in copper clearance DRC 2025-08-07 00:55:48 +08:00
Jeff Young
ac3eac9ed0 Nullptr safety.
Fixes KICAD-P7Q.
2025-08-01 16:46:50 +01:00
Seth Hillbrand
ff41ab9d8a Thread footprint pad clearance DRC
This needs to run in multiple threads in order to speed up
2025-07-21 11:03:17 -07:00
Seth Hillbrand
faeaee824a Optimize zone-zone clearance checks
Improve the CREEPAGE_GRAPH:::GeneratePaths to skip unused checks.
Handle zone-zone paralellism better

Fixes https://gitlab.com/kicad/code/kicad/-/issues/21353
2025-07-21 11:03:17 -07:00
Seth Hillbrand
4c03ab8ebb Finally remove other_math routines
Replace with standard SEG and VECTOR2 alternatives.  Add QA test for
additional SEG-line intersection routine
2025-07-21 11:03:17 -07:00
Jeff Young
c758a2fbaf Don't sequence layers when order doesn't matter. 2025-07-14 19:12:44 +01:00
Jeff Young
5074a2861f Repair zone-to-zone copper clearance test.
Don't copy zone fill when not necessary.
Make sure zone polys (not copies) have bbox caches.
2025-07-14 13:17:53 +01:00
Jeff Young
af076488f5 Naming conventions. 2025-06-17 14:03:57 +01:00
Jeff Young
5e707acbdb Ensure any mapped layers are enabled.
Also fixes a missing mutex for parallel access to cache
in DRC_TEST_PROVIDER_COPPER_CLEARANCE::testGraphicClearances().

Also simplifies the logic for not show multiple errors.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/21138
2025-06-17 14:03:57 +01:00
Jeff Young
9d6928043f Don't format strings if we're not going to report them. 2025-06-09 20:09:24 +01:00
Jeff Young
70d8050002 Formatting. 2025-05-31 22:14:09 +01:00
Jeff Young
5573dce448 Fix various errors in intersecting zones test.
Also gives a clearer error message, and better
descriptions of named zones.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/20718
2025-04-22 13:15:03 +01:00
Jeff Young
e530bab396 Don't report "shorting nets" when one pad has no net.
(Fall back to clearance violation instead.)

Fixes https://gitlab.com/kicad/code/kicad/-/issues/19752
2025-01-27 19:08:35 +00:00
Jeff Young
5f45c2c0d1 Nullptr fixes. 2025-01-16 13:12:25 +00:00
Seth Hillbrand
452e69de85 Move thread pool into true singleton
Thread pool needs to be stored in a single location for all of KiCad
otherwise each kiface will spin up its own pool of persistent threads
2025-01-09 09:03:08 -08:00
Seth Hillbrand
074e6df3bc Revert "Move thread pool to singleton class"
This reverts commit 361f61a02380881efb59b1cebfdc3e73322b3d3c.
2025-01-03 21:22:44 -08:00
Seth Hillbrand
361f61a023 Move thread pool to singleton class
Having thread pool as its own singleton in the library meant that each
kiface had its own threadpool, leading to many multiples of the threads
being started.  Placing a singleton class in PGM_BASE ensures that all
kifaces use the same thread pool.

The singleton class can be extended to provide single instance
guarantee for any element across kifaces
2025-01-03 13:51:11 -08:00
Seth Hillbrand
0b2d4d4879 Revise Copyright statement to align with TLF
Recommendation is to avoid using the year nomenclature as this
information is already encoded in the git repo.  Avoids needing to
repeatly update.

Also updates AUTHORS.txt from current repo with contributor names
2025-01-01 14:12:04 -08:00
Jeff Young
2ae321084f Collide (and generate violations) based on a well-defined order...
... so that exclusion checking against previously-generated
violations will work.
2024-12-18 12:03:29 +00:00
Fabien Corona
07a0c980f3 DRC : Show paths for clearance and creepage 2024-10-21 15:56:12 +00:00
Jon Evans
56e0811516 Phase 2 of padstack support
CHANGED: PCB file format now supports saving/loading complex padstacks

CHANGED: PTH pads are now rendered per copper layer in the copper color;
         the PTH pad color is no longer used.

ADDED: support for importing complex pad stacks from Altium PCBs

Enforce padstack-aware access to pad properties across KiCad

Fixes https://gitlab.com/kicad/code/kicad/-/issues/8182
2024-10-01 19:55:03 -04:00
Seth Hillbrand
5e0abadb23 Reorganize layer numbering
F_Cu = 0
B_Cu = 2
Remaining internal copper layers are even and incrementing

Non-copper layers are odd and incrementing.

This means that we can no longer do things like:
for( PCB_LAYER_ID layer = F_Cu; layer <= B_Cu; ++layer)
Instead, we have the class LAYER_RANGE:
for( PCB_LAYER_ID layer : LAYER_RANGE( F_Cu, B_Cu) )

Similarly, gt/lt tests should not refer to the integer value of the
layer.  We have functions such as IsCopperLayer to test whether a layer
is copper or not.

When using the connectivity RTree, the third dimension is layer, so we
provide B_Cu with the special INT_MAX value, ensuring that elements
between F_Cu and B_Cu will be identified.  There is a new, special
function GetBoardLayer() for interfacing with CN_ITEMS

Similarly, PNS layers remain unchanged and sequential.  A set of
interface functions is provided to map PNS layers to Board layers and
back.  This allows the PNS_LAYER_RANGE to function as expected
2024-09-06 23:07:58 +00:00
Jeff Young
88c1fa3e26 Ignore graphic shapes that implement netties.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/17223
2024-03-23 13:18:46 +00:00
Jeff Young
91d144c720 Do NOT return false from a visitor unless you want to stop visiting!
This fixes a bug where DRC would bail out early if any of
the colliding objects was a free pad.
2024-01-04 14:35:08 +00:00
Jeff Young
aa4107ce2d Code cleanup (and Coverity quieting). 2024-01-04 14:35:08 +00:00
Jeff Young
1e71899611 Thread pad & graphic clearance testing.
This allows us to poll the event loop & update the progress
on a time interval rather than on an items-completed
interval (the later of which can't easily take host machine
performance into account).

Also fixes a bug where we'd bail out of QueryColliding if
we ever found !testClearance && !testShorting && !testHoles.
2024-01-03 13:49:29 +00:00
Jeff Young
791aa64950 Functionally it's a "reference image".
The implementation happens to be a "bitmap".

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15932
2023-10-24 15:44:21 +01:00
Jeff Young
e1c51ed192 A few performance improvements from profiling.
Most of them are very small; the removal of the Fracture() in
DRC_TEST_PROVIDER_COPPER_CLEARANCE::testZonesToZones() is the only
significant one.
2023-09-29 21:54:59 +01:00
Jeff Young
d428b0e20e Improve SameLogicalPadAs() shorting nets test.
This is required to support 4cd26ab6bcf804c79032462e991e08067d7018cb.
2023-09-24 16:19:26 +01:00
Seth Hillbrand
f4afd7e363 Thread testTrackClearances
We are frequently testing thousands of track segments.  They can each be
uniquely tested in parallel with reporting and marking guarded by
mutexes.  This speeds up the DRC tests substantially

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15466
2023-09-20 19:51:33 -07:00
Marek Roszko
4d77fd48ef Shove thread_pool to core 2023-09-06 17:50:12 -04:00
Jon Evans
a77e630901 ADDED: Connectivity for graphic shapes on copper layers
Graphic shapes (excluding text) can now have nets when on
copper layers. Shapes behave like tracks in that they will
pick up nets from connected pads, and follow track opacity
settings.
2023-08-10 21:47:43 -04:00
Seth Hillbrand
954b265839 Check for zone-zone overlap
Instead of just checking for the zone outline, we adjust to check the
full fill area of the zones for intersection and overlaps
2023-07-07 11:52:25 -07:00
Jeff Young
dd83217062 Add DRC testing for copper graphic to zone fill collisions. 2023-06-30 14:04:20 +01:00
qu1ck
0c049eccc7 Fix a bunch of compiler warnings 2023-04-11 17:01:30 +00:00
Jeff Young
fd07f50c44 Report collisions of items with nets as SHORTING, not CLEARANCE.
Fixes https://gitlab.com/kicad/code/kicad/issues/14312
2023-04-02 21:07:52 +01:00
Jeff Young
bbd6c80507 Collapse FP_* down into their PCB_* equivalents. 2023-03-31 22:57:46 +01:00
Marek Roszko
aacc9746e3 Yeet the last of wxSize/wxPoint to stop leaking gdicmn everywhere 2023-02-18 22:57:18 -05:00
Jeff Young
8ecf64b6c5 Don't run DRC rules on non-existant layers.
Fixes https://gitlab.com/kicad/code/kicad/issues/13753
2023-02-03 15:08:31 +00:00
jean-pierre charras
eef47c2a79 DRC: ensure tracks are tested against holes, even if hole clearance is set to 0.
Even with clearance = 0, copper to hole must be tested because it cannot be
inside the hole
2022-12-23 14:06:10 +01:00
Seth Hillbrand
2fd500e20b Respect the "report all errors" checkbox
When we have objects spanning multiple layers, the user doesn't need to
see every layer/hole combination violation if they do not request it

(cherry picked from commit c07043e762b06a04cdb779ee03837252435156dc)
2022-12-12 11:14:38 -08:00
Jeff Young
1e3186b9cb Allow pad-to-copper-graphic collisions in net-ties.
This is done under the same conditions as track-to-copper-graphic --
the pad or track must also collide with a net-tie pad, and the pad or
track to copper-graphic collision must be within the boundary of said
pad.

Fixes https://gitlab.com/kicad/code/kicad/issues/13008
2022-11-26 15:04:33 +00:00
Jeff Young
098e96f1c7 Use more precise formatting in DRC messages when less precise values are identical.
Fixes https://gitlab.com/kicad/code/kicad/issues/12587
2022-10-06 22:18:53 +01:00
Jeff Young
e49de68a59 Implement a more durable zone bounding box caching strategy.
Fixes https://gitlab.com/kicad/code/kicad/issues/10821
2022-10-01 22:10:43 +01:00
Jeff Young
503385f52e Don't use FindNamedPad for net-tie logic. It only reutrns the *first*
pad of a given number.

Also improves other DRC logic to tighten up the net-tie rules now that
we know which pads are allowed to short with which other pads.

Also removes the "Overlapping pads" DRC violation now that we know
whether or not overlapping pads in a net-tie footprint constitute a
short.

Fixes https://gitlab.com/kicad/code/kicad/issues/12506
2022-09-25 17:38:31 +01:00
Seth Hillbrand
0150655ed3 Fix missing DRC check with via
When the via is first and not second in our ordering, the hole-copper
clearance was not checked as the track did not have a hole.

We also calculated the NPTH-via clearance incorrectly in the inspector
2022-09-20 13:43:01 -07:00
Jeff Young
64a6fc0fd4 Push UNITS_PROVIDER down into a low-level mixin.
This allows us to also construct cheap UNIT_PROVIDERs for specific
tasks when necessary.
2022-09-19 17:10:59 +01:00
Mark Roszko
b00178adb3 Nuke base_units from orbit 2022-09-16 04:38:10 +00:00
Jeff Young
0df1786456 Improve adherecne to ignored tests. 2022-09-11 19:48:08 +01:00