VTK/PythonDevelopment: Difference between revisions

From KitwarePublic
< VTK
Jump to navigationJump to search
(Created page with "=== VTK Eclipse/Pydev === Eclipse with Pydev provides a good development environment for developing Python scripts for VTK. You get Syntax checking/highlighting and code completi...")
 
Line 7: Line 7:


=== Environment variables for Linux/MacOS ===
=== Environment variables for Linux/MacOS ===
You must set '''KITWARE_PATH''' to the root path of your VTK build, for example '/home/username/Code/Kitware'.
Edit <code>~/.bashrc</code> and add in the following lines.
 
Note: You must set '''KITWARE_PATH''' to the root path of your VTK build, for example '/home/username/Code/Kitware'.
<pre>
<pre>
#Kitware
#Kitware
Line 29: Line 31:
source ~/.bashrc
source ~/.bashrc
</PRE>
</PRE>
=== Environment variables for Windows ===
Set the following environment variables:
{| class="wikitable" style="text-align: left; color: green;"
|KITWARE_PATH
| This will be the root path e.g C:\Kitware or C:\Users\<your username>\Code\Kitware you can choose whatever you prefer here
|-
|VTK_BIN
| %KITWARE_PATH%\build\VTK\Release\bin
|-
|VTK_DATA_ROOT
| %KITWARE_PATH%\src\VTKData
|-
|VTK_LARGE_DATA_ROOT
| %KITWARE_PATH%\src\VTKLargeData
|-
|VTK_ROOT
| %KITWARE_PATH%\src\VTK
|-
|TCLLIBPATH
| <root_path>/build/VTK/Release/Wrapping/Tcl/Release
|}
Note that for '''TCLLIBPATH''' the path must be fully expanded and \ replaced by /. Replace <root_path> with whatever you used for '''KITWARE_PATH''' replacing \ with / e.g C:/Kitware.
You will need to add the following path to the PATH environment variable:
<pre>
%KITWARE_PATH%\build\VTK\Release\bin\Release
</pre>
In Windows these are set by going to Control Panel|All Control Panel Items|System and selecting "Advanced System Settings". Then select the Advanced tab and click on Environment Variables.

Revision as of 00:51, 17 April 2012

VTK Eclipse/Pydev

Eclipse with Pydev provides a good development environment for developing Python scripts for VTK. You get Syntax checking/highlighting and code completion and debugging. However in order to integrate VTK we need to do a few extra steps.

This article will tell you you how to set up the development environment for Windows, Linux and MacOSX.

The folowing discussion assumes that the environment variables have been set and that the user is familiar with or willing to learn the Eclipse IDE.

Environment variables for Linux/MacOS

Edit ~/.bashrc and add in the following lines.

Note: You must set KITWARE_PATH to the root path of your VTK build, for example '/home/username/Code/Kitware'.

#Kitware
export KITWARE_PATH=/home/username/Code/Kitware

# VTK
export VTK_DATA_ROOT=$KITWARE_PATH/src/VTKData
export VTK_LARGE_DATA_ROOT=$KITWARE_PATH/src/VTKLargeData
export VTK_ROOT=$KITWARE_PATH/src/VTK
# 
export VTK_DIR=$KITWARE_PATH/build/VTK
# For VTK TCL programs.
export TCLLIBPATH='$VTK_DIR/Wrapping/Tcl'
alias vtk='$VTK_DIR/bin/vtk'
# For VTK Python programs.
alias vtkpython='$VTK_DIR/bin/vtkpython'
export PYTHONPATH=$PYTHONPATH:$VTK_DIR/Wrapping/Python:$VTK_DIR/lib

Then do:

source ~/.bashrc

Environment variables for Windows

Set the following environment variables:

KITWARE_PATH This will be the root path e.g C:\Kitware or C:\Users\<your username>\Code\Kitware you can choose whatever you prefer here
VTK_BIN %KITWARE_PATH%\build\VTK\Release\bin
VTK_DATA_ROOT %KITWARE_PATH%\src\VTKData
VTK_LARGE_DATA_ROOT %KITWARE_PATH%\src\VTKLargeData
VTK_ROOT %KITWARE_PATH%\src\VTK
TCLLIBPATH <root_path>/build/VTK/Release/Wrapping/Tcl/Release


Note that for TCLLIBPATH the path must be fully expanded and \ replaced by /. Replace <root_path> with whatever you used for KITWARE_PATH replacing \ with / e.g C:/Kitware.

You will need to add the following path to the PATH environment variable:

%KITWARE_PATH%\build\VTK\Release\bin\Release

In Windows these are set by going to Control Panel|All Control Panel Items|System and selecting "Advanced System Settings". Then select the Advanced tab and click on Environment Variables.