2. Gmsh

Examples of QTCAD scripts are stored in qtcad/examples. These examples use mesh files that may be produced from geometry files (with the .geo extension) stored in qtcad/examples/tutorials/meshes and qtcad/examples/practical_application/meshes using Gmsh.

As explained in the QTCAD installation instructions page, a conda installation ensures that QTCAD and all of its dependencies, in particular Gmsh, are properly installed in the QTCAD virtual environment. If you cannot use the conda installation procedure, you may install Gmsh inside the qtcad virtual environment (see Package installation with pyenv (not recommended)) by executing the following command.

pip install gmsh

To produce a .msh (Gmsh mesh file) from a .geo file, use

gmsh path_to_file.geo

In Linux or Mac, it is possible to produce all mesh files used in the examples with

gmsh qtcad/examples/*/meshes/*.geo

Note that mesh files can be quite heavy, so that it may be a good idea to delete them when they are not needed anymore.

In addition, it is sometimes useful to run Gmsh on a .geo script without launching the Graphical User Interface. This is particularly useful when generating meshes on a remote workstation or cluster, and can be done with

gmsh path_to_file.geo -

Once relevant mesh files are produced, examples may be run from the root of the qtcad folder, and inside the qtcad virtual environment with

python examples/folder_name/script_name.py

The user is free to create his/her own scripts in any folder to run them, provided that this is done in the virtual environment.

For more information on Gmsh, please visit gmsh.info.