[vtkusers] Question ? [Reading data from txt file]

David Doria daviddoria at gmail.com
Tue Aug 7 06:55:30 EDT 2012


On Tue, Aug 7, 2012 at 4:40 AM, Agata Krasoń <agatakrason at gmail.com> wrote:

> Hi David,
>
> I have already wirte this code . On my computer it works well:
>
> It is for csv files :
> My code here :
>
> vtkDelimitedTextReader* reader = vtkDelimitedTextReader::New();
>   reader->SetFileName(inputFilename);
>   reader->DetectNumericColumnsOn();
>   reader->SetFieldDelimiterCharacters(" ");
>   reader->Update();
>
>   vtkTable* table = reader->GetOutput();
>   vtkPoints* points = vtkPoints::New();
>   vtkDoubleArray* normals = vtkDoubleArray::New();
>
>   normals->SetNumberOfComponents(3);
>
>   for(vtkIdType i = 0; i < table->GetNumberOfRows(); i++)
>     {
>   std::cout << " " << (table->GetValue(i,0)).ToDouble();
>
>
>     points->InsertNextPoint((table->GetValue(i,0)).ToDouble(),
>                             (table->GetValue(i,1)).ToDouble(),
>                             (table->GetValue(i,2)).ToDouble());
>
>     double n[3];
>     n[0] = (table->GetValue(i,3)).ToDouble();
>     n[1] = (table->GetValue(i,4)).ToDouble();
>     n[2] = (table->GetValue(i,5)).ToDouble();
>
>
> std::cout<<" "<<std::endl;
>
>     normals->InsertNextTuple(n);
>     }
>
>
>
>   /*std::cout << "There are " << points->GetNumberOfPoints()
>     << " points." << std::endl; */
>
>   vtkPolyData* polydata = vtkPolyData::New();
>   polydata->SetPoints(points);
>   polydata->GetPointData()->SetNormals(normals);
>   vtkVertexGlyphFilter* glyphFilter = vtkVertexGlyphFilter::New();
>   glyphFilter->SetInputConnection(polydata->GetProducerPort());
>   glyphFilter->Update();
>
> //  system("Pause");
>
>   glyphFilter->Delete();
>   polydata->Delete();
>   normals->Delete();
>   points->Delete();
>   reader->Delete();
>
> But when I am trying to compile for antoher . I received an error ;/
> error LNK2019: unresolved external symbol __declspec(dllimport) public:
> static class vtkDelimitedTextReader * __cdecl
> vtkDelimitedTextReader::New(void) (__imp_?New at vtkDelimitedTextReader
> @@SAPAV1 at XZ) referenced in function protected: virtual void __thiscall
>
> I don't know what it may be wrong with this code.
> I have the same vtk version 5.8.
> I don't have any idea ;/
>
>
> I would appreciate for any help.
> Best,
> agatte
>

I believe you need to rebuild VTK and turn on INFOVIS.

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120807/2b316599/attachment.htm>


More information about the vtkusers mailing list