### 9.5.3. How to Topics

The following topics are discussed:

- How to Create a new UserIO Program
- How to Add Import/Export Capability

#### 9.5.3.1. How to Create a new UserIO Program

You can create a new UserIO program by copying one of the example projects provided under ANSYS Inc\v182\aisol\BladeModeler\BladeGen\UserIO_Source and then using Microsoft Visual Studio C++ 11.0 to modify and build it.

Related Topics:

How to Add Import/Export Capability

#### 9.5.3.2. How to Add Import/Export Capability

Note: This topic assumes that the steps described in How to Create a new UserIO Program have been completed.

The interface uses a the following global variables to control Import/Export options.

    //---------------------------------------------------
    // Required Data Structures
    //
    const int			g_iOrder = 10;										// specifies the location in menu
    const FileType				g_eImport = NoFile;						// specifies the file type for import
    const FileType				g_eExport = NoFile;						// specifies the file type for export
    const char						g_szFileDesc[64] = "UserIO";		// specifies the text for the menu and file type
    const char						g_szFileType[16] = "usr";				// specifies the file extension

    const int						g_nErrorMsg = nMsg;						// specifies the number of error strings
    const char**				g_ppszErrorMsg = pszErrMsg;		// specifies the error strings defined above

The g_iOrder variable can be used to order export routines in the menu. Sorting is done with this number and then by the description text.

The two FileType variables (g_eImport & g_eExport) determine which of the interfaces are enabled.

The file description (g_szFileDesc) variable is the text that will appear in the File | Export menu and Open File Dialog’s File Type control. Each UserIO program should have a unique description so that they can be differentiated.

The file type (g_szFileType) variable is the file type extension that is added to the name. It should be three characters, but can be up to 15 characters in length. Do not include the separator (period).

The error message count is stored in the g_nErrorMsg variable. It is recommended that the user create this using an "enum", as shown in the default file (See Common Interface).

The error messages are accessed using the g_ppszErrorMsg variable. This allows the interface display the error that is indicated by the return value. (See Common Interface).

Common Interface Requirements

The g_szFileDesc, g_szFileType, g_nErrorMsg, and g_ppszErrorMsg parameters must be defined for either interface to function.

Adding Import Capability

1. Change the value of the g_eImport variable. The options are described in bgUserIO.h.

2. Add the required code to the UserImport function. The function should return 0 (SuccessMsg) if successful and >0 if an error is found. As many error message as required can be added.

Adding Export Capability

1. Change the value of the g_eExport variable. The options are described in bgUserIO.h

2. Add the required code to the UserExport function. The function should return 0 (SuccessMsg) if successful and >0 if an error is found. As many error message as required can be added.

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