Skip to content

Commit

Permalink
Python updates
Browse files Browse the repository at this point in the history
  • Loading branch information
julien-tierny committed Jun 27, 2019
1 parent e86248d commit fb92978
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
10 changes: 10 additions & 0 deletions examples/python/README
Expand Up @@ -16,7 +16,17 @@ Proc. of IEEE VIS 2017.
To run this example, first install TTK on your system
(https://topology-tool-kit.github.io/installation.html).

Next, before launching the script, make sure to properly define the environment
variables PYTHONPATH and LD_LIBRARY_PATH.

For instance, under Linux, with Python 3.6, this can be done as follows, assuming that you installed ParaView and TTK to /usr/local:
$ export PYTHONPATH="/usr/local/lib/python3.6/site-packages/"
$ export LD_LIBRARY_PATH="/usr/local/lib/:/usr/local/lib/plugins"

Then, from the current directory, enter the following command (omit the '$'
character):
$ ./ttkExample-python.py ../data/inputData.vtu

Alternatively, you can also use the ParaView python wrapper (which will
automatically position environment variables correctly):
$ pvpython ttkExample-python.py ../data/inputData.vtu
19 changes: 18 additions & 1 deletion examples/python/ttkExample-python.py
@@ -1,4 +1,4 @@
#!/usr/bin/env pvpython
#!/usr/bin/env python

#/// \ingroup examples
#/// \author Julien Tierny <julien.tierny@lip6.fr>
Expand All @@ -25,6 +25,23 @@
print("Missing mandatory argument: Path to input VTU file")
sys.exit()


# -- Importing TTK python modules
import platform

print("[python] Loading TTK modules...")
if platform.system() == "Linux":
LoadPlugin("libTopologyToolKit.so", ns=globals())
elif platform.system() == "Windows":
LoadPlugin("libTopologyToolKit.dll", ns=globals())
else:
LoadPlugin("libTopologyToolKit.dylib", ns=globals())

print("[python] TTK modules loaded!")


# -- TTK pipeline

# 1. loading the input data
inputData = XMLUnstructuredGridReader(FileName=[inputFilePath])

Expand Down

0 comments on commit fb92978

Please sign in to comment.