[vtkusers] Converting vtkMultiBlockDataSet into vtkDataObject

David E DeMarle dave.demarle at kitware.com
Thu Oct 11 15:13:45 EDT 2007


Hi Renato,

Use
vtkDataObject *obj = vtkMultiBlockDataSet::GetDataSet(i,j) to get the
i/j'th DataObject out. In your case i and j are probably both 1.

To get the acceptable ranges for i call
int i = vtkMultiBlockDataSet::GetNumberOfBlocks() followed by
int j = vtkMultiBlockDataSet::GetNumberOfDataSets(i) to get the range
of j for each i.

obj->GetClassName() to figure out what the exact class of obj is.
Then use
vtk{InsertClassNameHere} * realobj =
vtk{InsertClassNameHere}::SafeDownCast(obj)
to get access to all of the callable methods.

cheers
Dave DeMarle



On 10/11/07, Renato N. Elias <rnelias at nacad.ufrj.br> wrote:
>
> Hi folks,
>
> I'm facing the following problem:
>
> I'm trying to load an Ensight file and convert it into a VTK XML file. The
> problem is that vtkGenericEnSightReader is treating my file as a
> vtkMultiBlockDataSet, even for a file with only one piece of data (I guess,
> it should not work in this way).
>
> The method of using vtkfile->SetInputConection(reader->GetOutputPort()) does
> not work at all and using vtkfile->SetInput(reader->GetOutput()) return me a
> compilation error message which says:
>
> cannot convert parameter 1 from 'vtkMultiBlockDataSet *' to 'vtkDataObject
> *'
>
> I already tried the forced method of using
> reinterpret_cast<vtkDataObject>(vtkMultiBlockDataSet) but it has not worked
> -- I should confess that I'm just a Fortran (and ex-Object Pascal)
> programmer playing a little bit with C++.
>
> I thought also about using the filter vtkMultiGroupDataExtractDataSets but I
> have no idea how I could use it. It's not on my VTK book (I guess, multi
> block data is a VTK-CVS feature). Ok, I could just simplify my problem using
> previous versions of VTK but in the other hand, I'd like to keep everything
> updated. Any ideas?
>
> Regards
>
> Renato.
>
> p.s.: In fact, I'm trying to overcome a ParaView problem by converting my
> Ensight files into VTK single block data.
>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>



More information about the vtkusers mailing list