Creating the XML Extension Definition File

The XML extension definition file defines and configures the extension.

The file ExtSample1.xml for the extension ExtSample1 follows.

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>

Key elements of this XML file are:

A GUID is a unique identifier for the extension that enables you to change the extension name in a new version without compromising the compatibility with projects that were saved with an older version of the extension.

The <entry> block defines the HighFive toolbar button, which uses the icon image from the file hand.bmp. The callback <onclick> defines the name of the function to invoke when the toolbar button is selected. The next section addresses the IronPython script defined for the function HighFiveOut.


Note:
  • For images to display as toolbar buttons or next to menu commands, Mechanical requires BMP files. ANSYS 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.


For more information on working with XML extension definition files, see Using Extensions.


Release 18.2 - © ANSYS, Inc. All rights reserved.