vs-code-aster – VS Code Extension for code_aster
This extension is currently released as a beta version. The main objective is to collect feedback on any bugs or anomalies you encounter during its usage. All input regarding features is valuable, whether it's about how commands are triggered, unexpected behaviors, or options that could be added. Your experience and suggestions greatly help improve the extension.
Description
vs-code-aster is a Visual Studio Code extension designed to simplify and speed up work with code_aster.
It offers:
- An interactive form to create or edit a
.export file
- The ability to launch simulations directly from VS Code
- Advanced features for editing
.comm files
- A fully integrated 3D Visualizer to explore your meshs
Installation
1. Installing the extension
2. Required dependencies
- For
.comm file features:
Broken for the moment (next probably requires AsterStudy)
- To run simulations:
- Install Docker
- Install a code_aster image
- Install cave (only for Simvia testing)
- For the Visualizer:
No extra installation is required, but you need to verify these points :
- The .comm, .export, and all .med and .mmed files referenced in the .export must be located in the same directory.
- This will be handled automatically, but for now, you need to convert you .med files by hand.
- To convert these files, run the Python script <file.name> python script with the appropriate command on each .med file.
- Create a folder named ./visu_data/ inside your directory.
- In this ./visu_data/ folder, place the .obj files obtained from the .med files, keeping the same filenames.
Usage
The extension uses a menu located on the left side of your VS Code window.
This menu is called code_aster and uses the Simvia logo.
From this menu, you can access all available features, described below.
1. Creating and managing .export files
Creating from scratch
- How to open the form:
- Option 1:
- Open the Command Palette (
Ctrl+Shift+P)
- Search for "Create export file"
- Option 2:
- From the menu: Export Command
- Key points:
- Any field highlighted in red will block the creation of the export file
- Once the 'create' button is validated, a
.export file is created at the root of your project
Creating from an existing file
- Open an existing
.export file
- The form will be pre-filled with existing data, ready to be modified
- Both options explained above still work and will directly take the values from the
.export file found in your project
2. Launching a simulation
From a .export file
- Open a
.export file
- Click the play icon "Run code_aster" in the top-right corner of the file.
It will open a terminal and execute the following command : cave run file.export.
If you don't have already installed cave or don't know how to correctly use it, you can go on : cave github.
Personnalize alias to run code-aster
If you want to use a personnal alias, you can do so :
- Open VS Code.
- Go to File > Preferences > Settings (or press
Ctrl+shift+P, and type settings).
- In the search bar, type
vs-code-aster.
- Find the setting "Alias For Run" and change the value to the command you want to use to run code_aster.
3. Smart editing of .comm files : not available
Syntax highlighting
- Dedicated highlighting for code_aster syntax, making
.comm files more readable
- For the best experience, use a theme that differentiates functions, variables, etc.
Hover documentation
- When hovering over a code_aster command, a tooltip displays:
- Command description
- Command arguments
- Types and default values of arguments
Command signatures
- When typing a
( after a command name, or a , after entering an argument (e.g., FORMAT="MED",), a signature is displayed
- This signature shows the parameters (depending on context — some parameters are only available under certain conditions)
Contextual auto-completion
- The extension automatically suggests:
- Command names
- Relevant arguments depending on the current command
4. The Visualizer — Interactive 3D result viewer
Overview
- The Visualizer is an integrated 3D viewer that lets you display and explore your simulation geometry and results directly in VS Code — without leaving your workspace
- It’s powered by VTK.js and supports both mesh visualization and node-based groups
How to open the Visualizer
From a .comm file:
- Open a
.comm file
- Click the "eye" icon "open mesh viewer" in the top-right corner of the file
What you can do
- Load geometry files (
.med) directly into the viewer
- Toggle visibility of face and node groups using the controller panel
- Activate the display of groups directly by selecting text from your command file (.comm)
- Reset the camera orientation planes using the dedicated x, y, and z buttons
Usage tips
- Click on a group name in the controller to show or hide it
- The main mesh automatically becomes transparent when you activate subgroups, helping to visualize details more clearly
- The 3D axis labels update dynamically when you rotate or zoom the view