HG-5010: Customize the Environment
In this tutorial, you will learn how to customize the program using the preference file.
The Preference File:
A preference file is a script file that is read each time the program is started. It specifies default user settings such as the order in which colors are assigned, the default printer, default page layout, the auto save interval, and so on. A standard preference file can be created in the program installation directory which is executed every time a license is activated. An additional preference file can be created in your working directory that contains personal settings that either overwrite the standard preference file or are added to the existing settings in the standard preference file.
- All HyperWorks Desktop products, except HyperStudy: preferences.mvw
- HyperStudy only: preferences_hst.mvw
Seven include preference files are contained in the installation. These include preference files must be included in the main preference file, as they cannot be used as independent preference files. They are located under $ALTAIR_HOME/hw/prefinc.
Organization of the Preference File:
*BeginDefaults()
*EndDefefaults()
*BeginDefinitions()
*EndDefinitions()
*BeginStatsTemplates()
*EndStatsTemplates()
*BeginPlotMacros()
*EndPlotMacros()
*BeginTemplexFunctions()
*EndTemplexFunctions()
The *BeginDefaults() block is unique to a preference file while the *BeginDefintions(), *BeginStatsTemplates(), *BeginPlotMacros(), and *BeginTemplexFunctions() blocks are the same as those found in script files.
- *Id statement
- The syntax for the *Id statement is: *Id("Release") where the release gives the program name and version.
- The *BeginDefaults - *EndDefaults block
- The *BeginDefaults() block is comprised of general defaults and seven subordinate statement blocks. The general defaults are declared first, and then as many sub-blocks as required. Each sub-block has the same structure as the main block. This means there is a *Begin statement, followed by the necessary statements, and closing the block with an *End statement.
- General defaults
- General defaults include the autosave interval, bubble help status, and
default printer settings. The block is delimited by these
statements:
*BeginDefaults() *EndDefaults()
- Model defaults
- Model defaults are used to customize the model tool bar and to add MDL
defaults for submitting mechanical system models to a solver. The block
is delimited by these
statements:
*BeginModelDefaults() *EndModelDefaults()
- Graphic defaults
- Graphic preferences such as model orientation and the part attributes
are specified in the graphics default block. The block is delimited by
these
statements:
*BeginGraphicDefaults() *EndGraphicDefaults()
- Plot defaults
- Plotting preferences for curves including colors, fonts, and note
defaults are specified in the plotting defaults block. The block is
delimited by these
statements:
*BeginPlotDefaults() *EndPlotDefaults()
- TextEditor defaults
- TextEditor preferences including text and background color and font
settings are specified in the text editor defaults block. The block is
delimited by these
statements:
*BeginTextEditorDefaults() *EndTextEditorDefaults()
- Page header defaults
- Page headers are specified in the page header block. The block is
delimited by these
statements:
*BeginHeader() *EndHeader()
- Page footer defaults
- Page footers are specified in the page footer block. The block is
delimited by these
statements:
*BeginFooter() *EndFooter()
To help you avoid compile problems, when you begin each block, start with the *Begin and *End block statements, then enter the remaining statements between the block delimiters.
Set the Auto Save Default
Observe the Updated AutoSave Default
Set the Curve Defaults
Observe the Updated Curve Default Settings
Set the Default Plot Colors
Observe the Updated Default Plot Colors
Set the Default Fonts for the Plot Area
Observe the Updated Default Plot Fonts
Set the Note Defaults
Set the Legend Defaults
Observe the Updated Default Plot Fonts
Update Note and Legend Defaults
Add a Page Footer
Observe the New Page Header and Footer
- Register and Load the preference file new_headers_footers.mvw.
- If a printer is installed, you can select Print and then click OK. These headers and footers will be seen when the session or page is printed.