Commit Graph

220 Commits

Author SHA1 Message Date
Jon Evans b11e315d10 Refactor DIMENSION to hide internal details; add some new properties
This is a board file format change to account for the new properties.
Also, we now only store the critical information about the dimension's
geometry in the board, rather than storing every drawn line.

The DIMENSION object is now an abstract base, and ALIGNED_DIMENSION
is the implementation that exists today (we will add more dimension
types in the future)
2020-09-11 21:12:36 -04:00
Jeff Young e2bc7557cc Clean up arc/circle polygonization.
1) For a while now we've been using a calculated seg count from a given
maxError, and a correction factor to push the radius out so that all
the error is outside the arc/circle.  However, the second calculation
(which pre-dates the first) is pretty much just the inverse of the first
(and yields nothing more than maxError back). This is particularly
sub-optimal given the cost of trig functions.

2) There are a lot of old optimizations to reduce segcounts in certain
situations, someting that our error-based calculation compensates for
 anyway.  (Smaller radii need fewer segments to meet the maxError
condition.) But perhaps more importantly we now surface maxError in the
UI and we don't really want to call it "Max deviation except when it's
not".

3) We were also clamping the segCount twice: once in the calculation
routine and once in most of it's callers.  Furthermore, the caller
clamping was inconsistent (both in being done and in the clamping
value). We now clamp only in the calculation routine.

4) There's no reason to use the correction factors in the 3Dviewer;
it's just a visualization and whether the polygonization error is
inside or outside the shape isn't really material.

5) The arc-correction-disabling stuff (used for solder mask layer) was
somewhat fragile in that it depended on the caller to turn it back on
afterwards.  It's now only exposed as a RAII object which  automatically
cleans up when it goes out of scope.

6) There were also bugs in a couple of the polygonization routines where
we'd accumulate round-off error in adding up the segments and end up with
an overly long last segment (which of course would voilate the error
max). This was the cause of the linked bug and also some issues with vias
that we had fudged in the past with extra clearance.

Fixes https://gitlab.com/kicad/code/kicad/issues/5567
2020-09-11 11:23:49 +01:00
Jeff Young e782794f96 Flesh out object properties and DRC Rule syntax help. 2020-09-05 17:44:59 +01:00
Wayne Stambaugh ede39780e2 Remove all debugging output that cannot be disabled.
The use of printf, wxLogDebug, and std::err/std::out causes excessive
debugging output which makes finding specific debugging messages more
difficult than it needs to be.

There is still some debugging output in test code that really needs to
be moved into a unit test.

Add debugging output section to the coding policy regarding debugging
output.
2020-08-18 10:17:36 -04:00
Michael Kavanagh b06e605255 Remove duplicate code in Eagle PCB plugin 2020-08-17 03:02:44 +00:00
Jeff Young dbb7859b7c Move Eagle routing layer to Dwgs.User (instead of Edge.Cuts).
Fixes https://gitlab.com/kicad/code/kicad/issues/1899
2020-08-15 17:32:13 +01:00
Jeff Young 692aeff334 Fix a bunch of usages of copy ctor that really meant duplicate.
In particular, "duplicate" means "with a new KIID".

Fixes https://gitlab.com/kicad/code/kicad/issues/5127
2020-08-10 14:23:11 +01:00
Jeff Young 00e77d1ba4 Implement pad & via aprons for hatched zones.
Fixes https://gitlab.com/kicad/code/kicad/issues/2519
2020-08-07 15:15:43 +01:00
Jeff Young a5f5a20722 Repair formatting. 2020-08-04 15:57:57 +01:00
Jan Mrázek 1c9cae0b06
eagle: Interpret overline in texts
CHANGED: Overline in Eagle boards are correctly imported
2020-08-04 16:25:08 +02:00
Seth Hillbrand 9f09c3872f Ensure file reads always use the C-locale variant
Str2Double assumes current locale.  We usually switch the locale when
reading files but we should be using the function that explicitly gets
the C-locale conversion.
2020-07-12 20:03:50 -07:00
Jan Mrázek 3091bb1459 eagle: Change font size calculation
Eagle includes stroke thickness into font size, KiCAD does not. Remove
the hack with scaling down the font, compute size precisely.

CHANGED: Fixed font calculation in Eagle import
2020-06-09 15:30:04 +00:00
Jan Mrázek e34a01dc68 eagle: Make semantics of cutout correct
Eagle cutout polygons only restrict filled copper, they do not limit
tracks, vias and pads inside them. Fix this behavior in the Eagle
import.

CHANGED: Fix semantics of Eagle cutout polygons
2020-06-09 15:30:04 +00:00
Thomas Pointhuber 25eb88636f eagle: handle TRESTRICT, BRESTRICT and VRESTRICT consistently 2020-06-07 00:16:04 +00:00
Thomas Pointhuber 23cc51a53f eagle: add support for tRestrict, bRestrict and vRestrict on circle
Fixes #1869
https://gitlab.com/kicad/code/kicad/-/issues/1869
2020-06-07 00:16:04 +00:00
Thomas Pointhuber 22860b6e7a eagle: add support for tRestrict, bRestrict and vRestrict on polygons
Fixes #2451
https://gitlab.com/kicad/code/kicad/-/issues/2451
2020-06-07 00:16:04 +00:00
Thomas Pointhuber 54decd8afb eagle: add support for tRestrict, bRestrict and vRestrict on rectangles
Fixes #2451
https://gitlab.com/kicad/code/kicad/-/issues/2451
2020-06-07 00:16:04 +00:00
Jeff Young 05855a5a1c Performance enhancements for DRC. 2020-05-18 13:38:17 +01:00
Jeff Young 74ee143d45 Add via annulus minimum. 2020-05-11 22:56:09 +01:00
Jeff Young 0f8c7ffd11 Add pad keepout and footprint keepout areas.
Fixes https://gitlab.com/kicad/code/kicad/issues/2365
2020-05-07 17:51:27 +01:00
Ian McInerney 2148c593d6 Fix some compile warnings 2020-05-06 01:46:09 +01:00
Jeff Young e0da677d4d Add min clearance to DRC; rename Min Via Drill to Min Through Hole.
Also fixes a crash bug when ignoring a DRC violoation with multiple
markers.

Fixes https://gitlab.com/kicad/code/kicad/issues/2528
2020-05-04 22:08:36 +01:00
Jeff Young e39d145d72 Add DRC tests for minimum drill size (based on min via size). 2020-05-04 22:08:36 +01:00
Michael Kavanagh b67f18b394 EAGLE import tKeepout/bKeepout to F_CrtYd/B_CrtYd
Also move Pcbnew import menu to correct sub menu.

Fixes https://gitlab.com/kicad/code/kicad/issues/2347
2020-04-27 19:33:17 +00:00
Jeff Young 9c8941e040 Remove a bunch of globals. 2020-04-16 17:34:46 +01:00
Jeff Young 6e800bddae Rationalize penWidth processing as first step in removing some globals. 2020-04-13 20:58:13 +01:00
Ben Dooks 070c6b8ce0 Fix issue with DRC for through hole being applied to SMD pads
Commit d7272b7f5e fixed the use of
the eagle DRC to change the library pad shapes. This was also
applied incorrectly to SMD stacks.

Remove the references to m_rules in packageSMD() and the code
that deals with them. eagle 7.7 does not have any SMD pad options
other than rectangle with rounding.
2020-02-27 16:58:15 +00:00
Jeff Young 129042f8a6 Convert timestamps to UUIDs. 2020-02-20 21:29:52 +00:00
Jeff Young 1e6840ea8f Don't report Eagle errors on the Unrouted layer.
Fixes https://gitlab.com/kicad/code/kicad/issues/3398
2020-02-05 22:21:16 +00:00
Jeff Young 715448611d Fix potential divide-by-zero (from Coverity scan). 2020-01-11 21:29:25 +00:00
Ian McInerney 13b6028e1b Refactor all math into a new kimath library
* Split up the thirdparty code into the thirdparty folder (#3637)
* Create a new kimath static library containing all the math functions

This is part of cleaning the build system for #1906.
2020-01-07 17:12:59 +00:00
Mark Roszko 19ceb11ae7 Change more enums over to scoped enums 2019-12-28 00:55:11 +00:00
Mark Roszko 11ff16be4e Switch to scoped enums 2019-12-20 14:11:39 +00:00
Seth Hillbrand 6983c56cf8 Use const references where possible
This avoids copy cost on local vars where we only read.
2019-12-05 14:40:22 -08:00
Seth Hillbrand b5f021ff9f Cleanup: Replace push_back with emplace_back
In cases where we create a new item and immediately push into a
container, the emplace idiom is faster and more efficient.
2019-12-05 13:41:21 -08:00
Seth Hillbrand 4d2e953f42 Cleanup: Replace C-only deprecated headers
This replaces headers deprecated by C++14 with their equivalent
replacement
2019-12-05 11:03:15 -08:00
Jeff Young 1c153c55c0 Add default units and precision for new dimension objects.
Fixes: lp:1846376
* https://bugs.launchpad.net/kicad/+bug/1846376
2019-11-05 17:22:51 +00:00
Wayne Stambaugh 4bfb8ef457 Pcbnew: fix Eagle footprint library polygon pad sizes.
Eagle includes the width of the polygon line when generating polygon pad
sizes where KiCad does not.  This simple fix inflates polygon pads half
of the Eagle polygon line width.

Fixes lp:1833687

https://bugs.launchpad.net/kicad/+bug/1833687
2019-09-12 07:35:48 -04:00
Jeff Young e269b5d1b9 Workaround an issue where a throw terminates (even when there's a catch for it).
You can trigger it before this fix by running Cvpcb when a .kicad_mod file is
incorrectly set as "Legacy" in your footprint table.
2019-08-31 15:18:27 +01:00
Seth Hillbrand 8277aeec7d eagle: Set module-relative position of ref/val
We need to set the footprint local coordinates of the footprint
reference and value fields at instantiation separately from the
TEXT_DIVERS elements.

Fixes: lp:1829727
* https://bugs.launchpad.net/kicad/+bug/1829727

(cherry picked from commit a43a228f78)
2019-08-26 09:57:17 -07:00
Thomas Pointhuber 5f438b7a85 Fix handling of filled circle in eagle importer (was only partly fixed)
Partly fixed in 4fc692f04b, but missed
that there is a loadPlain where I need to handle this case as well.
2019-07-26 09:55:06 -04:00
Thomas Pointhuber c68b83e1bb Add support for hatched zones in eagle import 2019-07-26 09:38:26 -04:00
Jeff Young b9749d361b Turn of pad mask layers if Eagle file specifies stop="no"
Fixes: lp:1835930
* https://bugs.launchpad.net/kicad/+bug/1835930
2019-07-17 01:03:34 +01:00
Jeff Young 2c5876ee8c Add more control over how corners are handled when inflating polygons. 2019-07-16 16:41:21 +01:00
Jeff Young 1a7cef2950 Improve performance, commenting and API of some polygon classes. 2019-07-14 10:39:38 +01:00
Jeff Young 37af3adffb Add preference for flip axis.
Fixes: lp:1836267
* https://bugs.launchpad.net/kicad/+bug/1836267
2019-07-14 10:36:48 +01:00
Seth Hillbrand 6a45446496 pcbnew: Remove the last dlist from modules/pcbnew 2019-06-01 20:55:32 -07:00
Seth Hillbrand 9163ac543a pcbnew: Move pads to std::deque 2019-06-01 16:23:54 -07:00
Seth Hillbrand 888c01d11b pcbnew: Move tracks to std::deque 2019-06-01 09:53:23 -07:00
Seth Hillbrand 6bcf1839b7 pcbnew: Add arc approximation setting to board
This places the arc approximation setting in the kicad_pcb file and uses
it for all parts of the board rendering where arcs are converted to
segments.  This allows the user to customize their speed vs. accuracy
tradeoff.  The default setting of maximum error of 0.005mm is acceptable
for small boards on moderate systems.
2019-05-24 21:21:06 -07:00