[Paraview] Python Cut Problems

Sylvester Gerardson sylvester.gerardson at gmail.com
Thu Mar 20 05:11:32 EDT 2008


Hi Kent,

Can it be that the cut is showing, but is not visible to you because you are
looking at it head on?
When I slightly modify your code (cutFunc.Normal) to the version shown
below, I can see just a sliver of the cut (using pvpython on OpenSUSE 10.3).


Regards,
Sylvester

from paraview import servermanager
servermanager.Connect()
view = servermanager.CreateRenderView()
sphere = servermanager.sources.SphereSource()
sphere.Radius = 1.0
sphere.Center = ( 0.0, 0.0, 0.0 )
repr1 = servermanager.CreateRepresentation( sphere, view )
implFuncModule = servermanager._createModule( "implicit_functions" )
cutFunc = implFuncModule.Plane()
cutFunc.Normal = ( 0.0, 1.0, 1.0 )
cutFunc.Origin = ( 0.0, 0.0, 0.0 )
cut = servermanager.filters.Cut( Input=sphere, CutFunction=cutFunc )
cut.ContourValues = [ 0.0 ]
repr2 = servermanager.CreateRepresentation( cut, view )
repr1.Visibility = 0
view.StillRender()
view.ResetCamera()
view.StillRender()

> -----Original Message-----
> From: paraview-bounces at paraview.org 
> [mailto:paraview-bounces at paraview.org] On Behalf Of Kent Eschenberg
> Sent: Wednesday, March 19, 2008 7:44 PM
> To: ParaView
> Subject: [Paraview] Python Cut Problems
> 
> I cannot seem to get the cut function to work and came up 
> with the simplest test case I could imagine:
> 
> ======
> from paraview import servermanager
> servermanager.Connect()
> implFuncModule = servermanager._createModule( "implicit_functions" )
> sphere = servermanager.sources.SphereSource()
> sphere.Radius = 1.0
> sphere.Center = ( 0.0, 0.0, 0.0 )
> cutFunc = implFuncModule.Plane()
> cutFunc.Normal = ( 0.0, 0.0, 1.0 )
> cutFunc.Origin = ( 0.0, 0.0, 0.0 )
> cut = servermanager.filters.Cut( Input=sphere, CutFunction=cutFunc )
> cut.ContourValues = [ 0.0 ]
> view = servermanager.CreateRenderView()
> if( raw_input("Enter 0/1 for cut/sphere: ") == "0" ):
>     repr = servermanager.CreateRepresentation( cut, view )
> else:
>     repr = servermanager.CreateRepresentation( sphere, view )
> view.StillRender()
> view.ResetCamera()
> view.StillRender()
> reply = raw_input("Do you have a dead parrot? ")
> ======
> 
> The sphere always appears; the cut never does. I'm using 
> pvpython 3.2.1 on CentOS 5. I hope someone can spot what I am 
> doing wrong.
> 
> TIA!
> Kent
> Pittsburgh Supercomputing Center
> _______________________________________________
> ParaView mailing list
> ParaView at paraview.org
> http://www.paraview.org/mailman/listinfo/paraview



More information about the ParaView mailing list