You are here

Automatically Load Custom Allegro® PCB SKILL Functionality

Problem

How can I load and use SKILL files in Allegro PCB Editor?


Solution

Loading SKILL files automatically
 

Allegro PCB Editor SKILL files can be loaded automatically when PCB Editor is invoked by using a file called allegro.ilinit. This file should reside in your pcbenv directory. You may need to replace the SKILL path with the correct path to your SKILL files, but the path MUST have a forward slash (/) to work correctly. When PCB Editor is invoked, it will try to locate the allegro.ilinit file first in your $HOME/pcbenv directory, and then in <CDSROOT>\share\local\pcb\skill.

A sample allegro.ilinit file is shown below.

Note: There is an example.ilinit file located in the install directory. It can be found at <install>\share\local\pcb\skill.

========= SAMPLE allegro.ilinit FILE ==============
setSkillPath(buildString(append1(getSkillPath()  "D:/skill")))
;
;    Lines preceded by ";" are comment lines
;
; replace D:/skill..... above with your path to the skill files. Remember the
; quotes. This MUST have a forward slash.
;

load("CreateFlash.il")
load("placelist.il")

; The next line will print on the Command line in Allegro "allegro.ilinit file loaded".
; This is a good way to confirm the allegro.ilinit file actually is loaded.

println("allegro.ilinit file loaded")
========= end SAMPLE allegro.ilinit FILE ==============

Loading regular SKILL files and SKILL context files in the CDS_SITE path
 

If you have placed your SKILL files in the CDS_SITE directory structure, you can set up the allegro.ilinit file to load regular SKILL files and SKILL context files.

PCB Editor looks in the <CDS_SITE>/pcb/skill directory to find the allegro.ilinit file.

The following is a sample allegro.ilinit file that will load all SKILL files located in that directory.

;=========== allegro.ilinit  Cut here. ======================
; Contents of allegro.ilinit file to load SKILL files, Context files and initialization files.
; Setting Allegro environment variable, LoadSkillFilesDebug will turn
; on printing the name of each file as it is loaded.

unless(boundp('LoadSkillFilesDebug)
        LoadSkillFilesDebug = axlGetVariable("LoadSkillFilesDebug"))

when(LoadSkillFilesDebug printf("\n"))
(foreach file (rexMatchList "\\.il$" (getDirFiles "."))
      when(LoadSkillFilesDebug printf("Loading Skill file: %s\n" file))
      (load strcat("./" file))
)
;End of loading regular SKILL files

;Load SKILL context files.

(foreach cxt_file (rexMatchList "\\.cxt$" (getDirFiles "."))
str = strcat( axlGetVariable("allegro_site") "/skill/" cxt_file)
when(LoadSkillFilesDebug printf("Loading Context file: %s\n" str))
loadContext(str)
);end foreach
; End of context loading.

; Load any ini files (containing axlCmdRegister)
(foreach file (rexMatchList "\\.ini$" (getDirFiles "."))
      when(LoadSkillFilesDebug printf("Loading Skill file: %s\n" file))
      (load strcat("./" file))
)
when(LoadSkillFilesDebug printf("\n"))

Loading and executing SKILL from a local directory (without setting up allegro.ilinit)
 

You can load a SKILL file by typing the following command at the Allegro PCB Editor command line:

Command > (load "skill_file_name.il")

If it is successfully loaded, the PCB Editor command line will report a "t" as the last entry. The SKILL file will only load if the file is present in the SKILL search path. To find the SKILL search path, you can type the following command on the command line:

Command > (getSkillPath())

SKILL will echo the current SKILL search path. If the file that you wish to load is not in the search path, you must perform one of the following actions:

  1. Move or copy the file into the SKILL search path.
  2. Specify the full path to the SKILL file. Use "/" to separate the paths.
  3. Modify the search path to include the path to your SKILL file (use "/" in the path).

Example (using g.il):

Command > (load "g.il")
t
Command >

To execute the file, open it in an ASCII text editor and review any comments about running the program or look for the registered command, such as:

   axlCmdRegister ("aa" 'Reports)

In this example, aa is the command that you type at the PCB Editor command prompt and Reports is the name of the SKILL function that is called by that command.
 

Running a program from a SKILL file
 

The command to run a program in a SKILL file can be determined from the axlCmdRegister line or a comment in the SKILL file. For example, the placelist.il file allows you to place components by list. This file contains:

axlCmdRegister( "place list" `Place_By_List)

To run the command, type place list at the PCB Editor command line.
 

Adding scripts and SKILL commands to a Menu pick
 

To add your scripts and/or SKILL programs to your menu, copy the allegro.men file from $CDSROOT/share/pcb/text/cuimenus to $CDSROOT/share/local/pcb/menus. This is a default location specified by MENUPATH for user menus. You could also create a new directory and update your MENUPATH accordingly. The MENUPATH can be set from Setup > User Preferences > Paths > Editor > menupath. PCB Editor will only look at the first allegro.men file found; so make sure that the path where you put your new menu is at the top of the list.

To use scripts in the menu, place your scripts in:

$CDSROOT/share/pcb/text/scripts

This is a default location for user scripts specified by SCRIPTPATH. You can create a new directory if you wish and update your SCRIPTPATH accordingly. The SCRIPTPATH can be set from Setup > User Preferences > Paths > Config > scriptpath. PCB Editor will search all paths included here for your scripts.

Edit the allegro.men file and add your new menu items as desired. Place the file in the menupath as described above (make sure you edit a copy of this file; do NOT edit the original file).

Below is an example of a section added to the end of the menu file just before the last "END" statement in the file. Once the menu file is saved and you open PCB Editor, you will see a menu pick called My commands and two submenus called diff pair report and My script. The first menu item will execute the dp_rep SKILL file (assuming it was properly loaded), and the second menu item will replay the script called test.scr, which would be located in your SCRIPTPATH.

**********************************
POPUP "&My commands"
BEGIN
MENUITEM "&diff pair report", "dp_rep"
MENUITEM "&My script", "replay test"
END
**********************************

Finding more information on SKILL
 

You can access the Allegro SKILL Library on the Cadence Support Portal (https://support.cadence.com).

From the Cadence Support Portal home, perform the following steps:

  1. From the menus, select Resources > SKILL Information.
  2. Select Allegro PCB Editor SKILL Code Library.
     

Executing SKILL from a command line
 

There is no direct way of doing this. However, you can run Allegro PCB Editor in nographic mode and SKILL can be called within an Allegro PCB Editor Script.

Here is an example of the syntax used to execute the SKILL file within a script:

allegro -expert -nographic <boardname.brd> -s <script.s>

The script looks like:

setwindow pcb
trapsize 5
skill
skill 'load "./skillfile.il"' ;### Where 'skillfile.il' is your SKILL file
exit

Note: Non-graphical mode of operation is not supported on the Windows platform.
 

Calling an allegro.ilinit file from another allegro.ilinit file
 

You can load other .ilinit files using the following command:

load "<path to file>/foo.ilinit"