Hello I have tried replacing the windows path structure with Unix style with no effect so I am not sure what the issue is ?
I can upload the whole sample file to test if that would help? As I can tell the the script will search for the delimiter of ">" to find each segment which is clear from the input file, but for whatever reason it seems not to be able to even locate the file. Cheers Lester From: [email protected] Date: Fri, 11 Mar 2011 14:09:31 -0500 Subject: Re: [Paraview] Getting line data into Paraview 3.10.0 To: [email protected] CC: [email protected]; [email protected] I recommend always using Unix style paths when trying to open files even when on windows. On Fri, Mar 11, 2011 at 2:05 PM, Sebastien Jourdain <[email protected]> wrote: is it because you are using "\" in your path ? It seems that your command to open the file is wrong.. On Fri, Mar 11, 2011 at 11:28 AM, Lester Anderson <[email protected]> wrote: > Hello > > I am having problems getting line data into Paraview like below: > >> @D0|802 > 71.544281294689512 -70.195276311658077 > 71.688883266535839 -70.803067353070787 > 71.38500823808829 -71.198687848942484 > 70.489943344507651 -71.537405020061286 > 69.243648292148919 -72.032781992602239 > 68.343962786687243 -72.448893783954588 > 67.981376969701287 -72.772842957827351 > 68.100709218429969 -73.404243851896808 > 68.405639346171426 -73.796396551645131 > 68.864598617974011 -74.278821236312368 >> @D1|802 > 67.01790387568883 -73.727007691932769 > 66.514604674359518 -74.029527337311038 > 66.158131619687595 -74.145946545617733 > 66.416517810764773 -74.554436935231323 >> @D2|802 > 67.315000523512794 -75.111290145048144 > 66.43005383192326 -75.716970640682874 > 65.362131457243223 -76.087825945619358 > 64.135678202144192 -76.588857027141785 > 61.504870583900271 -77.191571848696427 > > I did try the script: > > import os > > import string > > def insertNextCell(): > > nextpoly = vtk.vtkPolyLine() > > nextpoly.GetPointIds().DeepCopy(segments) > > cells.InsertNextCell(nextpoly) > > filename = os.path.normcase("C:\temp\rifts_gmt.txt") > > f = open(filename) > > pdo = self.GetPolyDataOutput() > > pts = vtk.vtkPoints() > > #an array for the fault information > > segmentNames = vtk.vtkStringArray() > > segmentNames.SetName("Fault Information") > > segmentNames.SetNumberOfComponents(1) > > cells = vtk.vtkCellArray() > > segments = vtk.vtkIdList() > > #traverse file > > for line in f: > > if line.startswith(">"): > > #when you find a new fault > > #save the one you just finished > > if segments.GetNumberOfIds() != 0: > > insertNextCell() > > segments = vtk.vtkIdList() > > segmentNames.InsertNextValue(line) > > else: > > #otherwise just keep remembering coordinates > > x,y = [float(n) for n in line.strip().split()[:2]] > > id = pts.InsertNextPoint(x,y,0) > > segments.InsertNextId(id) > > f.close() > > if segments.GetNumberOfIds()>0: > > #don't forget the last fault in progress > > insertNextCell() > > pdo.SetPoints(pts) > > pdo.SetLines(cells) > > pdo.GetCellData().AddArray(segmentNames) > > - this runs as a programmable source but only gives an error: > > Traceback (most recent call last): > > File "<string>", line 24, in <module> > > File "<string>", line 11, in RequestData > > IOError: [Errno 22] invalid mode ('r') or filename: 'c:\temp\rifts_gmt.txt' > > . > > I am working on Windows 7. > > Any ideas? > > Cheers > > Lester > > > _______________________________________________ > Powered by www.kitware.com > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Please keep messages on-topic and check the ParaView Wiki at: > http://paraview.org/Wiki/ParaView > > Follow this link to subscribe/unsubscribe: > http://www.paraview.org/mailman/listinfo/paraview > > _______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView Follow this link to subscribe/unsubscribe: http://www.paraview.org/mailman/listinfo/paraview -- Robert Maynard
_______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView Follow this link to subscribe/unsubscribe: http://www.paraview.org/mailman/listinfo/paraview
