I recommend always using Unix style paths when trying to open files even when on windows.<br><br><div class="gmail_quote">On Fri, Mar 11, 2011 at 2:05 PM, Sebastien Jourdain <span dir="ltr"><<a href="mailto:sebastien.jourdain@kitware.com">sebastien.jourdain@kitware.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">is it because you are using "\" in your path ?<br>
It seems that your command to open the file is wrong..<br>
<div><div></div><div class="h5"><br>
On Fri, Mar 11, 2011 at 11:28 AM, Lester Anderson<br>
<<a href="mailto:lester_anderson1963@hotmail.com">lester_anderson1963@hotmail.com</a>> wrote:<br>
> Hello<br>
><br>
> I am having problems getting line data into Paraview like below:<br>
><br>
>> @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>
>> @D1|802<br>
> 67.01790387568883 -73.727007691932769<br>
> 66.514604674359518 -74.029527337311038<br>
> 66.158131619687595 -74.145946545617733<br>
> 66.416517810764773 -74.554436935231323<br>
>> @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<br>
><br>
> import string<br>
><br>
> def insertNextCell():<br>
><br>
> nextpoly = vtk.vtkPolyLine()<br>
><br>
> nextpoly.GetPointIds().DeepCopy(segments)<br>
><br>
> cells.InsertNextCell(nextpoly)<br>
><br>
> filename = os.path.normcase("C:\temp\rifts_gmt.txt")<br>
><br>
> f = open(filename)<br>
><br>
> pdo = self.GetPolyDataOutput()<br>
><br>
> pts = vtk.vtkPoints()<br>
><br>
> #an array for the fault information<br>
><br>
> segmentNames = vtk.vtkStringArray()<br>
><br>
> segmentNames.SetName("Fault Information")<br>
><br>
> segmentNames.SetNumberOfComponents(1)<br>
><br>
> cells = vtk.vtkCellArray()<br>
><br>
> segments = vtk.vtkIdList()<br>
><br>
> #traverse file<br>
><br>
> for line in f:<br>
><br>
> if line.startswith(">"):<br>
><br>
> #when you find a new fault<br>
><br>
> #save the one you just finished<br>
><br>
> if segments.GetNumberOfIds() != 0:<br>
><br>
> insertNextCell()<br>
><br>
> segments = vtk.vtkIdList()<br>
><br>
> segmentNames.InsertNextValue(line)<br>
><br>
> else:<br>
><br>
> #otherwise just keep remembering coordinates<br>
><br>
> x,y = [float(n) for n in line.strip().split()[:2]]<br>
><br>
> id = pts.InsertNextPoint(x,y,0)<br>
><br>
> segments.InsertNextId(id)<br>
><br>
> f.close()<br>
><br>
> if segments.GetNumberOfIds()>0:<br>
><br>
> #don't forget the last fault in progress<br>
><br>
> insertNextCell()<br>
><br>
> pdo.SetPoints(pts)<br>
><br>
> pdo.SetLines(cells)<br>
><br>
> pdo.GetCellData().AddArray(segmentNames)<br>
><br>
> - this runs as a programmable source but only gives an error:<br>
><br>
> Traceback (most recent call last):<br>
><br>
> File "<string>", line 24, in <module><br>
><br>
> File "<string>", line 11, in RequestData<br>
><br>
> IOError: [Errno 22] invalid mode ('r') or filename: 'c:\temp\rifts_gmt.txt'<br>
><br>
> .<br>
><br>
> I am working on Windows 7.<br>
><br>
> Any ideas?<br>
><br>
> Cheers<br>
><br>
> Lester<br>
><br>
><br>
</div></div>> _______________________________________________<br>
> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
><br>
> Visit other Kitware open-source projects at<br>
> <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 ParaView Wiki at:<br>
> <a href="http://paraview.org/Wiki/ParaView" target="_blank">http://paraview.org/Wiki/ParaView</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="http://www.paraview.org/mailman/listinfo/paraview" target="_blank">http://www.paraview.org/mailman/listinfo/paraview</a><br>
><br>
><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 ParaView Wiki at: <a href="http://paraview.org/Wiki/ParaView" target="_blank">http://paraview.org/Wiki/ParaView</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.paraview.org/mailman/listinfo/paraview" target="_blank">http://www.paraview.org/mailman/listinfo/paraview</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>Robert Maynard<br>