[vtkusers] Writing MultiBlock datasets

Renato N. Elias rnelias at nacad.ufrj.br
Wed Apr 16 10:56:01 EDT 2008


Hooray, it works ;o)

For future references...

// Writing a MultiBlock dataset
  vtkXMLMultiBlockDataWriter* mbw = vtkXMLMultiBlockDataWriter::New();
  mbw->SetFileName("foo.vtm");
  mbw->SetInput(MyMultiBlock);
  mbw->Write();

P.S.: I was using VTK's head, so, the file created could only be read in 
ParaView's head (it's not a major problem since you can load the blocks 
piece-by-piece in previous ParaView's versions).

Thanks a lot Amy and Utkarsh

Renato.


Utkarsh Ayachit wrote:
> Oh another thing, you cannot directly instantiate 
> vtkXMLCompositeDataWriter since it's an abstract class. So,
>
> ...
> vtkXMLCompositeDataWriter* mbw  = vtkXMLMultiBlockDataWriter::New();
> ...
>
> Utkarsh
>
> Utkarsh Ayachit wrote:
>> You don't have to "get the output" from a vtkMultiBlockDataSet. 
>> vtkMultiBlockDataSet is itself the dataobject that can be set as the 
>> input to a filter/writer.
>>
>> To reiterate Amy, try:
>>
>> vtkMultiBlockDataSet* mb = vtkMultiBlockDataSet::New();
>> ...
>> vtkXMLCompositeDataWriter* mbw = vtkXMLCompositeDataWriter::New();
>> mbw->SetInput(mb); // directly set "mb" as the input no need to 
>> do                   // somethign like mb->GetOutput().
>>
>> Utkarsh
>>
>> Renato N. Elias wrote:
>>>
>>> yes, in fact, it was my first try. The problem is that I don't know 
>>> how to get the output from vtkMultiBlockDataSet. How should 
>>> classvtkXMLCompositeDataWriter and vtkMultiBlockDataSet be connected?
>>>
>>> Renato.
>>>>
>>>>
>>>> Have you tried calling mbw->SetInput(mb)?
>>>>
>>>> - Amy
>>>>
>>>> Renato N. Elias wrote:
>>>>> Hi folks,
>>>>>
>>>>> does anybody could give me a hand in writing a 
>>>>> vtkMultiBlockDataSet. I saw there's a  vtkXMLCompositeDataWriter 
>>>>> <http://www.vtk.org/doc/nightly/html/classvtkXMLCompositeDataWriter.html#f2b96e41718dcb0bc93db39ad82675ad> 
>>>>> and a derived vtkXMLMultiBlockDataWriter 
>>>>> <http://www.vtk.org/doc/nightly/html/classvtkXMLMultiBlockDataWriter.html> 
>>>>> the problem is that I can't do something like:
>>>>>
>>>>> // creating a multiblock object
>>>>> vtkMultiBlockDataSet* mb= vtkMultiBlockDataSet::New();
>>>>>
>>>>> // Assign some stuffs
>>>>> mb->SetBlock(0, ???)
>>>>> mb->SetBlock(1, ???)
>>>>> mb->SetBlock(2, ???)
>>>>>
>>>>> // Create the writer
>>>>> vtkXMLCompositeDataWriter* mbw = vtkXMLCompositeDataWriter::New();
>>>>>
>>>>> // Set the filename
>>>>> mbw->SetFileName("test.vtm");
>>>>>
>>>>> // Setting up the connection <--- HERE'S MY DOUBT
>>>>> mbw->SetInputConnection(mb->GetOutput());
>>>>>
>>>>> // Write the data
>>>>> mbw->Write();
>>>>>
>>>>> since vtkMultiBlockDataSet does not have a "GetOutput" method.
>>>>>
>>>>> Does anyone could supply an example?
>>>>>
>>>>> Thanks
>>>>>
>>>>> Renato.
>>>>> _______________________________________________
>>>>> 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
>>>>>
>>>>>
>>>>
>>>
>>> _______________________________________________
>>> 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