[Paraview] CellDataToPointData in paraview script

Peter Brady petertbrady at gmail.com
Tue Mar 3 11:40:19 EST 2009


Hi,

I had a similar problem a while back.  Try applying the
CellDataToPointData filter before the cut filter.

Hope it works,
Peter.

On Mon, Mar 2, 2009 at 3:06 AM, Luc Bordier <luc.bordier at sirehna.com> wrote:
> Hello,
>
> I'm starting to use paraview in script mode using pvpython.
>
> I succeeded to load my data and to make a representation of my U CellData
> fields using a Cut() filters.
> This works fine.
>
> But now I would like to have the magnitude of my U field for PointData and
> I'm stuck in the use of CellDataToPointData filter.
> The following script only give me a blank field for my Cut() when passing
> trough the CellDataToPointData filter.
>
> Surely I forgot something (interpolation, choice of component of field), but
> even by looking at the dir() and help() I didn't manage to have my field
> interpolated at points and represented in colors.
>
> Thanks for anyone who could give me hints to solve this problem.
>
> python script :
>
> con = servermanager.Connect()
> vtkf =
> servermanager.sources.LegacyVTKFileReader(FileNames="VTK\\design71_1.vtk")
> vtkf.UpdatePipeline()
>
> implicit_functions = servermanager.createModule("implicit_functions")
> plane = implicit_functions.Plane()
> plane.Origin = [0,0,-0.5]
> plane.Normal = [0,0,1]
>
> zcut = servermanager.filters.Cut()
> zcut.Input = vtkf
> zcut.CutFunction = plane
> zcut.ContourValues = [0]
> zcut.UpdatePipeline()
>
> pdata = servermanager.filters.CellDataToPointData(Input=zcut)
> pdata.UpdatePipeline()
>
> view = servermanager.CreateRenderView()
> view.ViewSize = [1440, 900]
> rep = servermanager.CreateRepresentation(pdata,view)
>
> lt = servermanager.rendering.PVLookupTable()
> rep.LookupTable = lt
> rep.ColorAttributType = 0
> rep.ColorArrayName = 'U'
> lt.RGBPoints = [0, 0, 0, 1, 15.0, 1, 0, 0]
> lt.ColorSpace = 1
>
> view.ResetCamera()
> camera = view.GetActiveCamera()
> camera.SetPosition(0.85, 0, 8.55)
> camera.SetFocalPoint(0.85, 0 , -0.5)
>
> view.StillRender()
> view.WriteImage("test.png","vtkPNGWriter", 1)
>
> --
> _________________________
> Luc Bordier
> R&D Engineer
> luc.bordier at sirehna.com
> http://www.sirehna.com
> SIREHNA
> 1, rue de la Noe
> BP 42105
> 44321 NANTES CEDEX 3
> FRANCE
> Tel: +33 2 51 86 02 80
> Fax: +33 2 40 74 17 36
> _________________________
>
> _______________________________________________
> 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
>


More information about the ParaView mailing list