<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body bgcolor="#ffffff" text="#000000">
Hi everybody,<br>
<br>
I have a problem with vtkUnstructuredGridWriter fonction used with
Python.<br>
Indeed, when I execute this code (that generates 10 points with 3
coordinates, creates a vtkUnstructuredGrid and then writes it):<br>
<br>
<font face="Courier New, Courier, monospace"><i>#!/usr/bin/env
python<br>
<br>
from pylab import *<br>
import vtk<br>
from random import *<br>
<br>
N=10;<br>
posx=zeros(N);<br>
posy=zeros(N);<br>
posz=zeros(N);<br>
<br>
for i in range(N):<br>
posx[i]=random();<br>
posy[i]=random();<br>
posz[i]=random();<br>
<br>
# Create unstructured grid each containing a cell of a<br>
# different type.<br>
<br>
polyVertexPoints = vtk.vtkPoints()<br>
polyVertexPoints.SetNumberOfPoints(N)<br>
for i in range(N):<br>
polyVertexPoints.InsertPoint(i, posx[i], posy[i], posz[i])<br>
<br>
aPolyVertex = vtk.vtkPolyVertex()<br>
aPolyVertex.GetPointIds().SetNumberOfIds(N)<br>
for i in range(N):<br>
aPolyVertex.GetPointIds().SetId(i, i)<br>
<br>
aPolyVertexGrid = vtk.vtkUnstructuredGrid()<br>
aPolyVertexGrid.Allocate(1, 1)<br>
aPolyVertexGrid.InsertNextCell(aPolyVertex.GetCellType(),<br>
aPolyVertex.GetPointIds())<br>
aPolyVertexGrid.SetPoints(polyVertexPoints)<br>
<br>
# Save the unstructured grid containing scatterers<br>
writer=vtk.vtkUnstructuredGridWriter()<br>
writer.SetFileName('bugCommas.vtk');<br>
writer.SetInput(aPolyVertexGrid);<br>
writer.Write();</i></font><br>
<br>
the file bigCommas.vtk is written with commas instead of periods for
decimal values. Consequently, It cannot be interpreted correctly and
notably with Paraview.<font face="Courier New, Courier, monospace"></font><br>
<br>
<style type="text/css">p, li { white-space: pre-wrap; }</style>
<style type="text/css">p, li { white-space: pre-wrap; }</style><font
face="Courier New, Courier, monospace">Generic Warning: In
/builddir/build/BUILD/ParaView-3.8.1/VTK/IO/vtkDataReader.cxx,
line 1382<br>
Error reading ascii data. Possible mismatch of datasize with
declaration.</font><br>
<br>
In the same way, I encountered this problem with vtkPolyDataWriter
function, again with Python.<br>
<br>
Does someone know why periods were replaced by commas ?<br>
<br>
Adrien<br>
<pre class="moz-signature" cols="72">--
Adrien MARION, Docteur/PhD
Chercheur post-doctorant (ANR VIP)
Laboratoire CREATIS, INSA de Lyon
CNRS UMR 5220, INSERM U630
Bâtiment Blaise Pascal, 4ème étage
7, avenue Jean Capelle
69621 Villeurbanne cedex FRANCE
Tel : (+33) 4 72 43 87 86
Fax: (+33) 4 72 43 85 26
e-mail : <a class="moz-txt-link-abbreviated" href="mailto:adrien.marion@creatis.insa-lyon.fr">adrien.marion@creatis.insa-lyon.fr</a>
<a class="moz-txt-link-freetext" href="http://www.creatis.insa-lyon.fr/~amarion">http://www.creatis.insa-lyon.fr/~amarion</a></pre>
</body>
</html>