VTK/Examples/Cxx/Broken/AssignAttribute
From KitwarePublic
Jump to navigationJump to searchContents
AssignAttribute.cxx
#include <vtkSmartPointer.h>
#include <vtkAssignAttribute.h>
#include <vtkSphereSource.h>
int main(int, char *[])
{
vtkSmartPointer<vtkSphereSource> sphereSource =
vtkSmartPointer<vtkSphereSource>::New();
vtkSmartPointer<vtkAssignAttribute> vectors =
vtkSmartPointer<vtkAssignAttribute>::New();
vectors->SetInputConnection(sphereSource->GetOutputPort());
vectors->Assign("Gradients", vtkDataSetAttributes::VECTORS,
vtkAssignAttribute::POINT_DATA);
return EXIT_SUCCESS;
}
Please try the new VTKExamples website.
CMakeLists.txt
cmake_minimum_required(VERSION 2.8)
PROJECT(AssignAttribute)
find_package(VTK REQUIRED)
include(${VTK_USE_FILE})
add_executable(AssignAttribute MACOSX_BUNDLE AssignAttribute.cxx)
if(VTK_LIBRARIES)
target_link_libraries(AssignAttribute ${VTK_LIBRARIES})
else()
target_link_libraries(AssignAttribute vtkHybrid vtkWidgets)
endif()
Download and Build AssignAttribute
Click here to download AssignAttribute. and its CMakeLists.txt file.
Once the tarball AssignAttribute.tar has been downloaded and extracted,
cd AssignAttribute/build
- If VTK is installed:
cmake ..
- If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:
cmake -DVTK_DIR:PATH=/home/me/vtk_build ..
Build the project:
make
and run it:
./AssignAttribute
WINDOWS USERS PLEASE NOTE: Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.