Using scripts in Altium Designer

11 Apr 2018, by Justin MASSIOT

Scripts? What’s that?!

What is an Electronics CAD tool with an embedded interpreter for scripts? It’s a great CAD tool, of course! Many professional ECAD software give users an access to an API through a scripting system, enabling us to automate some repetitive tasks. I don’t use other CAD systems than Altium Designer much but I’m sure Autodesk Eagle supports scripting and I suppose software packages from Mentor, Cadence, Zuken or even from Open Source communities (KiCad?) do the same.

Here are examples of what you can achieve with scripts:

  • Save time:
    • Generate some objects automatically (nets, tracks, corporate information, items required by your internal process, …)
    • Add new toolboxes to your CAD software
  • Add consistency between projects and designers:
    • Propagate some parameters across the whole design (board name and version, project number, …)
    • Enable a set of features on a project
  • Always release with the same confidence:
    • Adjust position or completely hide the component designators
    • Run some basic checks on the design
    • Auto-generate output documents and package them to make a release archive

Scripts are little pieces of code (you can see them as “lightweight software”) that you can easily execute, edit and enhance. They act exactly like macros which you “Record, Stop, Play” but are built from human-readable text. Text is great because it’s light, easily editable and you can make a diff on two different versions.

If you are a user of Altium Designer you may know that you can code custom scripts in the following languages:

  • Delphi Script
  • VB Script
  • Javascript
  • EnableBasic

Where to find plug-and-play scripts?

Great news: You don’t have to be a programmer to use scripts!
You can grab some great ones from elsewhere: friends, colleagues, websites (please be careful to only execute scripts coming from safe places). I personally am a contributor of the “Altium Designer addons” bank of scripts but I also like AltiumScriptCentral very much, and I’m sure there are plenty of other great scripts made by other great guys.

NB: Some scripts have a graphical user interface (GUI) but some haven’t, so don’t worry if no window is shown when you execute a script.

How to run scripts?

Link: Official “Altium Designer scripting system” documentation

HowTo_execute_scripts, from GitHub

A while ago I’ve written a guide on How to run a script from inside Altium Designer. It’s a good starting point for anyone aiming at using scripts. As a summary, you have 2 ways to run scripts from the AD interface: run it from “DXP > Run script” or launch it from a custom menu item or toolbar. If you use the “Run script” option you can directly browse your hard drive to launch scripts. Select a script project (PrjScr), a script file and the function you want to execute (a script file can contain many different functions).

Script execution inside Altium Designer

You can save some script paths in your Preferences to re-use them quickly later. Scripts can also be integrated inside PCB projects if that makes sense to you. If you do so, the “Run script” dialog should show any available scripts from the open projects.
If you prefer the “menu” option, my page about “Menu SVN” should help you a lot.

Want to have a more “visual” example? Watch this tutorial video from Petar Perisin:

I will try to post about writing custom scripts in the near future. Stay tuned 😉
While you are waiting, get ready by having a look at the official documentation about scripting in Altium Designer.

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: