• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Blogs
  2. System, PCB, & Package Design
  3. BoardSurfers: How to Create Custom Menus in Allegro SKI…
Kirti Sikri
Kirti Sikri

Community Member

Blog Activity
Options
  • Subscribe by email
  • More
  • Cancel
CDNS - RequestDemo

Try Cadence Software for your next design!

Free Trials
PCB
Allegro X PCB Editor
BoardSurfers
Allegro X Advanced Package Designer
custom menu
PCB Editor
skill language
PCB design
23.1
Allegro PCB Editor
Allegro Skill
allegro x
SKILL

BoardSurfers: How to Create Custom Menus in Allegro SKILL

1 Mar 2024 • 8 minute read

 A menu provides access to frequently used commands or features of an application or program. You can access menu items from the menu bar, typically located at the top of the application window, or a shortcut menu from the right mouse click.

There are multiple ways to create custom menus for Allegro X PCB Editor and Allegro X Advanced Package Designer applications, including the use of the Allegro SKILL language. Some of the methods are as follows:

1. Overriding the Default Menu File - You can create a menu file (.men file) containing customization and set it as default using the CDS_SITE system variable. The Cadence-provided menu file is replaced with the specified one

Pros: Easy to specify a custom menu file, and no SKILL programming is required.
Cons: With every Cadence release upgrade, you must merge custom menus with the latest Cadence application menus. This can be time-consuming if there are many menu-related changes in later releases.

2. Loading Menu Customizations using axlUIMenuRegister - You can load your menu customization using the SKILL function axlUIMenuRegister.

Pros: Easy as it requires minimal SKILL programming, and depending on your site, the addition to menus may be unaffected by Cadence application menu changes.
Cons: You cannot delete the default Cadence application menu items or restrict your changes to a single Cadence application menu.

3. Registering Menu Trigger Notifications usingaxlTriggerSet - You can register menu trigger notifications using the SKILL function axlTriggerSet.

Pros: As easy as overriding the default menu file, and the function can update specific menus.
Cons: Requires in-depth SKILL programming knowledge, and you may need to examine your SKILL code with new Cadence releases.

Among the three, registering menu trigger notifications using SKILL functions offers maximum flexibility. Let's explore it in detail in this post.

Creating Custom Menus

The following image illustrates a sample menu created by registering trigger notifications along with the associated SKILL code:

Adding a custom menu to Allegro X PCB and Package design applications involves the following steps:

  • Finding a location in the application area to add a menu using axlUIMenuFind.
  • Creating a menu using axlUIMenuInsert.
    This function associates the menu item with the command to be called on clicking the menu item. It may include items, such as submenus and separators.
  • Registering a trigger to load the menu using axlTriggerSet.

Let's delve deeper into each step with examples.

Step 1: Finding a Location to Add a Menu Using axlUIMenuFind

The axlUIMenuFind function finds a menu item by location or command. If successful, it returns a menu ID. The failure is indicated by nil. The following example uses this function:

l = axlUIMenuFind(nil -1 nil)

This code finds the last menu, which usually is the Help menu. Generally, a new submenu is added before the last menu on the menu bar.

The syntax of the axlUIMenuFind function is explained here: axlUIMenuFind( x_menuId/nil t_cmdName/x_location [g_menuOption] ) ==> x_menuId/nil

Argument

Description

x_menuId 

Searches from the top-level menu. Returns the menu ID of the previous call.

x_location

Finds items by location. The 0 location is the left or the topmost menu item. Typically, this is the File menu item on the menu bar. You can also use a negative number, where -1 indicates the rightmost or the bottommost menu item.

t_cmdName

Finds the item by the command line entry. This must be an exact match. For example, if the command is registered as "echo hello", you need to search using the complete string "echo hello" and not "echo".

g_menuOption

Supported values are nil, 'top, or 'bottom.

If used with the find command, it returns the menu's top or bottom location where a command exists. The bottom option indicates to the axlUIMenuInsert function that a new menu item is to be appended to the end of the menu.

If used with find by location, and the item is a submenu, it returns the top or the bottom location of that submenu.

Examples:

l = axlUIMenuFind(nil 3 'bottom) This returns the ID of the last menu item of the third top-level menu from the left.

l = axlUIMenuFind(nil "add line" 'top) This returns the ID of the top menu item add line.

While not too frequent, command names may change from release to release.

Step 2: Creating a Menu Using axlUIMenuInsert

The axlUIMenuInsert function inserts the menu item to add a command, separator, or submenu to an existing menu. The syntax of axlUIMenuInsert is as follows:

axlUIMenuInsert(
x_menuId
t_display
t_command
)

The arguments of this function are explained in the following table:

Argument

Description

x_menuId

Menu ID obtained from axlUIMenuFind or by creating a submenu using this function.

If nil, the latest menu ID is used.

t_display

Shows text and display string in the menu. The valid values are:

  • display string
  • separator - adds a separator (horizontal line)
  • popup - creates a new submenu

t_command

Runs when the menu is clicked. It is ignored for a 'separator.

Examples

■ Add a separator before the add rect command.

q = axlUIMenuFind( nil "add rect")
z = axlUIMenuInsert(q 'separator )

rect_command

■ Add a web link at the top of the Help menu.

q = axlUIMenuFind( nil -1 'top)
z = axlUIMenuInsert(q "Google" "http http://google.com" )

Help_menu_command

■ Add a new submenu before the Help menu with two commands.

q = axlUIMenuFind( nil -1)
z = axlUIMenuInsert(q 'popup "MyMenu")
;insert these items into MyMenu
axlUIMenuInsert(z "1" "echo hello 1" )
axlUIMenuInsert(z "add" "add rect" )

Selecting 1 calls the echo command, which prints the message, hello 1.

My_menu

To add your commands to the menu, you must register your Allegro SKILL code with axlCmdRegister, which registers a command named t_allegroCmd with the layout editor shell system. For example, clicking the View Jrl menu displays the allegro.jrl file, as specified in the following code:

axlCmdRegister("viewJrl" 'viewJrlFileSkill)
(procedure viewJrlFileSkill()
axlUIViewFileCreate("allegro.jrl" "Allegro Jrl file" nil)
)
axlUIMenuInsert(z "view Jrl" "viewJrl" )

My_menu_view

Step 3: Registering a Trigger Using axlTriggerSet

Use the axlTriggerSet function to register interest in events that occur in the Allegro X PCB and Package design applications. The event used for menu commands is 'menu, targeted to modify the menu. For example,

axlTriggerSet('menu 'MyCustomMenu)
axlTriggerSet( s_trigger s_function )

s_trigger options include the following:

'open

Called immediately after a database is opened

'save

Called before a database is saved to disk

'close

Called before another database is opened

'exit

Called when the program is exiting, except if it is an abnormal termination

'menu

Called when a new menu is loaded in the main window of the application

You can find other examples at the following Cadence install directory location:

 <Cadence Installation>/share/pcb/examples/skill/trigger

If you want your custom menu to be loaded automatically when the board or package design opens in a layout editor, add the following code to the SKILL initialization file (allegro.ilinit) present in the pcbenv folder inside your HOME directory (%HOME%/pcbenv/allegro.ilinit).

menu_SKILL_code

Editing Custom Menus

You can use other SKILL functions to delete a menu, modify its parameters, or load the main menus. Some of these functions are listed in the following table:

SKILL Function

Description

axlUIMenuDelete

Deletes a single menu item or submenu based on the current menu item.

axlUIMenuChange

Changes one or more parameters of an existing menu item.

axlUIMenuDump

Dumps the current menu of the main application window to the input argument menuFile.

axlUIMenuLoad

Loads the main application window menu from t_menuFile.

Examples related to menu customization are available in the menu.il file available in the Cadence install directory at the following location:

<Cadence Installation>/share/pcb/examples/skill/ui/menu.il

You can also refer to the Allegro SKILL Reference for details and the SKILL cheat sheet that helps you write your code.

Wrapping Up

Understanding how to create custom menus using Allegro SKILL functions provides flexibility to enhance the design environment of Cadence Allegro X PCB and Package design applications. Customizing menus to align with your unique workflow requirements improves user experience and efficiency. Leveraging Allegro SKILL functions for menu customization is key to optimizing the overall usability and productivity of your application environment.

Contact Us

For any feedback or topics you want us to include in our blogs, write to us at pcbbloggers@cadence.com.

Subscribe to stay updated about our upcoming blogs.

About BoardSurfers

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 much more.


CDNS - RequestDemo

Have a question? Need more information?

Contact Us

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information