299 Commits

Author SHA1 Message Date
Jon Evans ac8f0096ce Lazy-allocate a few pad and padstack things 2026-03-19 21:32:07 -04:00
Alex Shvartzkop 00094984ed Slightly optimize PAD::IsOnCopperLayer(). 2026-02-24 00:55:09 +03:00
Seth Hillbrand 5d2ee4db9d Skip EvalRules when no custom rules exist
GetSolderMaskExpansion() on PAD, PCB_TRACK, and PCB_SHAPE called
EvalRules(SOLDER_MASK_EXPANSION_CONSTRAINT) unconditionally during
DRC, even when no custom rules existed for that constraint type.

Now check HasRulesForConstraintType() first and fall back to the
direct property lookup chain when no custom rules exist.

Also fix a bug where PCB_TRACK and PCB_SHAPE returned 0 instead of
the board default mask expansion when no local override was set.

Apply the same optimization to solder paste margin lookups. Add
per-provider DRC timing via the existing KICAD_DRC_PROFILE trace mask.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/23213
2026-02-23 11:59:51 -08:00
Seth Hillbrand 80bfe4472c Fix routing perf regression from clearance cache
The clearance cache added in b0d0dd57ef invalidates on every
SetLayer() and SetNetCode() call. The router's rule resolver
calls SetLayer() on dummy board items for every clearance
evaluation during routing. Each call acquires an exclusive
lock and linearly scans the entire cache, but dummy items
never exist in the cache, so this is pure waste.

Skip cache invalidation for items flagged ROUTER_TRANSIENT.
The flag is already set on all dummy items in the rule
resolver.

Also replace the O(n) linear scan in InvalidateClearanceCache
with targeted O(1) hash erasure per copper layer.
2026-02-20 15:05:37 -08:00
Seth Hillbrand e027a2aacc Remove ignoreLineWidth assert in PAD::TransformShapeToPolygon
The parameter is unused in the pad implementation and inherited from
the BOARD_ITEM virtual interface. Callers may pass any value without
consequence.

Resolves KICAD-130R
2026-02-15 07:21:14 -08:00
Alex Shvartzkop d5b2c285a3 Slightly optimize PAD memory layout. 2026-02-15 01:07:28 +03:00
John Beard b788e20ab8 Add missing includes
And a build warning about unsued var
2026-02-14 18:40:58 +08:00
Seth Hillbrand 6c9c75eb07 Remove property.h and property_mgr.h from inspectable.h
This breaks the view_item.h -> inspectable.h -> property.h chain that
pulled wx/propgrid/property.h into 150-200 TUs. The lean inspectable.h
now includes only wx/any.h, wx/string.h, wx/variant.h.

Headers using DECLARE_ENUM_TO_WXANY (board_item.h, sch_item.h) retain
their property.h include since the macro requires it.
2026-02-13 19:54:46 -08:00
Jeff Young 81801d315f Cleanup PADSTACK TODOs.
Initialize new layers from either F_Cu, or, in the case
of additional inner layers, from In_1.

Initialize all copper shape props, not just the round
rect radius ratio.

Also, don't save and restore spoke angle; if we don't
want it changed, then don't change it.
2026-02-02 14:59:07 +00:00
Jeff Young 7ccc71c79f PADSTACKS: share definition of IsNPTHWithNoCopper. 2026-02-02 14:59:07 +00:00
Jeff Young dd29ada5d0 Build out PADSTACK::Similarity() and PADSTACK::FlipLayers(). 2026-01-31 22:00:20 +00:00
Seth Hillbrand b0d0dd57ef Add clearance cache to improve clearance outline rendering performance
When displaying pad and track clearance outlines, GetOwnClearance()
was called repeatedly during rendering, re-evaluating DRC rules on
every paint refresh. With complex DRC rules, this caused significant
slowdown.

Add a lazy-evaluated cache in DRC_ENGINE keyed by (UUID, layer) that
stores clearance values. The cache is invalidated when DRC rules
change (in InitEngine) or properties change that could affect clearance
(net, layer, pad type)
2026-01-07 16:59:47 -08:00
Jeff Young af64ef8d48 Formatting. 2026-01-07 15:23:14 +00:00
Jeff Young 88a58643d2 Cleanup. 2025-12-10 16:34:03 +00:00
Jeff Young 5dcd6f1eec Consistent formatting. 2025-12-10 16:34:03 +00:00
Jeff Young 7e0f11ff0a Improve code SNR. 2025-12-10 16:34:03 +00:00
Seth Hillbrand 3396cb7969 Fix capitalization 2025-12-05 10:25:26 -08:00
Seth Hillbrand 4775140bf1 Fix wxformbuilder version
Unify backdrill nomenclature to "XX Backdrill Must-Cut" specifying the
layer through which the backdrill must pass.
2025-12-01 10:27:03 -08:00
Seth Hillbrand 899d4888aa ADDED: Backdrill support
- Allow setting backdrill (from B.Cu up) and tertiary drill (from F.Cu
  down) width and target layer (backdrill is inclusive)
- Allow setting post machining options (counterbore, countersink)
- Update properties for vias and THT pads
- Add output for Excellon and Gerber drill files as separated files for
  different drill depths
- Add drill map output calling out post-machined holes
- Add STEP export support
- Add 3d-viewer support
- Add 2581 support using backdrill property.  Post machining called out
  in comments
- Add ODB++ support using separate drill file for each depth
- Add DRC check for tracks connected to pad layers that are backdrilled
  or post-machined

Fixes https://gitlab.com/kicad/code/kicad/-/issues/18836
2025-11-29 17:59:31 -08:00
Jon Evans 86d8082c01 API: Add schematic pin attributes to pads
Fixes https://gitlab.com/kicad/code/kicad/-/issues/22360

(cherry picked from commit bdd98e801f)
2025-11-20 23:37:50 -05:00
Jeff Young 48a5728c78 Don't guess pad shape names, and don't trample pad-stacks.
Also implements undo for Pad Table changes.
2025-11-12 13:33:15 +00:00
Wayne Stambaugh 6ba805173e Fix false positive warning message when updating board from schematic.
The board connectivity algorithm creates pseudo net names for footprints
that have multiple pads with the same number using a "_N" suffix.  At
some point a change was made to the zone net properties dialog that
allowed choosing a pseudo net name as the net name assigned to the zone.
This caused the netlist updater to trigger a false "zone has no pads
connected" warning because the pseudo net name is not in the schematic
net list.

The warning message was not very helpful. Added the correct zone layers
and the net name assigned to the zone to the message for improved
clarity.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/22133
2025-10-28 11:00:26 -04:00
Jeff Young b09aa34874 Improve pad warning messages.
(While we can guess what the user is doing with the
properties, we don't know for sure.)
2025-10-17 13:46:03 +01:00
jean-pierre charras b349f1988a PAD: better HitTest( const VECTOR2I& aPosition, int aAccuracy, PCB_LAYER_ID aLayer ) 2025-08-27 13:23:02 +02:00
jean-pierre charras 963aa47778 Pcbnew: fix teardrop generation for pads having different shapes by layer.
Teardrop generator used pad::HitTest not testing the hit of a specific layer.
It created false test for some complex pads. Now use a test specific to a layer.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/21560
2025-08-27 11:03:00 +02:00
Seth Hillbrand 3ef862f7b6 Specialize the pad wall drawing
Avoids slowdown when zoom/pan with many THTs as everything remains
cached.  Still slow in Cairo but this is expected

Fixes https://gitlab.com/kicad/code/kicad/-/issues/20506
2025-08-24 11:25:50 -07:00
jean-pierre charras da92279436 Pcbnew: add pad fabrication property Press-Fit
Fixes https://gitlab.com/kicad/code/kicad/-/issues/21457
2025-08-11 15:59:19 +02:00
Seth Hillbrand 1a4eba56a7 ADDED: Skip Via support
Skip vias are vias that are flashed on their start and end layers but
have no annular rings on the interior layers and do not connect to zones
in those layers

You can now select Annular ring type "Start and end layers only".  This
will prevent annular ring flashing on intermediate layers and zones
fills will provide clearance.  You can still connect tracks to
intermediate layers but preventing that will fall to the designer

Fixes https://gitlab.com/kicad/code/kicad/-/issues/21433
2025-08-07 15:48:10 -07:00
Ben Gamari a07db6763a api/common: Fix units of Time
Times are internally represented in attoseconds, not picoseconds.
2025-08-07 18:06:59 +01:00
Andrzej Wolski c73d555fe2 ADDED: Lasso selection in pcbnew
Adds a lasso or freeform selection tool to KiCad in addition to standard
rectangular selection.  Adds supporting HitTest routines

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/1977
2025-08-06 16:06:40 -07:00
Ben Gamari e6ab1194ed pcbnew/api: Expose pad-to-die delay
Addresses #21346.
2025-07-30 22:36:50 -04:00
Ben Gamari 29c733c651 pcbnew/api: Expose pad-to-die length
Closes #21346.
2025-07-30 22:36:50 -04:00
Jeff Young 7b5603503e Fix typo. 2025-07-28 19:37:52 +01:00
Jeff Young 046c36d060 Fix padstack/boundingbox issue.
Earlier fix to stop clearing the boundingRadius
for each unique layer also cleared it for
ERROR_INSIDE (when we aren't rebuilding it).

Re-order whole routine to make this more clear.
2025-07-27 13:55:16 +01:00
Jeff Young c58b1146de Honour pad holes when hit-testing.
They may be bigger than the pad.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/21331
2025-07-26 18:37:16 +01:00
Seth Hillbrand f875fd1d60 Add support for chamfering larger sizes
If we are only chamfering opposite corners, we can support up to 100%
chamfer

Fixes https://gitlab.com/kicad/code/kicad/-/issues/13567
2025-07-26 10:33:36 -07:00
Jeff Young ec155c00f3 Comboboxes for units and body styles.
Also for pin-types in pad properties.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/19904

Fixes https://gitlab.com/kicad/code/kicad/-/issues/19905
2025-07-23 14:35:37 +01:00
Jeff Young c63e2edfff Allow setting Pin Function and Pin Type.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/20992
2025-07-23 14:35:37 +01:00
Jeff Young 60d9713baf Consistent formatting. 2025-07-23 14:35:37 +01:00
Jeff Young 693ea44990 Debugging.
(Separate wxCHECKs so Sentry can tell us which
one fired.)
2025-07-06 21:42:13 +01:00
Jeff Young 044ac6e8e5 Prefer board's errorMax to a constant. 2025-06-27 22:59:12 -06:00
Jeff Young 8c6aa8e043 Still want to climb up to parent footprint in previewer (part II)
(Apply SolderMask fix to SolderPaste.)
2025-06-04 17:49:17 +01:00
Jeff Young 1c915d3456 Still want to climb up to parent footprint in previewer 2025-06-04 17:49:17 +01:00
Mike Williams b174911a39 board: prevent null-pointer deref in solder paste rules 2025-06-03 14:32:52 -04:00
jean-pierre charras b6aaa14e77 Fix crash in PAD::GetSolderMaskExpansion() when in 3D previewer.
The dummy board used in 3D previewer has no DRC engine, so creating a nullptr.
2025-06-03 17:35:36 +02:00
Jeff Young c994b96509 ADDED: custom rules for solder mask & paste margins.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15622
2025-06-03 11:41:27 +01:00
Jon Evans 7e24210b1e API: Use net names, not codes, and allow creating new nets
Fixes https://gitlab.com/kicad/code/kicad/-/issues/21027


(cherry picked from commit 0ff77bd332)

Co-authored-by: Jon Evans <jon@craftyjon.com>
2025-05-30 22:13:44 -04:00
Jeff Young f58fc0b952 Rewrite GROUP undo based on uuids.
This also removes the GROUP/UNGROUP-specific undo actions.

This also fixes a bunch of undo bugs when duplicating
group members, creating pins, etc.

This also fixes some undo bugs when dividing wires etc.

This also fixes some bugs with new sch items not
being created within an entered group.
2025-05-21 14:24:59 +01:00
Jeff Young 75d9f708a8 Fix presumed copy/pasta when ensuring circles are circles.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/20567
2025-05-04 10:13:38 +01:00
Jeff Young d384790d47 Don't use line styles for solder masks on shapes in 3D viewer.
Also convert hatched fills to solid for solder masks.

Also give track solder masks their specified
expansion when exporting to STEP.

Also implement solder masks for shapes when
exporting to STEP.
2025-04-28 21:46:10 +01:00