Jay,

I think I see the problem. Simply add

import vtk

to the top of your script and then change

view.SetAttributeArrayStatus(i, vtkDataObject.POINT, "p", 1)

to

view.SetAttributeArrayStatus(i, vtk.vtkDataObject.POINT, "p", 1)

That should do the trick.

Cory

On Thu, Apr 27, 2017 at 10:53 AM, Cory Quammen <cory.quam...@kitware.com> wrote:
> Arvind,
>
> Please explain how the code breaks at the line you cited. What error
> message are you seeing?
>
> Thanks,
> Cory
>
> On Wed, Apr 26, 2017 at 12:18 PM, Jayaprakash, Arvind
> <ajayaprak...@hotwater.com> wrote:
>> Dear All,
>>
>>
>>
>> I am interested in using the matplotlib library to plot the data filtered
>> through "PlotOverLine" filter.  I believe this is of type
>> vtkMultiBlockDataSet with 1 child (vtkPolyData)
>>
>>
>>
>> I am having issues with  SetAttributeArrayStatus(…)  for an array in
>> vtkMultiBlockDataSet.
>>
>>
>>
>> Here is the script, I used:
>>
>>
>>
>> def setup_data(view):
>>
>>   from paraview.numpy_support import vtk_to_numpy
>>
>>   for i in xrange(view.GetNumberOfVisibleDataObjects()):
>>
>>     dataObject = view.GetVisibleDataObjectForSetup(i).GetBlock(0)
>> #Accessing the point data
>>
>>     pressure = dataObject.GetPointData().GetArray("p")
>>
>>     print vtk_to_numpy(pressure)  # prints the pressure array
>>
>>     view.DisableAllAttributeArrays()
>>
>>     view.SetAttributeArrayStatus(i, vtkDataObject.POINT, "p", 1)  # code
>> breaks here! Could not pass the vtkDataObject.POINT array
>>
>>
>>
>> def render(view, width, height):
>>
>>   from paraview.numpy_support import vtk_to_numpy
>>
>>   from paraview import python_view
>>
>>   figure = python_view.matplotlib_figure(width, height)
>>
>>   for i in xrange(view.GetNumberOfVisibleDataObjects()):
>>
>>     dataObject = view.GetVisibleDataObjectForRendering(i) .GetBlock(0)
>>
>>     pressure = dataObject.GetPointData().GetArray("p")
>>
>>     print vtk_to_numpy(pressure)
>>
>>
>>
>> Any help is much appreciated.
>>
>> Thanks,
>>
>> Jay
>>
>>
>> _______________________________________________
>> 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
>>
>> Search the list archives at: http://markmail.org/search/?q=ParaView
>>
>> Follow this link to subscribe/unsubscribe:
>> http://public.kitware.com/mailman/listinfo/paraview
>>
>
>
>
> --
> Cory Quammen
> Staff R&D Engineer
> Kitware, Inc.



-- 
Cory Quammen
Staff R&D Engineer
Kitware, Inc.
_______________________________________________
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

Search the list archives at: http://markmail.org/search/?q=ParaView

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/paraview

Reply via email to