[vtkusers] how to map UnstructuredGrid?

Mathieu Malaterre mathieu.malaterre at kitware.com
Tue Jun 8 09:42:03 EDT 2004


VTK uses forward declaration, you need to include the dataset you want 
to use, in your case:

#include "vtkUnstructuredGrid.h"


HTH
Mathieu

nikhil butala wrote:
> VTKUsers,
>  
>                 I am new to vtk and have a very simple question. I am 
> trying to visualize an UnstructuredGrid using VTK file format. I get the 
> following error:
>  
> Error E2034 C:\groupsinC.cxx 40: Cannot convert 'vtkUnstructuredGrid *' 
> to 'vtkDataSet *' in  function main()
> Error E2342 C:\groupsinC.cxx 40: Type mismatch in parameter 'input' 
> (wanted 'vtkDataSet *',got 'vtkUnstructuredGrid *') in function main()
> *** 2 errors in Compile ***
>  
> Relevant part of my code is as follows:
>  
>  vtkDataSetReader *reader1 = vtkDataSetReader::New();
>  reader1->SetFileName ("C:/hola.vtk");
>  reader1->SetScalarsName("groups");
>  reader1->SetVectorsName("velocity");
> 
>  vtkThreshold *thresh = vtkThreshold::New();
>     thresh->SetAttributeModeToUseCellData();
>     thresh->ThresholdByUpper(1);
>     thresh-> AllScalarsOff();
>     thresh-> SetInput(reader1->GetOutput());
> 
> vtkDataSetMapper *mapper = vtkDataSetMapper::New();
>  mapper->SetInput(thresh->GetOutput() );
>  
> vtkActor *actor = vtkActor::New();
>  actor->SetMapper(mapper);
>  actor->GetProperty()->SetColor(.2, .2, .2);
>  actor->GetProperty()->SetRepresentationToWireframe();
> So I don't know what mapper to use to map Unstructured grid. Can someone 
> help me out?
>  
> Thanking you,
> Yours Sincerely,
> Nikhil Butala
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> 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://www.vtk.org/mailman/listinfo/vtkusers






More information about the vtkusers mailing list