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

[General] Listing the inputs of a grouped dataset with a programmable python filter in Paraview

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree1Likes
  • 1 Post By tkarabela

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 28, 2019, 19:16
Default Listing the inputs of a grouped dataset with a programmable python filter in Paraview
  #1
New Member
 
Nadine
Join Date: Jan 2019
Posts: 4
Rep Power: 2
NadineHS is on a distinguished road
Is there a way to list the names of the inputs in a Group Dataset filter with a programmable python filter?

I have a lot of point sources that I have grouped in paraview. Then I applied "Merge Blocks" and then the Programmable Python filter.

This is the code so far in the programmable filter:

Code:
pdi = self.GetInput()

npts = pdi.GetNumberOfPoints()
print npts

for i in range(0, npts):
        coord1 = pdi.GetPoint(i)
        print coord1
This code prints the coordinates of each point source. I would also like to print the names of the point sources, something like this:
PointSource1
PointSource5 etc.

I would appreciate your help.
NadineHS is offline   Reply With Quote

Old   February 7, 2019, 18:51
Default
  #2
New Member
 
Join Date: Feb 2019
Location: Czech Republic
Posts: 2
Rep Power: 0
tkarabela is on a distinguished road
It is possible to do it from the Python console in Paraview:

Code:
group_datasets = GetActiveSource()
for input_obj in group_datasets.Input:
    for (name, _), obj in GetSources().items():
        if obj == input_obj:
            print name
             break
However, this refers to the Paraview proxies, not the underlying VTK objects which you get in a programmable filter. If you just need to see which points come from different sources, you could use the programmable filter right after the Group Dataset filter and iterate over the vtkMultiBlockDataSet yourself and add a point array to each block containing index of the block. Perhaps not the best solution, but it could work
NadineHS likes this.
__________________
Lead software developer at ENGINN EFFECT
tkarabela is offline   Reply With Quote

Old   February 9, 2019, 16:41
Default
  #3
New Member
 
Nadine
Join Date: Jan 2019
Posts: 4
Rep Power: 2
NadineHS is on a distinguished road
Thanks tkarabela!
NadineHS is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[General] selected cells in python programmable filter ufocfd ParaView 3 May 30, 2017 10:05
[General] Programmable Filter - Multiple Inputs - Crash grnahas ParaView 0 April 25, 2017 08:14
[General] Pass variable from programmable filter to Plot Over Line Filter Jack001 ParaView 0 March 29, 2016 13:18
[General] Python Programmable vtkImageData joshuawd ParaView 6 August 18, 2014 16:08
[General] Programmable Filter: when multiple inputs, how to verify which input is which? macfly ParaView 0 July 12, 2014 11:14


All times are GMT -4. The time now is 18:28.