0

I have a scrip that is to visualize a object and I need to animate it. But I am using a TVTK Polydata object, and it seems I cannot change the scalar variable of the Polydata using the mlab_source technique.

Please let me know how can I animate this by changing the scalar for PolyData. Thanks

def polydata(pointsList, triangleList, scalars):
    points = numpy.array(pointsList, 'f')
    triangles = numpy.array(triangleList)
    mesh = tvtk.PolyData(points=points, polys=triangles)
    mesh.point_data.scalars = scalars
    mesh.point_data.scalars.name = 'scalars'
    return mesh 

def view(dataset):
    fig = mlab.figure(bgcolor=(1, 1, 1), fgcolor=(0, 0, 0),
    figure=dataset.class_name[3:])
    m_surf = mlab.pipeline.surface(dataset, opacity=1)
    return m_surf

m_surf = view(polydata(pointsList, triangleList, FMRIValues_norm[0]))
ms = m_surf.mlab_source #Gives the error. 
ssm
  • 620
  • 6
  • 24
  • I succeeded by using the traingular_mesh. – ssm Sep 19 '14 at 21:06
  • Partial duplicate of http://stackoverflow.com/questions/24022204/change-mlab-quiver3d-surf-data-sources-without-clearing-figure-in-traits-scrip/24048842#24048842 – aestrivex Sep 22 '14 at 14:23
  • Hi can you please tell me how you can set the scalar in polydata object. I succeeded using a triangular mesh for a regular 3d mesh but now I have another mesh which has irregular vertices. So I have to use polydata objects. But how can I set its scalar which animating. – ssm Sep 24 '14 at 17:17
  • `mesh.dataset.point_data.scalars = newvals` – aestrivex Sep 25 '14 at 17:26
  • Hi, thanks I succeeded in using that but the animation update only when i click on the scene. It doesnt update automatically as it did with the triangular mesh. Do you have any idea why? Thanks a lot again. – ssm Sep 26 '14 at 12:42
  • Please post the code for the entire program that reproduces the problem with the animation not working. – aestrivex Sep 30 '14 at 16:15

0 Answers0