[vtkusers] Again, I am doing something wrong. (Mace.cxx)
Berk Geveci
berkgeveci at hotmail.com
Tue Jan 22 10:06:29 EST 2002
Here is what happens: you get the input of the glyph
filter and add a scalars array to it. This input is
also the output of another source (in this case, a
sphere source, as far as I can see). When the pipeline
executes, sphere source initializes it's output before
generating data and pufff your scalars are gone.
Whatever you do, sphere source will initialize it's
output everytime it runs. The simplest solution is this:
Create a sphere source
Update it
Get it's output and severe it from the source
(with SetOutput(NULL);)
Add your scalars
There other ways of doing this (some of which allow you
to keep the source in the pipeline), if you want more hints,
let me know.
-Berk
>From: "Nick Edgington" <OutOfTurn at Yahoo.com>
>To: <vtkusers at public.kitware.com>
>Subject: [vtkusers] Again, I am doing something wrong. (Mace.cxx)
>Date: Tue, 22 Jan 2002 09:05:45 -0500
>
> I am using Vtk40 under winnt.
>
> I attach a scalar to a vtkGlyph3D
>
>
>main(){
>...........................
> scalars = vtkFloatArray::New();
>
>
> scalars->InsertTuple1(0, .5);
> scalars->InsertTuple1(1, .5);
> scalars->InsertTuple1(2, 1);
> scalars->InsertTuple1(3, 0);
> scalars->InsertTuple1(4, 1);
> scalars->InsertTuple1(5, 0);
>
> ............
> vtkDataSet *input = glyph->GetInput();
> vtkPointData * pd = input->GetPointData();
> pd->SetScalars(scalars);
>}
>
>When I trace through
>
>void vtkGlyph3D::Execute()
>{
>
> ...........
>
> pd->GetScalars(); <<<<<=== returns NULL
> <<<<< === because
>this->GetAttribute(SCALARS); returns -1
> <<<<<=== even thought it was
>originally set to 0 by the pd->SetScalars(scalars);
>
>I can force it to work by changing the flag myself.
>
> Thanks in advance
> Nick Edgington
>
>
>
>_________________________________________________________
>Do You Yahoo!?
>Get your free @yahoo.com address at http://mail.yahoo.com
>
>_______________________________________________
>This is the private VTK discussion list.
>Please keep messages on-topic. Check the FAQ at:
><http://public.kitware.com/cgi-bin/vtkfaq>
>Follow this link to subscribe/unsubscribe:
>http://public.kitware.com/mailman/listinfo/vtkusers
_________________________________________________________________
Join the worlds largest e-mail service with MSN Hotmail.
http://www.hotmail.com
More information about the vtkusers
mailing list