Creating the Extension Definition File

The supplied extension ExtSample1 customizes Mechanical by adding a toolbar with a single button toolbar. When this button is clicked, a dialog box opens, displaying the following message: High five! ExtSample1 is a success! For extension download information, see Extension and Template Examples.

The file ExtSample1.xml defines and configures the extension.

extension version="1" name="ExtSample1">
  <guid shortid="ExtSample1">2cc739d5-9011-400f-ab31-a59e36e5c595</guid>
  <script src="sample1.py" />
  <interface context="Mechanical">
    <images>images</images>
    <callbacks>
      <oninit>init</oninit>
    </callbacks>
    <toolbar name="ExtSample1" caption="ExtSample1">
      <entry name="HighFive" icon="hand">
        <callbacks>
          <onclick>HighFiveOut</onclick>
        </callbacks>
      </entry>
    </toolbar>
  </interface>
</extension>

The XML file for an extension always begins with the element <extension>. All other elements are children to this base tag or root node. For descriptions of basic elements, see Appendix A: Extension Elements. For descriptions of all elements, see the Ansys ACT XML Reference Guide.

In this extension, the element <entry> defines the single toolbar button. The file hand.bmp provides the image to use as the icon. The callback <onclick> defines the name of the function to invoke when the button is clicked. The next section addresses the script defined for the function HighFiveOut.


Note:
  • For images to display as toolbar buttons or next to menu commands, Mechanical requires BMP files. Workbench and all other Ansys products require PNG files.

  • To designate a transparent background for a BMP file, in an image editor, set the background color to 192, 192, 192 and then save the file with 256 colors.