In the directory where you store your extensions, the XML file and the folder with the extension's script and supporting files are stored at the same level. Both the XML file and the folder must have the same name as the extension.
The following figure shows the top-level directory structure for the extension
ExtSample1
. You can see that the extension's XML file and its
folder are both named ExtSample1.
The following figure shows the contents of the folder ExtSample1.
The script sample1.py contains the code that implements the extension's behavior. By default, ACT looks for the script in the directory of the extension. If the script is located in a different directory, in the XML file, the element
<script>
must specify an explicit path to the script.The folder
images
contains the one or more image files to display as icons in the interface of this extension.
The following figure shows the contents of the folder images
. The
image file hand.bmp displays as the icon for the custom button that is
exposed on the tab for this extension when it is loaded in Mechanical.
Custom Menu Icons in the Mechanical Ribbon User Interface
Introduced in 2019 R2, the Mechanical ribbon user interface handles menu entry icons differently than earlier Mechanical versions. To achieve optimum image compatibility:
Create four Portable Network Graphics (PNG) files of your icon in these specific pixel sizes: 16x16, 24x24, 32x32, and 48x48.
Apply this naming convention:
icon_
yourIconName
_sizeAxsizeA
.pngFor example, assume that you specify
"myIcon"
as the icon attribute value in your extension XML file:<entry name="myEntry" icon="myIcon" ... />
You must then name your icon files as follows:
icon_myIcon_16x16.png
icon_myIcon_24x24.png
icon_myIcon_32x32.png
icon_myIcon_48x48.png
Store all four icon files in your extension's original images folder.
Note:
You can use your preferred image manipulation tool to create the four PNG files in the required pixel sizes. Using the functionality for scaling an image, start with the maximum resolution (64x64 pixels) and work down to the minimum resolution (16x16 pixels), exporting a new image after each re-scale operation.
Tree object icons continue to use the bitmap image format in the 16x16 pixel size. You do not need to update these icons for existing extensions. In the XML file for a new extension, you specify the entire name (without the
.bmp
extension), just as you did before the ribbon UI change.