adamws / kicad-kbplacer

KiCad plugin for automatic keyboard's key placement and routing
GNU General Public License v3.0
333 stars 23 forks source link

Improve track routing algorithm #14

Closed adamws closed 11 months ago

adamws commented 11 months ago

Needed to update references because for some tracks 'start' and 'end' position switched and this happens to be to difficult to detect as acceptable difference in SVG even though the final result is the same.


Comparing test results before and after:

test_diode_switch_routing position36 before after
Screen Shot 2023-09-25 at 20 39 21 Screen Shot 2023-09-25 at 20 41 01

was not able to route before due bad implementation. Segment from diode was drawn first and collision check incorrectly flag it as colliding with switch pad (ends closer than clearance). Track before adding has no netcode so it did not ignore that 'collision' based on nets. Collision check is still flaky but this example now works because we start from switch pad.

test_diode_switch_routing position38 before after
Screen Shot 2023-09-25 at 20 42 17 Screen Shot 2023-09-25 at 20 42 35

This was flag as collision with mounting hole because only first track posture was checked. When using second corner it is possible to route.

example: 2x3-rotations before after
Screen Shot 2023-09-25 at 20 45 31 Screen Shot 2023-09-25 at 20 46 27

(variant with custom diode position is similar, two rotated diodes at bottom row are connected)

1x4-rotations-90-step before after
Screen Shot 2023-09-25 at 20 44 00 Screen Shot 2023-09-25 at 20 44 41