[vtkusers] unstructured grids color attributes

Paolo Bertolo paolo.bertolo at libero.it
Thu Nov 10 16:26:29 EST 2005


Hi everyone!

I have a very simple question.
I'm converting some big FEM mesh files to *.vtk files, in order to  
post process some output data with PARAVIEW.

As a starting point, I decided to use the very basic and well  
documented legacy VTK ASCII file format.
I convert triangles and rectangles into UNSTRUCTURED_GRID cells.
The point is that I absolutely need to manually set the color  
attributes of each CELL, using the colors of a given palette.
I've tried in different ways to pass Paraview CELL color attributes,  
but none of them seems to work when I load data into Paraview (2.0- 
 >2.4, Windows Linux Mac).
The weird thing is that when I load the same file into MayaVi, the  
color attributes are "correctly" displayed (I mean, I can see a red  
face where I would expect it, a green one where it is supposed to be  
green and so on...).

For example, the file below displays a cube with different colors for  
each side when opened in MayaVi, whereas it displays a uniformly grey  
cube when I open it in Paraview. Using lookup tables it seems I can  
only set the first cell color attributes, but the rest of the cells  
is always grey.

I'm sure there must be some mistake in my code... Has anyone any  
suggestion and, if possible, a demo VTK file to share?

Thanks in advance for your help!

Paolo Bertolo

-------

# vtk DataFile Version 2.0
Cube example
ASCII
DATASET UNSTRUCTURED_GRID
POINTS 8 float
0.0 0.0 0.0
1.0 0.0 0.0
1.0 1.0 0.0
0.0 1.0 0.0
0.0 0.0 1.0
1.0 0.0 1.0
1.0 1.0 1.0
0.0 1.0 1.0

CELLS 6 30
4 0 1 2 3
4 4 5 6 7
4 0 1 5 4
4 2 3 7 6
4 0 4 7 3
4 1 2 6 5

CELL_TYPES 6
9
9
9
9
9
9

CELL_DATA 6
COLOR_SCALARS colors 4
1.0 0.0 0.0 1.0
0.0 1.0 0.0 1.0
0.0 0.0 1.0 1.0
1.0 1.0 0.0 1.0
0.0 1.0 1.0 1.0
1.0 0.0 1.0 1.0



More information about the vtkusers mailing list