If it helps, there is an example of how to write a python programmable filter that outputs image data here:
http://www.paraview.org/Wiki/Here_are_some_more_examples_of_simple_ParaView_3_python_filters.#Producing_Image_Data_.28Source.29 You could modify this to be a filter that takes polydata from the PlotOverLine and outputs an image data. The wiki example may be slightly complicated to read because it is written in a way that it works as a parallel filter. You might be able to skip this part for your purposes. Pat On Wed, Nov 3, 2010 at 5:33 PM, <[email protected]> wrote: > > Hi, > > Thanks Jerome. You are dead right! The writer doesn't want > vtkpolydata, rather vtkimagedata. Grrrr, silly me. I couldn't figure > out how to convert vtkpolydata to vtkimagedata without actually > rendering to the screen unfortunately. > > Actually I found a really old posting on this mailing list (damn, lost > it now) that says that "Offscreen screenshots" aren't possible, unless > you compile paraview with offscreen rendering. Don't know if this is > still true or not. But, it appears I am after something too > difficult. > > Anyway, I did figure out how to just extract the numbers of the > vtkpolydata, using commands like this: > > pl.GetPoints().GetData().GetValue(0) > and > pl.GetPointData().GetArray(0).GetValue(0) > > etc > > so I can throw them into an array and use matplotlib. > > Thanks again > > Matt Wilkins > > On Fri, Oct 29, 2010 at 09:27:45AM +0200, Jérôme wrote: > > Hi Matt, > > > > By quickly reading your code, I understand that you try to put > > the ouput of the PlotOverLine on the the input of an image writer. > > The mistake, IMHO, is that PlotOverLine outputs a vtkPolyData > > (Polygonal Mesh in ParaView), that's why the writer doesn't want it as > > input (it expects a vtkImageData instead). > > > > I think that what you want is a screenshot of the plot. You should look > > in that direction. Sort of "Offscreen screenshot" ?? Don't know... > > > > HTH > > Jerome > > > > 2010/10/29 <[email protected]>: > > > > > > Hi, > > > > > > As promised, I have another question! > > > > > > The code below can render a picture to the screen fine. But I would > > > like to send the picture to a file, without rendering anything to the > > > screen. I know I can put > > > WriteImage('/tmp/foo.png') > > > at the end to save the output, but that is after I've popped up an > > > image. > > > > > > I did find a powerpoint by David E DeMarle about paraview scripting > > > with this in it: > > > > > > writer = servermanager.writers.PNGWriter() > > > writer.FileName = '/tmp/foo.png' > > > writer.Input = pl > > > writer.UpdatePipeline() > > > > > > But when I try that I get: > > > ERROR: In /scratch/pv/ParaView/VTK/IO/vtkPNGWriter.cxx, line 54 > > > vtkPNGWriter (0xb108028): Write:Please specify an input! > > > which is odd since I thought I had set the input via writer.Input = pl > > > > > > My full code was > > > > > > from paraview.simple import * > > > reader = servermanager.sources.XMLUnstructuredGridReader(FileName = > "/var/tmp/file.vtu") > > > pl = PlotOverLine(Input = reader) > > > pl.Source.Point1 = [-7000, -5000, 0] > > > pl.Source.Point2 = [4300, 6300, 1111.75] > > > writer = servermanager.writers.PNGWriter() > > > writer.FileName = '/tmp/foo.png' > > > writer.Input = pl > > > c = CreateXYPlotView() > > > d = Show() > > > d.XArrayName = 'arc_length' > > > d.SeriesVisibility = ['namecolours (0)', '0', 'namecolours (1)', '0', > > > 'namecolours (2)', '0', 'vtkValidPointMask', '0', 'arc_length', '0'] > > > d.UseIndexForXAxis = 0 > > > writer.UpdatePipeline() > > > > > > I feel pretty bad about always asking questions on this list, but I > > > just can't seem to find documentation, or if I do, it is for a > > > slightly different setup (as in David E DeMarle's powerpoint for > > > instance). So, if I am just missing some good doco source, please > > > point me that way! > > > > > > Thanks for any help! > > > > > > Matt Wilkins > > > > > > On Fri, Oct 29, 2010 at 01:22:24PM +1300, [email protected]: > > >> > > >> Hi Utkarsh, > > >> > > >> Thanks, I am using 3.9, but I wasn't using paraview.simple, just > > >> following the examples in the Python Scripting chapter in the ParaView > > >> Guide. Using paraview.simple does make things simpler ;-) and indeed > > >> I can get it to work. > > >> > > >> For the record this works fine for me: > > >> > > >> from paraview.simple import * > > >> reader = servermanager.sources.XMLUnstructuredGridReader(FileName = > "/var/tmp/file.vtu") > > >> pl = PlotOverLine(Input = reader) > > >> pl.Source.Point1 = [-7000, -5000, 0] > > >> pl.Source.Point2 = [4300, 6300, 1111.75] > > >> CreateXYPlotView() > > >> d = Show() > > >> d.XArrayName = 'arc_length' > > >> d.SeriesVisibility = ['namecolours (0)', '0', 'namecolours (1)', '0', > 'namecolours (2)', '0', 'vtkValidPointMask', '0', 'arc_length', '0'] > > >> d.UseIndexForXAxis = 0 > > >> Render() > > >> > > >> OK, so got past this problem, more to come I expect! > > >> > > >> Thank you > > >> > > >> Matt Wilkins > > >> > > >> On Thu, Oct 28, 2010 at 09:08:50AM -0600, Utkarsh Ayachit wrote: > > >> > What version of ParaView are you using? Here's my script with 3.9 > > >> > (should work with 3.8 too). > > >> > > > >> > Wavelet() > > >> > pl = PlotOverLine() > > >> > pl.Source.Point1 = [-10, -10, -10] > > >> > pl.Source.Point2 = [10, 10, 10] > > >> > CreateXYPlotView() > > >> > Show() > > >> > Render() > > >> > > > >> > Utkarsh > > >> > > > >> > > > >> > On Wed, Oct 27, 2010 at 2:30 PM, <[email protected]> wrote: > > >> > > > > >> > > Hi, > > >> > > > > >> > > I am driving paraview via pvpython, and trying to do a probe over > > >> > > line. I would think this is quite easy, but it is proving > > >> > > frustratingly difficult! This is what I am typing > > >> > > > > >> > > from paraview import servermanager > > >> > > c = servermanager.Connect() > > >> > > reader = servermanager.sources.XMLUnstructuredGridReader(FileName > = > > >> > > "/var/tmp/file.vtu") > > >> > > pl = servermanager.filters.ProbeLine(Input = reader) > > >> > > pl.Source.Point1 = [-7000, -5000, 0] > > >> > > pl.Source.Point2 = [4300, 6300, 1111.75] > > >> > > view = servermanager.CreateRenderView() > > >> > > rep = servermanager.CreateRepresentation(pl, view) > > >> > > pl.UpdatePipeline() > > >> > > view.ResetCamera() > > >> > > view.StillRender() > > >> > > > > >> > > I get a nice picture of the x axis and a short y axis, but nothing > > >> > > plotted. I try a probe over line in paraview with the same > beginning > > >> > > and end points and I get data displayed. > > >> > > > > >> > > I am not specifying what variables should be displayed for the > probe > > >> > > over line, so perhaps nothing is getting displayed? I cannot for > the > > >> > > life of me find how I would specify what to display though. If I > do a > > >> > > probe over line in paraview with the Python Shell Trace running, I > can > > >> > > see that the SeriesVisibility attribute in the > > >> > > paraview.servermanager.XYChartRepresentation object is being set. > > >> > > However I don't have that representation, I only have the 'rep' > above, > > >> > > and that doesn't have a SeriesVisibility attribute. > > >> > > > > >> > > Thank you for any help, even if it is a pointer to where this is > > >> > > documented! > > >> > > > > >> > > Matt > > >> > > > > >> > > > > >> > > _______________________________________________ > > >> > > 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 > > > _______________________________________________ > > > 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 >
_______________________________________________ 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
