[vtkusers] vtkPolyDataReader Error
周敏明
zmmbreeze0825 at gmail.com
Sat Mar 28 13:49:57 EDT 2009
Hi,
I met a problem about the class named "vtkPolyDataReader". I want to read a
vtp file and render it. So I write some code.
vtkPolyDataReader *vpdr = vtkPolyDataReader::New();
vpdr->SetFileName("C:/VTK 5.2/bin/Examples/All/Infovis/Cxx/cube.vtp");
vpdr->Update();
vtkPolyDataMapper *mapper = vtkPolyDataMapper::New();
mapper->SetInput(vpdr->GetOutput());
vtkRenderer* ren = vtkRenderer::New();
vtkRenderWindow* renwin = vtkRenderWindow::New();
renwin->AddRenderer (ren);
vtkActor* actor = vtkActor::New();
actor->SetMapper (mapper);
ren->AddActor (actor);
renwin->Render();
But I met a error:vtkPolyDataReader (003BBD28): Unrecognized file type: <?
xml version=" 1.0"?> for file: C:/VTK
5.2/bin/Examples/All/Infovis/Cxx/cube.vtp
The vtp file is:
<? xml version=" 1.0"?>
<VTKFile type=" PPolyData" version=" 0.1" byte_ order=" LittleEndian">
<PPolyData GhostLevel=" 0">
<PPointData Scalars=" my_ scalars">
<PDataArray type=" Float32" Name=" my_ scalars"/>
</ PPointData>
<PCellData Scalars=" cell_ scalars" Normals=" cell_ normals">
<PDataArray type=" Int32" Name=" cell_ scalars"/>
<PDataArray type=" Float32" Name=" cell_ normals" NumberOfComponents=" 3"/>
</ PCellData>
<PPoints>
<PDataArray type=" Float32" NumberOfComponents=" 3"/>
</ PPoints>
<Piece Source=" polyEx0. vtp"/>
</ PPolyData> </ VTKFile>
<? xml version=" 1.0"?>
<VTKFile type=" PolyData" version=" 0. 1" byte_ order=" LittleEndian">
<PolyData>
<Piece NumberOfPoints=" 8" NumberOfVerts=" 0" NumberOfLines=" 0"
NumberOfStrips=" 0" NumberOfPolys=" 6">
<Points>
<DataArray type=" Float32" NumberOfComponents=" 3" format=" ascii">
0 0 0 10 0 1 1 0 0 1 0 00 1 1 0 1 1 1 10 1 1
</ DataArray>
</ Points>
<PointData Scalars=" my_ scalars">
<DataArray type=" Float32" Name=" my_ scalars" format=" ascii">
0 1 2 34 5 6 7
</ DataArray>
</ PointData>
<CellData Scalars=" cell_ scalars" Normals=" cell_ normals">
<DataArray type=" Int32" Name=" cell_ scalars" format=" ascii">
0 1 2 34 5
</ DataArray>
<DataArray type=" Float32" Name=" cell_ normals"
NumberOfComponents=" 3" format=" ascii">
0 0 -1 00 1 0 -1 0 0 1 0-1 0 0 1 0 0
</ DataArray>
</ CellData>
<Polys>
<DataArray type=" Int32" Name=" connectivity" format=" ascii">
0 1 2 34 5 6 7 0 1 5 4 23 7 6 0 4 7 3 12 6 5
</ DataArray>
<DataArray type=" Int32" Name=" offsets" format=" ascii">
4 8 12 16 20 24
</ DataArray>
</ Polys>
</ Piece>
</ PolyData>
</ VTKFile>
Anyone can solve this problem.Your assistance will be highly appreciated. Sorry
for my bad English.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090329/1a44a429/attachment.htm>
More information about the vtkusers
mailing list