<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hello, <br>
<br>
I am Looking for an easy way to create my point data with Python. I
can make three single component arrays, but do not know how to
combine that into one three component array which I can feed into a
vtkpoints container.<br>
<br>
# Let's say I have an array of point data, large enough that a loop
should be avoided<br>
Array = np.empty([235, 3])<br>
#I can deconstruct the array in x, y and z<br>
VTK_datax = numpy_support.numpy_to_vtk(num_array=Array[:,0].ravel(),
deep=True, array_type=vtk.VTK_DOUBLE)<br>
VTK_datay = numpy_support.numpy_to_vtk(num_array=Array[:,1].ravel(),
deep=True, array_type=vtk.VTK_DOUBLE)<br>
VTK_dataz = numpy_support.numpy_to_vtk(num_array=Array[:,2].ravel(),
deep=True, array_type=vtk.VTK_DOUBLE)<br>
# Maybe I will need a VTK ID array (0..235) Lets just make one<br>
VTK_ID =
numpy_support.numpy_to_vtk(num_array=np.arange(shape(Array)[0]).ravel(),
deep=True, array_type=vtk.VTK_ID_TYPE)<br>
# Now I would like to combine x, y and z data into a single array<br>
VTK_data = vtk.vtkDoubleArray()<br>
VTK_data.SetNumberOfComponents(3)<br>
VTK_data.SetNumberOfTuples(235)<br>
# However, I do not know how to do this, it could be something like
this, VTK_data.SetTuple3(VTK_ID, VTK_datax, VTK_datay, VTK_dataz )
but that doesn't work with arrays. <br>
# Afterwards, I would like to fill the data array into a points
container<br>
points = vtk.vtkPoints()<br>
points.SetData(pcoords)<br>
<br>
Is there a way to combine three single component arrays into a three
component array?<br>
<br>
Thanks in advance, <br>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
margin-right:0px; -qt-block-indent:0; text-indent:0px;
-qt-user-state:0;"><br>
<!--EndFragment--></p>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
p, li { white-space: pre-wrap; }
</style><br>
<br>
<br>
<br>
<pre class="moz-signature" cols="72">--
---------------------------
Jaap Verheggen
</pre>
</body>
</html>