HW v2022.2 Multi-client Extensions for Ribbons, Dropdowns and Toolbars
Introduction
Extensions are a way to customize your Altair applications and to seamlessly include your scripts into the graphical user interface (GUI). In this blog I will focus on HyperMesh (HM) and will touch on HyperView (HV) and HyperGraph (HG), but other Altair Products also use extensions for customization. I will focus on explaining the framework so that what I show can be easily repurposed for your own customization. I will show how to add a button on ribbons, in menus and on toolbars.
Mechanics
Each extension needs its own extension.xml file but one extension.xml file can point to multiple ribbons, menus, and toolbars for multiple clients (HM, HV, HG). The image below shows part of an extension.xml file (also attached) that adds a ribbon, menu, and toolbar in HM, HV and HG. The corresponding view of the Extension Manager with corresponding fields marked in both is also shown.
The file called out with “tclscript” above (#6 in yellow), found in the same directory as the extension.xml file, runs when the extension is activated and when HyperWorks is open if the extension is left active. This file holds the procedures used in the extension, called by the “command” parameter in the xml file in the profile sections below. For this example, a simple message box is displayed when each button is pushed.
In each profile section, there is a folder with the toolbar xml file(s) and file specified for the menu and ribbon xml files. These xml files control what is seen and done for each toolbar, menu, and ribbon. The actionlist section defines the behavior of the item/button and the page/toolbar section defines the organization of the button(s) in the GUI.
Actionlist parameters (see images below)
- tag is the handle used to call the item and must be unique
- text is the text that will show under the ribbon item or in the menu (toolbars do not have text)
- tooltip is what will show on hovering over the item
- image is the image that shows for that item
- command is the action that will be performed if the button is pushed
Page parameters for ribbons (see image below)
- group defines a part of the ribbon separated by vertical lines
- action defines a button/item on the ribbon
Page parameter for menu (see image below)
- menu defines a dropdown menu
- actiongroup is a submenu under the menu
- action is an item either in the menu or submenu (actiongroup)
Toolbar parameters:
- Just list the buttons/actions you want in order in the toolbar section
This is certainly not an exhaustive view of extensions but should be enough to get started and at least get your script attached to a button.
Here are some references about extensions and some actual extensions:
https://help.altair.com/hwdesktop/hwd/topics/reference/extensions/extensions_r.htm
https://community.altair.com/community?id=kb_article&sysparm_article=KB0120189
https://community.altair.com/community?id=kb_article&sysparm_article=KB0121742
https://community.altair.com/community?id=kb_article&sysparm_article=KB0121665
TLDR
- Download and extract AddAButtonHGHVHM.zip
- In the Extension Manager point to the extracted folder
- Change the command value in the xml files contained in the sub folders to you desired function
- If the desired function is a TCL procedure add that procedure to the InitExtBB.tcl file