[Paraview] Cutting With Python

Utkarsh Ayachit utkarsh.ayachit at kitware.com
Fri Feb 29 09:18:47 EST 2008


The problem with your code is that you are connecting a vtk object (the
vtkPlane) directly to a proxy (the Cut filter). To create a plane proxy
refer to Robert's link. Here's the script updated to the current CVS (
servermanager.createModule() is now directly accessible):

implicit_functions = servermanager.createModule("implicit_functions")
plane1 = implicit_functions.Plane()
plane1.Normal = [1, 0, 0]

cutfunc = servermanager.filters.Cut(Input=cube1)
cutfunc.CutFunction = plane1
cutfunc.ContourValues = [1.0,2.5]


Utkarsh

On 2/28/08, Robert Maynard <robertjmaynard at gmail.com> wrote:
>
> This is most likely your best bet:
> http://public.kitware.com/pipermail/paraview/2008-February/006831.html
>
>
> Kent Eschenberg wrote:
> > To make a simple cut it seems like I need the following. I left out
> > all the rest to make this post as short as possible.
> >
> > ==============================================
> > from paraview import servermanager
> > servermanager.Connect()
> > cutF = servermanager.vtk.vtkPlane()
> > cut = servermanager.filters.Cut()
> > cut.CutFunction = cutF
> > ==============================================
> >
> > But here's what pvbatch says. I deleted the path up to the build
> > directory (mpi).
> >
> > ==============================================
> > Traceback (most recent call last):
> >   File "t4.py", line 5, in ?
> >     cut.CutFunction = cutF
> >   File "/mpi/Utilities/VTKPythonWrapping/paraview/servermanager.py",
> > line 1488, in setProperty
> >     return self.SetPropertyWithName(propName, value)
> >   File "/mpi/Utilities/VTKPythonWrapping/paraview/servermanager.py",
> > line 163, in SetPropertyWithName
> >     prop.SetData(arg)
> >   File "/mpi/Utilities/VTKPythonWrapping/paraview/servermanager.py",
> > line 487, in SetData
> >     self.SMProperty.AddProxy(value_proxy)
> > TypeError: function takes exactly 2 arguments (1 given)
> > ==============================================
> >
> > Using 3.2.1 on CentOS 5. Any ideas?
> >
> > TIA!
> > Kent
> > Pittsburgh Supercomputing Center
> > _______________________________________________
> > ParaView mailing list
> > ParaView at paraview.org
> > http://www.paraview.org/mailman/listinfo/paraview
> _______________________________________________
> ParaView mailing list
> ParaView at paraview.org
> http://www.paraview.org/mailman/listinfo/paraview
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/paraview/attachments/20080229/58a9a4b3/attachment.html


More information about the ParaView mailing list