68 Commits

Author SHA1 Message Date
Seth Hillbrand
4e7fa189aa Refactor gfx import cleanup
Break up monolithic function into responsibilities.  Adjust cleanup to
correctly modify each graphical pairing.  Fix drc test to properly
report gap distances that are relevant to outlines

Fixes https://gitlab.com/kicad/code/kicad/-/issues/13090
2025-08-25 11:33:26 -07:00
Seth Hillbrand
87ee9c4b49 Don't preemptively skip previously seen objects
We need to return them in order to detect the self-intersection
2025-08-25 11:31:51 -07:00
Seth Hillbrand
9cabceb773 Properly extend our outline
Previously, if we had a single gap in the outline, we would report
multiple errors depending on the order in which we parsed the outline.
This was confusing as most of those errors were invalid.  Instead, we
build the outline in both directions before reporting gaps
2025-08-25 11:31:51 -07:00
Seth Hillbrand
b207ec8817 Remove negative index access from CPoint
Callers should be responsible for index count and/or use iterators
2025-08-08 10:46:45 -07:00
Jeff Young
d3f2bec6a6 Performance tweaks. 2025-08-05 13:49:31 +01:00
Seth Hillbrand
4221c1d93b Additional speed-up for outlines and fills
BBOX check before polgon point inside
Clean representation of segment iterator
Pre-allocate line chain space
2025-07-22 13:38:39 -07:00
Seth Hillbrand
4dab336f95 One more pass at optimizing the board outline gen
Instead of iterating through the segment list each time, we use a kdTree
structure to efficiently query a 2d point cloud for the nearest
neighbors

Fixes https://gitlab.com/kicad/code/kicad/-/issues/21352
2025-07-22 12:49:13 -07:00
Seth Hillbrand
d53cbe638f Speed up massively slow outline convert
Avoid unneeded comparisons for segments that will never touch.  Helps in
pathological cases of O(10000+) segments in an outline

Fixes https://gitlab.com/kicad/code/kicad/-/issues/21352
2025-07-19 17:28:05 -07:00
Alex Shvartzkop
4a5039c2cf Remove some unused variables. 2025-07-02 16:48:26 +03:00
Jeff Young
e8e7282fe1 Fix a bunch more bugs in bezier approximation. 2025-05-26 18:12:43 +01:00
Alex Shvartzkop
e021cf4575 Connect first/last shapes within tolerance when building board outline.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/19901
Also see https://gitlab.com/kicad/code/kicad/-/issues/18125
2025-02-11 05:07:18 +03:00
Seth Hillbrand
0b2d4d4879 Revise Copyright statement to align with TLF
Recommendation is to avoid using the year nomenclature as this
information is already encoded in the git repo.  Avoids needing to
repeatly update.

Also updates AUTHORS.txt from current repo with contributor names
2025-01-01 14:12:04 -08:00
Seth Hillbrand
e9bc8cfe9d Give Clipper1 a Viking funeral
Clears out the last spot where we were only using Clipper1 (how'd I
miss that?) and remove all calls to the Clipper1 structures
2024-12-23 17:12:09 -08:00
Jon Evans
56e0811516 Phase 2 of padstack support
CHANGED: PCB file format now supports saving/loading complex padstacks

CHANGED: PTH pads are now rendered per copper layer in the copper color;
         the PTH pad color is no longer used.

ADDED: support for importing complex pad stacks from Altium PCBs

Enforce padstack-aware access to pad properties across KiCad

Fixes https://gitlab.com/kicad/code/kicad/-/issues/8182
2024-10-01 19:55:03 -04:00
Mike Williams
867cb58175 feature removal: remove Show Hidden Text
Does not work properly since 8.0 introduction of footprint fields.

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/18656
2024-09-19 15:41:44 -04:00
Jeff Young
7b076482c9 Don't collect footprint shapes twice.
(They're now PCB_SHAPE, so they get collected in the
board's collector.  No need to fetch them again from
their parent footprints.)

Fixes https://gitlab.com/kicad/code/kicad/-/issues/17027
2024-08-18 17:28:55 -06:00
Jeff Young
8b948e7b9c Give padstack warning violation a name.
Also regularises capitalisation & parens in some error
messages.

Also de-duplicates hole testing for PTH pads, and SMD
rationality testing.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/18334
2024-07-07 14:04:34 +01:00
Seth Hillbrand
bcf6b620a8 Large rework of BEZIER_POLY
Add direct handling of quadratic beziers to save compute time and number
of points.  Update cubic interpolation to reduce number of points
generated for a given smoothness

Cache data on open and used cached data to avoid multiple re-calcs

Remove minimum line length and number of segments and replace with
standard max error level.  Allows us to specify the tolerance of bezier
interpolation
2024-06-18 17:55:41 -07:00
Marek Roszko
8b4253cda4 Drop the first point of an arc when building an outline when there's a previous point that's being changed
Fixes https://gitlab.com/kicad/code/kicad/-/issues/18125
2024-05-31 18:40:16 -04:00
Alex Shvartzkop
3f704cb1f1 Fix an assert in isCopperOutside.
(cherry picked from commit dfd8aa402df333458ee52e3ae305bf1cfc3ee867)
2024-05-18 22:52:41 +03:00
Jeff Young
8184ed64e7 Explicit control over hidden text in bounding boxes.
In particular, don't consider hidden text when plotting,
and only when AsItemCheckboxes is checked for printing.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/17958
2024-05-06 21:36:19 +01:00
Jeff Young
cfa55d958a performance efficiencies 2023-12-18 18:45:02 +00:00
Alex Shvartzkop
a161829f86 Use SCOPED_FLAGS_CLEANER more carefully.
Other methods used ConvertOutlineToPolygon's SKIP_STRUCT state.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/16321
2023-12-09 19:24:51 +03:00
Alex Shvartzkop
12f529d6e0 Fix build error. 2023-12-04 10:44:37 +03:00
Alex Shvartzkop
111a8d6ab3 Improve/fix Expand connection for graphics. 2023-12-04 09:52:31 +03:00
Seth Hillbrand
75c6b0ab28 Added IPC2581 support
IPC2581 is a modern production file exchange system.  It provides
single-file data output for an entire board including BOM and netlist
information.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/1954
2023-11-26 15:30:58 -08:00
Jeff Young
62d959ed0e 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
2023-10-13 13:59:26 +01:00
jean-pierre charras
79a45c4803 TestBoardOutlinesGraphicItems(): handle small arcs. 2023-10-12 19:59:11 +02:00
Wayne Stambaugh
e3c491424b Coding policy, Doxygen comment, and spelling fixes. 2023-10-12 12:27:30 -04:00
jean-pierre charras
a7d540ce94 TestBoardOutlinesGraphicItems(): add missing case.
DRC_TEST_PROVIDER_MISC::testOutline(): use a smaller size to dectedt small items.
2023-10-12 15:53:21 +02:00
jean-pierre charras
499f3ca95b DRC_TEST_PROVIDER_MISC::testOutline(): add test to detect questionable items.
Graphic items (segments, rects, circles) on Edge.Cuts can create issues when
building board outlines, when they are very small (a few nm in size), because
they are not easily handled when trying to search connected graphics.
Also protect RC_ITEM::SetItems() against null pointer.
Fixes #15865
https://gitlab.com/kicad/code/kicad/-/issues/15865
2023-10-12 14:48:24 +02:00
Jeff Young
c7e865e4a2 Safety for negative pen widths. 2023-09-14 13:39:35 +01:00
Alex Shvartzkop
ab6a049b90 Add a routine for joining PCB shapes. 2023-09-04 06:46:24 +03:00
jean-pierre charras
15f5a14217 Fix minor compil warnings 2023-08-27 11:11:08 +02:00
Alex Shvartzkop
f842e6ac7a STEP: export arcs in board contours as curves, not polygons.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/13825
2023-08-24 21:53:53 +03: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
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
jean-pierre charras
66651327bd STEP export: in board outlines, export Circles as Cylinders, round 2.
Other arcs (not 360 deg arcs) are still exported as polylines
2023-05-16 13:39:16 +02:00
jean-pierre charras
99bdb82dff Revert "STEP export: in board outlines, export Circles as Cylinders."
This reverts commit 09515fe821cf1049e98ab90a0b992b631fbdc648.
It does not pass a QA test
2023-05-16 09:59:53 +02:00
jean-pierre charras
09515fe821 STEP export: in board outlines, export Circles as Cylinders.
Other arcs (not 360 deg arcs) are still exported as polylines
2023-05-16 08:46:34 +02:00
Seth Hillbrand
4b91c0c8ee Handle multiple holes in footprints
Our basic logic for whether we have a hole or an outline in a footprint
checks if there is copper pads outside of the closed edge.  This misses
the case where the footprint is used to align multiple holes but has no
copper.  Since we do not support multiple outlines in a board, we can
safely assume that multiple, closed edges in a footprint represent holes
and not outlines

Fixes https://gitlab.com/kicad/code/kicad/issues/14468
2023-04-20 14:56:36 -07:00
jean-pierre charras
97a4e535dc ConvertOutlineToPolygon(): fix handling of polygons living in footprints.
Due to recent changes in PCB_SHAPE items, the polygon coordinates are now
in board coordinates, not in coord relatives to the parent footprint.
Fixes #14530
https://gitlab.com/kicad/code/kicad/issues/14530
2023-04-13 17:22:03 +02:00
Jeff Young
bbd6c80507 Collapse FP_* down into their PCB_* equivalents. 2023-03-31 22:57:46 +01: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
Marek Roszko
aacc9746e3 Yeet the last of wxSize/wxPoint to stop leaking gdicmn everywhere 2023-02-18 22:57:18 -05:00
Jeff Young
53b6993d2b Don't report errors in first pass of board outline generation.
Segments which aren't used to build holes in footprints can still
be used by the second pass to build the board outline.

Fixes https://gitlab.com/kicad/code/kicad/issues/13321
2022-12-30 22:32:08 +00:00
Jeff Young
c85590a470 Correct is-inside logic.
Fixes https://gitlab.com/kicad/code/kicad/issues/13259
2022-12-27 14:34:35 +00:00
Jeff Young
ab6aa08f33 Fix typo.
Fixes https://gitlab.com/kicad/code/kicad/issues/13263
2022-12-26 20:33:04 +00:00
Jeff Young
8c97a7b8c6 If fps contain complete board-edge holes then exclude those edges from main calc.
Fixes https://gitlab.com/kicad/code/kicad/issues/12921
2022-12-04 11:51:44 +00:00
jean-pierre charras
c378d01068 code cleaning. 2022-12-01 16:01:38 +01:00