Documentation Of The ADINA-Lint Extension
Sets your coding experience with ADINA into an another level!
ADINA is a primier simulation software for advanced analyses. ADINA provides a GUI and also an impressive command language. To work easier with this command language this Visual Studio Code Extension provides headings to organize your code, code highlighting, formatting and useful commands.
Headings
To structure the .in-File, ADINA-Lint provides the possibility to add linked headings in four levels. Those will be shown in the Outline section of the Explorer tab (see image). This tab can be reached by clicking on the first symbol in the Activity-Bar on the left side and then open the OUTLINE slider.
IMPORTANT: A sub heading needs always its parent. For example, it is not possible to add *## before *#
or *### before *##
. This will end up in a error massage.
To insert some headers just go to the top right corner, press the three dot button ...
and select the Insert Header command, or even easier just press the short key ctrl+r h
(first press ctrl+r
and then h
). There are four levels available.
- *# Level 1
- *## Level 2
- *### Level 3
- *#### Level 4
Commands
How to Access the Commands
Every Adina-Lint command can be found by clicking on the three dot button ...
in the top right corner. Furthermore most commands can be activated via a shortcut like ctrl+r something
(first press ctrl+r
and then press something
). Adina-Lint uses always ctrl+r
to get in the command modus and then something
to start a specific command.
Reindex a Column
Adina-Lint makes it possible to reindex a given column. For this hold alt+shift
pressed and select the column with the mouse. Then press ctrl+r i
or select the command from the list.
The first entry of the column is the starting point of the reindexing. Fore example: If the first entry is 5, then the next entry will be 6 then 7 and so on.
Sort Rows by Values of a Column
To sort the rows by the values of a column just mark the values. For this hold alt+shift
pressed and select the column with the mouse. Then run the command ctrl+r s
for ascending and ctrl+r shift+s
for descending. It is also possible to select the commands from the list.
Actually this is a normal VSCode comment, but it is worth to be mentioned. In VSCode it is possible to select lines and comment or uncomment them by pressing ctrl+shift+7
or select it from the menu Edit/Toogle Line Comment
.
Adina-Lint makes it possible to comment and uncomment a header section including the subsections. Just place the cursor somewhere in the header section, then press ctrl+r shift+7
or select the commend from the list. It will search upwards for the next header row and comment or uncomment all included lines of this section.
To comment all lines below the current cursor position just press ctrl+r ctrl+7
or select the commend from the list.
Run ADINA Directly from VSCode
The extension provides a command to directly open a ADINA GUI and run the current .in-File. You can specify the path to the runnable of ADINA in the VSCode settings.
- You can use the red start button/icon in the top right corner like shown in the following picture.
- or you can use the shortcut
Ctrl+R
and after press A
. As an aide-memoire you can think Run ADINA
Run Python Directly from VSCode
The extension provides a command to directly run Python. You can specify the path to the runnable of Python in the settings.
The idea is, that you have a .in-File that will be extended via Python and save it in a new .in-file.
- The original .in-File has to contain (somewhere at the top of the file) the setting line:
**##compile/_python/true
- This setting line has to contain two
/
. Those are the options.
- The first part is the name of the setting
**##compile
and tells the extension which settings should be activated
- The second
_python
defines the name of the python file (doesn't have to include python).
- Normally it will used as the full file name, but if you use
_
as first character, then the current filename of the original .in-File will be extended by _what ever you wrote
.
- It is recommended to remove the setting line with Python in the new .in.File. Otherwise starting ADINA from the generated .in-File won't work. Starting ADINA from the original .in-File will work anyway.
- Don't include file extensions like
.py
or .in
- The third part has to be
true
or false
. ADINA will directly be started (true
) after python finished or not (false
) with the new compiled in.-File
Important
The new generated .in-File hast to have the same name as the Python-File.
How to Use It
- You can use the gear button/icon in the top right corner like shown in the following picture.
- or you can use the shortcut
Ctrl+R
and after press P
. As an aide-memoire you can think Run Python
Example
- filename.in
- Contains the following setting
**##compile/_python/true
- run the script by button or shortcut
- filename_python.py
- will be called
- For example reads the template in.-file and replaces or insert some sections at place holders like
**** INSERT MATERIAL ****
- Has to write the new .in-file filename_python.in
- filename_python.in
The code will look like as shown in the following pictures. This behavior can be changed in the settings of the extension.
Parameters
The parameter will be highlighted and formatted as show in the following picture.
Settings
- adina-lint.variableFormatter
- Default = true
- Turns the variable formatter (
PARAMETER
) on or off
Functions
This extension marks the start of a function (in this case blue) and formats the attributes in columns. This behavior can be changed in the settings of the extension.
Settings
- adina-lint.functionFormatter
- Default = true
- Turns the function formatter on or off
- adina-lint.numberOfColumns
- Default = 4
- Sets the number of columns for the code formatting of a function. It has to be at least 1.
- adina-lint.numberOfColumnsOfSingeLine
- Default = 2
- Sets the number of columns which are allowed to stay in a single line for the code formatting of a function. It has to be at least 2.
Function Bodies
The function body is the part between @CLEAR and @. It is important that every @CLEAR ends with a @! The function body will be formatted as columns. This behavior can be changed in the settings of the extension.
Settings
- adina-lint.functionBodyFormatter
- Default = true
- Turns the function body formatter on or off
Removing of Trailing Zeros from Numbers
All Global Settings
- adina-lint.spacesBetweenColumns
- Sets the number of spaces between columns for the code formatting of a function. It has to be at least 1.
All Settings
{
"adina-lint.functionBodyFormatter": true,
"adina-lint.functionFormatter": true,
"adina-lint.numberOfColumns": 4,
"adina-lint.numberOfColumnsOfSingeLine": 2,
"adina-lint.spacesBetweenColumns": 2,
"adina-lint.variableFormatter": true,
"adina-lint.pathToAdinaRun": "/opt/adina/95/tools/aui9.5",
"adina-lint.pathToPython": "python3"
}
VSCode Useful Settings
To activate the format on save option go to File/Preferences/Settings
select TextEditor/Formatting
and turn on the option Format On Save.
There are also other options like Format On Paste
or Format On Type
which can be selected.
Recommended VSCode Color Theme
I recommended the Community-Material-Theme
Recommended Icon Theme
I recommended the Material Icon Theme