Getting the total number of blocks

Hello All,

I want to know how to get the total number of blocks in my file (in Exodus format) by using python .

Thank you in advance.

Hi @Echo



Thanks you very much! @mwestphal

Another question: I notice that when i open my file in GUI, the ‘trace’ of the python script in paraview automatically shows the following form:

File= IOSSReader(registrationName=File, FileName=filePath)
File.ElementBlocks = ['block_1', 'block_2', 'block_6', 'block_7', 'block_11', 'block_12', 'block_16']
File.NodeBlockFields = ['disp', 'temp']
File.ElementBlockFields = ['vonmises']
File.NodeSets = []
File.SideSets = []

Based on my understanding, first line represents opening the file, and the second line represents selecting the blocks.
However, if there are a large number of blocks and i want to write the python script by myself to open the file and selecting all blocks, it could be annoying to write all block names one by one.
Is there any command i can use to import my file and selcting all blocks more simply?


Thanks a lot for your reply. I am new to Paraview, i want to know where i can find these valid commands and their usages. I searched the Paraview Tutorial, but it seems only a few available python commands are introduced.

Also, in the Python Shell, if you press Tab, you get an autocompletion menu.

1 Like

@mwestphal Thanks very much for you kindly and patiently help! :smiley:

1 Like