[vtkusers] How to read a text file into VTK

Kevin H. Hobbs hobbsk at ohiou.edu
Mon Dec 11 09:30:37 EST 2006


On Mon, 2006-12-11 at 14:29 +0100, Emmanuel Teguetio wrote:
> hallo kevin..
> could you sent your text file please? 

Could you please keep the conversation on the list.

I convert files that look like this :

20.5826 26.7372 10.9694
20.8055 27.3885 10.9694
20.8055 27.457 10.9694
20.8226 27.5427 10.9694
20.8397 27.6627 10.9694
20.8397 27.7313 10.9694
20.8397 27.817 10.9694
20.8397 27.8855 10.9694
20.7883 28.0055 10.9694
20.7712 28.0741 10.9694

into polygon vertexes with this code :

#include "vtkParticleReader.h"
#include "vtkXMLPolyDataWriter.h"

int main( int argc, char * argv[] )
{

	char *  in_file_name = argv[1];
	char * out_file_name = argv[2];

	// Particle Reader
	vtkParticleReader * reader = vtkParticleReader::New();
	reader->SetFileName( in_file_name );

	// PolyData Writer
	vtkXMLPolyDataWriter * writer = vtkXMLPolyDataWriter::New();
	writer->SetFileName( out_file_name );
	writer->SetInputConnection( reader->GetOutputPort() );
	writer->Update();

	writer->Delete();
	reader->Delete();

	return 0;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20061211/298b79ec/attachment.pgp>


More information about the vtkusers mailing list