Freerouting launcher

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:

  1. Export DSN (File -> Export -> Specctra DSN…) using the default filename for your PCB (board.kicad_pcb would be board.dsn, for example).
  2. 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.
  3. Run your autoroute in Freeroute (Click the Autorouter button, wait, File -> Export Specctra Session File), then exit Freeroute.
  4. Back in KiCAD, Import the session file (File -> Import -> Specctra Session…).
  5. 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.

5 Likes

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:

2 Likes

Just tried out this plugin as I also missed the FreeRoute button. I had to make the the following changes in order to get it to work in Windows 7:

I placed freeroute.py code in:

C:\Users\my-user-name\AppData\Roaming\kicad\scripting\plugins

The FreeRouting.jar file I placed in:

C:\Users\my-user-name\AppData\Roaming\kicad\

I could not get it to work initially as it could not find the FreeRouting.jar file so I modified the python file to point directly to this file:

os.system(‘C:\\Users\\my-user-name\\AppData\\Roaming\\kicad\\FreeRouting.jar -de "’+basename[0]+’.dsn"’)

Once I restarted Kicad it opened FreeRouting as it used to.

Thanks for making this plugin, it is very useful.

1 Like

Agreed. I’ll play around with the other ways to launch things, but so far I haven’t yet managed to get it to work.

Hrm… That’s odd, the GetKicadConfigPath really should be pointing at %APPDATA%\kicad… Wonder why it couldn’t find 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.

Ah, yeah, that would do it, heh.

Right, added a note about that.

1 Like

Great work. You might want to look into archive plugin code for ideas how to automate step one (lines 225-247).

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.

for some reason I couldn’t find the plugin registered on pcbnew.

I am on Windows7x64 and placed the freeroute.py in
C:\Users\Usr\AppData\Roaming\kicad\scripting\plugins

and FreeRouting.jar in
C:\Users\Usr\AppData\Roaming\kicad

refreshed in Tools>External Plugins>Refresh, but not working.

Edit: Kicad 5.1 nightly build

Solved: It was a mistake in saving the file from browser with html content. :face_with_hand_over_mouth:

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