Commit Graph

295 Commits

Author SHA1 Message Date
Jeff Young 371091a09b Make zone filler respect mechanical clearances. 2022-05-06 00:06:00 +01:00
Jeff Young 5d0d2201f3 Improve clearance report messages.
Removes some duplicated terms; puts in some more headers to make
visual parsing easier, and makes non-connected-pads report the correct
data.

Also fixes a bug where zone-connection overrides of none weren't getting
handled correctly.

Fixes https://gitlab.com/kicad/code/kicad/issues/11544
2022-05-03 16:30:04 +01:00
Jeff Young 604a148f40 Don't apply electrical clearance to shapes on Edge.Cuts.
Also don't apply them to NPTH holes.
2022-04-13 23:38:45 +01:00
Jeff Young 1dae5eb7c4 A better blob vs web detector.
Since we're in a deflated state, a long web *could* still have a very
small area.  So check max extents instead.
2022-04-10 19:48:45 +01:00
Jeff Young 1a2e0d8226 Apply the min-width-by-min-width test to islands after pruning.
We're looking for minimum *web* width.  A blob does not a web make.

Fixes https://gitlab.com/kicad/code/kicad/issues/6907
2022-04-10 18:21:31 +01:00
Jeff Young fd9fd1df05 Careful of skipping non-flashed pads for performance: they might still have a hole. 2022-04-04 15:03:01 +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 f6dac9eb13 Support text knockouts in non-copper zones. 2022-03-08 18:06:41 +00:00
Jeff Young 23088e6e1a Minor performance enhancements for zone filler.
Be smarter about not knocking out some classes of pads twice.
2022-03-05 20:32:08 +00:00
Jeff Young fed5bcbdf6 Improvements for pads/vias in zones which knockout other zones.
1) Drop tiny islands which might cause connection problems.
2) Cleanup some dead code in filler
3) Don't estabilish a connection to an island that is fully covered
by whatever its connecting to.

Fixes https://gitlab.com/kicad/code/kicad/issues/11036
2022-03-05 18:59:53 +00:00
Jeff Young 878c4d2f6b Must clear arcs before calling Clipper. 2022-03-05 18:59:53 +00:00
Jeff Young 843a56c4e4 Implement two-staged zone priority: assigned priority followed by UUID. 2022-03-01 14:53:35 +00:00
Jeff Young e6c617b74d Respect ERROR_OUTSIDE when inflating polygons.
Fixes https://gitlab.com/kicad/code/kicad/issues/10896
2022-02-21 15:19:46 +00:00
Jeff Young 81bed9ab96 Add zone margin when subtracting other graphics and zones.
It was already added for pads and tracks, but not the other objects.

Fixes https://gitlab.com/kicad/code/kicad/issues/10896
2022-02-18 13:20:36 +00:00
Jeff Young b1bd8421e0 Performance: remove associated triangle sets when removing outline.
This saves us having to re-triangulate at the end of zone filling.
2022-02-16 17:00:54 +00:00
Jeff Young 327ddad79f Performance: get rid of rawPolys / finalPolys distinction.
(The final fractured polys are required, and we don't really ever use
the raw polys anyway, so they were removed.)
2022-02-16 15:33:12 +00:00
Jeff Young 2172810600 Performance: better sharing of zone fills. 2022-02-15 19:19:03 +00:00
Jeff Young d8c4f2cb09 Performance improvements for zone filler. 2022-02-15 19:19:02 +00:00
Jeff Young 3deaf902bb Retire the V5 zone fill algorithm.
Fixes https://gitlab.com/kicad/code/kicad/issues/10578
2022-02-11 13:10:52 +00:00
Jeff Young 7ccac79192 More wxString wide literals. 2022-02-05 21:29:34 +00:00
Jeff Young 5739505aa3 TextBoxes for PCBNew. 2022-01-31 20:00:47 +00:00
jean-pierre charras aef665b1e2 PCB_TARGET: add missing TransformShapeWithClearanceToPolygon() method.
Fixes #10653
https://gitlab.com/kicad/code/kicad/issues/10653
2022-01-29 18:19:22 +01:00
Jeff Young 4eac8d7c66 Remove unit-less angles from geometry lib APIs. 2022-01-20 21:10:04 +00:00
Jeff Young 038db715a3 Move zone hatch orientation to EDA_ANGLE. 2022-01-19 00:34:03 +00:00
Jeff Young 07013d00e1 More EDA_ANGLE. 2022-01-14 16:08:19 +00:00
Jeff Young d485eb2514 Move pads to EDA_ANGLE. 2022-01-14 16:08:18 +00:00
jean-pierre charras ac78d51b14 Teardrops: better dialog, and better code 2022-01-10 20:04:41 +01:00
jean-pierre charras 53770fec68 Ensure thermal spoke widths are smaller than the pad size (fix a regression)
This is needed to create good thermal reliefs, and ensure the DRC about
thermal spoke count works.
Fixes #10246
https://gitlab.com/kicad/code/kicad/issues/10246
2022-01-07 16:38:27 +01:00
jean-pierre charras 7fa451dc93 Thermal reliefs: fix incorrect calculation
commit eeef655 did not fix the calculations.
2022-01-06 09:00:29 +01:00
jean-pierre charras eeef65533a Pad Thermal Reliefs: fix spoke incorrect angle for rotated pads.
Fixes #10251
https://gitlab.com/kicad/code/kicad/issues/10251
2022-01-05 11:19:43 +01:00
Marek Roszko ea613cf448 Another batch of point changes 2022-01-01 13:17:12 -05:00
Marek Roszko c4c56de708 Neurotically update position wxPoint usages 2022-01-01 11:55:51 -05:00
Jeff Young 3aa6d73770 Allow min/max/opt to come from different rules. 2021-12-24 12:36:37 +00:00
Jeff Young 32721755bf Hook up zone-pad connections to custom rules.
ADDED zone_connection constraint.
ADDED thermal_relief_gap and thermal_spoke_width constraints.

ADDED angle override for thermal relief spokes in Pad Properties.

Fixes https://gitlab.com/kicad/code/kicad/issues/4067
2021-12-23 22:30:26 +00:00
Jeff Young 77239591c0 Don't commit zone refill if there were no changes.
Fixes https://gitlab.com/kicad/code/kicad/issues/10085
2021-12-23 16:54:03 +00:00
Seth Hillbrand 401de24274 Recalculate ratsnest after zone fill
Push the mutex down into the ZONE::Fill() routine and set the
connectivity update to run after zone fills.  The connectivity update
cannot run while the mutex is locked for zone fills.

Fixes https://gitlab.com/kicad/code/kicad/issues/9993
2021-12-14 13:37:15 -08:00
Jeff Young 341b0a5652 Don't depend on a keepout zone having no priority.
Fixes https://gitlab.com/kicad/code/kicad/issues/7776
2021-10-26 17:20:09 +01:00
Jeff Young b1f17dc927 Don't let the polygon routines collapse on a zero line width.
Fixes https://gitlab.com/kicad/code/kicad/issues/9418
2021-10-20 12:29:07 +01:00
Jeff Young f606679164 Proper numeric sorting for intersheet refs.
Also expunges the horrifically named std::remove and std::remove_if
(neither of which remove anything).
2021-10-01 18:29:21 +01:00
Jeff Young 41619ebbe2 Decouple PROGRESS_REPORTER interface from implementations. 2021-08-14 21:05:49 +01:00
Jeff Young a208dac8d8 Convert hole clearance tests from NPTH holes to all holes. 2021-08-09 22:26:00 +01:00
Roberto Fernandez Bautista 6a9a177fa3 Remove zone filler arc collision workaround 2021-08-05 17:45:12 +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
jean-pierre charras 17737af130 Fix some issues related to SHAPE_ARC:
- Some are related to shape errors when the allowed error to approximate circle
by segment is large and arc radius small.
- fix the actual error used in ConvertToPolyline().
- Use SHAPE_ARC::DefaultAccuracyForPCB() instead of a fixed value as extra margin
in zones. It should not change something, because it is also a fixed value
(5 micrometers), but it is not a magic number.
-TransformArcToPolygon() fix some issues and add a new algo, based on the arc actual
outline shape (initial algo is still available in code, just in case).
2021-06-30 13:33:49 +02:00
Jeff Young 81fc710a5d Use consistent terminology.
Fixes https://gitlab.com/kicad/code/kicad/issues/8681
2021-06-26 10:11:41 +01:00
jean-pierre charras 83b549741d PCB_ARCS in zones: increase clearance to avoid DRC issues. This is a workaround,
but arcs in tracks are still not fully fixed.
The clearance is increased by only 4 microns, that should not create issues.
2021-06-25 19:45:32 +02:00
Jeff Young 096e342386 Prefix TRACK, ARC and VIA. 2021-06-11 22:07:02 +01:00
luz paz f968fc8719 Fix source comment / documentation typos 2021-06-09 19:32:58 +00:00
Marek Roszko 10e60acf34 Clean up including of board_design_settings.h 2021-06-06 15:03:42 -04:00
Marek Roszko 03cf2b517f Enum class PAD_ATTR_T
Renamed such that python stays the same
2021-05-01 10:51:54 -04:00
Marek Roszko b243c2280d enum class PAD_SHAPE_T 2021-05-01 08:22:35 -04:00
Jeff Young eb85836234 Make sure we have footprint courtyards before depending on DRC rules.
Fixes https://gitlab.com/kicad/code/kicad/issues/8291
2021-04-25 12:45:06 +01:00
Jeff Young fe6cc0c3d8 Spokes are from center of pad, not from hole (ie: pad position).
Fixes https://gitlab.com/kicad/code/kicad/issues/8195
2021-04-14 11:34:26 +01:00
Jeff Young 6272b48481 Make sure layer gets passed in to rules evaluation. 2021-02-08 14:53:49 +00:00
Jeff Young e26c912b86 Don't apply electrical clearance to non-copper zones.
Also removes a very old (and somewhat confusing) comment.

Fixes https://gitlab.com/kicad/code/kicad/issues/7404
2021-02-03 11:56:43 +00:00
Seth Hillbrand 8778599c0d Apply same nettie hack to zone filler
The nettie hack is used in DRC but we also need to use it in zone filler
to allow zones to be used with netties.  We limit this to the
appropriate nets in the nettie

Fixes https://gitlab.com/kicad/code/kicad/issues/7351
2021-01-31 16:16:48 -08:00
Seth Hillbrand 6b685dfb3f Fix the knockout conditions
We need to knock out thermal clearance for same net pads but this
doesn't need to be placed in the regular clearance area (probably).

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

Fixes https://gitlab.com/kicad/code/kicad/issues/7340
2021-01-30 08:15:00 -08:00
Seth Hillbrand 714430fefa Flash pads when connected by zone
Zone connections (even half-connections) should trigger the connected
logic in flashPads.  This removes the double-standard for painting pads
and imposes thermal standoff based on the net connection to the pad if
it shares a net, not just if connected
2021-01-28 13:21:22 -08:00
Jon Evans 1e33928b96 Fix issues with zone filling connectivity locking
Two issues found with the locking system used to prevent access to
stale connectivity data during the zone fill process:

1) a std::mutex has undefined behavior if you try to use it to guard
against access from the same thread.  Because of the use of wx event
loops (and coroutines) it is entirely possible, and in some situations
inevitable, that the same thread will try to redraw the ratsnest in the
middle of zone refilling.

2) The mutex was only guarding the ZONE_FILLER::Fill method, but the callers
of that method also do connectivity updates as part of the COMMIT::Push.
Redrawing the ratsnest after the Fill but before the Push will result in
stale connectivity pointers to zone filled areas.

Fixed (1) by switching to a trivial spinlock implementation.  Spinlocks would
generally not be desirable if the contention for the connectivity data crossed
thread boundaries, but at the moment I believe it's guaranteed that the reads
and writes to connectivity that are guarded by this lock happen from the main
UI thread.  The writes are also quite rare compared to reads, and reads are
generally fast, so I'm not really worried about the UI thread spinning for any
real amount of time.

Fixed (2) by moving the locking location up to the call sites of
ZONE_FILLER::Fill.

This issue was quite difficult to reproduce, but I found a fairly reliable way:
It only happens (for me) on Windows, MSYS2 build, with wxWidgets 3.0
It also only happens if I restrict PcbNew to use 2 CPU cores.
With those conditions, I can reproduce the issue described in #6471 by
repeatedly editing a zone properties and changing its net.  The crash is
especially easy to trigger if you press some keys (such as 'e' for edit)
while the progress dialog is displayed.  It's easiest to do this in a debug
build as the slower KiCad is running, the bigger the window is to trigger this
bug.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/6471
Fixes https://gitlab.com/kicad/code/kicad/-/issues/7048
2021-01-18 13:22:12 -05:00
Jeff Young da4b269783 Make sure pad local clearances get in to m_worstClearance. 2021-01-13 12:37:20 +00:00
Jeff Young 3fd128a75b Performance enhancements. 2021-01-08 00:46:55 +00:00
Jeff Young 018c17399d SNR. 2021-01-01 23:17:49 +00:00
Jon Evans 23f81412c3 Ensure connectivity is updated before filling zones
Fixes https://gitlab.com/kicad/code/kicad/-/issues/6844
(maybe)
2020-12-29 14:58:45 -05:00
Jeff Young cfb4e34b07 Cleanup. 2020-12-28 20:44:46 +00:00
Jeff Young 889408c96a More improvements to new selection disambiguation.
Also a rationalization of text polygon generators, with the "standard"
version inherited from BOARD_ITEM now giving the bounding box.  This
requires callers who want the (much) more expensive stroke-based one
to call it explicitly (and brings PCB_TEXT in line with the was FP_TEXT
already was.

Fixes https://gitlab.com/kicad/code/kicad/issues/6525
2020-11-29 14:02:46 +00:00
Roberto Fernandez Bautista 5db78a3d53 Fix typo in zone filling progress reporter. "insulated" -> "isolated" 2020-11-28 17:18:17 +00:00
Jeff Young ff3bd7e72a Fix a crash bug in DRC, and equate Margin to Edge.Cuts. 2020-11-20 21:22:27 +00:00
Jeff Young 203c860f01 Ensure better smoothing for zones clipped by board edges. 2020-11-19 18:34:30 +00:00
Jeff Young bdbb68f813 MODULE -> FOOTPRINT. 2020-11-13 16:04:03 +00:00
Jeff Young 522d64968e Yet more module -> footprint. 2020-11-13 15:16:24 +00:00
Jeff Young 52a46341db More module -> footprint. 2020-11-13 15:16:24 +00:00
Jeff Young f5443de7f9 D_PAD -> PAD. 2020-11-13 15:16:24 +00:00
Jeff Young 84dd5108ba Remove some "class_" prefixes from files. 2020-11-13 15:16:23 +00:00
Jeff Young f7333ad64a Update some classnames including archaic zone names. 2020-11-12 10:31:25 +00:00
Ian McInerney d88eaaf477 Fix various compiler and Coverity warnings 2020-11-11 00:41:02 +00:00
Jeff Young 0a0a51471c More commenting and simpification of zone filler code. 2020-11-07 18:50:30 +00:00
Jeff Young dd428b3d5a Small fix to comment. 2020-11-04 13:29:49 +00:00
Jeff Young 55c25f3cc4 Work around a round-off bug in Clipper.
Fixes https://gitlab.com/kicad/code/kicad/issues/6260
2020-11-02 17:43:13 +00:00
Jeff Young ae9afdd169 SNR. (Mostly for progammers, but a little for user messages.) 2020-11-02 16:20:00 +00:00
Jeff Young fc6fc88219 Zone fill fixes for divots and hatching + more debug layers.
Fixes https://gitlab.com/kicad/code/kicad/issues/6203
2020-10-29 21:20:34 +00:00
Jeff Young 397f3d07db Be more responsive to cancel when filling zones.
Fixes https://gitlab.com/kicad/code/kicad/issues/6077
2020-10-26 15:36:07 +00:00
Jeff Young 09af6c78bb Consistency. 2020-10-26 15:36:07 +00:00
jean-pierre charras d6f91c810f Fix a few compil and Coverity warnings. 2020-10-25 10:02:07 +01:00
Jeff Young 050cfd34dd Move same-net higher-priority knockout to after smoothing.
Fixes https://gitlab.com/kicad/code/kicad/issues/6145
2020-10-24 17:48:30 +01:00
Jeff Young 317bdc58a8 Add a couple more layers to zone debugging. 2020-10-24 17:48:30 +01:00
Jeff Young d2eca81b8b Fix deadlock when filling single zone. 2020-10-24 17:48:30 +01:00
Jeff Young 1cdb8b5584 Make sure local zone clearances are factored into worstClearance.
Fixes https://gitlab.com/kicad/code/kicad/issues/6128
2020-10-23 14:27:36 +01:00
jean-pierre charras 0cf57c7b1f Fix minor compil warnings (shadowed vars) 2020-10-13 17:35:54 +02:00
Jeff Young 1703729269 Require explicit decl of maxError and errorLocations.
This should reduce both performance issues and clearance issues.
2020-10-13 13:49:07 +01:00
Jeff Young af90642440 Hook board edge clearance constraints up to zone filling.
Also hooks them up to the clearance resolution reporter, and makes
some general improvements to reporting.

Fixes https://gitlab.com/kicad/code/kicad/issues/5947
2020-10-12 18:31:00 +01:00
Jeff Young 37568d10ec Min width is smallest width it *can* be, not largest it *can't*.
Fixes https://gitlab.com/kicad/code/kicad/issues/5966
2020-10-11 19:17:19 +01:00
Jeff Young 22cde88ba9 Allow chamfering/filleting of zone/board edge intersections.
Fixes https://gitlab.com/kicad/code/kicad/issues/5947
2020-10-10 23:09:43 +01:00
Jeff Young 37906511f5 Class renaming.
DRAWSEGMENT  -> PCB_SHAPE
EDGE_MODULE  -> FP_SHAPE
TEXTE_PCB    -> PCB_TEXT
TEXTE_MODULE -> FP_TEXT
2020-10-05 11:55:33 +01:00
Jeff Young 7a4900b8dc PCB_LINE_T -> PCB_SHAPE_T and PCB_MODULE_EDGE_T -> PCB_FP_SHAPE_T
Also updated footprint text and zone types for consistencey.
2020-10-04 16:49:04 +01:00
Seth Hillbrand bf3cb0b1d0 Standardize pad type enums 2020-09-30 08:38:35 -07:00
Jeff Young 673b52b5c4 Non-copper zones need a different trim-outside-board strategy.
The copper zones are checking for any point being outside the board
as they will have already been broken in to islands either entirely
outside or entirely inside the board.  Not so for non-copper zones.

However, non-copper zones are *already* trimmed to the board edges,
so we just need to avoid using the above faulty assumption.

Fixes https://gitlab.com/kicad/code/kicad/issues/5811
2020-09-30 11:50:51 +01:00
Jeff Young d3f8f2b81e Remove confusion between pad->IsOnLayer and pad->IsPadOnLayer 2020-09-30 11:50:51 +01:00
Jeff Young d0773cbe89 Be more careful with iterators when deleting.
Fixes https://gitlab.com/kicad/code/kicad/issues/5811
2020-09-29 14:11:32 +01:00
Jeff Young d70f812255 Fix some initialisation issues in the Python framework.
Fixes https://gitlab.com/kicad/code/kicad/issues/5824
2020-09-29 14:11:32 +01:00
Jeff Young 8dfb5b5640 Go back to separate intermediate and final corner strategies.
While we can *almost* get away with only chamfering/rouding acute
corners, some ugly edge cases turn up.

Fixes https://gitlab.com/kicad/code/kicad/issues/5581
2020-09-29 00:51:36 +01:00