[vtkusers] Save as vtu

houssen houssen at ipgp.fr
Thu Apr 27 03:50:53 EDT 2017


Hi,

First let me describe a bit more the need behind this (to answer Andy's 
question). I need to visualize some data: I decided to use a 
vtkUnstructuredGrid as a starting point (because it seems more flexible: 
you can describe all kind of meshes with that, not only specific ones). 
For very simple cases, I can build my vtkUnstructuredGrid myself and do 
stuffs I need to do with it: that's OK. For more complex cases, I would 
like to use some external data (stl or xmf for instance): this means I 
need to build a vtkUnstructuredGrid from stl or xmf (or ideally from any 
other format). So I was like : "OK, let's try to use the 
vtkUnstructuredGridReader" (hoping this reader could read any format and 
convert it to a vtkUnstructuredGrid). It turns out that 
vtkUnstructuredGridReader is only for vtu, right ? Not such a big deal 
anyway if I can convert stl/xmf to vtu: as I didn't succeed to do that 
in paraview, I sent this mail.

Now to answer your questions/remarks:

1. The xmf defines a multiblock: yes, I noticed that. I already tried 
to save as vtm (proposed in the GUI - there was no vtu format available 
at this step) and get what you said David. But the problem is that when 
I read the vtm with vtkUnstructuredGridReader, I get : 
"vtkUnstructuredGridReader (0x55cf2916cc00): Unrecognized file type: 
<VTKFile type="vtkMultiBlockDataSet" version="1.0" 
byte_order="LittleEndian" header_type="UInt64"> for file: tstXmfFEM.vtm"

2. I didn't know about the merge blocks filter. I used it: now the 
"save as" GUI propose to save as vtu. I save as vtu but when I read it 
with vtkUnstructuredGridReader, I get : "vtkUnstructuredGridReader 
(0x5650aee5ec00): Unrecognized file type: <VTKFile 
type="UnstructuredGrid" version="1.0" byte_order="LittleEndian" 
header_type="UInt64"> for file: tstXmfFEM.vtu"

3. How to convert a stl to vtu ?

Franck

Note: I use Paraview-5.1.0 and VTK-7.1.0 (does this trigger version 
related problems ?)

Note: to read with vtkUnstructuredGridreader, I basically do 
reader->SetFileName(), then reader->Update(), then reader->GetOutput()

Le 2017-04-26 19:03, David E DeMarle a écrit :
> Adding to what Andy said.
> In this case the xdmf file defines a multiblock with three
> unstructured grids underneath it. Each of your unstructured grids
> happens to have just one cell in it. When you save as vtm, you will
> get a top level .vtm defining the collection, and a directory with
> three .vtu files, one for each block.
>
> David E DeMarle
> Kitware, Inc.
> R&D Engineer
> 21 Corporate Drive
> Clifton Park, NY 12065-8662
> Phone: 518-881-4909
>
> On Wed, Apr 26, 2017 at 12:55 PM, Andy Bauer <andy.bauer at kitware.com
> [12]> wrote:
>
>> Hi,
>>
>> The vtu format is for unstructured (non-multiblock) grids. For
>> multiblock grids like the ones read in from an xmf file you will
>> need to convert it to an unstructured grid. You an use the Merge
>> Blocks filter to do that.
>>
>> Is there a strong reason for saving it as a vtu file? It sounds
>> like there are better file formats available for your data set.
>>
>> Andy
>>
>> On Wed, Apr 26, 2017 at 12:24 PM, houssen <houssen at ipgp.fr [6]>
>> wrote:
>>
>>> In paraview, I open a xmf file, I would like to export it as vtu
>>> (to read it later on with vtkUnstructuredGridReader): neither
>>> "save data" nor "export scene" allows this (save data suggest the
>>> .vtm format but it turns out that vtm can not be read later on by
>>> vtkUnstructuredGridReader as vtu is expected - I guess ?). Same
>>> problem when opening a stl file in paraview: can not export it as
>>> vtu.
>>>
>>> How can I export a xmf/stl fle as vtu ? Do I need a (existing ?)
>>> plugin ? If yes, which one ? Is there a work around ? Or is this
>> a
>>> dead end ?
>>>
>>> Franck
>>>
>>> PS: I have paraview-5.1.0, should I compile a newer version ?
>>>
>>> _______________________________________________
>>> Powered by www.kitware.com [1]
>>>
>>> Visit other Kitware open-source projects at
>>> http://www.kitware.com/opensource/opensource.html [2]
>>>
>>> Please keep messages on-topic and check the VTK FAQ at:
>>> http://www.vtk.org/Wiki/VTK_FAQ [3]
>>>
>>> Search the list archives at:
>>> http://markmail.org/search/?q=vtkusers [4]
>>>
>>> Follow this link to subscribe/unsubscribe:
>>> http://public.kitware.com/mailman/listinfo/vtkusers [5]
>>
>> _______________________________________________
>> Powered by www.kitware.com [7]
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html [8]
>>
>> Please keep messages on-topic and check the VTK FAQ at:
>> http://www.vtk.org/Wiki/VTK_FAQ [9]
>>
>> Search the list archives at:
>> http://markmail.org/search/?q=vtkusers [10]
>>
>> Follow this link to subscribe/unsubscribe:
>> http://public.kitware.com/mailman/listinfo/vtkusers [11]
>
>
>
> Links:
> ------
> [1] http://www.kitware.com
> [2] http://www.kitware.com/opensource/opensource.html
> [3] http://www.vtk.org/Wiki/VTK_FAQ
> [4] http://markmail.org/search/?q=vtkusers
> [5] http://public.kitware.com/mailman/listinfo/vtkusers
> [6] mailto:houssen at ipgp.fr
> [7] http://www.kitware.com
> [8] http://www.kitware.com/opensource/opensource.html
> [9] http://www.vtk.org/Wiki/VTK_FAQ
> [10] http://markmail.org/search/?q=vtkusers
> [11] http://public.kitware.com/mailman/listinfo/vtkusers
> [12] mailto:andy.bauer at kitware.com



More information about the vtkusers mailing list