Change Settings on Abaqus Cae Startup Using the Environment File
There are things of which I know that it is possible, without ever taking the time to figure out how to do it and actively use it. Until recently, that was the case for what I want to discuss here: using the environment file to automatically do things when you startup Abaqus.
If you find yourself frequently doing the same thing after starting up Abaqus, then this may come in handy. You can do anything that you can script, so the options are extensive. For example, you can change the background color, change the default views so that Z is considered up, change font sizes, etc.
In this example, I'll change the look of Abaqus/CAE so that the background is white and a Simuleon logo is in the top right corner, as you can see here:
I'll give the main approach, so you can easily apply it to whatever you want to do. The main idea is to define a function called 'onCaeStartup' in the environment file, and to let that function do whatever you please.
1.Get the Code You Need
This approach works via scripting. We therefore need to know the code corresponding to the changes we want to make in Abaqus. One of the easiest ways to do this, is by making a macro. Go to File --> macro manager and click 'Create' to make a new macro. You can select whether it should be stored in the work directory or the home directory.
Abaqus will then record what is clicked in GUI. In this case I go to View --> Graphics options to set the background to white, and View --> Image/movie options to include the image. After doing everything what I want to include in my script, I click 'stop recording'.
The code will now be stored as a function in abaqusMacros.py; either in the home directory or in the work directory based on what was chosen. You can open it to take a look, for example in Abaqus/PDE: File --> Abaqus PDE.
2.Determine Where to Place the Environment File
Within in Abaqus several environment files can be used, for settings at different levels.
For settings on the system level, use a file named custom_v6.env or abaqus_v6.env in solvers_install_dir/os/SMA/site/custom_v6.env file is used for settings on the system level.
The default location is:
- 6.14 (hf4 shown, other versions analogous):
- Simulia/Abaqus/6.14-4/SMA/site/abaqus_v6.env
- 2016-2019 (2016 shown, other versions analogous):
- Program files/dassault systemes/SimulationServices/V6R2016x/win_b24/SMA/site/custom_v6.env
- 2020:
- C:/SIMULIA/EstProducts/2020/win_b64/SMA/site/custom_v6.env
User-specific settings can be defined in a file named abaqus_v6.env placed in the home directory of the user.
Job-specific settings can be defined in a file named abaqus_v6.env placed in the directory from which Abaqus is started.
Multiple environment files can be used. They are called in the order given here, so more local settings will override more global settings. To create an environment file, simply create a text file and store it under the correct name, usually abaqus_v6.env. The .env extension should be used.
3.Create/Modify the Environment File
Once we know where to place the environment file (step 2) and we know what to include in it (step 1), it is simply a matter of putting things together. Open or create the required environment file in a text editor. Create a function 'onCaeStartup' by Including the text:
def onCaeStartup():
copy from macro
Within python (the language used for scripting with Abaqus) indentation is very important. The text in the macro should have consistent indentation with respect to the def-statement. The function is ended by stopping the indentation.
Save the file in the specified location.
When you restart Abaqus, it will now run the function 'onCaeStartup' and hopefully do what you intend it to.