I would use the python programmable filter to do it instead. It can't easily be done from the python shell because that executes on the client side which is potentially very far away from the data you are trying to append to.
David E DeMarle Kitware, Inc. R&D Engineer 28 Corporate Drive Clifton Park, NY 12065-8662 Phone: 518-371-3971 x109 On Sun, Dec 5, 2010 at 4:00 AM, George <[email protected]> wrote: > Hi Paraviewers, > > Is it possible to add or append a newly created vtkFloatArray to an > existing set of arrays? > Please find below my attempt to append/add an array 'p2' to the existing > arrays 'U','U_0' and 'p' > > #~~~~~~~~~~~~~~~~ > from paraview import vtk > try: paraview.simple > except: from paraview.simple import * > paraview.simple._DisableFirstRenderCameraReset() > > OpenFOAM = OpenFOAMReader( FileName='C:\\Users\\Public\\30x30x1.OpenFOAM' ) > OpenFOAM.CellArrays = ['U', 'U_0', 'p'] > OpenFOAM.MeshRegions = ['internalMesh'] > MergeBlocks1 = MergeBlocks() > > parray=servermanager.Fetch(MergeBlocks1).GetPointData().GetArray('p') > npts=parray.GetNumberOfTuples() > p2array = vtk.vtkFloatArray() > p2array.SetName('p2') > p2array.SetNumberOfComponents(1) > p2array.SetNumberOfTuples(npts) > > for i in range(npts): > p2array.SetValue(i, 999.9) > > # Is it possible to add or append the p2array to the 'U','U_0' and 'p' > arrays? > # Maybe something like: MergeBlocks1.GetCellData().AddArray(p2array) > #~~~~~~~~~~~~~~~ > Any help will be greatly appreciated. > > Best regards, > George > > _______________________________________________ > 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
