Commit Graph

119 Commits

Author SHA1 Message Date
Jeff Young f7cdc7af75 Apply a more sophisticated test for ignoring isInCoupledDiffPair.
The basic problem is that the DRC engine does length testing and skew
testing by collecting all the diff pair constituent parts and pairing them
itself.  Since each part is collected on its own, we need to ignore the
'B' unit when evaluating any conditional expressions.  However, doing this
in general means that when evaluating "OwnClearance()" we also ignore the
'B' unit and return the diff pair CLEARANCE_CONSTRAINT when we shouldn't.

This implements a more discerning test which know what the current requested
constraint is when evaluating expressions.

See also https://forum.kicad.info/t/solved-custom-differencing-rule-not-working-drc/34034/6

Fixes https://gitlab.com/kicad/code/kicad/issues/11314
2022-04-02 15:12:42 +01:00
Jeff Young 65185f53a1 Rotate fp zones before comparing with library versions.
Also includes some performance fixes to not copy around triangulation
data when it's not needed.

Fixes https://gitlab.com/kicad/code/kicad/issues/10143
2022-03-14 15:53:24 +00:00
Jeff Young ae307e1b34 Parallelize DRC triangulation, keepout processing, and sliver checking.
Also fixes issue with adding fractured polygons in sliver checking which
slowed the board from hell down to less than a crawl.
2022-03-11 20:52:11 +00:00
Jeff Young 392a3ec131 Fix typo which leads to catastrophic performance on boards with tons of zones. 2022-03-08 20:16:37 +00:00
Seth Hillbrand c18d9b9baf Normalize `IsInsideCourtyard` 2022-03-04 15:49:02 -08:00
Jeff Young 8f670552a6 Allow Rule Areas on all physical layers.
Required to do things like modify silk_clearance rules.
2022-02-17 23:59:09 +00:00
jean-pierre charras 876061369b Fix some Pcbnew crashes due to null pointers 2022-02-14 13:46:05 +01:00
Jeff Young fe7e72538e Don't force user to be overly pedantic when writing diffpair rules. 2022-02-13 18:16:13 +00:00
Jeff Young 8dcc933fc3 Don't use bounding box cache during insideArea.
For starters we can't rely on it having been updated, but we also
cache the entire result so there's no huge cost-savings anyway.

Fixes https://gitlab.com/kicad/code/kicad/issues/10821
2022-02-12 18:38:11 +00:00
Jeff Young 7ccac79192 More wxString wide literals. 2022-02-05 21:29:34 +00:00
Jeff Young 6cec58cf75 Add field access to custom DRC rules.
ADDED getField() method to custom DRC rules.
2021-12-24 18:13:00 +00:00
Seth Hillbrand b88473e41f Respect context layer in eval
When testing for a specific layer context, we should only return true if
the item either exists on that layer or if the context layer is
UNDEFINED_LAYER, meaning the layer value is not material to the test

Relates to https://gitlab.com/kicad/code/kicad/-/issues/9366
2021-10-15 10:35:29 -07:00
Seth Hillbrand 58f553a9ca Check for layer when DRC on vias and non-zone items
We were already checking for zone-zone overlap but missing checks when
running against (possibly) buried vias as well as the general check

Fixes https://gitlab.com/kicad/code/kicad/issues/9366
2021-10-11 10:33:50 -07:00
Jeff Young b9ffe2aca8 Don't capture stack-defined lambdas by reference. 2021-08-21 22:49:57 +01:00
Seth Hillbrand 3b3cb88ad9 Remove shadowed variable in lambda 2021-08-21 14:01:20 -07:00
Jeff Young eb85af3366 Don't capture references to local stack variables. 2021-08-21 21:40:17 +01:00
Jeff Young 048e13f423 Defer DRC rule function eval to make use of short-circuit bools.
The lemon parser doesn't lend itself to short-circuiting booleans,
but if we defer processing until we fetch the second value when
processing the TR_OP_BOOLEAN opcode then we get to piggy-back on
C++'s boolean short-circuiting.
2021-08-21 16:43:11 +01:00
Jeff Young 1a252b4f96 Add a compile error for ill-defined rules, and more performance.
Also adds const-safety to GetBoard().
2021-08-16 12:14:17 +01:00
Jeff Young f34e280c81 Garden-variety 100X performance improvement.
Adds a compile mode for layer strings.
2021-08-15 22:24:51 +01:00
Jeff Young 1ec70d30af Cherry-pick some 7.0 Clearance Resolution improvements.
6.0 will be in the field for a long time, and the better the debugging
tools we have available the less costly it will be to maintain.

Fixes https://gitlab.com/kicad/code/kicad/issues/8961
2021-08-15 19:03:58 +01:00
luz paz 0446d35f0d Fix source comment/doc typos (follow-up)
Found via `codespell -q 3 -S *.po,./thirdparty -L aactual,acount,aline,alocation,alog,anormal,anumber,aother,apoints,aparent,aray,dout,einstance,modul,ot,overide,serie,te,,tesselate,tesselator,tht`
2021-07-13 10:48:17 +00:00
Jeff Young a89f6404b4 Fix logic bug found by Coverity. 2021-06-24 12:18:22 +01:00
Jeff Young 096e342386 Prefix TRACK, ARC and VIA. 2021-06-11 22:07:02 +01:00
Marek Roszko 10e60acf34 Clean up including of board_design_settings.h 2021-06-06 15:03:42 -04:00
Ian McInerney 4f05262705 Cleanup includes in board.h and footprint.h 2021-06-03 20:19:52 +01:00
Ian McInerney 23f8851409 Remove pcb_group include from board header 2021-06-03 20:03:31 +01:00
Jeff Young 00ed75b891 Fix DRC performance with multi-layer keepout zones.
The main issue was a parameter mismatch which caused On^2 behaviour
for zone layers.

But there are several other performance optimizations here, along
with status bar updating for zones while running the dissallow test.

Fixes https://gitlab.com/kicad/code/kicad/issues/8521
2021-06-02 14:11:43 +01:00
Marek Roszko cf2bb5692a Remove the wxLog calls from math/util.h for now
This was leaking windows headers and partial wx headers to 1084 compilation units......
This also means math/util.h is leaking to 1084 compilation units which seems a bit high too.
2021-06-01 18:44:22 -04:00
Jeff Young d12e5d824e Renaming for clarity and a performance improvement in corner rounding. 2021-06-01 23:11:54 +01:00
Marek Roszko 382dca4e6f Fix uninitialized member warnings
Based on PVS Studio report
2021-05-30 20:01:01 -04:00
Jeff Young e93e9fa3e5 Add rudimentary type checking to rule eval with reporter.
Also cleaned up existing error reporting to not expend CPU cycles
when there was no reporter.

Fixes https://gitlab.com/kicad/code/kicad/issues/8438
2021-05-20 23:06:24 +01:00
Tomasz Wlostowski 939b5e1932 PCB_EXPR_EVALUATOR: don't use string comparison to check for undefined enum values 2021-05-03 23:45:54 +02:00
Marek Roszko 03cf2b517f Enum class PAD_ATTR_T
Renamed such that python stays the same
2021-05-01 10:51:54 -04:00
Jon Evans ae113ea299 DRC: inDiffPair should return false if the coupled net is missing
Fixes https://gitlab.com/kicad/code/kicad/-/issues/8268
2021-04-21 22:41:17 -04:00
Jeff Young a2ffb45698 Update diff pair rule syntax to be clearer.
Fixes https://gitlab.com/kicad/code/kicad/issues/8010
2021-03-25 10:29:38 +00:00
Ian McInerney a94a481574 Fix compile warnings
Some simple warnings and also a deprecation warning from wx
because they felt that a function should be renamed...
2021-03-23 19:46:49 +00:00
Jeff Young fe196771d8 Implement isCoupledDiffPair() DRC rule function.
Fixes https://gitlab.com/kicad/code/kicad/issues/7975
2021-03-20 23:07:36 +00:00
Jeff Young ce46fe6581 Add insideFrontCourtyard and insideBackCourtyard DRC functions.
Fixes https://gitlab.com/kicad/code/kicad/issues/7972
2021-03-20 21:53:30 +00:00
Jeff Young 47145d349b Don't run insideArea on ruleAreas.
Fixes https://gitlab.com/kicad/code/kicad/issues/7826
2021-03-07 17:55:30 +00:00
Jon Evans cd7a2cd807 Fix shadowing fix that caused logic bug and different shadowing 2021-02-27 20:01:14 -05:00
Jon Evans 65531accf6 DRC: allow testing against particular diff pair membership 2021-02-27 19:54:55 -05:00
Jeff Young 3538c8a963 Thread safety for new caches (which are also used during zone fill).
Fixes https://gitlab.com/kicad/code/kicad/issues/7749
2021-02-27 21:33:30 +00:00
Wayne Stambaugh 5ca25a609e Pcbnew: fix shadow variable in expression evaluator. 2021-02-27 12:09:06 -05:00
Jeff Young 4ede4e061e More DRC performance work.
Push DRC zone RTrees into BOARD so that they can also be used by
insideArea.

All these caches are a bit of an encapsulation leak, but they make a
significant impact on performance.

Fixes https://gitlab.com/kicad/code/kicad/issues/7720
2021-02-27 11:45:04 +00:00
Jeff Young f226373324 Add cache for insideArea() and insideCourtyard().
Fixes https://gitlab.com/kicad/code/kicad/issues/7720
2021-02-26 19:22:25 +00:00
Jeff Young c7a71b44e5 Zones must be entirely inside for insideCourtyard.
This is a huge performance win as otherwise we're doing *lots* of
shape collisions with ground planes.

Fixes https://gitlab.com/kicad/code/kicad/issues/7720
2021-02-26 17:19:48 +00:00
Seth Hillbrand bac7b3e77a Protect against dynamic_cast
Items might not be FOOTPRINT, in which case the dynamic_cast will return
nullptr.  Check for this in the subfunction
2021-02-22 10:12:54 -08:00
Jeff Young ba2d0cdd62 Nullptr safety. 2021-02-22 01:14:06 +00:00
Jeff Young a1f09befe0 Vias are plated holes too.... 2021-02-20 14:13:36 +00:00
Jeff Young 199ef61cdc A footprint isn't "inside" itself.
Fixes https://gitlab.com/kicad/code/kicad/issues/7549
2021-02-15 22:52:12 +00:00