# Extension Manager¶

Register and load user-defined extensions in the Extension Manager, found under the File menu at File > Extension Manager.

An extension provides the means to extend the application through shared libraries or scripts. Use extensions to create new profiles, contexts, model views, and more.

Sample extensions that illustrate the various use cases are included in the Extension Manager.

## Extension Structure¶

An extension is comprised of a folder containing a manifest file, plugin.xml, and all related scripts and resources.

The plugin.xml file defines the metadata of the extension such as name, version, and minimum supported product version. The entire content of plugin.xml should be wrapped inside of section as shown below:

<?xml version="1.0" encoding="UTF-8"?>
<section name="Extension">
<entry name="name" value="Boxify"/>
<entry name="script" value="extension.py"/>
<entry name="author" value="Altair Engineering Inc."/>
<entry name="publisher" value="Altair Engineering Inc."/>
<entry name="description" value="Boxifies a selected part in Inspire."/>
<entry name="minProductVersion"   value="2021.2"/>
</section>

Table 1. Supported attributes in extension.xml
Attribute Description
name Name of the Extension
minProductVersion The minimum version of the product that is supported by this extension
documentation HTML file with the detailed description of the extension that can be opened in a web browser through the Extension Manager user interface
author The author of this extension
publisher The publisher of this extension
script The script that should be executed when this extension is loaded
resources Location of the resources directory relative to the extension directory
settings An xml file that defines the settings of this extension
advancedToolTip An xml file that defines the tooltips related to this extension
workFlowHelp An xml file that defines the workflow help content of this extension
required The plugin that should be loaded as a pre-requisite for this extension
extends The plugin that this plugin should be auto-loaded after
profile The name of the profile implemented in this extension

## Implementing a Profile as an Extension¶

A Profile is the UI state that defines menus, ribbon pages, toolbars and dock windows. There can be multiple Profiles, but only one can be active, or displayed, at a time. Splitting functionality into Profiles can reduce screen clutter, allowing the user to focus on specific tasks.

Profiles can be hierarchical with a Profile having sub-Profiles. Sub-Profiles can make use of the base Profile functionality and implement additional functionality as required. There are two types of Profiles, stand-alone and add-on.

• A stand-alone Profile re-configures the entire UI.

The plugin.xml should have an entry defining the Profile name so that the Framework loads this extension when the Profile is requested to be activated.

<entry name="profile" value="MyProfile"/>


The following command line should be used to load the Profile, where -p denotes the extension and -pr denotes the Profile:

<installation directory>/hwx/bin/win64/runhwx.exe -p MyExtension -pr MyProfile


### Sample code snippet for Profile Creation¶

from hwx import gui
class MyProfile(gui.Profile):
def build(self):
gui.RibbonPage(name="Geometry", children=[
gui.RibbonPageGroup(name="Modify", children=[
gui.SpriteActionGroup (
text = "Boolean",
children = [gui.SpriteAction (text = "Test", icon = "ribbonBooleanMainStrip-80.png", command = lambda: print('you clicked a button!!!'))])])])

def activate(self):
print('activate')
#Profile creation
profile = MyProfile("MyProfile")


## Managing Extensions¶

1. Click File > Extension Manager to open the Extension Manager.

2. Click Add Extension, and browse to the extension folder to register it.

Note: All of the extensions located in the Custom plugins location specified in Preferences are automatically registered by the Extension Manager. The default custom plugins location is /Documents/Altair/extensions.

Result: The extension is loaded in Inspire. This extension creates a new icon on a new ribbon.