Commit Graph

589 Commits

Author SHA1 Message Date
Jeff Young acd7d5ad2f Don't clamp arc centers quite so aggressively.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/16029

(cherry picked from commit 24ca7add42)
2023-11-06 17:00:37 +00:00
Wayne Stambaugh f988b807c4 Don't show integer overflow errors in release builds.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15529

(cherry picked from commit bfd3e71a88)
2023-10-30 10:09:35 -04:00
Jeff Young 4156587abe Don't assume an error location for PAD::GetEffectivePolygon().
While ERROR_INSIDE was good for plotting, 3D generation, etc., it's
not good for generating router hulls.

Also reverts part of the change to always use polygons for PNS::SOLIDs.  A single shape in a SHAPE_COMPOUND will be faster (and
more accurate).

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

(cherry picked from commit 62d959ed0e)
2023-10-14 15:33:00 +01:00
Alex Shvartzkop 86beb339b7 Improve error reporting when running Python action plugins.
Python error traceback is now logged to stderr.
On Windows, a console window will pop up if wxTheApp gets destroyed,
because message dialogs crash due to hooks that wxWidgets sets up.

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

(cherry picked from commit a9a2d4aa7a)
2023-09-15 13:33:28 +03:00
John Beard c7a4ea97c3 Fix oval pad snapping
Previously the snap points computed for oval pads didn't get all the
points correct. This breaks out the "find snap points for ovals"
into a function, reworks the logic, adds some tests.

Also adds "extremum points" when the oval isn't exactly H/V.

(cherry picked from commit 78c8de9b08)

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/15594
2023-09-10 00:49:03 +01:00
Marek Roszko da5e1de1c8 Add a workaround to Nahimic crapware
Fixes https://gitlab.com/kicad/code/kicad/-/issues/11850


(cherry picked from commit 726f09f9ad)
2023-08-18 03:02:06 +00:00
Ian McInerney 20a5b2d4c4 Don't try to enable sequential mode on non-existant files on GTK
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15222

(Cherry-picked from c26863cc1e)
2023-07-18 21:04:16 +01:00
Mark Roszko 3fc404cd25 Add missing imm32 lib link 2023-07-17 10:37:17 +00:00
Mark Roszko e016fa913f Backport change to block IME on the canvas itself 2023-07-17 02:07:07 +00:00
Marek Roszko d73f96e3d8 Add support for enum based policies
(cherry picked from commit b0fa2561b6)
2023-07-14 00:04:31 +00:00
Jeff Young b857374aa2 Don't consider a group to be on a copper layer.
Its members can be on copper layers, but the group itself isn't on any
layer.

Also fixes a bug where we were trying to clone TRIANGULATED_POLYGON::TRI
shapes as indexable sub-shapes.  (The TRI only has indexes into its
parent, so cloning it will only result in segfaults down the line.)

Also fixes a bug where we weren't including copper items inside groups
when checking footprint net ties.

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

(cherry picked from commit 40abb013ec)
2023-07-09 21:08:52 +01:00
Mark Roszko 35126ba22c const bool is just bool
(cherry picked from commit e53e571d2d)
2023-07-08 01:04:30 +00:00
Seth Hillbrand cadea90109 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

(cherry picked from commit 954b265839)
2023-07-07 12:03:58 -07:00
Jeff Young 60696a895c Add DRC testing for copper graphic to zone fill collisions. 2023-06-30 11:56:40 +01:00
Seth Hillbrand d3aa304556 Fix MSW and OSX kiplatform io libs
Takes fixes from master branch.  Includes ff072feeb4
2023-06-18 15:35:21 +02:00
Seth Hillbrand 361fdcce1b Maintain file permissions when renaming
Temporary and autosave files do not neccessarily have the correct
permissions set to replace existing project files.  This updates the
permissions to match the existing values where possible

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

(cherry picked from commit 48ecd742eb)
2023-06-18 01:06:14 +02:00
Jeff Young 9240566167 Support shape collisions between SHAPE_POLY_SET and other shapes.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14890

(cherry picked from commit 0f8c5a96b2)
2023-06-06 13:41:37 +01:00
Jeff Young 45c7490180 Outline font performance improvements.
1) Don't fracture font glyphs when generating them; we're going
   to fracture during triangulation anyway.
2) Don't check for self-intersection when deciding to fracture.
   It costs nearly as much as the fracture does.
3) Cache drawing sheet text.
4) Use the current font when checking for cache validity.
5) Parallelize glyph triangulation.
6) Don't invalidate bounding box caches when offset by {0,0}
7) Use the glyph cache when generating text effective shape.
8) Short-circuit NormalizeJustification() if its center/center.
9) Don't triangulate for GuessSelectionCandidates()
10) Avoid sqrt whenever possible.
11) Pre-allocate bezier and SHAPE_LINE_CHAIN buffers.

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

(cherry picked from commit 4ed267394a)
2023-06-04 20:57:14 +01:00
jean-pierre charras 0a3f5b65bf Fix last changes in io.cpp for msys2.
- use the same code for msys2 and msvc
- add an option to use a fallback for msys2 if the common code does not compile
2023-05-29 13:38:52 -04:00
Marek Roszko 93c29ad15e Add a sequential read flagged fopen helper
Trying to squeeze out some kind of gain by informing the OS we will read a file sequentially.
In particular our FILE_LINE_READER just uses fgetc until the end
2023-05-29 13:36:06 -04:00
jean-pierre charras fb23fe3084 fix a minor compil warning. 2023-05-10 09:36:51 +02:00
Marek Roszko a6b23a751e Add env var to force logging on msw
(cherry picked from commit 18dd623122)
2023-05-05 00:59:41 +00:00
Seth Hillbrand 53eb39e033 Avoid NaNs when applying fillets
Segments that are inline with each other will create NaNs when
filleting.  This double check prevents NaN points from being added to
the polygon

(cherry picked from commit b72c6e5cb0)
2023-05-03 11:50:47 -07:00
Seth Hillbrand 1a2c9011e6 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

(cherry picked from commit f7f52d77e4)
2023-05-03 10:22:49 -07:00
Tomasz Wlostowski c1274e24b0 router: hole as first class objects, wip
Rebased by Jeff Young <jeff@rokeby.ie> 5 April 2023

(Also includes a bug-fix for highlighting collisions with edge-cut
items.)

(cherry picked from commit bfbda978b8)
2023-04-14 00:09:56 +01:00
Ian McInerney 4ef6cbf4fb Add hack to speed up font choice box widget creation
There are problems internal to GTK that mean creating choice boxes with
a lot of items is a very slow process. This hack works around one of
those issues to make it faster to create and display the menu in the
choice box.

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

(Cherry-picked from a77e94d16f)
2023-04-12 15:24:25 +01:00
Seth Hillbrand e39550e77f Update to Clipper 1.2+
Updates to Clipper2 742614f, which includes bug fixes for specific KiCad
boards beyond Clipper2 itself

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

(cherry picked from commit 97558b62ec)

Fixes https://gitlab.com/kicad/code/kicad/issues/14475
2023-04-03 10:06:34 -07:00
Seth Hillbrand 7040b2178d Revert "Update for Clipper 1.2"
This reverts commit e758391a23.
2023-03-24 12:30:09 -07:00
Seth Hillbrand edf23c4c18 Revert "Clean up various simplify steps"
This reverts commit 798e13f70d.
2023-03-24 12:30:06 -07:00
Seth Hillbrand 798e13f70d Clean up various simplify steps
Adds the option to simplify the output of Clipper ops that remove minor
detours from the output lines.  These detours are not substantive, so
removing them speeds up the rest of the system by removing unimportant
vertices.  This also prevents the introduction of inadvertant concave
points when unioning two, closely-sized rounded shapes
2023-03-24 09:42:01 -07:00
Seth Hillbrand e758391a23 Update for Clipper 1.2 2023-03-24 09:42:01 -07:00
Alex b466bfa6c8 Improve anti-overflow in SEG::intersects.
Caused issues when testing against
A=( -INT_MAX, ... ), B=( INT_MAX, ... ) segments.

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


(cherry picked from commit 98e635869f)
2023-03-16 02:50:22 +00:00
Jon Evans ee0ba17c03 Improve HiDPI handling of appearance/layer controls
(cherry picked from commit 43d3a18b86)
2023-03-07 08:49:06 -05:00
Seth Hillbrand e699bcf5a3 Use Chamfer lines when deflating
Rounded line ends when deflating leads to microscopic jags in the
outline that are not visible but add substantial computation time and
minor error when computing polygon offsets.

Instead, the chamfer deflate method prevents these jagged lines by
clipping angles < 90° by the error level.  This does not impact deflate
calls where we explicitly require the angles to be maintained

(cherry picked from commit af10878954)
2023-03-06 16:18:51 -08:00
Jeff Young e51d43568e Prefer Clamp() to std::min( std::max() ).
(cherry picked from commit d545216432)
2023-03-03 21:32:19 +00:00
Jeff Young 1bb6b7acdd Overflow safety.
Potential fix for some or all of
https://gitlab.com/kicad/code/kicad/-/issues/13969

(cherry picked from commit 2f2a00c307)
2023-03-03 21:32:12 +00:00
Seth Hillbrand 6116eebbad Prevent inf when presented with 0 errormax
acos(1) returns 0, so this implies infinite segements to get to 0 error.
This is not reasonable but might be encountered in bad arcs or circles
that have 0 radius.  Instead of returning infinite or std::max segments,
we limit the error to be at least 1 IU

(cherry picked from commit 1fda68099f)
2023-03-02 10:21:25 -08:00
Seth Hillbrand f56fcb0a14 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

(cherry picked from commit e7fe69b97f)
2023-02-13 11:23:14 -08:00
Seth Hillbrand e60152e351 Fix island removal when copper->edge clearance is 0
Just testing a single point to find copper that is outside the board works
until the arc->segment conversion moves the board outline just enough to
have the filled copper slightly (few IU) outside of the converted outline.

Instead, we do an expensive check of comparing the size of the
intersection between the island and the island's intersection with the
board.  If the intersection is at least half as large as the original
island, we can say with certainty that the island is inside.  The margin
could be much smaller than half but this preserves the intent without
picking an arbitrary number that might be violated

Fixes https://gitlab.com/kicad/code/kicad/issues/13717
2023-02-02 19:19:26 +00:00
Alex 04c82a42eb Add KICAD_ALLOC_CONSOLE environment variable to show console in GUI apps on Windows.
For debugging purposes, currently.
2023-02-02 01:12:34 +03:00
Jon Evans 563143951f macOS: Always show file type selector
Fixes https://gitlab.com/kicad/code/kicad/-/issues/13716
2023-01-31 12:47:37 -05:00
Roberto Fernandez Bautista 0ecad1ef2e Add EDA_ANGLE::NormalizeNegative() and qa tests 2023-01-30 19:56:22 +00:00
Marek Roszko dd519f1b38 Remove WerSetFlags that was a pre-sentry test 2023-01-28 00:08:37 -05:00
Vincenzo Fortunato 42b4f49e7f Fix polygon self intersection check
Fixes https://gitlab.com/kicad/code/kicad/issues/13628
2023-01-26 22:56:47 +00:00
Alex 2f0dee40ea Use explicit coord type in GetClampedCoords. 2023-01-16 19:42:08 +05:00
Alex 2382764009 Fix cast in GetClampedCoords. 2023-01-15 15:10:39 +05:00
Alex 8c6eb4ce22 Extend types in GetClampedCoords. 2023-01-15 14:22:17 +05:00
Tomasz Wlostowski 4d208bac49 geometry: added SHAPE_SEGMENT::Is45Degree() method 2023-01-12 23:37:07 +01:00
Roberto Fernandez Bautista 33249d37b0 EAGLE SCH: Improve detail of curved shape imports (0.01mm error)
Follow-up from https://gitlab.com/kicad/code/kicad/-/merge_requests/1445
2023-01-10 22:45:46 +01:00
Roberto Fernandez Bautista ebce53d574 Allow specifying acuracy when appending an arc to a chain 2023-01-10 22:28:01 +01:00