Thanks a lot Utkarsh !<br><br>It works. I was almost there, but I couldn't figure out a way to expose the available interface for each object!<br>
Where am I supposed to look to figure out that CopyStructure(), and NewInstance(), SetBlock() etc ... are functions available ?<br><br>Kind regards,<br>Jacques Papper<br><br><br><div class="gmail_quote">2008/11/13 Utkarsh Ayachit <span dir="ltr"><<a href="mailto:utkarsh.ayachit@kitware.com">utkarsh.ayachit@kitware.com</a>></span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Jacques,<br>
<br>
Couple of ways to solve your problem:<br>
<br>
* Solution One:<br>
If you don't want to deal with the fact that your data is a vtkMultiblockDataSet, apply the "Merge Blocks" filter after each of the "Extract Block" filters and then connect to the "Programmable Filter" to to the output from the "Merge Blocks" and then your current script should work just fine. The "Merge Blocks" will convert the vtkMultiBlockDataSet to a vtkUnstructuredGrid on which your script is applicable.<br>
<br>
* Solution Two:<div class="Ih2E3d"><br>
input0 = self.GetInputDataObject(0,0)<br>
input1 = self.GetInputDataObject(0,1)<br>
output = self.GetOutputDataObject(0)<br>
<br></div>
input0Block0 = input0.GetBlock(0)<br>
input1Block0 = input1.GetBlock(0)<br>
<br>
output.CopyStructure(input0)<br>
outputBlock0 = input0Block0.NewInstance()<br>
outputBlock0.CopyStructure(input0Block0)<br>
output.SetBlock(0, outputBlock0)<br>
<br>
outputBlock0.GetPointData().AddArray(input0Block0.GetPointData().GetArray("pressure1"))<br>
outputBlock0.GetPointData().AddArray(input1Block0.GetPointData().GetArray("pressure2"))<br>
<br>
The above script will work if you are extracting a single block using the Extract Block filter. If you want to merge arrays for all the blocks in the input you'll have to iterate over the datasets in the vtkMultiblockDataset. Take a look at<br>
<a href="http://www.paraview.org/Wiki/Python_Programmable_Filter#Dealing_with_Composite_Datasets" target="_blank">http://www.paraview.org/Wiki/Python_Programmable_Filter#Dealing_with_Composite_Datasets</a><br>
<br>
Utkarsh<br>
<br>
<br>
Jacques Papper wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="Ih2E3d">
Here is what I am doing at the moment.<br>
-Load geometry 1<br>
-Extract wing block<br>
<br>
-Load geometry 2<br>
-Extract wing block<br>
<br>
Then use the resample filter with wing1 as input and wing2 as source<br>
(this works)<br>
<br>
The last bit is missing (that is merging the data from wing2 with the resampled data)<br>
<br>
Jacques<br>
<br></div>
2008/11/13 Berk Geveci <<a href="mailto:berk.geveci@kitware.com" target="_blank">berk.geveci@kitware.com</a> <mailto:<a href="mailto:berk.geveci@kitware.com" target="_blank">berk.geveci@kitware.com</a>>><div class="Ih2E3d">
<br>
<br>
Programmable filter can still be made to work. Do the datasets have<br>
multiple parts? I am not sure how resampling would work with multiple<br>
parts. It is impossible to guess which parts map to which parts...<br>
<br>
-berk<br>
<br>
On Thu, Nov 13, 2008 at 8:28 AM, Jacques Papper<br></div><div class="Ih2E3d">
<<a href="mailto:jacques.papper@gmail.com" target="_blank">jacques.papper@gmail.com</a> <mailto:<a href="mailto:jacques.papper@gmail.com" target="_blank">jacques.papper@gmail.com</a>>> wrote:<br>
> They are multi-block datasets from Ensight Reader.<br>
> Is there another way of dealing with this then ?<br>
> Jacques<br>
><br>
> 2008/11/13 Berk Geveci <<a href="mailto:berk.geveci@kitware.com" target="_blank">berk.geveci@kitware.com</a><br></div>
<mailto:<a href="mailto:berk.geveci@kitware.com" target="_blank">berk.geveci@kitware.com</a>>><div class="Ih2E3d"><br>
>><br>
>> Are the inputs multi-block datasets by any chance?<br>
>><br>
>><br>
>> -berk<br>
>><br>
>> On Thu, Nov 13, 2008 at 6:03 AM, Jacques Papper<br></div><div class="Ih2E3d">
>> <<a href="mailto:jacques.papper@gmail.com" target="_blank">jacques.papper@gmail.com</a> <mailto:<a href="mailto:jacques.papper@gmail.com" target="_blank">jacques.papper@gmail.com</a>>> wrote:<br>
>> > Hi Berk,<br>
>> ><br>
>> > I am trying out your suggestion of merging arrays :<br>
>> ><br>
>> > input0 = self.GetInputDataObject(0,0)<br>
>> > input1 = self.GetInputDataObject(0,1)<br>
>> > output = self.GetOutputDataObject(0)<br>
>> ><br>
>> ><br>
output.GetPointData().AddArray(input0.GetPointData().GetArray("pressure1"))<br>
>> ><br>
>> ><br>
output.GetPointData().AddArray(input1.GetPointData().GetArray("pressure2"))<br>
>> ><br>
>> > but I get the following error message :<br>
>> ><br>
>> > File "<string>", line 2, in <module><br>
>> > File "<string>", line 4, in RequestData<br>
>> > AttributeError: GetPointData<br>
>> ><br>
>> > I also tried just using the programmable filter on one source<br>
and with<br>
>> > the<br>
>> > following code, and I get the same error :<br>
>> ><br>
>> > input0=self.GetInputDataObject(0,0)<br>
>> > input0.GetPointData()<br>
>> ><br>
>> > I am using version 3.4.0<br>
>> ><br>
>> > _______________________________________________<br>
>> > ParaView mailing list<br></div>
>> > <a href="mailto:ParaView@paraview.org" target="_blank">ParaView@paraview.org</a> <mailto:<a href="mailto:ParaView@paraview.org" target="_blank">ParaView@paraview.org</a>><div class="Ih2E3d"><br>
>> > <a href="http://www.paraview.org/mailman/listinfo/paraview" target="_blank">http://www.paraview.org/mailman/listinfo/paraview</a><br>
>> ><br>
>> ><br>
><br>
><br>
<br>
<br>
<br></div>
------------------------------------------------------------------------<div class="Ih2E3d"><br>
<br>
_______________________________________________<br>
ParaView mailing list<br>
<a href="mailto:ParaView@paraview.org" target="_blank">ParaView@paraview.org</a><br>
<a href="http://www.paraview.org/mailman/listinfo/paraview" target="_blank">http://www.paraview.org/mailman/listinfo/paraview</a><br>
</div></blockquote>
</blockquote></div><br>