<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman,new york,times,serif;font-size:12pt"><div>Here's what I have done:<br><br>//output is a vtkPolyData<br><br>int nbComponents = 2;<br><br>vtkSmartPointer&lt;vtkFloatArray&gt; dataToAdd = vtkSmartPointer&lt;vtkFloatArray&gt;::New();<br><br>vtkIdType nbElems = output-&gt;GetNumberOfCells(); <br>int size = nbElems * nbComponents;<br><br>dataToAdd-&gt;SetNumberOfComponents(2);<br>dataToAdd-&gt;SetNumberOfTuples(size);<br>dataToAdd-&gt;SetName(name);<br>&nbsp;&nbsp;&nbsp; <br>int cpt = 0;<br>for(unsigned int i = 0; i &lt; values.size(); i += 2)<br>{<br>&nbsp;&nbsp;&nbsp; dataToAdd-&gt;InsertTuple2(cpt, values[i], values[i+1]);&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; cpt++;<br>}<br><br>output-&gt;GetCellData()-&gt;AddArray(dataToAdd);&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br><br><br>Everything is ok and
 I can see elements that are colored corresponding to the magnitude, x and y components.<br><br>But now, If I want to display gliph of these velocities I can't. Only attibutes attached to the points are presents.&nbsp; So, What is the way to display gliphs of attributes that are attached to some elements.<br><br>Thank you.<br></div><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><br><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><font face="Tahoma" size="2"><hr size="1"><b><span style="font-weight: bold;">De :</span></b> Andy Bauer &lt;andy.bauer@kitware.com&gt;<br><b><span style="font-weight: bold;">À :</span></b> R M &lt;mlokida@yahoo.fr&gt;<br><b><span style="font-weight: bold;">Cc :</span></b> paraview@paraview.org<br><b><span style="font-weight: bold;">Envoyé le :</span></b> Mar 12 octobre 2010, 19h 13min 16s<br><b><span style="font-weight: bold;">Objet&nbsp;:</span></b> Re:
 [Paraview] How to add vector/scalar field as attributes to a vtkPointSet (vtkPolyData, ...)?<br></font><br><meta http-equiv="x-dns-prefetch-control" content="off">For the velocity array you'll need to set the number of components.&nbsp; You probably want to set the number of components to 3 for both 2D and 3D so that ParaView can manipulate the vector quantities (for 2D just set the last component to 0).<br>
<br>Using the glyph filter will give you arrows for showing the velocity magnitude and direction.<br><br><div class="gmail_quote">On Tue, Oct 12, 2010 at 12:08 PM, R M <span dir="ltr">&lt;<a rel="nofollow" ymailto="mailto:mlokida@yahoo.fr" target="_blank" href="mailto:mlokida@yahoo.fr">mlokida@yahoo.fr</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><div>Hi,<br>
<br>Like the title say, I would to like to add some attributes to a vtkPointSet (vtkPolyData and vtkUnstructuredGrid).<br>The attributes are vector(2D, 3D,...) field or scalar field. <br><br>For a scalar Field, If I want to add an attribute to the cells , I do: output-&gt;GetCellData()-&gt;AddArray( data) and output-&gt;GetPointData()-&gt;AddArray(donnees);&nbsp; for the points<br>
For the moment it is ok, because I can select them in Paraview.<br><br>But now, I have a 2D (or 3D) vector field (velocity) and I would to add the velocity field for the points or the cells.&nbsp; How can I do that ?<br>Moreover, if I want to show somme arrow (to show the direction of the vectors) should I use the glyph filter ?<br>
<br>Thank you.<br><br></div>
</div><br></div><br>_______________________________________________<br>
Powered by <a rel="nofollow" target="_blank" href="http://www.kitware.com">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a rel="nofollow" target="_blank" href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the ParaView Wiki at: <a rel="nofollow" target="_blank" href="http://paraview.org/Wiki/ParaView">http://paraview.org/Wiki/ParaView</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a rel="nofollow" target="_blank" href="http://www.paraview.org/mailman/listinfo/paraview">http://www.paraview.org/mailman/listinfo/paraview</a><br>
<br></blockquote></div><br>
<meta http-equiv="x-dns-prefetch-control" content="on"></div></div>
</div><br></body></html>