<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style>
</head>
<body class='hmmessage'>
Hello<br><br>I am having problems getting line data into Paraview like below:<br><br>&gt;&nbsp; @D0|802<br>71.544281294689512 -70.195276311658077<br>71.688883266535839 -70.803067353070787<br>71.38500823808829 -71.198687848942484<br>70.489943344507651 -71.537405020061286<br>69.243648292148919 -72.032781992602239<br>68.343962786687243 -72.448893783954588<br>67.981376969701287 -72.772842957827351<br>68.100709218429969 -73.404243851896808<br>68.405639346171426 -73.796396551645131<br>68.864598617974011 -74.278821236312368<br>&gt;&nbsp; @D1|802<br>67.01790387568883 -73.727007691932769<br>66.514604674359518 -74.029527337311038<br>66.158131619687595 -74.145946545617733<br>66.416517810764773 -74.554436935231323<br>&gt;&nbsp; @D2|802<br>67.315000523512794 -75.111290145048144<br>66.43005383192326 -75.716970640682874<br>65.362131457243223 -76.087825945619358<br>64.135678202144192 -76.588857027141785<br>61.504870583900271 -77.191571848696427<br><br>I did try the script:<br><br>import os
<p style="margin: 0px; text-indent: 0px;">import string</p>

<p style="margin: 0px; text-indent: 0px;">def insertNextCell():</p>
<p style="margin: 0px; text-indent: 0px;">  nextpoly = vtk.vtkPolyLine()</p>
<p style="margin: 0px; text-indent: 0px;">  nextpoly.GetPointIds().DeepCopy(segments)</p>
<p style="margin: 0px; text-indent: 0px;">  cells.InsertNextCell(nextpoly)</p>

<p style="margin: 0px; text-indent: 0px;">filename = os.path.normcase("C:\temp\rifts_gmt.txt")</p>
<p style="margin: 0px; text-indent: 0px;">f = open(filename)</p>

<p style="margin: 0px; text-indent: 0px;">pdo = self.GetPolyDataOutput()</p>

<p style="margin: 0px; text-indent: 0px;">pts = vtk.vtkPoints()</p>

<p style="margin: 0px; text-indent: 0px;">#an array for the fault information</p>
<p style="margin: 0px; text-indent: 0px;">segmentNames = vtk.vtkStringArray()</p>
<p style="margin: 0px; text-indent: 0px;">segmentNames.SetName("Fault Information")</p>
<p style="margin: 0px; text-indent: 0px;">segmentNames.SetNumberOfComponents(1)</p>

<p style="margin: 0px; text-indent: 0px;">cells = vtk.vtkCellArray()</p>
<p style="margin: 0px; text-indent: 0px;">segments = vtk.vtkIdList()</p>

<p style="margin: 0px; text-indent: 0px;">#traverse file</p>
<p style="margin: 0px; text-indent: 0px;">for line in f:</p>
<p style="margin: 0px; text-indent: 0px;">  if line.startswith("&gt;"):</p>
<p style="margin: 0px; text-indent: 0px;">    #when you find a new fault</p>
<p style="margin: 0px; text-indent: 0px;">    #save the one you just finished</p>
<p style="margin: 0px; text-indent: 0px;">    if segments.GetNumberOfIds() != 0:</p>
<p style="margin: 0px; text-indent: 0px;">      insertNextCell()</p>
<p style="margin: 0px; text-indent: 0px;">      segments = vtk.vtkIdList()</p>
<p style="margin: 0px; text-indent: 0px;">    segmentNames.InsertNextValue(line)</p>
<p style="margin: 0px; text-indent: 0px;">  else:</p>
<p style="margin: 0px; text-indent: 0px;">    #otherwise just keep remembering coordinates</p>
<p style="margin: 0px; text-indent: 0px;">    x,y = [float(n) for n in line.strip().split()[:2]]</p>
<p style="margin: 0px; text-indent: 0px;">    id = pts.InsertNextPoint(x,y,0)</p>
<p style="margin: 0px; text-indent: 0px;">    segments.InsertNextId(id)</p>
<p style="margin: 0px; text-indent: 0px;">f.close()</p>

<p style="margin: 0px; text-indent: 0px;">if segments.GetNumberOfIds()&gt;0:</p>
<p style="margin: 0px; text-indent: 0px;">  #don't forget the last fault in progress</p>
<p style="margin: 0px; text-indent: 0px;">  insertNextCell()</p>

<p style="margin: 0px; text-indent: 0px;">pdo.SetPoints(pts)</p>
<p style="margin: 0px; text-indent: 0px;">pdo.SetLines(cells)</p>
<p style="margin: 0px; text-indent: 0px;">pdo.GetCellData().AddArray(segmentNames)</p><p style="margin: 0px; text-indent: 0px;"><br></p><p style="margin: 0px; text-indent: 0px;">- this runs as a programmable source but only gives an error:</p><p style="margin: 0px; text-indent: 0px;"><br></p><p style="margin: 0px; text-indent: 0px;"><span style="font-family: 'Courier'; font-size: 8.25pt; color: rgb(128, 0, 0);">Traceback (most recent call last):</span>
</p><p style="margin: 0px; text-indent: 0px;"><span style="font-family: 'Courier'; font-size: 8.25pt; color: rgb(128, 0, 0);">  File "&lt;string&gt;", line 24, in &lt;module&gt;</span></p>
<p style="margin: 0px; text-indent: 0px;"><span style="font-family: 'Courier'; font-size: 8.25pt; color: rgb(128, 0, 0);">  File "&lt;string&gt;", line 11, in RequestData</span></p>
<p style="margin: 0px; text-indent: 0px;"><span style="font-family: 'Courier'; font-size: 8.25pt; color: rgb(128, 0, 0);">IOError: [Errno 22] invalid mode ('r') or filename: 'c:\temp\rifts_gmt.txt'</span></p><p style="margin: 0px; text-indent: 0px;">. <br></p><p style="margin: 0px; text-indent: 0px;"><br></p><p style="margin: 0px; text-indent: 0px;">I am working on Windows 7.</p><p style="margin: 0px; text-indent: 0px;"><br></p><p style="margin: 0px; text-indent: 0px;">Any ideas?</p><p style="margin: 0px; text-indent: 0px;"><br></p><p style="margin: 0px; text-indent: 0px;">Cheers</p><p style="margin: 0px; text-indent: 0px;"><br></p><p style="margin: 0px; text-indent: 0px;">Lester<br></p><br>                                               </body>
</html>