Commit Graph

252 Commits

Author SHA1 Message Date
Alex Shvartzkop e498f1b9a0 FOOTPRINT: add a method to auto-position Reference and Value. 2023-08-10 00:30:05 +03:00
Jeff Young c697a934b2 Update layer names to current terminology.
Also fixes some out-of-date tooltips/names.
2023-08-04 11:37:46 +01:00
Seth Hillbrand a90c9d7c93 Refine the footprint selection logic
- Footprints cannot be selected if they do not have items visible on the
  screen
- Clicking on empty space in a footprint will select it if the space is
  contained in the visible bounding box
- Clicking on a selected footprint a second time will deselect it
- Clicking on a footprint that has pads selected will still select the
  footprint

This avoids having the full footprint bounding box considered when
selecting footprints (useful b/c footprint bbox is often much larger and
unexpected).  Also allows non-standard footprints (e.g. silk or fab only
footprints) to be logically selected if the layers on which they have
elements are visible.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15284
2023-08-03 10:03:15 -07:00
Seth Hillbrand f3d65b5156 Revise method of selecting footprints in contrast
When working in high contrast mode, we want to be able to select a
footprint with only elements in, e.g. silk and fab layers.

The previous design for footprint IsOnLayer had one behavior of every
other element and a different behavior for footprints.  This leads to
multiple bugs as new features use the overloaded IsOnLayer expecting it
to report if the element exists on a layer or not.

For footprints, we need a different routine to determine whether or not
to select the footprint when clicking on it.  IsOnLayer will report if
the footprint has any elements on a specific layer but we don't want to
use the bbox for a hittest because large footprints with through hole
pads will exist on every layer and have an enormous bbox.  Instead, we
filter footprints based on the hittest of each element.  This behaves in
a more logical fashion, allowing you to select a footprint by clicking
on a visible element of that footprint.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15284
2023-08-01 10:43:13 -07:00
Seth Hillbrand 96a34e5b57 Consolidate Maximum clearance calculation
We were calculating the same thing in three locations and we missed
adding the clearance from the footprints in, resulting in bad fills and
missed drc errors (see QA addition)
2023-07-26 12:55:48 -07: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 8425e5a0b7 footprint.cpp::GetBoundingBox( bool aIncludeText, bool aIncludeInvisibleText ):
Do not include invisible fields when aIncludeInvisibleText is false.
2023-07-22 11:48:17 +02:00
Jeff Young 8f5b7569d1 Split StyleFootprints into separate bools for fields vs text & graphics.
Also moves the settings from Board Setup to Preferences > PCB Editor.

Also collapses Track Drag Mode from radio buttons to a choice menu to
save space and allow it to be with the other editing action modes.
2023-07-10 17:15:57 +01:00
Jeff Young a66360525a Broaden "Style footprint fields" to cover graphics as well.
Also cleans up the layout of the symbol & fp properties dialogs.

Also fixes the background colour of the link textEdit controls on Mac.

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

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15152
2023-07-09 12:45:55 +01:00
Jeff Young def1a9f39c Add SHORT_NET_NAME processing to footprint variable resolution.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15095
2023-07-02 10:58:10 +01:00
Ian McInerney b8e9544828 Remove temporary footprint from pcb group before deletion
Bounding box computation uses a temporary footprint, but the clone
operation keeps the group information. We can't delete a footprint if it
has group information, so just delete the group information.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14909
2023-06-24 00:04:06 +01:00
Mike Williams a24c55affe PCB Fields: fix up python, API
Remove SetFields from both symbol and footprint, it doesn't handle
mandatory fields and is unlikely to ever be safe.
2023-06-20 18:34:52 +00:00
Mike Williams 85f889bc19 Fields: Description now mandatory
Propagate from symbols to footprints, footprints keep a library
description, too. (GetLibDescription())
2023-06-20 18:34:52 +00:00
Mike Williams 993bb84240 PCB_FIELD: bug fixes 2023-06-20 18:34:52 +00:00
Mike Williams ad7d9ec956 PCB: footprint properties dialog fields fixes 2023-06-20 18:34:52 +00:00
Mike Williams 6d93950dcc PCB: abolish TEXT_TYPE::TEXT_is_*
PCB_TEXT is now always what was formerly TEXT_is_DIVERS and PCB_FIELDs
now what mandatory field type they are already.
2023-06-20 18:34:52 +00:00
Mike Williams 37837dc392 PCB: introduce PCB_FIELD_T 2023-06-20 18:34:52 +00:00
Mike Williams a859b25d2c PCB: convert footprints to use PCB_FIELDs for fields from schematics 2023-06-20 18:34:52 +00:00
Mike Williams bd5d3533d8 Footprints: rename Fabrication Attributes to just Attributes
Makes it consistent with the Symbol attributes that are often
synchronized.
2023-06-20 18:34:52 +00:00
Mike Williams 028f500cd9 Footprints: rename properties to fields for consistency with symbols 2023-06-20 18:34:52 +00:00
Jeff Young 40abb013ec 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
2023-06-20 18:13:21 +01:00
Jeff Young 8baf2a832f Make pad flipping work both from parent footprint *and* individually.
The last fix was for individual pads, but it broke when the whole
footprint was flipped for rotated footprints.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14829
2023-05-31 11:13:35 +01:00
Jeff Young 65e53b8ecd Move SHAPE_POLY_SET::Inflate's error spec from a seg-count to a max-deviation.
1) Also reorders parameters to make sure the compiler helps out.

2) This also makes it harder to mess up the discrepency between
   BOX2I/wxRECT/etc::Inflate() and SHAPE_POLY_SET::Inflate.

3) Also fixes a couple of bugs where the corner strategy was passed
   in as a segCount.

4) Also fixes a couple of bugs where the error wasn't forced to the
   outside to match the ERROR_LOCATION.

5) Also fixes a couple of bugs where the seg count was specified
   without regard to an already passed-in max deviation
2023-05-29 15:29:03 +01:00
Jeff Young c71cf21e2f Use rendered text to generate bounding box for knockout text.
Don't open-code knockout text shape generation in several different
places.

Make sure triangulated knockout text gets clearance added when
specified.

Collapse duplicated footprint text item plot routine (they're no
longer any different from plotting pcb text items).
2023-05-28 17:20:11 +01:00
Jeff Young b41d446f58 Fix a bunch more issues with sheetpaths and allowExtraText.
A sheetpath is required to correctly resolve text variables.
Depending on currentSheet is rife with bugs.

There are many places where we do *not* want to be prepending
field names to the field values, such as netlisting,
building PDF hypertext menus, etc.

Also, Find/Replace needs to work on unresolved text, as
that's what we're going to display (and if replace nuked
your variable references you wouldn't be happy).
2023-05-05 17:23:52 +01:00
Mike Williams 32eb1ef77e Sch->PCB: propagate DNP from symbols to footprints attributes
Also add a 3D viewer toggle.
2023-04-10 13:11:21 -04:00
Jeff Young 28028c941e Retire Local/Draw coords distinction from PAD (the last object to have it). 2023-04-02 18:02:41 +01:00
Jeff Young bbd6c80507 Collapse FP_* down into their PCB_* equivalents. 2023-03-31 22:57:46 +01:00
jean-pierre charras 061e423b1f Pcbnew: fix incorrect position of cached text shapes when moving a footprint.
when moving a footprint, the position of texts living in FP_TEXT_BOX was
not updated when the text shape was cached (non Kicad fonts).
Fixes #14452
https://gitlab.com/kicad/code/kicad/issues/14452
2023-03-30 17:25:25 +02:00
Jeff Young 725834b554 Don't use ViewBBox for zoom-to-fit.
The ViewBBox can include the largest document clearance so that pad
clearance lines get included.  But the largest clearance can be, well,
large.

Fixes https://gitlab.com/kicad/code/kicad/issues/14276
2023-03-13 22:45:37 +00:00
qu1ck c7bb6f5778 Treat dimensions in fp as text for bbox calculations
Fixes https://gitlab.com/kicad/code/kicad/-/issues/13976
2023-02-18 13:04:12 +00:00
Jeff Young 362d85ef50 Special selection mode when in high-contrast with courtyard layer active.
Fixes https://gitlab.com/kicad/code/kicad/issues/13521
2023-02-11 21:11:07 +00:00
jean-pierre charras 82d9176782 FOOTPRINT::Flip(): add missing PCB_BITMAP_T.
Fixes #13785
https://gitlab.com/kicad/code/kicad/issues/13785
2023-02-05 18:41:58 +01:00
jean-pierre charras f8051d954a Better handling of PCB_BITMAP items in a footprint.
- Ensure they can be erased in the FP editor
- Ensure they cannot be selected in the PCB editor (they are not show)
Fixes #13714
https://gitlab.com/kicad/code/kicad/issues/
2023-01-31 11:16:38 +01:00
jean-pierre charras b2f6c13b6a Fp editor and Fp viewer: fix missing info on msg panel after loading a fp
Fix also duplicate/not used code
Fixes #11404
https://gitlab.com/kicad/code/kicad/issues/11404
2023-01-25 17:47:04 +01:00
Jon Evans 4a55b7998a Standardize on longer phrasing
Fixes https://gitlab.com/kicad/code/kicad/-/issues/13514
2023-01-23 08:59:18 -05:00
Jeff Young 24dd402e29 Finish processing last pad in pad group, and trim whitespace from pads. 2023-01-19 15:48:32 +00:00
Seth Hillbrand b99bd7633d Allow commas, spaces in pad names for net-ties
Net tie groups are currently separated by comma.  But comma is also an
allowed, albeit rare character for pad names.  To allow pad names with
commas in net tie groups, the group definition must be escaped with a
forward slash for commas (and forward slashes).

Pad 1,2
Pad 2,3

Net-tie group "1\,2,2\,3"

Fixes https://gitlab.com/kicad/code/kicad/issues/13001
2023-01-18 14:45:52 -08:00
Jeff Young f45d44a639 Don't leave temp footprints attached to a board. 2023-01-18 00:46:59 +00:00
Jeff Young 26c821962f Simplify and regularize text variable substitution architecture.
EDA_ITEMs are responsible for giving their parent a crack at it if
they failed to resolve it.  This recurses all the way up to the schematic/
board, and then to the project.

Cross-reference handling is also move to the EDA_ITEMs.  It must be done
before bubbling up so that we don't end up in loops.  (The aDepth parameter
will break the loop, but without having done anything useful.)

Fixes https://gitlab.com/kicad/code/kicad/issues/13541
2023-01-17 17:05:41 +00:00
Jon Evans c530bdb5a1 Rename GetSelectMenuText to GetItemDescription
This descriptive text is used for many more things than
just the select menu these days.
2023-01-11 22:27:44 -05:00
qu1ck 2654279678 Cleanup zone bbox cache in destructor 2023-01-12 00:21:51 +00:00
Seth Hillbrand a93c83d2fa Don't count non-coper SMD pads for likely type
We are only concerned for connected pads, not apertures

Fixes https://gitlab.com/kicad/code/kicad/issues/13387
2023-01-07 07:14:16 -08:00
Seth Hillbrand a6eb6d3228 Default to SMD if we have an SMD pad
SMD pads indicate that the footprint can be used in PnP more often  than
the presence of THT indicate that it cannot.

Fixes https://gitlab.com/kicad/code/kicad/issues/13387
2023-01-05 16:56:07 -08:00
Jon Evans 5eb3f5d3e7 Use correct translation macro for group names
Fixes https://gitlab.com/kicad/code/kicad/-/issues/13277
2022-12-26 20:11:20 -05:00
jean-pierre charras ec4fd42bee Pcbnew: force courtyard area shape rebuild afret rotation/flip.
Fixes #13039
https://gitlab.com/kicad/code/kicad/issues/13039
2022-11-30 09:07:32 +01:00
Jon Evans 81ab8a0499 Properties: Move orientation to basic 2022-11-29 18:56:15 -05:00
Marek Roszko 25d5defc10 Add cli for "fp" upgrade 2022-11-28 20:48:14 -05:00
Jon Evans b2b3f5752f Properties: Add grouping and sorting by creation order 2022-11-27 22:40:23 -05:00
Jon Evans 74a2e4cad9 Properties: Add support for zone connection style 2022-11-25 18:44:02 -05:00
Jon Evans 96fe93618e Properties: Stop sorting by name
It's more useful to have properties shown in add order,
since we can group them
2022-11-25 16:29:56 -05:00
Jon Evans 220ef6fb44 Properties: Add some missing footprint properties; cleanup
Add concept of "internal" properties that will be accessible from
Python/DRC but not shown in the Properties Manager
2022-11-25 12:37:47 -05:00
Jeff Young 4aff5c7618 Keep courtyard caches alive during move.
Fixes https://gitlab.com/kicad/code/kicad/issues/12999
2022-11-25 17:20:11 +00:00
Jon Evans 11e784cf10 Properties: specialize layer setting for footprints
Fixes https://gitlab.com/kicad/code/kicad/-/issues/12480
2022-11-24 22:11:26 -05:00
Jeff Young d6ae915616 Pay attention to layers when sorting pads.
Fixes https://gitlab.com/kicad/code/kicad/issues/10143
2022-11-24 15:47:10 +00:00
Jeff Young 03ba14c6d3 Tighten lifecycle management of parent group pointers.
Also adds some debugging to try to catch dangling pointers.

Also adds a cache for group bounding boxes (which will be expensive
to calculate for large groups).

Fixes https://gitlab.com/kicad/code/kicad/issues/12875
2022-11-11 17:27:28 +00:00
Jeff Young d16b23d16e Name shortening and line-break reduction. 2022-10-21 18:41:39 +01:00
Jeff Young 73e1676bdb Fix const-reference property access.
Fixes https://gitlab.com/kicad/code/kicad/issues/12639
2022-10-15 20:22:38 +01:00
Jeff Young b012cc1ac3 Don't resolve footprint text variables in footprint editor.
Fixes https://gitlab.com/kicad/code/kicad/issues/12658
2022-10-15 16:05:22 +01:00
Jeff Young 6f9bc0980b Refactor poly outline generator to handle multiple outlines.
Note: disjoint outlines are handled in footprint courtyards, but not
for board outlines.

Fixes https://gitlab.com/kicad/code/kicad/issues/7660
2022-10-14 20:32:04 +01:00
Jeff Young adbbceacda Make footprint type check more narrow, and set default to ignore. 2022-10-02 18:19:43 +01:00
Jeff Young 503385f52e Don't use FindNamedPad for net-tie logic. It only reutrns the *first*
pad of a given number.

Also improves other DRC logic to tighten up the net-tie rules now that
we know which pads are allowed to short with which other pads.

Also removes the "Overlapping pads" DRC violation now that we know
whether or not overlapping pads in a net-tie footprint constitute a
short.

Fixes https://gitlab.com/kicad/code/kicad/issues/12506
2022-09-25 17:38:31 +01:00
Jeff Young 64a6fc0fd4 Push UNITS_PROVIDER down into a low-level mixin.
This allows us to also construct cheap UNIT_PROVIDERs for specific
tasks when necessary.
2022-09-19 17:10:59 +01:00
Marek Roszko a8613ee80f Combine Iu2Millimeter & remove PcbMm2iu 2022-09-16 21:09:26 -04:00
Jeff Young 57f9d6cb3d ADDED text variables for pad NET_NAME, NET_CLASS and PIN_NAME.
Fixes https://gitlab.com/kicad/code/kicad/issues/6405
2022-09-12 00:55:57 +01:00
Jeff Young c0ba1b35bf Remove SMD pad side sanity check. 2022-09-05 10:41:37 +01:00
Jeff Young d5cf7828fa ADDED footprint checks for SMD pad consistency.
Fixes https://gitlab.com/kicad/code/kicad/issues/11736
2022-09-04 10:34:32 +01:00
Jeff Young b4492e0bd2 More EDA_RECE yeetage. 2022-08-31 17:19:50 +01:00
Jeff Young f17a865593 Move EDA_ITEM hitTest to BOX2I. 2022-08-31 17:18:45 +01:00
Jeff Young 2dc6300501 Move EDA_ITEM bounding boxes to BOX2I. 2022-08-31 10:16:55 +01:00
Jeff Young 5679b9dbdc Remove a few EDA_RECT instances. 2022-08-31 01:22:49 +01:00
Jeff Young 86944c4f9f Marginal performance improvements. 2022-08-26 13:22:57 +01:00
Roberto Fernandez Bautista 940a15c547 Todo: Properties system doesn't like const wxString& getters
Comment out for now
2022-08-22 21:32:33 -04:00
Maciej Suminski af71d42307 Renamed PROPERTY_TYPE enum names to avoid a conflict on MSYS2 2022-08-22 21:32:32 -04:00
Maciej Suminski 95fd58b25a Properties meta-data for pcbnew classes 2022-08-22 21:32:00 -04:00
Jeff Young 4f0136db3b Attempt to fix std::initializer_list lifetime issue. 2022-08-21 20:54:41 +01:00
Jeff Young aa2ad3b44c Move KICAD_T[] to std::initializer_list<KICAD_T>. 2022-08-20 10:28:11 +01:00
Jeff Young 46df421064 ADDED defined pad groups for net-tie footprints
Each pad group is allowed to short nets with other pads in its group.

Legacy footprints with the "net tie" keyword hack will get a single
group auto-created with all the footprint's pads in it.

DRC and the router now allow a track to collide with copper graphic items
while entering a net-tie pad as long as the closest point in the collision
is within the pad.

DRC (and the footprint checker) now check for copper items in the
footprint shorting pads which are not in the same pad group.

Fixes https://gitlab.com/kicad/code/kicad/issues/2265
2022-08-19 18:54:20 +01:00
Seth Hillbrand 97d7ee1f30 Remove `/` from our forbidden LIB_ID list
It is still forbidden from footprint file names but that is handled
separately and it should not be forbidden in symbol files at all
2022-08-18 12:49:40 -07:00
Jeff Young 96f01d33c8 Performance improvements.
1) Move a bunch of std::map's to std::unordered_map to get constant-time
look-ups
2) Lengthen progress-reporting intervals to spend more time doing work
and less time talking about it
3) Reverse order of SHAPE_LINE_CHAINs in thermal intersection checks to
make (much) better use of bbox caches
4) Don't re-generate bboxes we already have
5) Fix some autos that weren't by reference (and were therefore copying
large datasets)
6) Rename delta progressDelta so it's easier to search for in future
7) Get rid of a few more autos (because I don't like them)
8) Pass large items to lambdas by reference

Fixes https://gitlab.com/kicad/code/kicad/issues/12130
2022-08-03 11:59:42 +01:00
Jeff Young 43df863df2 Fix issue with caches not being initialized when printing msg bar. 2022-08-01 13:09:51 +01:00
Marek Roszko a8505d9c76 SEARCH_RESULT -> INSPECT_RESULT
To fix the name squatting it's doing for future functionality
2022-07-29 20:01:10 -04:00
Jeff Young f41af10007 Clean up hole shapes for safety (smart pointer) and consistency. 2022-07-22 23:06:07 +01:00
Jeff Young 1ade5a8c72 Fix typo.
And clean up the code just a little to make it clearer.

Fixes https://gitlab.com/kicad/code/kicad/issues/12022
2022-07-17 17:04:04 +01:00
Mike Williams 3669cb4673 PCB Editor: Add User Background Images 2022-07-14 11:23:23 +00:00
Jeff Young 8a9bf02b7e Smarten up silk clearance & tented item handling.
The inspection tool will report whether or not the item is tented
(indicating in that case that any clearance will only be applied
to any hole).

The DRC test ignores tented items without a hole, and runs the
clearance test against the hole for items with a hole.

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

Fixes https://gitlab.com/kicad/code/kicad/issues/11951
2022-07-08 17:27:05 -06:00
Jeff Young aad85a83da Improvements to rotation/mirroring of dimensions inside footprints.
Fixes https://gitlab.com/kicad/code/kicad/issues/11861
2022-06-20 22:25:39 +01:00
jean-pierre charras d19705ac8c FOOTPRINT::Flip(): add missing handle of dimensions. 2022-06-20 11:37:25 +02:00
Jeff Young 82ebc247b8 More performance enhancements for DRC. 2022-06-18 19:47:11 +01:00
Jeff Young dee22a31d9 Expose footprint ID, description and keywords to property system. 2022-06-01 12:47:37 +01:00
jean-pierre charras 57e59a4959 Pcbnew, on line DRC when moving footprints: add visible collisions between courtyards 2022-05-20 12:58:05 +02:00
Jeff Young 37838dffb9 Make sure physical_clearance rules are run against courtyard layers. 2022-05-10 23:02:53 +01:00
Jeff Young 3bdae40881 Remove extra layer of parens. 2022-04-24 23:44:02 +01:00
Jeff Young 4cd48cd5c9 Fix some test issues. 2022-04-23 22:15:39 +01:00
Jeff Young 4525b1f085 More consistency in DRC error messages. 2022-04-23 09:39:34 +01:00
Jeff Young ab131859f6 Bring footprint textvars in line with symbol textvars.
ADDED ${FOOTPRINT_LIBRARY} and ${FOOTPRINT_NAME} resolution.
2022-04-18 22:45:02 +01:00
jean-pierre charras 74c3ad0b3a Shadow on locked fp: do not show if LAYER_MOD_FR or LAYER_MOD_BK is not shown 2022-04-12 11:17:04 +02:00
Jeff Young 73f835437e Don't modify outer loop variable inside inner loop. 2022-03-19 19:37:01 +00:00
Jeff Young 5aa561abe1 Add overlapping pad test and share some tests between board & fp editor DRC.
Fixes https://gitlab.com/kicad/code/kicad/issues/10086
2022-03-18 19:58:42 +00:00
Seth Hillbrand 442aae19d9 Separate flashing check for connectivity
When building the connectivity database, we should not be using the
connectivity to check for shapes.

To make this deterministic, we introduce two flags (ALWAYS_FLASH and
NEVER_FLASH) that are used with connectivity building to determine
whether a pad is flashed for connectivity or not.  ZONE <-> PAD/VIA
connectivity will be checked with ALWAYS_FLASHED and all other
connectivity will be checked with NEVER_FLASHED if they are marked for
potential annular ring removal.  If they are not marked for removal,
they will be checked ALWAYS_FLASHED.

Fixes https://gitlab.com/kicad/code/kicad/issues/11114
2022-03-16 17:30:01 -07:00