CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Visualization & Post-Processing Software > ParaView

[General] python view + matplotlib: SetAttributeArrayStatus(…) for an array in vtkMultiBlockDa

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 2 Post By arvindpj

 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old   April 26, 2017, 12:23
Default python view + matplotlib: SetAttributeArrayStatus(…) for an array in vtkMultiBlockDa
  #1
Member
 
Arvind Jay
Join Date: Sep 2012
Posts: 96
Rep Power: 14
arvindpj is on a distinguished road
Dear All,

Based on the feature metiond in the paraview blog, I am trying to use 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:
Code:
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
arvindpj is offline   Reply With Quote

 

Tags
paraview matplotlib


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to build current blower fan model in Flotherm eric0722 FloEFD, FloWorks & FloTHERM 3 January 2, 2021 02:36
Trouble modelling a jet fan josee OpenFOAM Pre-Processing 0 September 23, 2016 13:06
[OpenFOAM] Python to show row data in spreadsheet view JensD ParaView 0 August 18, 2016 03:40
Constant Power Fan Model using General Momentum Source Dano62 CFX 0 April 14, 2016 13:09
fan driven flow, Fan BC validation (getting lost) soonic OpenFOAM Running, Solving & CFD 0 July 7, 2013 19:16


All times are GMT -4. The time now is 02:38.