[vtkusers] vtkAssignAttribute for Java

Jeff Lee jeff at cdnorthamerica.com
Thu Jan 20 15:29:38 EST 2005

Ed Stewart wrote:

>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
I think you first need to add the sc array to your surfPolyData.

after that, I don't think you need assignAttribute at all.  just point
the mapper at that array

if you need to use assignAttribute, you still need to add the data array
to the dataset before assignAttribute will do anything.  All
assignAttribute is supposed to do is make an already existing array in a
dataset an attribute.

>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,
>This is the private VTK discussion list. 
>Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>Follow this link to subscribe/unsubscribe:

More information about the vtkusers mailing list