Running AWROut using an Allegro Script

June 21, 2016
Steve DiBartolomeo, Applications Manager
Andrew Wilford, Sr. Programmer

AWROut is normally run from it's dialog inside of Allegro. However a requirement has arisen where the user wishes to extract 3Di data from Allegro via an automated script file.


This application note will document the script commands used by AWROut and show an example of how to do this.

Getting Started

We'll start by building a script template using Allegro's script recording function. Once we have a template and understand the various script commands we can edit or create a script from scratch using any number of programs such as Perl or Python.

Our Example and Assumptions

    a) We wish to create two 3Di files - one for the top conductor and one for the bottom conductor. Our designers always name these "layers" TOP and BOTTOM.

    b) We want to output all etch types of geometry objects (i.e. traces, pins, vias, shapes)

    c) We want to exclude all etch geometries that belong to the "GND" net.

    d) AWROut is loaded when Allegro starts up (using allegro.ilinit).

Annotated Allegro Script File

Below you will find a commented script file. For purposes of fitting on this page I introduced line "breaks" in the longer commands - just realize that there are no breaks in the actual script file. The are no blank lines between script commands either.

#   Allegro script
#	file: C:/CAD Data/BRD Files/top_bottom_no_gnd_net.scr
#	start time: Tue Jun 21 12:10:47 2016
#	Version: 16.6-2015 S066 (v16-6-112FJ) Windows 32

setwindow pcb                     <-- moves focus to the PCB main window
generaledit                       <-- don't know
acsawrout                         <-- launches the acsawrout
setwindow form.acsawrout          <-- directs focus to the AWROut window
FORM acsawrout net_filter YES     <-- turn on the net filter
FORM acsawrout net_reverse YES    <-- reverse the selection set
FORM acsawrout all_nets GND       <-- select the GND net
FORM acsawrout add_net            <-- move to selected window
FORM acsawrout lay_filter YES     <-- turn on the layer filter  
FORM acsawrout all_lays TOP       <-- select the layer named TOP
FORM acsawrout add_lay            <-- add the selected layer to the layer list
FORM acsawrout file_name 
  'C:`\CAD Data`\BRD Files`\top_no_gnd_net.3Di'    <-- define name of 3Di file to produce

FORM acsawrout settings           <-- change focus to the Settings tab
FORM acsawrout sub_layers NO      <-- render each component on its own layer (no)
FORM acsawrout substrate NO       <-- do not render component outlines
FORM acsawrout dielectric NO      <-- do not generate dielectric bodies
FORM acsawrout polyarcs NO        <-- do not produce arcs in 3Di (they'll be lost anyway)

FORM acsawrout apply              <-- clicks the Apply button generating the output 3Di file
                                      but does not "close" the AWROut program since we need to 
                                      produce a second 3Di file.   

setwindow pcb                     <-- appears we have clicked on the main editing window
setwindow form.acsawrout          <-- focus back on AWROut
FORM acsawrout filters            <-- select the AWROut filter tab 
FORM acsawrout del_lays           <-- deleted all layer i.e. TOP which we had previously selected 
FORM acsawrout all_lays BOTTOM    <-- select BOTTOM from the list of all layers
FORM acsawrout add_lay            <-- add selected layer to the list
FORM acsawrout file_name 
 'C:`\CAD Data`\BRD Files`\bot_no_gnd_net.3Di'    <-- define name of 3Di file to produce

FORM acsawrout apply              <-- click on the Apply button. This executes the AWROut
                                     program. It does not "close" the program (perhaps we should use 
                                     OK instead of Apply.)       

setwindow pcb                     <-- focus back to PCB window.
setwindow form.acsawrout          <-- focus on AWROut window
FORM acsawrout cancel             <-- Cancel - closes AWROut (releases license)

setwindow pcb

Launching the Allegro Script from a Windows Batch File

Now let's modify our assumptions slightly.

    We don't want to have to start up Allegro manually, pull down the File menu, select and load the desired .brd file

    We don't even want to install AWROut permanently in the Allegro menu - we just need it for extracting the 3Di files.

The Batch Command

allegro -s top_bottom_no_gnd_net.scr sample_file.brd


allegro                     launches your desired version of allegro. I've assumed allegro.exe 
                            is in the path. If it is not you would use the full path name.

-s                          indicates an Allegro script file follows

top_bottom_no_gnd_net.scr   the name of the script file to be run

sample_file.brd             the name of the Allegro .brd file to load

If you do things in this fashion there are a couple of changes you have to make to the Allegro script.

setwindow pcb
skill '(load "C:/WCAD/AWROut/")'   <-- this is a SKILL commmand to load '(AcsAwrOut)'
skill '(AcsAwrOut)'                             <-- use SKILL to start program
setwindow form.acsawrout

The reason for this change is that in the initial example, AWROut was installed upon Allegro start up along with its menu system. The acssawrout command directly refers to a menu which is non-existent in our new situation. So we call the SKILL function directly instead of working through the menus.