It is possible to install more Python modules packages using the pip standard way of python
There is a Tcl proc that facilitate download and install packages in the GiD python folder.<GiD directory>\scripts\tohil\
GiD_Python_PipInstallMissingPackages <list_packages_required>
Example: to install numpy and h5py (in case that are not present)
Code Block |
---|
set failed_packages [GiD_Python_PipInstallMissingPackages [list numpy h5py]] |
if they are installed the returned list of failed_packages will be empty
GiD_Python_GetPythonExe
Is a tcl proc that returns the full path to the pyhon exe of GiD
Is possible to install packages also with this syntax:
<GiD directory>/scripts/tohil/python/python -m pip install <module><package>
e.g. to install the KratosMultiphysics module version 9.2solver package:
Code Block | ||
---|---|---|
| ||
<GiDdirectory>/scripts/tohil/python/python -m pip install KratosMultiphysics-all==9.2 |
Note: Kratos is is a framework for building parallel multi-disciplinary simulation: https://github.com/KratosMultiphysics
The Note: the pip
program is located at:
Windows:
<GiDdirectory>\scripts\tohil\python\scripts\pip.exe
Linux and macOS:
<GiDdirectory>/scripts/tohil/python/bin/pip
Modules Packages will be located at:
Windows:
<GiDdirectory>\scripts\tohil\python\lib\site-packages
Linux and macOS (depending if they are only scripts or have architecture dependent files):
<GiDdirectory>/scripts/tohil/python/lib/python3.10/site-packages
<GiDdirectory>/scripts/tohil/python/x64/lib/python3.10/site-packages
Note: In Windows pip
shall be run in a console opened in Windows 'as administrator' (otherwise Windows doesn't allow to copy the files if GiD is installed in 'Program files' as usual). In Linux do it as 'sudo' if GiD is installed in system folders like /usr/local/ or /opt/ .
Some Python interesting modules for GiD
NURBS-Python (geomdl) https://github.com/orbingol/NURBS-Python (pure-scripting use of NURBS)
pythonOCC https://dev.opencascade.org/project/pythonocc (Python wrap of C++ OpenCascade CAD)
vtk https://vtk.org (Python wrap of C++ Vtk scientific visualization library).
SciPy https://scipy.org (fundamental algorithms for scientific computing)
SymPy https://docs.sympy.org/latest/modules/geometry/index.html (library for symbolic mathematics)
PyMesh https://pymesh.readthedocs.io/en/latest (mesh processing library)
...
...