[Paraview] Extracting a block from a vtkMultiBlockDataSet in Paraview (Bug?)

Evan Kao tossin at gmail.com
Wed Nov 25 15:52:48 EST 2015


Hi all,

I had an additional question.  I'd like to convert this script into a
Custom Filter using the python_filter_generator.py script
<http://www.kitware.com/blog/home/post/534>, but this requires the output
type to be set automatically.  Is that possible with the Programmable
Filter, i.e., is it possible to set the output type without manually using
the drop-down menu?

Thanks,
Evan Kao

On Wed, Nov 25, 2015 at 11:35 AM, Evan Kao <tossin at gmail.com> wrote:

> Thanks Jean!  That did the trick.
>
> - Evan
>
> On Wed, Nov 25, 2015 at 12:16 AM, Favre Jean <jfavre at cscs.ch> wrote:
>
>> You are missing a RequestInformation Script to indicate the dimensions of
>> the grid you wish to create.
>>
>> Set the type of the Output Data to "vtkStructuredGrid"
>>
>> you will need, at the minimum, the following two sections of python code
>>
>> in the "Script"
>>
>> mbds = inputs[0]
>>
>> block0 = mbds.GetBlock(0)
>>
>> output.ShallowCopy(block0)
>>
>> (make sure to toggle the Advanced Properties to make the second text
>> input widget to appear, and fill in the "RequestInformation Script" with
>> the following text:
>>
>> executive = self.GetExecutive()
>>
>> outInfo = executive.GetOutputInformation(0)
>>
>> mbds = inputs[0]
>>
>> block0 = mbds.GetBlock(0)
>>
>> dims = block0.GetDimensions()
>>
>> outInfo.Set(executive.WHOLE_EXTENT(), 0, dims[0]-1 , 0, dims[1]-1 , 0, dims[2]-1)
>>
>> ==============
>> That's all!
>>
>> Jean/CSCS
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview/attachments/20151125/8ef07c1e/attachment.html>


More information about the ParaView mailing list