Writing and Reading Binary vtk file

Hi, all, I have difficulties in writing binary vtk file that can be opened paraview.
I attach two files one is written in ASCII and paraview renders this ASCII file very well
However, as I try to open the Binary file, I receives errors saying that

ERROR: In /Users/kitware/dashboards/buildbot-slave/8275bd07/build/superbuild/paraview/src/VTK/IO/Legacy/vtkPolyDataReader.cxx, line 303
vtkPolyDataReader (0x7faa29f38ea0): Unrecognized keyword:

Anyone has idea where I might have a mistake?

The attached files has a structure like this

# vtk DataFile Version 2.0
vtk output
BINARY
DATASET POLYDATA
POINTS 4 double
[[Binary Data]]......
POLYGONS 1 5
4 0 1 2 3
CELL_DATA 1
POINT_DATA 4
SCALARS nodal double
LOOKUP_TABLE default
[[Binary Data]]......

Thanks!

Jaekwang Kim

ascii.vtk (204 Bytes) binary.vtk (301 Bytes)

有同样的问题咨询,vtk的二进制格式是怎样的

Several issues:

  1. new lines in binary data for POINTS
  2. POLYGONS specified in ASCII … should be binary data there too

Attached is a “fixed” version. Hope that helps.
binary.vtk (309 Bytes)