<div dir="ltr"><div><div>Dennis,<br><br></div>Given those block names, I think I know what you are missing. It is possible for a block to be a vtkMultiBlockDataSet itself, in which case you would need to get the block with mbi.GetBlock(0) and then do another loop over the blocks in that one to look at the block names. A quick way to check this is to look at the Information panel in ParaView. The tree there reflects the tree in the data and each node you can expand is a vtkMultiBlockDataSet (or other composite dataset type, but that one is the most common).<br><br></div>Shawn</div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Aug 31, 2015 at 10:40 AM, Dennis Conklin <span dir="ltr"><<a href="mailto:dennis_conklin@goodyear.com" target="_blank">dennis_conklin@goodyear.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div link="blue" vlink="purple" lang="EN-US">
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">Shawn,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">Ok, I’m dense.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">When I run your code inside the Programmable Filter, I see some confusing things:<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">mbi.GetNumberOfBlocks returns 8, which is NOT the number of blocks in my model but IS the number of MetaData blocks.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">The mbi.GetMetaData[i].Get(<a href="http://vtk.vtkCompositeDataSet.NAME" target="_blank">vtk.vtkCompositeDataSet.NAME</a>()) then is<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">Value of i Name<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">0 Element Blocks<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">1 Face Blocks<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">2 Edge Blocks<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">3 Element Sets<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">4 Side Sets<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">5 Face Sets<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">6 Edge Sets<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">7 Node Sets<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">8 <out of range><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">I am poking around mbi.GetMetaData[0] (Element Blocks) but I still haven’t found any Block Names there. I feel like I am completely missing something here,
but I have no idea what it is.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">Dennis<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> Shawn Waldon [mailto:<a href="mailto:shawn.waldon@kitware.com" target="_blank">shawn.waldon@kitware.com</a>]
<br>
<b>Sent:</b> Monday, August 31, 2015 9:46 AM<span class=""><br>
<b>To:</b> Dennis Conklin<br>
<b>Cc:</b> Paraview (<a href="mailto:paraview@paraview.org" target="_blank">paraview@paraview.org</a>)<br>
</span><b>Subject:</b> Re: [EXT] Re: [Paraview] Exodus Block Names<u></u><u></u></span></p><div><div class="h5">
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">Hi Dennis,<u></u><u></u></p>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt">The metadata is on the reader's output, which is a vtkMultiBlockDataSet. reader.GetOutput() should get you the dataset in your python script. Inside the programmable filter you will need to get the input dataset
(self.GetInput() should get you the input dataset and self.GetOutput() should get you the output dataset). So something like the following for your programmable filter:<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">mbi = self.GetInput()<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">mbo = self.GetOutput()<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">mbo.ShallowCopy(mbi)<br>
<br>
for i in range(mbo.GetNumberOfBlocks()):<br>
metadata = mbo.GetMetaData(i)<br>
name = metadata.Get(<a href="http://vtk.vtkCompositeDataSet.NAME" target="_blank">vtk.vtkCompositeDataSet.NAME</a>())<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> # do something with the name<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<p class="MsoNormal">HTH,<u></u><u></u></p>
</div>
<p class="MsoNormal">Shawn<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">On Mon, Aug 31, 2015 at 8:31 AM, Dennis Conklin <<a href="mailto:dennis_conklin@goodyear.com" target="_blank">dennis_conklin@goodyear.com</a>> wrote:<u></u><u></u></p>
<blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">Shawn,</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"> </span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">Thanks for that tip but I can’t seem to access this structure. Really, I need it within the Programmable
Filter, but even when I run a Python script and try to find it directly in an Exodus reader, I can’t seem to locate this metadata.</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"> </span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">If I print dir(ExodusReader), there doesn’t seem to be anything about metadata.</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">Dennis</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"> </span><u></u><u></u></p>
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> Shawn Waldon [mailto:<a href="mailto:shawn.waldon@kitware.com" target="_blank">shawn.waldon@kitware.com</a>]
<br>
<b>Sent:</b> Friday, August 28, 2015 4:44 PM<br>
<b>To:</b> Dennis Conklin<br>
<b>Cc:</b> Paraview (<a href="mailto:paraview@paraview.org" target="_blank">paraview@paraview.org</a>)<br>
<b>Subject:</b> [EXT] Re: [Paraview] Exodus Block Names</span><u></u><u></u></p>
<div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">Hi Dennis,<u></u><u></u></p>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt">The block name is in the block metadata, which is not where I looked the first time either. Here is a code snippet that shows how to access it.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">mb = vtk.vtkMultiBlockDataSet()<br>
...<u></u><u></u></p>
</div>
<p class="MsoNormal">for i in range(mb.GetNumberOfBlocks):<u></u><u></u></p>
</div>
<p class="MsoNormal"> metadata = mb.GetMetaData(i)<u></u><u></u></p>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt"> name = metadata.Get(<a href="http://vtk.vtkCompositeDataSet.NAME" target="_blank">vtk.vtkCompositeDataSet.NAME</a>())<u></u><u></u></p>
</div>
<p class="MsoNormal">HTH,<u></u><u></u></p>
</div>
<p class="MsoNormal">Shawn<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
<div>
<p class="MsoNormal">On Fri, Aug 28, 2015 at 4:13 PM, Dennis Conklin <<a href="mailto:dennis_conklin@goodyear.com" target="_blank">dennis_conklin@goodyear.com</a>> wrote:<u></u><u></u></p>
<blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt">
<div>
<div>
<p class="MsoNormal">All,<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">Once again, I need help. We are starting to assign names to our Exodus blocks (outside of Paraview). This is very useful for ease and clarity of post processing and allows convenient
reference to actual components. The good news is that Paraview seems perfectly happy to read in the Block Names and use them in the Properties Panel and the Multi-block Inspector and the Find Data screen if they exist (no action or programming required for
this). So, for instance, instead of Paraview generating the non-useful name of “Unnamed block ID: 13 Type: hex” when the blockname is empty, it will automagically use the more useful Blockname of “Tread” if that is in the Exodus file.
<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">However, there has been an unintended consequence of this change. If I select some elements and examine them in Spreadsheet View, I see Block Number 14( the +1 offset from Block_ID
and Block Number is NOT the problem!). And now I can no longer associate the element (Block Number 14) with it’s block in the Properties Panel or the Multi-block Inspector or the Find Data panel – where the same block is called “Tread”.<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">So, to remedy this situation I would like to add an element variable of BlockName, which would contain “Tread” for all the elements in BlockID 13, etc., etc. for all the blocks.<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">My only problem is I can’t seem to find the list of Block Names. I’m pretty weak at vtk, so it must be available but I surrender – I can’t seem to find it. If someone can help
me find the list of Block Names from inside the Programmable Filter, I’ll be happy to add the element variable myself.<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">Thanks for any help, again!<u></u><u></u></p>
<p class="MsoNormal"><span style="color:#888888"> </span><u></u><u></u></p>
<p class="MsoNormal"><span style="color:#888888">Dennis</span><u></u><u></u></p>
</div>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">
http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the ParaView Wiki at: <a href="http://paraview.org/Wiki/ParaView" target="_blank">
http://paraview.org/Wiki/ParaView</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=ParaView" target="_blank">
http://markmail.org/search/?q=ParaView</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/paraview" target="_blank">http://public.kitware.com/mailman/listinfo/paraview</a><u></u><u></u></p>
</blockquote>
</div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div></div></div>
</div>
</blockquote></div><br></div>