[Paraview] using with python to make a clip
BOUSSOIR Jonathan 167706
Jonathan.BOUSSOIR at cea.fr
Tue May 19 06:17:13 EDT 2009
Hi all,
I am using Linux and Paraview 3.4 or 3.5. I have one question how I can do clipping on a sphere with Python and Paraview.
I made a very simple geometry and tried to do add a clipping. But, I dont manage to see the clip on the view rendering.
There my script belong, if someone can help me to understand where is my bug.
I am new to paraview, please let me know if I asked any inappropriate questions. Thanks in advance for your kind help.
Regards,
Jona
#!/usr/bin/python
# -*- coding: latin-1 -*-
from paraview import servermanager
connection = servermanager.Connect('localhost')
sphere = servermanager.sources.SphereSource(PhiResolution=20, ThetaResolution=20, Radius=0.5, Center=[0, 0, 0])
view = servermanager.CreateRenderView()
rep = servermanager.CreateRepresentation(sphere, view)
rep.Representation = 2 #Surface mode
view.ResetCamera()
view.StillRender() #I can see the sphere
# Create the clip filter
clipper = servermanager.filters.Clip(Input=sphere)
# Create the implicit plane that is used to define the
# clip function
plane = servermanager.implicit_functions.Plane()
plane.Normal = [1.0, 0.0, 0.0]
# Assign the clip function
clipper.ClipFunction = plane
rep = servermanager.CreateRepresentation(clipper, view)
# Reset camera and render
view.StillRender()
view.ResetCamera()
view.StillRender() #I can't see clipping on the sphere :(
More information about the ParaView
mailing list