I missed having the Freerouting button in the toolbar in Kicad 5.x, so I dove into the scripting a little bit to bring back at least the launcher button.
You’ll still have to export the .dsn and import the .ses file manually, but by far the slowest part for me was getting Freerouting to actually open the .dsn file because of it’s obnoxious defaulting to the Documents folder, so this script launches FreeRouting.jar and passes it the default filename that KiCAD will pick for the .dsn, saving you possibly dozens of clicks!
Setup:
Place the .py file in %APPDATA%\kicad\scripting\plugins (On Windows. This should look something like "C:\Users<username>\AppData\Roaming\kicad\scripting\plugins in File Explorer.) or ~\.kicad\scripting\plugins (On Linux, not sure about OS X).
Place FreeRouting.jar (I use this version) in %APPDATA%\kicad\ (On Windows) or ~\.kicad\ (On Linux, not sure about OS X).
In Pcbnew, under Tools -> External Plugins there should now be a Freeroute entry (If not, click the “Refresh Plugins” entry and try again).
On nightlies(Or 5.1 when it releases), you can also go into the Preferences and under Action Plugins, you can set the plugin to show directly on the toolbar.
Now, the workflow for using this:
Export DSN (File -> Export -> Specctra DSN…) using the default filename for your PCB (board.kicad_pcb would be board.dsn, for example).
Click the Freeroute button/tool entry. This should launch the usual Freeroute GUI, with your design already loaded. NOTE: The KiCAD UI might be unresponsive at this point, as it’s waiting for Freeroute to finish running.
Run your autoroute in Freeroute (Click the Autorouter button, wait, File -> Export Specctra Session File), then exit Freeroute.
Back in KiCAD, Import the session file (File -> Import -> Specctra Session…).
Done!
This post has been mirrored into the repository at the bitbucket repository in the first link for anybody who might like to link to that instead.
You probably don’t want to block your plugin and lock KiCad UI while autorouting happens. Instead of os.system() you can use non-blocking “open” call, unfortunately it’s system dependent. This is how I handled it:
I have been testing the code today and it now works as expected - I think I may have been using the wrong name for the FreeRouting.jar part, the version that I have had installed for quite a long time is called freeroute.jar so this is probably why it could not be found.
The only clarification maybe needed in the given instructions is that the files need to be placed in the kicad directory in the ‘roaming’ part of ‘AppData’ when manually navigating in windows explorer.
Just another quick update. As mentioned above I thought I had miss-spelled the name of the jar file which is why it was not working.
I have just been re-testing and have found that you need to completely close and re-start Kicad for any changes in the python file to take effect.
I think this is what was happening when I could not get the code to work - I changed the filename of the jar file but I did not fully re-start Kicad which is why it did not immediately work (I was just closing PCBNew and re-opening it again).
Just thought I would add this small detail in case anyone else has this issue.