How to customize Model Info note in HyperView?
The model Info note anchored top right exposes default information, some depending of animation mode, that can be customized.
There are frequent requests for customizing the Model Info, and this article will propose few use cases that we faced.
Where to edit the Model Info note?
You can edit Model Info note via the Model browser.
- Expand the Notes folder and left-click on the Model Info note to get access to its attribute in the bottom section of the browser.
- Click on the Text Attribute to open a pop-up allowing text edition.
How to edit the Model Info note?
The note contains instructions between curly braces. The default text is:
{for (i = 0; i != numpts(window.modeltitlelist); ++i) } {window.modelidlist[i]}: {window.modeltitlelist[i]} {window.loadcaselist[i]} : {window.simulationsteplist[i]} : {window.framelist[i]} {endloop}
These curly braces instructions are a Templex statement, which is an Altair proprietary language used in Altair software for different purposes:
- Notes in HyperView/HyperGraph
- Mathematical functions in HyperGraph (even if Compose is now preferred)
- Cell filling in TableView client
- Parametrized session file/report template/flexible report for HyperView/HyperGraph
- ASCII parametrized files in HyperStudy
Each statement in curly braces is independent and can be removed without any effect on the other statements (except the loop statements).
Eg, you could remove from Model Info note's Model ID (not necessary if you deal with a single model) and Frame ID:
{for (i = 0; i != numpts(window.modeltitlelist); ++i) } {window.modeltitlelist[i]} {window.loadcaselist[i]} : {window.simulationsteplist[i]} {endloop}
Where to retrieve information about Templex core commands?
Altair Simulation online help include a section in HyperWorks Desktop Reference guide dedicated to Templex:
How to save your Model Info custom layout so that it becomes the default?
Your Model Info settings can be saved through a preference file (see example attached).
Once the preference file is saved (File -> Load -> Preference File) in HyperView, you can register your preference file and then load it.
Once this done, your settings will be taken by default, as long as the preference file is available.
How to display the filename without the full path?
You can remove the {window.modelfilename[i]} statement and insert the Model File Name (Short) from the left part of the pop-up dialog.
The Model File Name (Short) will add the {window.shortmodelfilename} statement, which you can change to {window.shortmodelfilename[i]} if you're dealing with multiple models in the same window.
How to display only the path of the model file (part or all of it)?
For this, we need to bring in a templex operator, fileinfo. Below are some examples of fileinfo usage.
For instance, if you want to keep the full path without the name, you can set {fileinfo(window.modelfilename[i],"dirname")}
How to change simulation time to a mm:ss or hh:mm:ss format?
For a long time simulation (eg CFD) you may want to expose simulation time in a more intuitive format.
For this, 2 steps are needed:
- Extract the numerical portion of the Simulation Time information
- Compute the number of minutes/hours and expose it
Here is an example of code to be used for such case:
{fulltime=convert(replace(window.simulationsteplist[i],"Time = ",""))} {hours=int(fulltime/3600)} {minutes=int((fulltime-60*hours)/60)} Time={hours}h:{minutes}m
Information about Templex convert, replace and int operators can be retrieved in HyperWorks Desktop Reference Guide.
How to cut a string?
Let's take the example of a long result file name:
For some reason, you may want to cut and keep only the beginning of the end of the string.
If you want to cut at a given position, you can use the mid command, which will ask you for the first and last index to be kept:
{mid(window.shortresultfilename,0,20)}
Now, let's say you want to keep only the 20 last digits of the string. In addition of mid, you'll need also strlen operator which returns the length of a string:
{mid(window.shortresultfilename,strlen(window.shortresultfilename)-20,strlen(window.shortresultfilename))}
Sometimes, you do not want to cut at a fixed index, because you want to cut at a given pattern, which can be a character (:, ;, ...) or a string.
In that case you can use strstr operator in order to get the start index of your pattern. This can be useful for instance if you want to display only the title or the label of a given loadcase.
{mid(window.shortresultfilename,0,strstr(window.shortresultfilename,":"))}
Last, if you have a specific string pattern you want to completely remove, you the replace statement:
{replace(window.shortresultfilename,"FRONT_BEAM_FIRST_RUN_","")}