vtkGLTFWriter: a working example?

Hello, does anybody have a working example of vtkGLTFWriter().

The documentation is very concise, and I’m trying different patterns similar to other writers, but I always get the error:

Process finished with exit code -1073741819 (0xC0000005)

Basically I am building a vtkMultiBlockDataSet(), required as input, and then I am trying to write it as GLTF (I simplified the following code to give an idea).

multi_block = vtkMultiBlockDataSet()
gltf_writer = vtkGLTFWriter()

i = 0
for polydata in list_of_polydata:
    multi_block.SetBlock(i, polydata)
    i = i+1

gltf_writer.SetFileName(out_file_name)
gltf_writer.SetInputDataObject(multi_block)
gltf_writer.Write()

It’s not the writer, but here’s an example of using the vtkGLTFExporter:

There are a number of tests:
ctest -R TestGLTFWriter

The source is in TestGLTFWriter.cxx

Dan

Hi, there is some problem here.

With writer = vtkGLTFWriter(), every time i call the writer.Write() method I got the error:

Process finished with exit code -1073741819 (0xC0000005)

Then I got errors also when I call methods listed in the documentation and used to set the behaviour of the filter. For instance:

writer.CopyTexturesOn() → AttributeError: ‘vtkmodules.vtkIOGeometry.vtkGLTFWriter’ object has no attribute ‘CopyTexturesOn’

writer.SetRelativeCoordinates(True) → AttributeError: ‘vtkmodules.vtkIOGeometry.vtkGLTFWriter’ object has no attribute ‘SetRelativeCoordinates’

writer.RelativeCoordinatesOn() → AttributeError: ‘vtkmodules.vtkIOGeometry.vtkGLTFWriter’ object has no attribute ‘RelativeCoordinatesOn’

The code at the moment is like this:

writer.InlineDataOff()
writer.SaveNormalOn()
writer.SaveTexturesOn()
writer.SetInputDataObject(multi_block)
writer.SetFileName(out_file_name)
print("test - writer: ", writer)
writer.Write()

And this is what I got from the print just before .Write() crashes the application.

test - writer:  vtkGLTFWriter (00000255E10DA220)
  Debug: Off
  Modified Time: 75510
  Reference Count: 2
  Registered Events: (none)
  Executive: 00000255DAFBDAA0
  ErrorCode: No error
  Information: 00000255E0AA7030
  AbortExecute: Off
  Progress: 0
  Progress Text: (None)
InlineData: 0
  FileName: D:/test/test_2/multi_block_dataset.glb

What version of VTK are you using?

It seems that it does not have the latest version of the writer.