[Paraview] Programmable filter - input data and output data
Crepier, Pierre
P.Crepier at marin.nl
Mon Jan 16 11:16:36 EST 2017
I tried with 5.1.2 and 5.2.0-98-g5cacbab and both hang when I press Update.
I copied-pasted the script from the previous e-mail.
Thanks,
Pierre
ir. Pierre Crepier | Project Manager Ships | CFD
MARIN | T +31 317 49 34 75 | P.Crepier at marin.nl<mailto:P.Crepier at marin.nl> | www.marin.nl<http://www.marin.nl>
[LinkedIn]<https://www.linkedin.com/company/marin> [YouTube] <http://www.youtube.com/marinmultimedia> [Twitter] <https://twitter.com/MARIN_nieuws> [Facebook] <https://www.facebook.com/marin.wageningen>
MARIN news: Vliegende boten bij strijd om snelste zeiljacht<http://www.marin.nl/web/News/News-items/Vliegende-boten-bij-strijd-om-snelste-zeiljacht-1.htm>
From: Cory Quammen [mailto:cory.quammen at kitware.com]
Sent: Monday, January 16, 2017 4:33 PM
To: Crepier, Pierre
Cc: paraview at paraview.org
Subject: Re: [Paraview] Programmable filter - input data and output data
Hmm, that's odd. Does it make a difference if you do things in the following order:
* Add Programmable Filter
* Change the output type to vtkUnstructuredGrid
* Paste in script
* Hit Apply now, but only after the first steps have been completed
I recall that there is some funny behavior if you apply the filter and then change the output data type, so my guess is to make sure the output data type is set before applying.
Thanks,
Cory
On Fri, Jan 13, 2017 at 10:36 AM, Crepier, Pierre <P.Crepier at marin.nl<mailto:P.Crepier at marin.nl>> wrote:
Cory,
Thanks for your quick answer and clarifying the context.
So if I try to reproduce the behaviour of the clip filter, I would do:
import vtk
input = self.GetInputDataObject(0, 0)
plane = vtk.vtkPlane()
plane.SetOrigin(-4.0, 0.0, 0.0)
plane.SetNormal(1.0, 0.0, 0.0)
xMin = vtk.vtkClipDataSet()
xMin.SetClipFunction(plane)
xMin.SetInputData(input)
xMin.Update()
self.GetOutput().ShallowCopy(xMin.GetOutput())
I changed to the “Output Data Set Type” to vtkUnstructuredGrid.
I tried but paraview stops responding ...
Where am I doing something wrong ? and what am I doing wrong ?
Thanks,
Pierre
ir. Pierre Crepier | Project Manager Ships | CFD
MARIN | T +31 317 49 34 75<tel:+31%20317%20493%20475> | P.Crepier at marin.nl<mailto:P.Crepier at marin.nl> | www.marin.nl<http://www.marin.nl>
[LinkedIn]<https://www.linkedin.com/company/marin> [YouTube] <http://www.youtube.com/marinmultimedia> [Twitter] <https://twitter.com/MARIN_nieuws> [Facebook] <https://www.facebook.com/marin.wageningen>
MARIN news: Few places left for Offshore and Ship hydrodynamics courses<http://www.marin.nl/web/News/News-items/Few-places-left-for-Offshore-and-Ship-hydrodynamics-courses.htm>
From: Cory Quammen [mailto:cory.quammen at kitware.com<mailto:cory.quammen at kitware.com>]
Sent: Wednesday, January 11, 2017 3:33 PM
To: Crepier, Pierre
Cc: paraview at paraview.org<mailto:paraview at paraview.org>
Subject: Re: [Paraview] Programmable filter - input data and output data
Pierre,
First thing first. The code inside the Programmable Filter script runs in a context in which it is aware of VTK only and not ParaView, so you cannot use paraview.simple module functions such as Clip. Instead, you would need to use a VTK-equivalent. In this case, you would use vtkClipDataSet:
import vtk
plane = vtk.vtkPlane()
plane.SetOrigin(-4.0, 0.0, 0.0)
plane.SetNormal(1.0, 1.0, 1.0)
clip = vtk.vtkClipDataSet()
clip.SetClipFunction(plane)
clip.SetInputData(input)
clip.Update()
Next, to use the output of the clip filter as the output of the Programmable Filter, do the following.
self.GetOutput().ShallowCopy(clip.GetOutput())
Make sure you change the Output Data Set Type to vtkUnstructuredGrid if you go this way.
Hope that helps,
Cory
On Wed, Jan 11, 2017 at 8:49 AM, Crepier, Pierre <P.Crepier at marin.nl<mailto:P.Crepier at marin.nl>> wrote:
Hi everyone,
I am trying to use the programmable filter to combine multiple filters. Sort of like the custom filter but I want to have control over some of the properties using user input.
If I understood correctly, I can get the input data with:
input = self.GetInputDataObject(0, 0)
then I can use this input in a filter:
xMin = Clip(Input=input)
xMin.ClipType = 'Plane'
xMin.Crinkleclip = 1
xMin.ClipType.Origin = [-4.0, 0.0, 0.0]
xMin.ClipType.Normal = [1.0, 0.0, 0.0]
Now, how can I use the output of this filter as output of my programmable filter ?
Thanks in advance,
Pierre
ir. Pierre Crepier | Project Manager Ships | CFD
MARIN | T +31 317 49 34 75<tel:+31%20317%20493%20475> | P.Crepier at marin.nl<mailto:P.Crepier at marin.nl> | www.marin.nl<http://www.marin.nl>
[LinkedIn]<https://www.linkedin.com/company/marin> [YouTube] <http://www.youtube.com/marinmultimedia> [Twitter] <https://twitter.com/MARIN_nieuws> [Facebook] <https://www.facebook.com/marin.wageningen>
MARIN news: Modelling natural transition on hydrofoils for application in underwater gliders<http://www.marin.nl/web/News/News-items/Modelling-natural-transition-on-hydrofoils-for-application-in-underwater-gliders-1.htm>
_______________________________________________
Powered by www.kitware.com<http://www.kitware.com>
Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView
Search the list archives at: http://markmail.org/search/?q=ParaView
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/paraview
--
Cory Quammen
Staff R&D Engineer
Kitware, Inc.
--
Cory Quammen
Staff R&D Engineer
Kitware, Inc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview/attachments/20170116/404547c5/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 293 bytes
Desc: image001.png
URL: <http://public.kitware.com/pipermail/paraview/attachments/20170116/404547c5/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.png
Type: image/png
Size: 331 bytes
Desc: image002.png
URL: <http://public.kitware.com/pipermail/paraview/attachments/20170116/404547c5/attachment-0001.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image003.png
Type: image/png
Size: 333 bytes
Desc: image003.png
URL: <http://public.kitware.com/pipermail/paraview/attachments/20170116/404547c5/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image004.png
Type: image/png
Size: 253 bytes
Desc: image004.png
URL: <http://public.kitware.com/pipermail/paraview/attachments/20170116/404547c5/attachment-0003.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image1e8391.PNG
Type: image/png
Size: 293 bytes
Desc: image1e8391.PNG
URL: <http://public.kitware.com/pipermail/paraview/attachments/20170116/404547c5/attachment-0004.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: imageef2fda.PNG
Type: image/png
Size: 331 bytes
Desc: imageef2fda.PNG
URL: <http://public.kitware.com/pipermail/paraview/attachments/20170116/404547c5/attachment-0005.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: imagea27a96.PNG
Type: image/png
Size: 333 bytes
Desc: imagea27a96.PNG
URL: <http://public.kitware.com/pipermail/paraview/attachments/20170116/404547c5/attachment-0006.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: imageba945c.PNG
Type: image/png
Size: 253 bytes
Desc: imageba945c.PNG
URL: <http://public.kitware.com/pipermail/paraview/attachments/20170116/404547c5/attachment-0007.png>
More information about the ParaView
mailing list