TiGL ships with three examples of how to use the API from different programming languages: C/C++, Python and MATLAB. All examples can be found in the
TIGL_INSTALL_DIR/share/doc/tigl3/examples
directory.
In order to run a TiGL based project, make sure to add
This program is given by the file
c_demo.c
and an be build using the makefiles shipped with the example.
On Windows, open a visual studio command prompt, go into the
TIGL_INSTALL_DIR/share/doc/tigl3/examples
directory. Open makefile.msvc in a text editor and change TIGL_HOME and TIXI_HOME to the appropriate directories. Then enter
nmake /f makefile.msvc
to build the c-demo.exe.
On Linux, open a shell and go into the directory
TIGL_INSTALL_DIR/share/doc/tigl3/examples
Open makefile.gnu in a text editor and change TIGL_HOME and TIXI_HOME to the appropriate directories. Then type
make -f makefile.gnu
to build the c-demo.
To build this example program by yourself without a makefile, one has to link against the following libraries:
The OpenCASCADE libraries should be automatically linked by the TiGL shared library.
To run this program, call it with a CPACS file, e.g.
c-demo simpletest.cpacs.xml
Recently, we extended TiGL's Python bindings to access the entire object structure of TiGL. These classes and methods allow more control compared to the high level functions of tigl3wrapper. These allow for example:
The installation of this new Python API differ from the installation for the other languages. The easiest way to install TiGL 3 with the internal python api support is to use the amazing conda package manager. To install, type
conda create -n cpacscreator_env python=3.6 cpacscreator -c dlr-sc activate cpacscreator_env
This installs TiGL and all its dependencies.
Then, you can run the python examples as usual. For example type:
python create_space_ship.py
Make sure the script create_space_ship.py is in your python path or go in the example directory. This script should generate a cpacs file out.xml that contains a space ship in your current directory.
To run the MATLAB demo, one has to make sure, that the TiGL and TiXI libraries can be found by setting the path variables as described above.
The MATLAB bindings can be found in the following directories:
TIGL_INSTALL_DIR/share/tigl3/matlab TIXI_INSTALL_DIR/share/tixi3/matlab
Please add both directories to the MATLAB path using the 'path' command of MATLAB.
The demo can be called as a function by entering
matlab_demo('simpletest.cpacs.xml')
To compile the Java Demo (JavaDemo.java), you have to link against the following libraries
Under Windows it is important to chose the right TiGL library matching to the Java Virtual Machine. That means if you use a 64 Bit JVM, use the TiGL 64 bit library and vice versa.