[vtkusers] vtkAssignAttribute for Java

Ed Stewart estewart at vni.com
Thu Jan 20 15:08:55 EST 2005


I'm having a bit of trouble getting vtkAssignAttribute working in Java.
I have a vtkPolyData object that I'd like to shade with a set of scalar
values. I've created a vtkDoubleArray to hold those values and then I'm
doing the following:

//sc is the vtkDoubleArray that has been filled up with scalar values
vtkAssignAttribute aa = new vtkAssignAttribute();
aa.SetInput(surfPolyData);	//surfPolyData is my vtkPolyData object
to be shaded
aa.Assign("foo",0,0);		//enums are used for SCALARS and
aa.Update();			//I don't think this is needed

//I then create a vtkLookupTable lut to hold the shading colors

vtkPolyDataNormals surfNormas = new vtkPolyDataNormals();
vtkPolyDataMapper surfMapper = new vtkPolyDataMapper();
surfMapper.SetScalarRange(0.0, 255.0);
vtkActor surfActor = new vtkActor();

The problem of course is that this doesn't change the surface at all. I
suspect the aa.Assign("foo",0,0) line is to blame as I don't see how it
can make the connection back to the vtkDataArray object that I've named

Can anyone confirm that I am coding this correctly?

Thank you,

More information about the vtkusers mailing list