[vtkusers] vtkUnstructuredGridWriter only stores 6 digits?

Nico Schlömer nico.schloemer at gmail.com
Wed Dec 16 20:23:46 EST 2015


Hi everyone,

with
```
import numpy
import vtk
from vtk.util import numpy_support

mesh = vtk.vtkUnstructuredGrid()

# add points to mesh
points = numpy.array([
    [0.123456789, 3.14159265, 0.0]
    ])
vtk_points = vtk.vtkPoints()
vtk_array = numpy_support.numpy_to_vtk(points)
vtk_points.SetData(vtk_array)
mesh.SetPoints(vtk_points)

# write to VTK
writer = vtk.vtkUnstructuredGridWriter()
writer.SetFileTypeToASCII()
writer.SetFileName('test.vtk')
writer.SetInputData(mesh)
writer.Write()
```
I noticed that, although the `point` is given with some precision, the
output `test.vtk` file only contains 6 digits of accuracy,
```
0.123457 3.14159 0
```
The numpy data type hosts 8 digits.

Is this a bug or expected? How to mitigate?

Cheers,
Nico
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20151217/a336a807/attachment.html>


More information about the vtkusers mailing list