An alternative freerouting plugin

https://github.com/jharris2268/kicad-freerouting-plugin-alt

This uses a command line only version of freerouting, updating the tracks in pcbnew as it runs. The dsn export has been reimplemented in python. This allows the dsn export to be manipulated to change the behaviour of freerouting. The readme file explains these options.

It has only been tested on one linux machine, running ubuntu 22.04, using kicad version 7.0 installed with apt. Also required is openjdk runtime, version 19 or higher. I don’t think it will work with kicad installed with snap/flatpak as the java executable will not be visible to kicad. I think it should work with Windows and MacOS, but I have not tried either.

Download the zip file from https://github.com/jharris2268/kicad-freerouting-plugin-alt/releases/tag/v0.1.0 and install using the Plugin and Content manager from the main kicad window.

Please leave bug reports using the github issues tab.

1 Like

I think I sort of like the idea. Does this still attempt to route the whole PCB? That as always been my biggest gripe with autorouters. A long time ago I used Specctra as part of Ultiboard, and it made such a mess of things that I quickly abandoned it. It does 95% of a PCB, and cleanup of the last 5% combined with proper routing so the PCB has a chance of meeting EMC requirements takes more time and effort than routing the whole PCB manually in the first place.

For some time KiCad’s Interactive router has slowly been getting some autorouter like functions. For example, when pressing f for finish during routing, it finishes the track to the nearest pad even if that pad is off screen. This saves some (accurate) mouse pointing and panning / zooming. Just point the mouse in the general direction and press f.

KiCad also has [Shift +f] which can do a simple attempt to route a few tracks from a selection (for example a footprint or some selected pads).

FreeRouting is based on Specctra (some rumors about stolen or leaked code, I don’t know the details, but apparently suspicions are strong enough to keep it out of KiCad for that reason alone). It is also a very old and not very capable router. However, I guess it is more powerful then the simple Finish functions currently implemented in KiCad.

For me, there are 2 things that have to be met before I would attempt to try this as a plugin.

  1. It has to be able to route only a selection of tracks.
  2. It has to work with KiCad V8 (I use the latest stable for this forum, and having both V7 and V8 is a bore on Linux.
1 Like

Addition,
today I accidentally bumped into a redo of the eevblog routing of a bunch of nixie tubes, but now done in several smaller steps, and this gives a good impression of the advantage of routing tracks in smaller groups compared to try to do everything at once.

Autorouting this whole layout at once just makes a mess of things (as Dave showed) KiCad’s own “fake router” is very simple and just attempts to route tracks one by one. I guess that freerouting has enough smarts to make something decent of a local group of 10 or so tracks, but would also make a big mess of routing everything at once.

I guess the end conclusion in the video is a bit misleading. Sure, the quality of the router is very comparable to what dave himself did, but the time for setting up this thing is not mentioned in the end result. For example, it probably takes quite some time to figure out that placing the via’s for the serial data and clock lines first was needed. In KiCad, this might just as well have been done later, cause KiCad’s interactive router can easily shove some tracks aside to make room for these via’s later. I guess altium can do this too, so I wonder how much planning was done ahead of time to make this look like a “streamlined video”.

To make an autorouter do a good job, you have to feed it a lot of information about priorities. Usually it’s simply faster to do this manually, route the critical tracks first.

Yes to make an autorouter really good is very complicated, and out of reach for the KiCad project at least for the coming bunch of years. That discussion has been done well over.

“Simple” autorouter generally make a mess of things. I guess that by chopping it into little sections, the mess decreases, and is more localized and remaining issues are easier to fix manually.

Also, when the user directly sees the result of routing small sections with an autorouter, then with a bit of experience he learns what the autorouter can and can not do. It’s very much different from trowing away the autorouter because it creates spaghetti monsters.

For me, it would be the difference between ignoring Freerouter as I do now, and giving it a fair trial to see what it can do. At the moment my faith in (simple) autorouters is quite low, and as I mentioned earlier, the combination of better integration in KiCad combined with routing a selection would at least peak my interest.

I tested this on windows and… it has some issues.

First I ran into

  File "....\KiCad\8.0\3rdparty\plugins\com_github_jharris2268_kicad-freerouting-plugin-alt\dsn\misc.py", line 28, in <listcomp>
    return [(i,board.GetLayerName(i),pcbnew.LAYER_ShowType(board.GetLayerType(i))) for i in board.GetDesignSettings().GetEnabledLayers().Seq()]
                                     ^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'pcbnew' has no attribute 'LAYER_ShowType'

Changed it to LAYER.ShowType() and got past it, then ran into

  File "....\KiCad\8.0\3rdparty\plugins\com_github_jharris2268_kicad-freerouting-plugin-alt\dsn\structure.py", line 89, in make_structure
    assert len(board_edge_merged)==1
           ^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError

Looks like complex board outlines with holes are a no go, so I simplified my design. Then ran into

  File "....\KiCad\8.0\3rdparty\plugins\com_github_jharris2268_kicad-freerouting-plugin-alt\dsn\structure.py", line 104, in make_structure
    zone_settings = zone.GetParent().GetZoneSettings()
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'BOARD_ITEM_CONTAINER' object has no attribute 'GetZoneSettings'

Fixed that by calling zone’s methods directly. And finally ran into

       1     0.0s     info: FRLogger verbosity: NO_DEBUGGING_OUTPUT                                                                                 
       2     0.0s     info: testing version: off                                                                                                    
       3     0.0s     info: freerouting_cli application starting...                                                                                 
       4     0.0s     info: requesting design_file_text                                                                                             
       6     0.1s     info: Loading design D:\OSP\projects\BlinkyTree\blinky_tree\blinky_tree.kicad_pcb.dsn                                         
       7     0.1s     info: creating input stream with 20108 bytes                                                                                  
      12     0.2s    error: Illegal character '`' was found at position 14837 : java.lang.Error: Illegal character '`' was found at position 14837  

And at this point I gave up.

You should test your plugin with more designs and kicad 8 specifically.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.