Commit Graph

1615 Commits

Author SHA1 Message Date
Jeff Young 1c7971c4dc Cleanup. 2023-06-17 18:12:13 +01:00
Jeff Young 9fbaa238a2 Don't create 22.5-degree gateways if we're not cardinal or diagonal.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14984
2023-06-17 16:05:35 +01:00
Ian McInerney 63e91366e2 Add variable initializations 2023-06-15 23:49:24 +01:00
Ian McInerney b73cc7db4a Fix a few accidental copies in loop iterators 2023-06-15 22:57:05 +01:00
Yang Hongbo fe1b1becef Check visibility when switching layer in router tool
When routing and using layerNext (hotkey '+') to switch to next layer,
it will skip invisible layer, when click BUT_LEFT, the new line should
be in the same layer (visible layer)

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14480
2023-06-13 09:46:12 -07:00
Tomasz Wlostowski 3667e4f6b2 router: correctly assign owner via/pad to its hole when committing the world state
fixes #14852
2023-06-08 11:57:23 +02:00
Jeff Young 3c8d2bfca5 Assertion checking for hole/parent ownership mismatch.
(This mismatch is the root of the problem in issue #14852.)
2023-06-02 18:30:16 +01:00
Tomasz Włostowski 3c3517cc36 router: can't add a clone of a VIA's hole when adding the via to INDEX - this will result in bogus colliding objects
This commit partially reverts deb3cbf8. VIA and SOLID operator='s introduced in it do a good job but the cloning of holes in addHole() causes bogus collisions.
2023-06-01 22:47:02 +02:00
Jeff Young deb3cbf89b Prevent use-after-free crashes by not fighting over who owns a HOLE.
The diff-pair placer creates DIFF_PAIRs on the stack, which have
VIAs in them, which have HOLEs in them.  The HOLEs get put in the
NODE's index, and we then crash later when doing a collision after
the stack variable has gone out of scope.

The stack variable is also copied while doing a search for "best",
and without the operator= definitions the "best" and the "original"
both think they own the HOLE.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14852
2023-06-01 15:07:29 +01:00
Tomasz Wlostowski 7966126040 router: invalidate items freed by PNS::NODE in the clearance cache
This was causing intermittent shove hiccups/freezes as RULE_RESOLVER::GetClearance() could return a bogus clearance value, taking
a cached value for an item that does not exist anymore. If the allocator/stack accidentally reclaimed such item's address - we were getting
very nasty and difficult to reproduce misbehaviours of the shove algorithm. Hopefully this patch fixes this. More info in the comments.

Note to self - I'm still not fully convinced I want PNS::ITEM pointers as the cache key, probably a unique counter would be better here.
2023-06-01 00:01:15 +02:00
Tomasz Wlostowski 15db42d9c8 router: fix use-after-free crash in drag walkaround mode 2023-05-31 22:20:28 +02:00
Tomasz Wlostowski 5100345c6e router: prevent pushout/bogus collision of via with is own hole (or copper) when dragging
The root cause was not removing the original (pre-dragging) via from the world, comparing the ITEM::Parent() pointers of the items was only hiding the main issue.
This also fixes the PNSViaCollisions test in the qa/ suite.
2023-05-31 17:06:24 +02:00
Jeff Young 4874537c40 Push/pop router tool for inline drag.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14832
2023-05-30 18:02:12 +01:00
Jon Evans 141cc85ff3 PNS: Work around collision checking issues in shove mode
Need to special-case shove mode since 942ee13c introduced
collision checking in all modes.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14836
2023-05-29 18:19:47 -04: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 768fbf5af2 Give up on trying to calculate text bounding boxes.
It results in too many hacks strewn through the code.  Just draw the
text and measure it.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14803
2023-05-26 18:44:33 +01:00
Jon Evans 942ee13cd1 PNS: Allow width-caused DRC violations at start of route
Also fix an issue where DRC violations introduced by the
width change action could be committed in walk/shove mode.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14805
2023-05-25 23:10:00 -04:00
Jeff Young b442d769fd Don't allow collisions with self.
The previous test didn't handle is-self-tests between a hole and
its override in a different NODE.  When calculating the pushout
force we don't remove the via (and its hole) from the current
node until after the calculation, so we end up checking for
collisions between the new (cloned) via's hole and the original
hole in the root node.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14795
2023-05-23 14:10:22 +01:00
Jeff Young df763eaf88 Reconcile PNS router with DRC.
Hole-to-hole is only for drilled holes.
NPTH slots also get EDGE_CLEARANCE applied.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14771
2023-05-21 19:58:00 +01:00
Marek Roszko 8a7044c3fb Fix some more warnings 2023-05-20 08:00:16 -04:00
Jeff Young 8b1fd62d35 Make pad & via teardrops 1st-class citizens (props of the pad/via)
Change teardrop generation to rely more heavily on BOARD_CONNECTIVITY
for improved performance.

Add updating of teardrops on BOARD_COMMIT::Push().

Also converts m_CopperItemRTreeCache to std::shared_ptr.
We don't copy it around anyway, and having to create a new set
of std::unique_ptr's for each operation is likely to be more
expensive than std::shared_ptr's overhead.
2023-05-19 18:02:03 +01:00
Jon Evans 94130716a5 PNS: Collision search context may be null
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14741
2023-05-14 17:20:59 -04:00
Alex d790865549 Make sure text bounding box exists when syncing PNS world.
Fixes https://gitlab.com/kicad/code/kicad/issues/14733
2023-05-14 13:40:14 +03:00
Steve Bollinger 85f4f0d6c8 pcbnew: switching track posture may not work on first attempt
If you drag a track out and connect to a pad then press the hotkey
to switch the track posture it may not switch because the track
posture selected when the pad was reached is different than the one
that the mouse trail placer drew. As the aspect switching is done
in the mouse trail placer it does not know that the line placer
already override the track.

To correct this, in LINE_PLACER::FlipPosture() if the aspect is not
currently manually forced then copy the current aspect from the
line placer to m_mouseTrailPlacer before calling the FlipPosture()
method of m_mouseTrailPlacer. This will only be done once per
dragging session as once the aspect is manually forced it remains
manually forced. This seems to fix the issue with no undesirable
side effects.

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/12369
2023-05-11 23:35:21 +00:00
Jon Evans 89aae88e96 PNS: make sure context options are used in collideSimple
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14659
2023-05-11 16:48:15 -04:00
Jon Evans 2e60315959 PNS: Don't use clearance epsilon for calculating shove distances
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14707
2023-05-11 13:09:03 -04:00
Jeff Young 2dcbc10a09 Performance optimization. 2023-05-08 11:46:04 +01:00
Jeff Young 5b3798a370 Holes need a parent.
SetHole() handles all this for us.  Make sure it's called.

Fixes https://gitlab.com/kicad/code/kicad/issues/14702
2023-05-08 11:41:12 +01:00
Jon Evans b06f90335b PNS: Remove holes when removing items with holes
Related to https://gitlab.com/kicad/code/kicad/-/issues/14702
2023-05-07 22:12:11 -04:00
Lucas Dumont a22e6db982 Add Zone when dragging component
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14629
2023-05-06 09:32:38 +00:00
Jeff Young f27bc16d62 Cleanup API and use text bounding box for routing.
If someone wants to route around the text more tightly
they can now convert the text to polygons.

Fixes https://gitlab.com/kicad/code/kicad/issues/14252
2023-05-02 16:03:43 +01:00
Jeff Young 80f8cd2254 Commenting and formatting. 2023-05-02 14:16:02 +01:00
Jeff Young 16e000f2b0 Use Net() accessor uniformly; init hole parent in VIA::Clone()
Fixes https://gitlab.com/kicad/code/kicad/issues/14603
2023-04-28 18:32:58 +01:00
Lucas Dumont b1a4353c34 Update collide for hole
As hole don't keep track of the net, update the collide function to keep it working
2023-04-28 10:20:55 +00:00
Jeff Young b2a45023bc Tighten ownership model of PNS::ITEM.
In particular, ownership must be explicitly set.  It is
no longer inherited through copy/clone/etc.
2023-04-28 11:05:39 +01:00
Jeff Young 9646e3c1c0 Simplify PNS::VIA construction. 2023-04-28 00:32:49 +01:00
Lucas Dumont 2992d7c68b Fix typo in QueryConstraint switch 2023-04-26 13:20:32 +00:00
jean-pierre charras b9ed84b7db Fix minor compil warnings 2023-04-25 12:43:15 +02:00
Lucas Dumont e2e901de1d Don't override clearance when routing
The default `m_overrideClearance = -1` used here was changed to 1.
Reseting it to -1 to solve linked issue

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14595
2023-04-25 09:18:53 +00:00
Jeff Young 676a15df65 Don't try to keep track of a HOLE's net.
Keep track of it's parentPadVia instead.

Fixes https://gitlab.com/kicad/code/kicad/issues/14603
2023-04-24 18:32:17 +01:00
Seth Hillbrand 990641d2eb Cleanup printf bits 2023-04-20 15:19:04 -07:00
Lucas Dumont 469fe76994 pcbnew: Fix crash with differential routing
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14537
2023-04-17 14:17:14 +12:00
Jeff Young 26609bbf05 Fix PNS_KICAD_IFACE_BASE::IsFlashedOnLayer() to be able to handle multi-layer queries. 2023-04-14 12:02:36 +01:00
Jeff Young 6059e895d7 Fix a typo.
Fixes https://gitlab.com/kicad/code/kicad/issues/14515
2023-04-12 10:45:24 +01:00
Jeff Young 6fb30398ca Don't steal an existing via's hole. 2023-04-11 17:48:27 +01:00
Jeff Young ab0dbeb523 Post-holes-work cleanup. 2023-04-11 15:51:00 +01:00
Jeff Young 2f198bdcb2 Further simplify PNS::ITEM::collideSimple().
Also brings text_pns_basic's mocks into line with their "real"
counterparts.
2023-04-11 15:51:00 +01:00
Jeff Young 6f0d963683 Add PNS::ITEM::BoardItem() call.
About 1/3 of callers to Parent() don't care if they get the immediate
parent or not, about 1/3 want only the immediate parent, and about 1/3
want the hole parent's Parent().

I had earlier changed PNS::ITEM::HOLE to override Parent() and return
the hole parent's Parent(), but since the callers are pretty evenly
split I've reverted that and added BoardItem() for callers who want the
eventual BOARD_ITEM (whether a direct parent or a grandparent).

(Also removes a dead routine so I didn't have to figure out which of
the two it wanted....)
2023-04-11 15:51:00 +01:00
Jeff Young 8a0c225efa Unify most special-case processing to the clearance if-then-else.
This also allows us to support hole-to-hole clearance when dragging
a via near another via on the same net.

Fixes https://gitlab.com/kicad/code/kicad/issues/12781
2023-04-11 15:51:00 +01:00
Jeff Young b18bf09208 Don't return holes that have a parent pad or via.
(While we don't currently have holes without a parent pad or via, you
could imagine using HOLEs in the future to represent a hole in a first-class
board outline, so better not to build this assumption in.)
2023-04-11 15:51:00 +01:00
Jeff Young 4cc289c6fb Post-merge cleanup of holes-as-first-class-citizens. 2023-04-11 15:51:00 +01:00
Tomasz Wlostowski 1532a83330 router: hole as first-class-object, initial version of rewritten collision check routine
Rebased and modified by Jeff Young <jeff@rokeby.ie> 6 April 2023
2023-04-11 15:51:00 +01:00
Tomasz Wlostowski d961cdce3f router: further changes to the ownership model
- LINEs now own their vias optionally (depending whether a LINE with its VIA belongs to a node)
- get rid of unique_ptr on the internal NODE::Add API (and also made it private)
- make sure stack pointers are not added to the node
- use rvalue reference for NODE::Add/NODE::Replace

Manually rebased by Jeff Young <jeff@rokeby.ie> 5 April 2023
2023-04-11 15:51:00 +01:00
Tomasz Wlostowski bfbda978b8 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.)
2023-04-11 15:51:00 +01:00
Jeff Young 507a25f150 Don't call BuildInitialTrace() for entry gateways.
We're going to call it to connect the entry and target gateways
anyway, so all we need are gateways at 22.5 degrees to setup entry
at +/- 45 degrees from the current direction.

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

Fixes https://gitlab.com/kicad/code/kicad/issues/12459
2023-04-11 15:34:55 +01:00
Jeff Young 11995c1350 Improve readability. 2023-04-11 15:26:39 +01:00
Jeff Young d040690f60 Ease acquisition of a target item.
pickSingleItem() had a two-attempt algorithm, but the second attempt
was never made because we'd check for no hits before throwing out the
aAvoidItems.

The second attempt would fail anyway because QueryHoverItems() ignored
the aUseClearance flag when not idle, and didn't factor in the actual
clearance.
2023-04-09 22:05:17 +00:00
Jeff Young 1d19672054 Handle more pad shapes when building diffpair gateways.
Fixes https://gitlab.com/kicad/code/kicad/issues/1883
2023-04-09 22:05:17 +00:00
Jeff Young e522e73e0e Improve readability. 2023-04-08 15:06:49 +01:00
Jeff Young 3b63d70d01 Centralize NPTH has-annulus processing.
Fixes https://gitlab.com/kicad/code/kicad/issues/13437
2023-04-08 15:06:49 +01:00
Tomasz Wlostowski 1283c4713f router: rework ITEM ownership model.
- prerequisite for holes as first class objects code
- introduced the OWNABLE_ITEM interface that defines the owning container (NODE/other ITEM/ITEM_SET)
- simplified the ITEM_SET interface
- constified a lot of APIs (ownership/JOINT management) as a side effect

Rebased and cleaned up by Jeff Young <jeff@rokeby.ie> 5 April 2023
- some STL cover types removed
2023-04-05 11:21:31 +01:00
Tomasz Wlostowski eed05191a9 router: pass collision query options in a structure
Selectively cherry-picked by Jeff Young <jeff@rokeby.ie> 4 April 2023
- Jon's user-clearance-epsilon algo kept intact
- Jeff's castellated-pad code kept intact
2023-04-05 11:21:31 +01:00
Jeff Young bbd6c80507 Collapse FP_* down into their PCB_* equivalents. 2023-03-31 22:57:46 +01:00
Wayne Stambaugh 28776f5745 Text attributes object improvements.
* Add compare method to COLOR4D object.
* Add unit test to validate COLOR4D comparison method.
* Add missing color test in text attribute comparison method.
* Add unit test for text attribute object.
* Remove unnecessary headers from text attribute header.
* Move text attribute code into separate source file.
2023-03-29 12:53:45 -04:00
jean-pierre charras 893a362d9e Minor Coverity and compil warnings fix. 2023-03-15 20:09:04 +01:00
Mike Williams 74a9d79a8d Router: fix Continue From End/ Attempt Finish work for diff pairs
Fixes: https://gitlab.com/kicad/code/kicad/-/issues/13772
2023-03-08 12:23:04 -05:00
Mike Williams 8d3e1eb52a Continue From End: support other placement algos 2023-03-08 12:01:29 -05:00
Mike Williams e7555aa45f PNS Router: arcs are directional, too
Fixes: https://gitlab.com/kicad/code/kicad/-/issues/10391
2023-03-08 12:01:29 -05:00
Mike Williams 5bc018f7dc PNS Diff Placer: fix invalid cast of Arc to Segment and derefence 2023-03-08 12:01:29 -05:00
Wayne Stambaugh a1fb8e1b1d Coverity fixes and code cleaning. 2023-03-06 07:12:18 -05:00
Wayne Stambaugh 4e99812145 Coverity fixes and code cleaning. 2023-03-04 13:02:05 -05:00
Wayne Stambaugh 789bf6455a Coverity fixes and code cleaning. 2023-03-02 09:04:47 -05:00
Ian McInerney c6e417c19c Fix missing override statements 2023-02-22 01:44:06 +00:00
Marek Roszko aacc9746e3 Yeet the last of wxSize/wxPoint to stop leaking gdicmn everywhere 2023-02-18 22:57:18 -05:00
Jon Evans f12f2b8420 PNS: Diff pairs can have different hole-to-hole size
Fixes https://gitlab.com/kicad/code/kicad/-/issues/13993
2023-02-17 19:56:02 -05:00
Jon Evans 459473ccc3 PNS: Safety for evaluating item nets for rules
Fixes https://gitlab.com/kicad/code/kicad/-/issues/13993
2023-02-17 19:56:02 -05:00
Jon Evans 2d7c5c5c0f Router: Do not collide items within a net tie footprint
Fixes https://gitlab.com/kicad/code/kicad/-/issues/13909
2023-02-14 21:08:36 -05:00
Alex bf1a8f2582 router: Fix clamp in meander corner radius calculation.
Fixes https://gitlab.com/kicad/code/kicad/issues/13781
2023-02-05 07:22:38 +03:00
Alex 6543d23d9f router: Re-add electrical path lines drawing for length tuning. 2023-02-01 20:36:52 +03:00
Jon Evans 48e4005111 Fix diff pair router checking of min clearance
Fixes https://gitlab.com/kicad/code/kicad/-/issues/13720
2023-01-31 19:53:35 -05:00
Jon Evans 971abcfc1a Fix DP meander placer when tuning from an uncoupled section
Fixes https://gitlab.com/kicad/code/kicad/-/issues/12212
2023-01-28 22:25:46 -05:00
Jeff Young 8268234aa1 Reverse shown-source logic so we report if it's the netclass width.
(whether or not it's *also* the previous track width).
2023-01-27 15:31:02 +00:00
Alex e3fa447f0c router: Remove extra qualification. 2023-01-27 11:56:23 +03:00
Alex 0ff6cb49d6 router: When dragging tracks, don't snap to parts of the original line.
Fixes https://gitlab.com/kicad/code/kicad/issues/10113
2023-01-27 11:06:36 +03:00
Mike Williams a76a4f9788 Router: don't unnecessarily change track widths on layer change
Fixes: https://gitlab.com/kicad/code/kicad/-/issues/13546
2023-01-25 09:34:17 -05:00
Jeff Young 89d434255c Run clearance rules for router status bar.
Fixes https://gitlab.com/kicad/code/kicad/issues/13605
2023-01-20 14:19:58 +00:00
Tomasz Wlostowski 761e754294 router: trying to improve the 'guess posture' algorithm to work well with both fix-all and fix-last-segment on click 2023-01-12 23:37:07 +01:00
Tomasz Wlostowski 65def26b4d router: follow up ROUTER::GetUpdatedItems() API changes in the ROUTER_TOOL 2023-01-12 23:37:07 +01:00
Tomasz Wlostowski d07d6c9a30 router: fix 'Bowen knot'-looking hulls for 0-length segments 2023-01-12 23:37:07 +01:00
Tomasz Wlostowski 0595440d79 router: minor improvements in shove algorithm handling of vias 2023-01-12 23:37:07 +01:00
Tomasz Wlostowski 213d30cad6 router: workaround for assertion fail on NODE::Add(unique_ptr<LINE>) 2023-01-12 23:37:07 +01:00
Tomasz Wlostowski aa7271e55a router: expose the 'head' traces in a separate list for debug logs 2023-01-12 23:37:07 +01: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
Alex 95f5d92fc6 Fix length overestimation when first/last line segment enters a pad.
Fixes https://gitlab.com/kicad/code/kicad/issues/13322
2022-12-30 16:27:59 +05:00
Alex 867a2e833d router: Hotglue the debug graphics back to pcbnew. 2022-12-30 14:44:48 +05:00
Jeff Young 4c63b4e061 Class name <-> file name sync. 2022-12-29 18:05:57 +00:00
Tomasz Wlostowski 7d40bbdf38 router: mark the head trace (as opposed to the 'fixed tail') with fully saturated color
Fixes https://gitlab.com/kicad/code/kicad/-/issues/11386
2022-12-29 17:54:59 +01:00
Tomasz Wlostowski dfb1068358 router: improve heuristic to avoid segment drag 'flickery snapping'
Fixes https://gitlab.com/kicad/code/kicad/-/issues/10113
2022-12-29 17:54:31 +01:00
Jon Evans ee0a41e3bc Remove excess calls to SelectedItemsModified
We really don't want to post these events unless the *selected* items
were actually modified, since it results in a redraw of the properties
panel (which disturbs edit state and causes flicker on MSW).

Now the COMMIT system is responsible for sending this event iff the
commit touches items that are selected.

Side note: UpdateMsgPanel is useless on every app except pl_editor, so
it can probably be refactored/removed at some point.
2022-12-26 20:57:58 -05:00
Jeff Young 34e134c5e5 Don't allow clearanceEpsilon to force clearance < 0.
Also, a plated hole has the max clearance of hole_clearance and
copper_clearance.

Fixes https://gitlab.com/kicad/code/kicad/issues/13237
2022-12-24 12:56:41 +00:00
jean-pierre charras 59f0e428fa Fix a PnS router issue doesn't respect knockout texts.
Fixes #13251
https://gitlab.com/kicad/code/kicad/issues/13251
2022-12-23 18:17:44 +01:00
Alex e8f755c665 router: Match segment endpoint calculation between dragger and the tool.
Prevents always picking point A when dragging short segments.
2022-12-21 20:55:49 +03:00
jean-pierre charras 161a1e21f5 PnS router: NPTH can be on copper layers, depending of the pad size and the hole size.
Now: round NPTH with a round hole bigger than the pad are not on a copper layer.
Other pas shapes are seen on copper layers (far from ideal, but reasonable)
Fixes #13214
https://gitlab.com/kicad/code/kicad/issues/13214
2022-12-20 12:50:22 +01:00
Alex 82874daf08 router: Limit the amount of move attempts in ROUTER::Finish
Otherwise auto-finish hangs in some cases.
2022-12-07 19:24:13 +03:00
Alex 008704fc6f router: Allow highlighting both DP nets when routing. 2022-12-06 05:24:23 +03:00
Alex 90ad4dcc05 router: Various bugfixes in length tuning meandering
- When fine-tuning, keep adjust to the original baseline length
- Enforce a minimum amplitude based on settings, DP gap and track width
- Use binary search to fine-tune amplitude if the length is not trivial
- Account for inequalities in balancing
- Don't add the meander if adding it with min. amplitude will make the
  tuning worse
- Keep a distance after meandering end to prevent overlaps in DP

Fixes https://gitlab.com/kicad/code/kicad/issues/9267
Fixes https://gitlab.com/kicad/code/kicad/issues/1776
2022-12-04 16:30:00 +00:00
Alex e56064696b router: Refactor m_padToDieLength out of meander placer base. 2022-12-02 01:03:34 +03:00
Alex 1aa05c0e10 router: Fix up single meander side switching. 2022-12-01 18:39:19 +03:00
Alex 7dbdb68730 router: ADDED option to create single-sided meanders. 2022-11-30 20:39:02 +00:00
Jon Evans 7a9467b0d5 Get rid of some gcc warnings 2022-11-24 17:05:58 -05:00
Jeff Young 226529235c Mostly const safety, but also performance opt. by avoiding shared_ptr overhead. 2022-11-22 12:21:30 +00:00
Tomasz Wlostowski 24c271d508 router: GetUpdatedItems() now returns an unique_ptr to the temporary NODE so that the items it owns do not get deleted upon return from the method 2022-11-18 15:14:33 +01:00
Tomasz Wlostowski 644c76b9c6 router: follow up via force propagation interface changes in the via DRAGGER 2022-11-18 15:14:09 +01:00
Tomasz Wlostowski dcfb35f002 router: more resilient via force propagation 2022-11-18 15:14:09 +01:00
Alex 3dea146488 router: Clear rule resolver caches on routing/dragging start.
Fixes https://gitlab.com/kicad/code/kicad/issues/12907
2022-11-17 02:10:21 +05:00
Alex 3f790d9dae Revert "router: Disable writing clearance cache for items in local variables."
This reverts commit 6d71f27500.

Caused a performance drop in walkaround mode.
2022-11-17 02:10:20 +05:00
Alex 6d71f27500 router: Disable writing clearance cache for items in local variables.
Fixes https://gitlab.com/kicad/code/kicad/issues/12907
2022-11-16 21:19:56 +05:00
Tomasz Wlostowski 26a38797c7 router: log and replay the 'unfix' events too 2022-11-15 23:05:53 +01:00
Tomasz Wlostowski b507c44d74 router: fix regression in Backspace (unfix/undo last segment) caused by redesign of the line placement algo
Fixes https://gitlab.com/kicad/code/kicad/-/issues/12835
2022-11-15 23:05:53 +01:00
Jeff Young 9724f6e736 Don't allow zone filling during other editing operations.
It's a very heavy op, and is likely to violate all manner of
assumptions the other ops make.

Fixes https://gitlab.com/kicad/code/kicad/issues/12736
2022-11-14 23:39:49 +00:00
Alex 126914859a Use correct pad to die lengths in DP length tuner.
Fixes https://gitlab.com/kicad/code/kicad/issues/12859
2022-11-13 21:07:09 +00:00
Alex 348c3d4216 Fix an incorrect calculation in length tuning tools.
MEANDER_PLACER_BASE::lineLength wasn't calculating the length correctly
when starting and ending pads were on different layers.

Naturally, now jointA corresponds to the start of the path, jointB to the end.

Fixes https://gitlab.com/kicad/code/kicad/issues/12881
2022-11-12 13:11:27 +00:00
Jeff Young 63f937db85 Don't use drag origin for real drag events.
Fixes https://gitlab.com/kicad/code/kicad/issues/12763
2022-11-09 13:09:31 +00:00
Jeff Young a03799c61e Don't mark collisions on dragged items, only things they collide with.
Fixes https://gitlab.com/kicad/code/kicad/issues/8965
2022-11-05 21:54:33 +00:00
Tomasz Wlostowski a0105efc0c router: major rewrite of shove/walkaround single line placement. An attempt to fix most router blockages/non-45 stray segments and simplar stuff. Also adds a ton of debug geometry cruft.
fixes: 12258
fixes: 12067
fixes: 10807
fixes: 10632
2022-10-31 11:38:31 +01:00
Tomasz Wlostowski 70bca1b2d5 router: allow caller to override the 'safety' length limit in WALKAROUND 2022-10-31 11:17:32 +01:00
Tomasz Wlostowski 363d606503 router: improved heuristics in via force propagation algorithm 2022-10-31 11:17:32 +01:00
Tomasz Wlostowski 1ddabd4eaf router: some extra debug geometry dumps in SHOVE 2022-10-31 11:17:32 +01:00
Tomasz Wlostowski 165b5257e8 router: temporaily disable upper corner count limit constraint in the OPTIMIZER which prevents almost any optimization of shoved lines 2022-10-31 11:17:32 +01:00
Tomasz Wlostowski e80bdf934a router: add via force propagation iteration limit as a user-controllable parameter in ROUTING_SETTINGS 2022-10-31 11:17:32 +01:00
Tomasz Wlostowski 247922ca2d router: LINE::SetShape() should update the attached via position with the last point of the new line shape 2022-10-31 11:17:32 +01:00
Tomasz Wlostowski 3e67b42efd router: fix another corner case in LINE::Walkaround 2022-10-31 11:17:31 +01:00
Tomasz Wlostowski 65507e7186 router: extend dump format to support automatic regressions tests of interactive routing scenarios 2022-10-31 11:17:31 +01:00
Jeff Young 01b4c20c94 Router only owns message panel when routing.
Also fixes a pair of copy/paste error not caught earlier.

Fixes https://gitlab.com/kicad/code/kicad/issues/12780
2022-10-28 22:51:43 +01:00
Jeff Young c026c3af7b Fix typo.
Fixes https://gitlab.com/kicad/code/kicad/issues/12753
2022-10-25 18:28:31 +01:00
Jeff Young 5fe5534822 Clean up layer handling and normalize to remove magic numbers.
Fixes https://gitlab.com/kicad/code/kicad/issues/12747
2022-10-25 12:31:47 +01:00
Jeff Young 2dec37f806 We must check clearance on all layers of multi-layer items.
(One layer may have a custom rule.)

Fixes https://gitlab.com/kicad/code/kicad/issues/12733
2022-10-24 00:14:12 +01:00
Jeff Young d16b23d16e Name shortening and line-break reduction. 2022-10-21 18:41:39 +01:00
Jeff Young 6fd195c389 Use comma to separate diff pair nets/netclassse rather than /.
("/" is problematic because it's more likely to appear in netnames.)

Fixes https://gitlab.com/kicad/code/kicad/issues/12592
2022-10-21 00:05:11 +01:00
Jeff Young e3842514e7 Move courtyard collision setting to preferences.
Also cleans up PCBNew/FPEditor edit options panel to be more in sync
with each other.
2022-10-19 11:33:11 +01:00
Jeff Young 413fd82813 Re-entrancy guard for router tool.
Fixes https://gitlab.com/kicad/code/kicad/issues/12604
2022-10-17 13:21:07 +01:00
Jeff Young 3e53426b6c Use same ratsnest colours in the router as the rest of KiCad. 2022-10-16 22:21:14 +01:00
Jeff Young 6357c83a8c Debug code to try and catch Undo/SyncWorld mismatch.
Fixes https://gitlab.com/kicad/code/kicad/issues/12640
2022-10-14 13:25:25 +01:00
Jeff Young 07d9671126 Repair unbalanced UndoRedoBlock call. 2022-10-14 11:44:04 +01:00
Jeff Young b01bf081d8 Cleanup. 2022-10-14 11:12:25 +01:00
Jeff Young de5980b92e Share more of the courtyard collision highlighting code. 2022-10-14 10:42:07 +01:00
Jeff Young 11dc5424cb Pull interactive courtyard checker out of move tool to share with router.
Fixes https://gitlab.com/kicad/code/kicad/issues/12594
2022-10-14 00:48:37 +01:00
Jeff Young 3090363cd5 Copy via flags down to the level the router consumes.
Fixes https://gitlab.com/kicad/code/kicad/issues/12591
2022-10-13 17:41:42 +01:00
Jeff Young 08260661b8 Force flashing when generating SOLIDs.
We only have a single SOLID per pad, so the solid's shape must always
be the flashed shape and then we can do layer-specific flashing tests
internally.

Fixes https://gitlab.com/kicad/code/kicad/issues/12458
2022-10-13 13:05:51 +01:00
Jeff Young b2f05c758b We don't always have a line when dragging.
Fixes https://gitlab.com/kicad/code/kicad/issues/12612
2022-10-10 11:44:17 +01:00
Jeff Young ea6fb84351 Formatting. 2022-10-10 11:44:17 +01:00
Jeff Young d6f1d5da76 Start-routing list needs to be a white list, not a black list.
We check the collisions later in the same routine, which is where all
the black-listed objects come in.

Fixes https://gitlab.com/kicad/code/kicad/issues/12595
2022-10-07 18:18:02 +01:00
Jeff Young bc58480e24 Missed some other uses of m_startItem in previous commit.
Fixes https://gitlab.com/kicad/code/kicad/issues/12592
2022-10-07 14:01:46 +01:00
Jeff Young cbb997a3b5 Use GetCurrentNets(), not m_startItem for message panel updates.
Fixes https://gitlab.com/kicad/code/kicad/issues/12592
2022-10-07 10:34:11 +01:00
Jeff Young 40ad5b6de3 Broaden reset-sizes-after-layer-switch algorithm.
Fixes https://gitlab.com/kicad/code/kicad/issues/12576
2022-10-06 15:50:22 +01:00
Jeff Young d8a3ba7917 Update router sizes when switching layers.
We may have layer-specific rules involved.  Note that at some point
we also need to do something similar on every "fix route" step to
handle area-specific rules.

Fixes https://gitlab.com/kicad/code/kicad/issues/12576
2022-10-05 16:45:42 +01:00
Seth Hillbrand b4f3390626 Drill size is absolute
Use hole plating size for visibility only, not zone filling, routing or
DRC
2022-10-04 09:52:40 -07:00
Jeff Young 7be05e9eb1 Make sure we have nets before grabbing the first.
Fixes https://gitlab.com/kicad/code/kicad/issues/12554
2022-10-01 13:50:26 +01:00
Mike Williams ba6afafc86 Router Tool: get rid of getNearestRatnestAnchor
Unused now that the PNS Router handles the actions that needed it.
2022-09-28 13:29:52 +00:00
Mike Williams 6252840abd PNS/Router Tool: Refactor Continue From End 2022-09-28 13:29:52 +00:00
Mike Williams 1be0deb58f PNS/Router Tool: Refactor Finish Route 2022-09-28 13:29:52 +00:00
Mike Williams b1f2273bc6 PNS: Add CurrentStart() to placers. 2022-09-28 13:29:52 +00:00
Ian McInerney 1683e552f7 Add/fix some variable initializations 2022-09-25 00:48:38 +01:00
Ian McInerney fdb97a46c1 Don't copy items in for loops when not needed 2022-09-24 03:46:06 +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
Mike Williams 9304607624 TOOL_EVENT: make command string non-optional
We're getting segfaults in places where this isn't checked. Also, add
some asserts so we can catch bad tool push/pop.

Removes all uses of GetCommandStr() and makes it private.
2022-09-19 10:23:09 -04:00
Jeff Young 45d6b4a9fc Readability improvements. 2022-09-19 11:18:20 +01:00
Mark Roszko b00178adb3 Nuke base_units from orbit 2022-09-16 04:38:10 +00:00
Mike Williams 1a023f5dd0 PCB Editor: (Auto)Route Selected (From Other End)
3x Selection-Based Routing Tools. Takes a selection of routable objects
and routes them one at a time individually, with an attempted finish, or
from the other end, depending on the action given.
2022-09-13 15:06:36 +00:00
Mike Williams dc20e24c4a Route Other End: Perform Steps in one Undo Commit 2022-09-13 15:06:36 +00:00
Mike Williams 82f8cd72a3 PNS Router IFACE: Add board commit mode control 2022-09-13 15:06:36 +00:00
Alex cc4e34ef49 Don't sync the world twice in inline router tools.
Activate() already clears and syncs the world via PNS::TOOL_BASE::Reset,
so there's no need to sync in InlineDrag and InlineBreakTrack.
2022-09-10 20:49:30 +00:00
Mike Williams fa3e9efdce PCB Router: return to original active layer after routing
Fixes: https://gitlab.com/kicad/code/kicad/-/issues/12313
2022-09-06 10:51:46 -04:00
Mike Williams 68f71e4a62 PCB Router: Pressing V again can untoggle Via
Fixes: https://gitlab.com/kicad/code/kicad/-/issues/12315
2022-09-06 10:51:46 -04:00
Jeff Young 7c83c78afe Allow free pad usage in router.
Fixes https://gitlab.com/kicad/code/kicad/issues/11730
2022-09-06 13:59:52 +01:00
Jeff Young 156755e9db Allow processing of non-handled events in length tuner tool.
Fixes https://gitlab.com/kicad/code/kicad/issues/11425
2022-09-05 10:57:07 +01:00
Jeff Young 895a8a8dbc Work around focus issues for status popups.
Autoscroll wasn't working on Mac because the status popup's panel
has the focus.  This *may* also fix a problem on MSW of the auto-scroll
not being cancel-able.

Fixes https://gitlab.com/kicad/code/kicad/issues/11425
2022-09-04 21:08:01 +01:00
Jeff Young 9405817a4d Improve contrast of status popup text on Mac.
Also works around an issue where GetBackgroundColor() returns black
(with a 40% alpha) on Mac.
2022-09-04 21:08:01 +01:00
Jeff Young c30a557810 ADDED netclass assignment from PCB canvas.
Fixes https://gitlab.com/kicad/code/kicad/issues/5975
2022-09-03 19:29:59 +01:00
Roberto Fernandez Bautista c15a13963b Fix Build error: AddLine doesn't exist anymore 2022-09-02 11:17:28 +02:00
Roberto Fernandez Bautista 22f96bfd11 Re-route m_last_head after routing fails
This should ensure the shove state gets reverted

Fixes https://gitlab.com/kicad/code/kicad/-/issues/9023
2022-09-02 09:41:15 +02:00
Seth Hillbrand b736460e71 Move optional access from value() to *operator
`value()` throws.  Where we check for existence, we don't need to use
the throwing version and should just use the unprotected variant
2022-08-30 13:59:39 -07:00
Seth Hillbrand 91fbb5c957 Don't prevent immediate actions while router active
Immediate actions that can take place are useful.  We should only be
preventing immediate actions while actively routing or dragging

Fixes https://gitlab.com/kicad/code/kicad/issues/12311
2022-08-30 10:31:29 -07:00
Stefan Hamminga 2ff6a6aee1 Implement and enable option to not shove vias during push & shove routing 2022-08-29 17:32:39 +00:00
Jeff Young 7baa56528a Make sure via-gap-same-as-trace-gap gets turned off for board settings.
Fixes https://gitlab.com/kicad/code/kicad/issues/12236
2022-08-26 13:22:57 +01:00
Seth Hillbrand f1261e71d4 Replace boost::optional with std::optional 2022-08-25 15:50:47 -07: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
Mike Williams f06e28b7a7 PCB: Finish Route, Route From End
Adds restart routing from other ratsnest' end and automatically finish
routing.

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/5051
2022-08-17 03:15:46 +00:00
Jeff Young a9536b5de9 CHANGED netclass assignments now done via canvas or via patterns. 2022-08-14 22:56:29 +01:00
Seth Hillbrand 1ce8fc1614 Ensure arcs are handled in topology
Use the connection-independent `Anchor()` function to get connection
points for either arcs or segments in topology.  This allows the
ratsnest to be correctly drawn between nets with arcs

Fixes https://gitlab.com/kicad/code/kicad/issues/12205
2022-08-12 20:07:28 -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
Seth Hillbrand 76b9e25143 Cleanup unused code 2022-08-02 08:33:59 -07:00
Seth Hillbrand e0b3f6c258 PNS: Handle via-in-pad distances when tuning
Tuning with a via in pad, the via isn't a part of the full line.  But we
still need to account for the line length distance of the
starting/ending vias.  To do this, we simply measure the height from
the ending track to the ending pad and starting track to starting pad

(cherry picked from commit 82e8e38054)
2022-08-01 20:25:17 -07:00
Seth Hillbrand 17fdb7c6a8 Prevent drag index from exceeding full line count
Simplification removes segments, so we might lose our valid index.
Ideally, we would simplify during the assembly or pass the input index
to the simplify routine to maintain the proper value.

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

(cherry picked from commit 6c617d84ca)
2022-08-01 08:58:28 -07:00
Jeff Young f41af10007 Clean up hole shapes for safety (smart pointer) and consistency. 2022-07-22 23:06:07 +01:00
Seth Hillbrand 16e3d40552 ADDED: Display calculated clearance in status bar
In addition to showing resolved clearance, we also show the calculated
clearance in the same method as is used for DRC.  This will allow users
to better examine their system while working.

Fixes https://gitlab.com/kicad/code/kicad/issues/7934
2022-07-21 15:44:48 -07:00
Tomasz Wlostowski e558893851 router: use actual snap point position for routability checks of a segment instead of the segment endpoint(s).
Explanation:
- place a long segment A with something violating the rules close to its endpoint
- try to start routing in the 2/3 of the length of A (on the obstacle side)
- bummer - the router picks the nearest endpoint of A for the collision check (even though we don't care about this collision since we want to route far away from it)
2022-07-21 16:30:28 +02:00
Seth Hillbrand a9a5136c1c Always allow blind/buried/micro vias
Removes a nanny setting that prevented the use of
blind/buried/micro-vias without a checkbox.  If the designer does not
want microvias in their board, they simply do not place microvias.
2022-07-12 19:47:31 -07:00
Mike Williams 3d1d432c5e PCB Editor: re-add missing color to dynamic ratsnest 2022-07-12 19:36:51 -04:00