Dear Paraview users, I would like to create, from a script file, some data (lines) with python/vtk instructions and display the result for a Paraview client.
I know I can do it with Programmable Source. The wiki page here gives some examples http://www.paraview.org/Wiki/ParaView/Simple_ParaView_3_Python_Filters However, this presents several drawback for me. - The code might be long, and is not easily maintenable as it is stored as a single string, when doing some batch operations - I need to give some input arguments to this code - I have some python functions Therefore, I have tried to do it with DataObjectGenerator, but I can not use it properly. I use the comand servermanager.Fetch to retrieve data, I manage to modify it. Next step would be to ask Paraview to propagate modifications, and display the new data. But I dont know how to do it. Any advice? I know some people had the same problem, but I can not figure out the solution http://comments.gmane.org/gmane.comp.science.paraview.user/10879 Below is my Python code, that does not work: the final result is not displayed on screen. try: paraview.simple except: from paraview.simple import * paraview.simple._DisableFirstRenderCameraReset() from paraview import vtk p= DataObjectGenerator(Program='PD1') p.UpdatePipeline() output = servermanager.Fetch(p) output.Initialize() newPts = vtk.vtkPoints() numPts=5 newPts.InsertPoint(0, 0.0,0.0,0.0) newPts.InsertPoint(1, 0.0,0.0,5.0) newPts.InsertPoint(2, 5.0,0.0,5.0) newPts.InsertPoint(3, 5.0,5.0,5.0) newPts.InsertPoint(4, 5.0,9.0,7.0) output.SetPoints(newPts) aPolyLine = vtk.vtkPolyLine() aPolyLine.GetPointIds().SetNumberOfIds(numPts) [aPolyLine.GetPointIds().SetId(i, i) for i in range(0,numPts)] output.Allocate(1, 1) output.InsertNextCell(aPolyLine.GetCellType(), aPolyLine.GetPointIds()) print(output) p.UpdatePipeline() Render() Show() dp=GetDisplayProperties(p) dp.DiffuseColor=[0.0,0.0,0.0] Guillaume Jacquenot
_______________________________________________ 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