[vtkusers] Read Rectilineargrid File::Only the grid is visible

Winfried Bilgic 4Winne at web.de
Wed Sep 21 14:15:24 EDT 2005


Hello Folks, 

i tried many things but i was still unable to read an vector dataset from an rectilinear gridfile. What i get from the file is the visualization of the grid, but no surface. I bet the solution is easy, but with 11 hours working in my neck i need your helpful assistence.

Thanks in advance and kind regards Winne

SourceCode::
#include "vtkDataReader.h"
#include "vtkDataSet.h"
#include "vtkRectilinearGridReader.h"
#include "vtkRectilinearGrid.h"
#include "vtkRectilinearGridGeometryFilter.h"
#include "vtkRenderer.h"
#include "vtkRenderWindow.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkActor.h"
#include "vtkProperty.h"
#include "vtkPolyDataMapper.h"

int main()
{
	char *cVTKFile = NULL;
	// cVTKFile = "./files/dump-1.80000e+003.asc.vtk";
	cVTKFile = "./files/mslfilter.vtk";
	// cVTKFile = "./files/Original.vtk";
	
	vtkRectilinearGridReader *clReader = vtkRectilinearGridReader::New();
	clReader->SetFileName(cVTKFile);
	
	vtkRectilinearGrid *clGrid = NULL;
	vtkPointData *clPointData = NULL;
	clGrid=clReader->GetOutput(0);

	vtkRectilinearGridGeometryFilter *clGeoGrid = vtkRectilinearGridGeometryFilter::New(); 
	clGeoGrid->SetInput(clGrid);
	
	vtkPolyDataMapper *clMapper = vtkPolyDataMapper::New();
	clMapper->SetInput(clGeoGrid->GetOutput());

	vtkActor *clActor = vtkActor::New();
	clActor->SetMapper(clMapper);
	clActor->GetProperty()->SetRepresentationToWireframe();

	vtkRenderer *clRen= vtkRenderer::New();
	clRen->AddActor(clActor);
	
	vtkRenderWindow *clRenWin = vtkRenderWindow::New();
	clRenWin->AddRenderer(clRen);
	clRenWin->SetSize(800,800);

	vtkRenderWindowInteractor *clIren = vtkRenderWindowInteractor::New();
	clIren->SetRenderWindow(clRenWin);

	clRenWin->Render();
	clIren->Start();
	clIren->Delete();
	clRenWin->Delete();
	clRen->Delete();
	clActor->Delete();
	clMapper->Delete();
	clGeoGrid->Delete();
	clReader->Delete();

	return 0;
}




More information about the vtkusers mailing list