[vtkusers] What's wrong with my script?

Charles Boivin Charles.Boivin at rwdiwest.com
Tue Oct 19 14:35:56 EDT 2004


Hi Sonam,

I am no VTK expert, but here is where I think the source of your
problem is:

Look at:

vtkContourFilter cf
  cf SetInput  [$octreeSource GetOutput]
  cf SetValue 0 0
 
and:

vtkContourFilter cf2
  cf2 SetInput  [$octreeSource GetOutput]
  cf2 SetValue 0 0


You set the input of both cf and cf2 to the output of octreeSource.
That output is a pointer. By calling octreeSource->SetScalarsName(), you
change the values that are referenced by that pointer, but the pointer
itself does *not* change. Are both contours of the second scalar? If
that is the case, it confirms what I was thinking... Basically, the
contour filter does not store which scalar is active when you make a
call to its SetInput. It simply copies the pointer, and will do the
actual contouring on the active scalar at the moment it is computed
(which, presumably, will be at the same time for both contour filters).

The way I've handled this (on both structured and unstructured grids),
is by writing a filter that extracts a single array out of multiple
ones. By using, say two, "extraction" modules, each of their GetOutput()
*is* different, and I can then display separate values. Now, this might
not be the most efficient way to do things, but this module actually
does a few more things for me, so that's the way I have done things.

Hope this helps,

Charles Boivin

>>> s comp <sscomp2004 at yahoo.com.au> 10/19/04 11:32am >>>
Hi all,
 
any help would be appreciated.
 
The relevant section is shown below
I am trying to contour two different sets of scalar point attributes,
stored on the same grid, but it always produces 2 contours of the one
set of scalar data (In this case since both isovalues are the same just
the one contour is seen)
 
Thanks,
 
sonam
 
$octreeSource SetScalarsName "psf1"
$octreeSource Update
 
vtkContourFilter cf
  cf SetInput  [$octreeSource GetOutput]
  cf SetValue 0 0
 vtkPolyDataMapper contoursMapper
  contoursMapper SetInput [cf GetOutput]
 vtkActor contours
  contours SetMapper contoursMapper
 
$octreeSource SetScalarsName "psf2"
$octreeSource Update


vtkContourFilter cf2
  cf2 SetInput  [$octreeSource GetOutput]
  cf2 SetValue 0 0
 vtkPolyDataMapper contoursMapper2
  contoursMapper2 SetInput [cf2 GetOutput]
 vtkActor contours2
  contours2 SetMapper contoursMapper2

  



---------------------------------
Find local movie times and trailers on Yahoo! Movies.




More information about the vtkusers mailing list