Hi all,

I am using Linux and last csv version of Paraview (3.7)
I have 2 Pyphon script which animate a cylinder either with or without scalar 
opacity.
When I use "pvserver" on one CPU, both work well.
If I use "mpirun -np 4 pvserver" to work on four cpu, I saw a color problem 
when I use script with scalar opacity.
I don't understand why.

I link the scipts in my email.
Thanks in advance for your kind help.

Regards, 
Jona


from paraview.simple import *
Connect('localhost')

reader = servermanager.sources.LegacyVTKReader(FileNames='wavelet.vtk')

Show(reader)

dp = GetDisplayProperties(reader)

# Create LUT
dp.LookupTable = MakeBlueToRedLT(37.35, 276)

# Set array to color by
dp.ColorAttributeType = 'POINT_DATA'
dp.ColorArrayName = 'RTData'

dp.Representation = 'Volume'
Render()

camera = GetActiveCamera()
camera.Elevation(25)


#ResetCamera()

# find view object
view = GetActiveView()

# Create an animation scene
scene = servermanager.animation.AnimationScene()

# Add the view to the scene
scene.ViewModules = [view]

# Set the number of frame in one loop.
scene.NumberOfFrames = 100


# Create an animation cue for the camera. This represents the "track" shown in cuethe Animation View.
cue = servermanager.animation.CameraAnimationCue()
cue.AnimatedProxy = [view]

# Add this cue to the scene.
scene.Cues = [cue]

# Now create keyframes. Let's say we are going to orbit around the object.
camera = view.GetActiveCamera()
num_of_keyframes = 10
listKeyframe = []
for i in range(0, num_of_keyframes):
    camera.Azimuth(360.0/num_of_keyframes)
    keyframe = servermanager.animation.CameraKeyFrame()
    # set the value of the key frame to the current camera location.
    keyframe.KeyTime = i*1.0/num_of_keyframes
    keyframe.Position = camera.GetPosition()
    keyframe.FocalPoint = camera.GetFocalPoint()
    keyframe.ViewUp = camera.GetViewUp()
    keyframe.ViewAngle = camera.GetViewAngle()
    listKeyframe.append(keyframe)

#cue.KeyFrames.append(keyframe) because 'append' don't exist for this object
cue.KeyFrames = listKeyframe

# Play the animation
scene.Play()
from paraview.simple import *
Connect('localhost')

reader = servermanager.sources.LegacyVTKReader(FileNames='wavelet.vtk')

Show(reader)

dp = GetDisplayProperties(reader)

# Create LUT
dp.LookupTable = MakeBlueToRedLT(37.35, 276)

# Set array to color by
dp.ColorAttributeType = 'POINT_DATA'
dp.ColorArrayName = 'RTData'

#dp.Representation = 'Volume'
#Render()

# Register PiecewiseFunction if not already available.
if not "PiecewiseFunction" in dir(servermanager.rendering):
  servermanager.createModule("piecewise_functions", servermanager.rendering)

# Setup opacity function
opacity_func = servermanager.rendering.PiecewiseFunction()
opacity_func.Points = [37.35, 0, 276.82, 0.5]
dp.ScalarOpacityFunction = opacity_func

dp.Representation = 'Volume'
Render()

camera = GetActiveCamera()
camera.Elevation(25)


#ResetCamera()

# find view object
view = GetActiveView()

# Create an animation scene
scene = servermanager.animation.AnimationScene()

# Add the view to the scene
scene.ViewModules = [view]

# Set the number of frame in one loop.
scene.NumberOfFrames = 100


# Create an animation cue for the camera. This represents the "track" shown in cuethe Animation View.
cue = servermanager.animation.CameraAnimationCue()
cue.AnimatedProxy = [view]

# Add this cue to the scene.
scene.Cues = [cue]

# Now create keyframes. Let's say we are going to orbit around the object.
camera = view.GetActiveCamera()
num_of_keyframes = 10
listKeyframe = []
for i in range(0, num_of_keyframes):
    camera.Azimuth(360.0/num_of_keyframes)
    keyframe = servermanager.animation.CameraKeyFrame()
    # set the value of the key frame to the current camera location.
    keyframe.KeyTime = i*1.0/num_of_keyframes
    keyframe.Position = camera.GetPosition()
    keyframe.FocalPoint = camera.GetFocalPoint()
    keyframe.ViewUp = camera.GetViewUp()
    keyframe.ViewAngle = camera.GetViewAngle()
    listKeyframe.append(keyframe)

#cue.KeyFrames.append(keyframe) because 'append' don't exist for this object
cue.KeyFrames = listKeyframe

# Play the animation
scene.Play()

_______________________________________________
Powered by 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

Follow this link to subscribe/unsubscribe:
http://www.paraview.org/mailman/listinfo/paraview

Reply via email to