[vtkusers] Coloring PolyDatas depending on various (externally computed) values

Arnaud GELAS arnaud_gelas at hms.harvard.edu
Tue Oct 26 10:40:46 EDT 2010


  On 10/26/2010 10:37 AM, David Doria wrote:
>
>     I have tried to set a color (see attached code), but I still need
>     to remove the active scalar array ?
>
>     Arnaud
>
>
> What you've done there is correct.
>
> A couple of comments:
>
>       sphere->GetCellData()->SetScalars( data );
>       sphere->GetCellData()->SetActiveScalars( "data" );
>
> I believe The second line is redundant. Setting the scalars 
> automatically sets that array to active.
>
> That is:
>
>       sphere->GetCellData()->SetScalars( data );
>
> is equivalent to:
>
>       sphere->GetCellData()->AddArray(data );
>       sphere->GetCellData()->SetActiveScalars( "data" );
>
> Also,
>
>       sphere->GetCellData()->SetActiveScalars( "" );
>
> and this:
>
>       sphere->GetCellData()->SetActiveScalars(NULL);
>
> I believe do the same thing. In your program, calling either of them 
> turns off the coloring by 'data'. The color that is displayed is the 
> SetColor(t,t,t) (which is what I think you want no?).
>
> Last thing - the preferred method of connecting filters is:
>
> mapper->SetInputConnection( sphere->GetOutputPort() );
>
> rather than
>
> mapper->SetInput( sphere );
>
> If I am still missing your problem, please let me know.
>
> David
David,

I just wanted a confirmation and I got it!!!

Thanks for your help, and I will contribute this code on the example wiki.

Best,
Arnaud
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20101026/f74d2111/attachment.htm>


More information about the vtkusers mailing list