<div dir="ltr">Hi Hayden,<div><br></div><div style>Find below a fully functional example in Python for creating a &quot;mesh&quot;  with only vertices as cells.</div><div style><br></div><div style>I provided some comments in the file, so it should be relatively easy to follow. If not drop</div>
<div style>more questions on the list and we will try to help. I also attached the file that is produced</div><div style>by the script. </div><div style><br></div><div style>===== SCRIPT ========================================</div>
<div style><div>#!/usr/bin/env python  </div><div><br></div><div>from vtk import vtkPoints, vtkCellArray, vtkVertex, vtkUnstructuredGrid</div><div>from vtk import vtkFloatArray</div><div>from vtk import vtkXMLUnstructuredGridWriter</div>
<div><br></div><div>from random import random</div><div><br></div><div>coords = (</div><div>    (0,0,2),</div><div>    (1,0,2),</div><div>    (1,1,2),</div><div>    (0,1,2),</div><div>    (2,0,2),</div><div>    (3,0,2),</div>
<div>    (3,1,2),</div><div>    (2,1,2))</div><div><br></div><div>#=== Create a VTK array to store points</div><div>points = vtkPoints()</div><div><br></div><div>#=== Loop over the list of coordinates and insert them into the array; store</div>
<div>#    corresponding point index (or id)</div><div>pids = []</div><div>for crd in coords:</div><div>    pids.append(points.InsertNextPoint(crd))</div><div><br></div><div># Create a VTK array to store cells</div><div>cells = vtkCellArray()</div>
<div><br></div><div>vertex      = vtkVertex()</div><div>typecode    = vertex.GetCellType()</div><div>ncellpoints = vertex.GetNumberOfPoints()</div><div><br></div><div>for p in pids:</div><div>    # Notify the cells array of how many cellpoints are needed to describe the</div>
<div>    # next cell that we want to insert</div><div>    cells.InsertNextCell(ncellpoints)</div><div><br></div><div>    # For a vertex, we only need to insert a single point index; for a triangle</div><div>    # this would typically be a loop</div>
<div>    cells.InsertCellPoint(p)</div><div><br></div><div># Create a data array</div><div>#</div><div><br></div><div>temperature = vtkFloatArray()</div><div>temperature.SetName(&#39;temperature&#39;)</div><div><br></div>
<div>npoints = points.GetNumberOfPoints()</div><div>temperature.SetNumberOfValues(npoints)</div><div><br></div><div># Insert some random data</div><div>for i in range(npoints):</div><div>    temperature.SetValue(i, random())</div>
<div><br></div><div>grid = vtkUnstructuredGrid()</div><div>grid.SetPoints(points)</div><div>grid.SetCells(typecode, cells)</div><div><br></div><div>grid.GetPointData().SetScalars(temperature)</div><div><br></div><div>writer = vtkXMLUnstructuredGridWriter()</div>
<div>writer.SetDataModeToAscii()</div><div>writer.SetInput(grid)</div><div>writer.SetFileName(&#39;vertex_demo.vtu&#39;)</div><div>writer.Write()</div><div><br></div></div><div style><br></div><div style><br></div><div style>
<br></div><div style><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Apr 26, 2013 at 3:45 PM, Hayden Smith <span dir="ltr">&lt;<a href="mailto:s_hayden_28@yahoo.com" target="_blank">s_hayden_28@yahoo.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="font-size:12pt;font-family:times new roman,new york,times,serif"><div><span>Hi,</span></div>
<div style="font-size:16px;font-style:normal;background-color:transparent;font-family:times new roman,new york,times,serif"><span>   I have tried the following .vtk data file with the foloowing tcl code. I tried to generate glyphs at each point. But my screen in blank without any output. I have placed the code here. Please help me clarify what&#39;s going wrong, is it something with code (tcl file) or the data file?</span></div>

<div style="font-size:16px;font-style:normal;background-color:transparent;font-family:times new roman,new york,times,serif"><span>/******************************************/</span></div><span><span lang="EN">
<div>package require vtk</div>
<div>package require vtkinteraction</div>
<div> </div>
<div># Create arc plots</div>
<div># get the interactor ui</div>
<div> </div>
<div>vtkCamera camera<var></var></div>
<div># read the bore</div>
<div>v</div>
<div>tkPolyDataReader bore</div>
<blockquote style="MARGIN-RIGHT:0px" dir="ltr">
<div>bore SetFileName &quot;bore.vtk&quot;</div></blockquote>
<div>vtkMaskPoints ptMask</div>
<blockquote style="MARGIN-RIGHT:0px" dir="ltr">
<div>ptMask SetInputConnection [bore GetOutputPort]</div></blockquote>
<blockquote style="MARGIN-RIGHT:0px" dir="ltr">
<div>ptMask SetOnRatio 1</div>
<div>ptMask RandomModeOff</div>
<div>ptMask SetMaximumNumberOfPoints 10</div>
<div>ptMask GenerateVerticesOn</div>
<div>ptMask SingleVertexPerCellOn</div></blockquote>
<div>vtkArrowSource arrow</div>
<blockquote style="MARGIN-RIGHT:0px" dir="ltr">
<div>arrow SetTipResolution 6 </div>
<div>arrow SetTipRadius 0.25 </div>
<div>arrow SetTipLength 0.5</div>
<div>arrow SetShaftResolution 6 </div>
<div>arrow SetShaftRadius 0.125</div></blockquote>
<div>vtkGlyph3D glyph</div>
<blockquote style="MARGIN-RIGHT:0px" dir="ltr">
<div>glyph SetInput [ptMask GetOutput] </div>
<div>glyph SetSource [arrow GetOutput] </div>
<div>glyph SetVectorModeToUseVector </div>
<div>glyph SetColorModeToColorByScalar</div>
<div>glyph SetScaleModeToDataScalingOff </div>
<div>glyph OrientOn </div>
<div>glyph SetScaleFactor 0.5</div></blockquote>
<div>vtkPolyDataMapper mapBore</div>
<blockquote style="MARGIN-RIGHT:0px" dir="ltr">
<div>mapBore SetInputConnection [glyph GetOutputPort]</div>
<div>mapBore ScalarVisibilityOff</div></blockquote>
<div>vtkActor boreActor</div>
<blockquote style="MARGIN-RIGHT:0px" dir="ltr">
<div>boreActor SetMapper mapBore</div>
<div>[boreActor GetProperty] SetColor 0 0 0</div></blockquote>
<div># create the arc plots</div>
<div>#</div>
<div># Create graphics objects</div>
<div># Create the rendering window renderer and interactive renderer</div>
<div>vtkRenderer ren1</div>
<blockquote style="MARGIN-RIGHT:0px" dir="ltr">
<div>ren1 SetActiveCamera camera</div></blockquote>
<div>vtkRenderWindow renWin</div>
<blockquote style="MARGIN-RIGHT:0px" dir="ltr">
<div>renWin AddRenderer ren1</div></blockquote>
<div>vtkRenderWindowInteractor iren</div>
<blockquote style="MARGIN-RIGHT:0px" dir="ltr">
<div>iren SetRenderWindow renWin</div></blockquote>
<div># Add the actors to the renderer set the background and size</div>
<div>ren1 AddActor boreActor</div>
<div>ren1 SetBackground 1 1 1</div>
<div>renWin SetSize 235 500</div>
<div>camera SetClippingRange 14144 32817</div>
<div>camera SetFocalPoint -1023 680 5812</div>
<div>camera SetPosition 15551 -2426 19820</div>
<div>camera SetViewUp -0.651889 -0.07576 0.754521</div>
<div>camera SetViewAngle 20</div>
<div>renWin Render</div>
<div># render the image</div>
<div>#</div>
<div>iren AddObserver UserEvent {wm deiconify .vtkInteract}</div>
<div>iren Initialize</div>
<div># prevent the tk window from showing up then start the event loop</div>
<div>wm withdraw .</div></span></span>
<div style="font-size:16px;font-style:normal;background-color:transparent;font-family:times new roman,new york,times,serif"><span></span> </div>
<div style="font-size:16px;font-style:normal;background-color:transparent;font-family:times new roman,new york,times,serif"><span>/******************************************/</span></div>
<div style="font-size:16px;font-style:normal;background-color:transparent;font-family:times new roman,new york,times,serif"><span></span> </div>
<div style="font-size:16px;font-style:normal;background-color:transparent;font-family:times new roman,new york,times,serif"><span>Thanks,</span></div>
<div style="font-size:16px;font-style:normal;background-color:transparent;font-family:times new roman,new york,times,serif"><span>Hayden</span></div>
<div><br></div>
<div style="FONT-FAMILY:times new roman,new york,times,serif;FONT-SIZE:12pt">
<div style="FONT-FAMILY:times new roman,new york,times,serif;FONT-SIZE:12pt">
<div dir="ltr">
<div style="BORDER-BOTTOM:#ccc 1px solid;BORDER-LEFT:#ccc 1px solid;PADDING-BOTTOM:0px;LINE-HEIGHT:0;MARGIN:5px 0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;min-height:0px;FONT-SIZE:0px;BORDER-TOP:#ccc 1px solid;BORDER-RIGHT:#ccc 1px solid;PADDING-TOP:0px" readonly>
</div><font face="Arial"><b><span style="FONT-WEIGHT:bold">From:</span></b> Hal Canary &lt;<a href="mailto:hal@cs.unc.edu" target="_blank">hal@cs.unc.edu</a>&gt;<br><b><span style="FONT-WEIGHT:bold">To:</span></b> Hayden Smith &lt;<a href="mailto:s_hayden_28@yahoo.com" target="_blank">s_hayden_28@yahoo.com</a>&gt; <br>
<b><span style="FONT-WEIGHT:bold">Cc:</span></b> &quot;<a href="mailto:vtkusers@vtk.org" target="_blank">vtkusers@vtk.org</a>&quot; &lt;<a href="mailto:vtkusers@vtk.org" target="_blank">vtkusers@vtk.org</a>&gt; <br><b><span style="FONT-WEIGHT:bold">Sent:</span></b> Friday, April 26, 2013 6:54 AM<div class="im">
<br><b><span style="FONT-WEIGHT:bold">Subject:</span></b> Re: [vtkusers] Can a VTK file consists of Points only<br></div></font></div><div><div class="h5">
<div><br>Try this:<br><br>/**************************************************/<br># vtk DataFile Version 3.0<br>track data of XX well<br>ASCII<br>DATASET POLYDATA<br>POINTS 10 float<br>0.00 0.00 0.00<br>0.00 0.00 1400.00<br>
0.00 0.48 1466.00<br>0.50 2.34 1600.00<br>2.68 4.17 1800.00<br>5.53 4.68 2000.00<br>9.15 4.36 2200.00<br>12.02 1.95 2400.00<br>8.68 -0.86 2599.96<br>-1.14 4.81 2799.95<br>VERTICES 10 20<br>1 0<br>1 1<br>1 2<br>1 3<br>1 4<br>
1 5<br>1 6<br>1 7<br>1 8<br>1 9<br>/**************************************************/<br><br><br>On 04/26/2013 12:12 AM, Hayden Smith wrote:<br>&gt; Hello,<br>&gt;    Thank you very much for the reply. Could you tell me what is the<br>
&gt; problem with the following vtk file, why it shows error reading cell data?<br>&gt; /**************************************************/<br>&gt; # vtk DataFile Version 1.0<br>&gt; track data of XX well<br>&gt; ASCII<br>
&gt; DATASET
 POLYDATA<br>&gt; POINTS 10 float<br>&gt; 0.00 0.00 0.00<br>&gt; 0.00 0.00 1400.00<br>&gt; 0.00 0.48 1466.00<br>&gt; 0.50 2.34 1600.00<br>&gt; 2.68 4.17 1800.00<br>&gt; 5.53 4.68 2000.00<br>&gt; 9.15 4.36 2200.00<br>&gt; 12.02 1.95 2400.00<br>
&gt; 8.68 -0.86 2599.96<br>&gt; -1.14 4.81 2799.95<br>&gt; VERTICES 10 10<br>&gt; 0  0.00 0.00 0.00<br>&gt; 1  0.00 0.00 1400.00<br>&gt; 2  0.00 0.48 1466.00<br>&gt; 3  0.50 2.34 1600.00<br>&gt; 4  2.68 4.17 1800.00<br>&gt; 5  5.53 4.68 2000.00<br>
&gt; 6  9.15 4.36 2200.00<br>&gt; 7  12.02 1.95 2400.00<br>&gt; 8  8.68 -0.86 2599.96<br>&gt; 9  -1.14 4.81 2799.95<br>&gt;  <br>&gt; CELLS 10 10<br>&gt; 1  0.00 0.00 0.00<br>&gt; 1  0.00 0.00 1400.00<br>&gt; 1  0.00 0.48 1466.00<br>
&gt; 1  0.50 2.34 1600.00<br>&gt; 1  2.68 4.17 1800.00<br>&gt; 1  5.53 4.68 2000.00<br>&gt; 1  9.15 4.36 2200.00<br>&gt; 1  12.02 1.95 2400.00<br>&gt;
 1  8.68 -0.86 2599.96<br>&gt; 1    -1.14 4.81 2799.95<br>&gt; CELL_TYPES 10<br>&gt; /***************************************************/<br>&gt; Thanks,<br>&gt; Hayden<br><br><br><br></div></div></div></div></div></div>
</div><br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><br></div>