Commit Graph

858 Commits

Author SHA1 Message Date
Marek Roszko 4d77fd48ef Shove thread_pool to core 2023-09-06 17:50:12 -04:00
Jeff Young 55a7b9e6bf More consistent naming.
(Also better differentiates the PCBEXPR_ classes from PCB_
objects.)
2023-08-21 15:26:33 +01:00
Jon Evans 0c529411d7 Update SHAPE_POLY_SET API to not hide virtual functions 2023-08-18 21:40:40 -04:00
Jeff Young 6a6e839cc4 Move checking for null parent higher.
(Otherwise we set the failure flag without telling the user why.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15415
2023-08-18 10:32:45 +01:00
Marek Roszko 14a0fa435c ADDED: DRC JSON report 2023-08-13 14:59:10 -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
Jeff Young 1cbef0157d Avoid edge cases on very wide thermal spokes.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15280
2023-08-04 15:38:06 +01:00
Jeff Young 9456fab435 Fix QA gold DRC counts.
Also improves the error message when some spokes are ignored because
they're connected to an isolated island.
2023-08-04 00:35:19 +01:00
Jeff Young a9b7b73f10 Make sure pad primitives get normalized before diff'ing.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15208
2023-08-03 18:08:33 +01:00
Jeff Young 297bbca0ea Finer-grained messages for diff pads. 2023-08-03 18:08:33 +01:00
Jeff Young 9e019a1ad1 Don't conclude we're unconnected if only connected to isolated island.
Also adds the layer name to the "thermal connection incomplete" DRC
error message.

Also improves zone layer description to not say "X and 1 more" (which
takes as much room as saying "X and Y").

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15279
2023-08-03 16:30:52 +01:00
Seth Hillbrand 96a34e5b57 Consolidate Maximum clearance calculation
We were calculating the same thing in three locations and we missed
adding the clearance from the footprints in, resulting in bad fills and
missed drc errors (see QA addition)
2023-07-26 12:55:48 -07:00
jean-pierre charras a16ab0aae1 Replace SHAPE_T::RECT by SHAPE_T::RECTANGLE: RECT creates a collision name
issue with a Windows header on msys2.
Change very similar to the commit 9a47b344 about class PAD_SHAPE.
No actual code change
2023-07-25 09:11:55 +02: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
Jeff Young 493828cc6b Eradicate a bunch of calls to dyn_cast.
Also deletes PAD::GetParent() which fails to look for parent footprint
through groups.
2023-06-25 11:10:07 +01:00
Jeff Young b3d7aea4df dyn_cast<PCB_TEXT*> won't find PCB_FIELDs.
We really should get rid of dyn_cast entirely....

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15052
2023-06-24 15:48:57 +01:00
Mike Williams 85f889bc19 Fields: Description now mandatory
Propagate from symbols to footprints, footprints keep a library
description, too. (GetLibDescription())
2023-06-20 18:34:52 +00:00
Mike Williams 993bb84240 PCB_FIELD: bug fixes 2023-06-20 18:34:52 +00:00
Mike Williams 37837dc392 PCB: introduce PCB_FIELD_T 2023-06-20 18:34:52 +00:00
jean-pierre charras 21f2f98270 drc_test_provider_connection_width: fix crash due to a null pointer.
Fix a crash (tested on W10 - MSYS2) when running DRC on the board
attached to issue #15005
Fixes #15005
https://gitlab.com/kicad/code/kicad/-/issues/15005
2023-06-20 16:32:07 +02:00
Jeff Young fb40c202a1 Refine track dangling test.
Turns out Clean Up Tracks and Vias wants a different answer from DRC.
2023-06-17 22:56:57 +01:00
Jeff Young 782c73300b Move drawing sheet datastructures to EDA_IU_SCALE.
Or mostly, at least.  Plotters still define their own mils-to-iu scale.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14934
2023-06-12 22:34:25 +01:00
Jeff Young fcb156c323 Make sure opposite-corner rects test the same.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14907
2023-06-10 22:30:04 +01:00
Jeff Young c5e7d800a4 Back out earlier diamond-to-rectangle fix for one that's more targeted.
(And doesn't fail qa_pcbnew.)

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14828
2023-06-05 21:26:37 +01:00
Seth Hillbrand e4fe27993e Fix wxCHECK_MSG in DRC
The layers check needs to look for testing against technical layers for
those vias that pass the outer layers
2023-06-03 20:25:35 -07:00
jean-pierre charras 9a47b34499 Replace PAD_SHAPE::RECT by PAD_SHAPE::RECTANGLE to avoid a collision NAME with a windows header on MSYS2, creating many compil warnings. No actual code change. 2023-06-02 12:18:24 +02:00
Jeff Young f5791f5dc6 Left some fixes out of previous commit. 2023-05-29 16:22:24 +01:00
Jeff Young 65e53b8ecd Move SHAPE_POLY_SET::Inflate's error spec from a seg-count to a max-deviation.
1) Also reorders parameters to make sure the compiler helps out.

2) This also makes it harder to mess up the discrepency between
   BOX2I/wxRECT/etc::Inflate() and SHAPE_POLY_SET::Inflate.

3) Also fixes a couple of bugs where the corner strategy was passed
   in as a segCount.

4) Also fixes a couple of bugs where the error wasn't forced to the
   outside to match the ERROR_LOCATION.

5) Also fixes a couple of bugs where the seg count was specified
   without regard to an already passed-in max deviation
2023-05-29 15:29:03 +01:00
Jeff Young c71cf21e2f Use rendered text to generate bounding box for knockout text.
Don't open-code knockout text shape generation in several different
places.

Make sure triangulated knockout text gets clearance added when
specified.

Collapse duplicated footprint text item plot routine (they're no
longer any different from plotting pcb text items).
2023-05-28 17:20:11 +01:00
Jeff Young 8b1fd62d35 Make pad & via teardrops 1st-class citizens (props of the pad/via)
Change teardrop generation to rely more heavily on BOARD_CONNECTIVITY
for improved performance.

Add updating of teardrops on BOARD_COMMIT::Push().

Also converts m_CopperItemRTreeCache to std::shared_ptr.
We don't copy it around anyway, and having to create a new set
of std::unique_ptr's for each operation is likely to be more
expensive than std::shared_ptr's overhead.
2023-05-19 18:02:03 +01:00
Jeff Young 5bf450a89f Performance. (Coverity) 2023-05-07 14:58:44 +01:00
Jeff Young b41d446f58 Fix a bunch more issues with sheetpaths and allowExtraText.
A sheetpath is required to correctly resolve text variables.
Depending on currentSheet is rife with bugs.

There are many places where we do *not* want to be prepending
field names to the field values, such as netlisting,
building PDF hypertext menus, etc.

Also, Find/Replace needs to work on unresolved text, as
that's what we're going to display (and if replace nuked
your variable references you wouldn't be happy).
2023-05-05 17:23:52 +01:00
Jeff Young af7753c7cd Record parent rule for DRC assertions.
(Particularly important if the rule specified a severity.)

Also fixes a bug looking up LSET layer names in the
GetStandardLayerNames array (which aren't the same).

https://forum.kicad.info/t/a-few-questions-about-custom-rules-syntax/40068/7
2023-04-30 13:01:09 +01:00
Jeff Young 251161dbeb Bring inspection reporting in line with zone filler
1) "clearance" rules don't apply to NPTH holes with no copper
2) local zone clearance applies even if other item has no copper

Fixes https://gitlab.com/kicad/code/kicad/issues/14575
2023-04-28 22:15:10 +01:00
Seth Hillbrand f7f52d77e4 Rework Copper Sliver check
Adds QA checks to copper sliver tests.  Adds the following checks:
- Dot product between two arms (quickly avoids checks for >90°)
- Checks the sliver is convex (area test)
- Eliminates minor slivers with angles that are approximately 0 and ones
  with the opposite side width beneath a configurable level
- Updates Clipper2 to fix a couple of jagged edges on inflate
- Adds simplify during zone fill inflation to limit jaggies

Fixes https://gitlab.com/kicad/code/kicad/issues/14549
2023-04-25 10:32:46 -07:00
jean-pierre charras d4cf063e40 Fix a few more doxygen errors (no actual code change) 2023-04-19 20:24:42 +02:00
jean-pierre charras 7545097d7f Fix a compil issue on msys2/gcc12.2, due to changes in commit dd1c58dc 2023-04-16 15:28:34 +02:00
Marek Roszko dd1c58dcf5 Fix MSVC C4840 warning
va_start requires trivially copy able classes.

wxString is not trivial. The correct thing to do is to use wxChar*
2023-04-16 07:36:41 -04:00
qu1ck 0c049eccc7 Fix a bunch of compiler warnings 2023-04-11 17:01:30 +00:00
jean-pierre charras 4d05bd62da drc_test_provider_library_parity: fix false positive.
After last changes in PCB_SHAPES, there were issues when comparing coordinates
of shapes.
Use now a footprint not flipped, not rotated and at position 0,0 for comparisons.
Fixes #14496
https://gitlab.com/kicad/code/kicad/issues/14496
2023-04-05 18:25:19 +02: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 28028c941e Retire Local/Draw coords distinction from PAD (the last object to have it). 2023-04-02 18:02:41 +01:00
Jeff Young bbd6c80507 Collapse FP_* down into their PCB_* equivalents. 2023-03-31 22:57:46 +01:00
Jeff Young a214ac0310 Better reporting of copper <--> keepout area clearances.
(Keepout areas can keep-out copper, but they don't have a clearance
to copper.)

Fixes https://gitlab.com/kicad/code/kicad/issues/14375
2023-03-26 20:57:59 +01:00
Jeff Young 9976b9ce8c Only report on clearances where there was one defined.
If it's 0, it's just a straight-up collision.
2023-03-26 20:46:59 +01:00
Jeff Young 0266d03f79 Run SILK_CLEARANCE rules on mask layer when testing silk-to-mask clearance.
This allows custom rules to be authored without firing the auto-generated
rule from Board Setup > Silk Item Clearance (which should be only for silk-
to-silk clearances).

Fixes https://gitlab.com/kicad/code/kicad/issues/14417
2023-03-26 20:42:41 +01:00
Jeff Young 04f6f04bed Test silk/mask collisions on the correct layer.
Fixes https://gitlab.com/kicad/code/kicad/issues/14417
2023-03-26 16:27:05 +01:00
Jeff Young c5e66361db Allow solder mask bridges between net-tie-group pads.
Fixes https://gitlab.com/kicad/code/kicad/issues/14412
2023-03-25 16:11:07 +00:00
Jeff Young d6dd58fff9 Keep track of single-pad-islands so we can discount spokes to them. 2023-03-25 10:44:46 +00:00
Seth Hillbrand 914b5a4d21 Simplify test for substantial nubs
Substantial elements following a divot should be at least as far in each
cardinal direction from the origin point in order to be considered
substantial.  This catches cases where the "substantial" element is
actually a straight segment away from the divot

Fixes https://gitlab.com/kicad/code/kicad/issues/14130
2023-03-22 13:01:50 -07:00
Jeff Young 129ccb891e Use standard paradigm for macro scope limiting. 2023-03-19 20:43:18 +00:00
Jeff Young ee1d9c561c Improve zone & rule area reporting.
Also removes a bunch of "wxEmptyString" where it was degrading readability.

Also fixes a bug where footprint zones were getting sorted incorrectly
due to rotation of coordinates.

Fixes https://gitlab.com/kicad/code/kicad/issues/14322
2023-03-17 13:28:29 +00:00
Jeff Young 967ee2c85b Improved macro protection. 2023-03-17 11:04:58 +00:00
Jeff Young 5427100539 Handle plotting of text on solder mask layer.
Admittedly this is an odd thing to do, but we should still be internally
consistent, and it has come up in customers' files.

Fixes https://gitlab.com/kicad/code/kicad/issues/14226
2023-03-12 21:21:15 +00:00
jean-pierre charras e6945a85b0 fix compil and Coverity warnings. 2023-03-12 15:19:50 +01:00
jean-pierre charras a264608368 drc_test_provider_library_parity.cpp: fix a typo that crashes Pcbnew. 2023-03-11 15:01:26 +01:00
Jeff Young 357427d803 Graphical diff for board vs library footprints.
Fixes https://gitlab.com/kicad/code/kicad/issues/13736
2023-03-10 17:16:40 +00:00
Jeff Young 2d6ab62da4 ADDED: schematic/library diff for symbols. 2023-03-09 18:04:52 +00:00
Seth Hillbrand 6b4c366cb8 Cleanup DRC check for via layers
Vias should only be placed on the layers through which they pass.  if
they pass through front or back copper, then they also pass through the
tech layers on that side

This is an update to 9d3f4bef6a
2023-03-07 11:13:05 -08:00
Jeff Young 33e7c78533 Edge connectors shouldn't trigger edge clearance violations.
Fixes https://gitlab.com/kicad/code/kicad/issues/14199
2023-03-07 12:23:18 +00:00
jean-pierre charras e7c3350482 fix compil warnings 2023-03-07 09:52:29 +01:00
Seth Hillbrand 7653a2bf99 Smarten connection width checker looking for splits
Fractured polygons are always fractured along the x-axis, so when
checking to see if a segment is a fracture point, we check if the y
coordinate is equal.  This avoids situations where there are multiple
fracture points between two inflection points

Additionally, we add a second check to ensure we don't hit spurious
blobs (all kinks should be symmetric and therefore be substantial in
each direction)

Fixes https://gitlab.com/kicad/code/kicad/issues/14130
2023-03-06 16:14:34 -08:00
Jeff Young 25623552f6 ADDED: board/library inspection for footprint differences.
Fixes https://gitlab.com/kicad/code/kicad/issues/13736
2023-03-06 23:08:59 +00:00
Wayne Stambaugh a1fb8e1b1d Coverity fixes and code cleaning. 2023-03-06 07:12:18 -05:00
Seth Hillbrand f24deac017 Consider oblong holes with x/y equal size as drills
An oblong hole with drillsizex = drillsizey is the same as a circular
drill hit and should be converted to such in outputs (both excellon and
DRC)
2023-03-03 00:42:44 +01:00
Seth Hillbrand 597ef81e53 Allow micro/buried via holes to be considered
hole_to_hole clearance should account for all holes in the board.
Previously, we had excluded non through holes from this test but that
omits via holes that can still foul a future drill hit.

Designers wanting the old behavior can explicitly set the hole_to_hole
clearance to 0mm for specific ViaType pairs
2023-03-03 00:42:44 +01:00
Wayne Stambaugh 789bf6455a Coverity fixes and code cleaning. 2023-03-02 09:04:47 -05:00
Seth Hillbrand a0f99ea8ba Allow for rounding error in connection width checker
We perform checks using squared distance but this loses the integer
rounding in the standard norm.  To correct for this, we allow a single
IU in the restriction, allowing fractionally smaller connection widths
before calculating the squared limit

Fixes https://gitlab.com/kicad/code/kicad/issues/14130

Fixes https://gitlab.com/kicad/code/kicad/issues/14131
2023-02-28 15:26:16 -08:00
Jeff Young 7bb2cdd658 Better error reporting for constraints (and a bug fix for no constraints).
Fixes https://gitlab.com/kicad/code/kicad/issues/14070
2023-02-28 18:07:29 +00:00
jean-pierre charras 7256a51e8e Fixes in build board outlines as polygon and convert_shape_list_to_polygon:
- Ensure Bezier curves have their polygon build before use it.
- When building board outlines as polygon the same chaining epsilon value
for DRC, export step and 3D view (default 0.01mm).
Fixes #14115
https://gitlab.com/kicad/code/kicad/issues/14115
Fixes #14009
https://gitlab.com/kicad/code/kicad/issues/14009
2023-02-28 16:45:03 +01:00
Jon Evans 8440d7258b Do not invalidate board caches during DRC
Footprints now modify their parent container when destroyed due to
26542796, and a temporary footprint is created during DRC
in some situations.  This can lead to board caches being messed
with during DRC which can cause unpredictable bad effects due to
multithreading.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/13844
2023-02-24 22:55:32 -05:00
Jeff Young d9a77e6a64 Add DRCEpsilon to net-tie-exclusion testing.
Fixes https://gitlab.com/kicad/code/kicad/issues/14008
2023-02-24 12:44:55 +00: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 5b0f1376c0 Simplify code now that we no longer drop out on first rule fired. 2023-02-16 17:55:33 +00:00
Jeff Young 978c2b074e Negative clearance means test will be ignored, not rule. 2023-02-16 17:39:47 +00:00
Jeff Young 407cdd63fb Translatable strings. 2023-02-16 17:28:06 +00:00
Seth Hillbrand 9d3f4bef6a DRC: Verify overlapping layers in physical clearance
When checking the physical clearance on a layer, it is critical to check
that the via hole exists on that layer.  Blind/buried and micro vias may
not overlap, so should be excluded from this check when they don't exist
on a particular layer

Similarly, we should only be reporting a single physical clearance error
for each item pair even though they may have multiple errors across
multiple layers in the case of via-via clearance
2023-02-15 11:35:24 -08:00
Seth Hillbrand e7fe69b97f Better handling of vertex sorting
Nominally, the zcode of a vertex is unique.  This is not 100% true,
however, as we must interlace two 32-bit numbers into a single 32-bit
number.  Sorting needs to account for the possibility that the zcode
will be the same while other elements of the vertex are different.  This
commit fixes the broken boolean logic to more clearly handle these cases

Fixes https://gitlab.com/kicad/code/kicad/issues/13867
2023-02-13 11:21:04 -08:00
Seth Hillbrand 90a388571e Fix copy-pasta
testing 'othervia' for dynamic_cast success needs to use `othervia`
rather than `via` which might still be null

Fixes Sentry issue KICAD-5K
2023-02-10 13:33:21 -08:00
Jeff Young a59c1afa53 Fix two bugs in RTree polygon collions special case.
1) Special case doesn't work for polygons with holes
2) Fix special case to handle intersecting lines where neither end is
   in the polygon.

Note that only (1) is required for the bug below.  (2) was just
discovered while implementing (1).

Fixes https://gitlab.com/kicad/code/kicad/issues/13779
2023-02-04 13:46:40 +00: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
Jeff Young 235925d62c Clearer reporting of negative clearances. 2023-02-03 15:08:31 +00:00
Jon Evans 26b9d2f5ac DRC: Allow disabling DP constraints in specific areas
Fixes https://gitlab.com/kicad/code/kicad/-/issues/13743
2023-02-01 23:11:39 -05:00
Jeff Young 50e9685490 Check for tented vias before expanding solder mask.
Fixes https://gitlab.com/kicad/code/kicad/issues/13705
2023-01-30 17:56:35 +00:00
Jeff Young e886ccacbd Cleanup unused local variable. 2023-01-24 23:45:55 +00:00
Jeff Young 00e2bbac5a Special-case net-ties for solder mask bridging.
Fixes https://gitlab.com/kicad/code/kicad/issues/13646
2023-01-24 11:33:08 +00:00
Jon Evans 12b0a12d74 Handle DP checks for board minimum rules
Fixes https://gitlab.com/kicad/code/kicad/-/issues/13640
2023-01-23 17:45:16 -05:00
Jeff Young ece775c53c Blind/buried vias are drilled, and drilled holes need to avoid prior-burned holes.
Fixes https://gitlab.com/kicad/code/kicad/issues/13627
2023-01-23 16:25:29 +00:00
Jeff Young e490728226 Don't run the footprint checker's shorting pads routine at board level.
Fixes https://gitlab.com/kicad/code/kicad/issues/13555
2023-01-16 16:44:16 +00:00
Jon Evans c530bdb5a1 Rename GetSelectMenuText to GetItemDescription
This descriptive text is used for many more things than
just the select menu these days.
2023-01-11 22:27:44 -05:00
Seth Hillbrand 14339aa786 Fix shadowing variable
Move check into switch block
2023-01-03 17:15:44 -08:00
Jeff Young 375fdb7a49 Exact clearance is allowed; less than clearance is an error.
Also fixes a bug where the units weren't shown for extra precision
numbers.

Fixes https://gitlab.com/kicad/code/kicad/issues/13262
2023-01-04 00:03:11 +00:00
Jeff Young 0094a0fc15 Treat teardrops as tracks not zones for disallow constraints.
Fixes https://gitlab.com/kicad/code/kicad/issues/13264
2022-12-26 11:33:09 +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
Jeff Young e28f6ecc00 Fetch a better location for keepout area collsions.
Fixes https://gitlab.com/kicad/code/kicad/issues/13220
2022-12-21 18:22:15 +00: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 c07043e762)
2022-12-12 11:14:38 -08:00
Jeff Young 492e6548ff If item is on mask layer then we won't call it again on copper layer.
Fixes https://gitlab.com/kicad/code/kicad/issues/13075
2022-12-10 13:51:00 +00:00
Jeff Young 295ef6588d Fix uninitialized variable. 2022-12-05 14:42:05 +00:00
Seth Hillbrand 92266635cc Add an advanced config value for the minimum sliver
The hard coded value was too small for certain calculations.  Better to
have a configurable value that is initially set to our error level to
allow for deviations that don't meet the visibility test for spikes.
These have become more apparent with Clipper2
2022-12-03 16:03:43 -08:00