Never miss a story from System, PCB, & Package Design . Subscribe for in-depth analysis and articles.
The Allegro SKILL coding language offers capabilities to create user-friendly graphical user interfaces (GUIs) for an enhanced user experience. The extensive collection of Allegro SKILL widgets enables the creation of sophisticated GUI components for various design tasks. Using Allegro SKILL, PCB, and package, you can extend the design environments. Creating a GUI using Allegro SKILL requires the use of associated Allegro SKILL APIs, which are an integral part of Allegro SKILL. So, you don't even need to install anything else to begin creating GUIs. This post covers detailed steps to create a GUI using Allegro SKILL.
An example of the Allegro SKILL GUI is shown in the following image. The image displays the Extract Selector form created using Allegro SKILL.
Extract Selector GUI contains a list of the extracta command files available in the Cadence installation location at <Cadence_installation_directory>/share/pcb/text/views
You can select any of the files in theView File field and start the extracta process, which pulls out specific data in an ASCII Text format from the design database of the Allegro layout editor.
The steps to create a GUI with Allegro SKILL are listed in the following table:
STEP 1: Write a Form file - Define the GUI elements, including their location and options, in a Form file.
fw = axlFormCreate('f1s "axlform" position
'_afCallback t nil )
axlFormTitle(fw "--F1-- Skill Test Form" )
axlFormBuildPopup(fw "enum" '(("item1") ("item2") ("item3")) )
STEP 5: Display the form using the axlFormDisplay function.
You must place a Done or OK button (default field name is Done) and, optionally, a Cancel button (default field name is Cancel).
STEP 6: Click the Done or OK button to close the form using the axlFormClose function.
Let us look at these steps in detail:
A Form file defines the GUI elements, their location, and default values or options. The filename has a .form extension. The name of the Form file is used to invoke the form using the axlFormCreate function in Step 3 as explained later in the post.
The Form file is expected to be in the same directory as the SKILL file or in one of the directories specified in the Allegro PCB Editor environment variable, FORMPATH.
The GUI elements are defined in a Form file using the following format:
Here’s an example of a Form file:
To fully comprehend the contents of a Form file, it is recommended to familiarize yourself with the Forms Specification Language, Backus Naur Form (BNF). BNF is a formal notation used to describe the syntax of a language. The following example illustrates the BNF definition of the Form file:
To delve deeper into this topic, refer to the Allegro User Guide: SKILL Reference guide.
The following example is an excerpt from the Form file created using BNF:
You can view the form to check how the objects are visually placed by using the function axlFormTest "<form file>", as shown in the following image:
At this stage, you can only view the form. The GUI elements, such as buttons and fields, are not interactive.
Whenever a user interacts with a GUI element by clicking a button or entering a value in a form, the Callback function is invoked. The Callback function is the core of the GUI and defines the actions needed to be performed based on user interactions.
The format of the Callback function is a case statement for various field values in the form. It is similar to the switch statement in other programming languages. In each case statement, corresponding to a GUI element, you must specify what needs to be done after the value is changed.
The following is an example code of a form Callback function, showing the output when the Done, Cancel, or View File buttons are clicked:
In this example:
The next three steps involve writing the main function that ties up everything and is called to bring up the GUI. For example, in the following sample code, myExtract is the main function:
The myExtract function does the following:
To get started with Allegro SKILL GUI creation, you can refer to the examples located in the <Cadence_installation_directory>/share/pcb/examples/skill/form directory.
Some of the examples available in this directory include the following:
This example includes all the GUI elements that you can use in Allegro SKILL-generated GUI, including:
Grid control: fgrid.il/fgrid.form
Multi-select grid control:fgrid-msel.il/fgrid.form
The following images display examples of GUIs with basic controls:
To use the example files, perform the following steps:
Explore other SKILL codes and the Form files to understand how the Allegro SKILL GUI works.
A sample Form file to create a GUI is provided in the installation folder. For user interactions, the sample form includes Cancel, OK, Print, and Script buttons. The GUI also includes a list field to show a list of files and a field for View File to display the file selected from the list of files.
The following SKILL code uses this sample Form file:
The Allegro SKILL GUI APIs let you customize the design environment according to your specific requirements. By seamlessly integrating the SKILL-generated GUIs into your workflows, you can streamline complex tasks, enhance collaboration, and achieve greater design precision.
For any feedback or any topics you want us to include in our blogs, write to us at firstname.lastname@example.org.
Subscribe to stay updated about our upcoming blogs.
The BoardSurfers series provides solutions to the various tasks related to the creation and management of PCB design using the Allegro platform products. The name and logo of this series are designed to resonate with the vision of making the design and manufacturing tasks enjoyable, just like surfing the waves. Regular, new blog posts by experts cover every aspect of the PCB design process, such as library management, schematic design, constraint management, stackup design, placement, routing, artwork, verification, and more.