How to use vtkCesium3DTilesWriter with vtkPolyData to Export 3D Tiles in VTK?

Dear @NemaAryan welcome to the VTK discourse!

The expected multiblock dataset structure is the one from vtkCityGMLReader, and the Cesium exporter expects a multiblock of multiblock structure to work.

Below the modifications at the end of your script to make the exporter works:

# Wrap vtkPolyData in vtkMultiBlockDataSet
multi_block_dataset = vtkMultiBlockDataSet()
multi_block_dataset.SetBlock(0, polydata)

mb2 = vtkMultiBlockDataSet()
mb2.SetBlock(0, multi_block_dataset)

# Setup vtkCesium3DTilesWriter for exporting the tiles
writer = vtkCesium3DTilesWriter()
writer.SetDirectoryName("output_directory")
writer.SetSaveTextures(True)
writer.SetSaveTiles(True)
writer.SetContentGLTF(True)
writer.SetContentGLTFSaveGLB(False)
writer.SetInputType(vtkCesium3DTilesWriter.Mesh)  # Input type: Mesh
writer.SetInputData(mb2)

# Write the 3D tiles
writer.Write()

However, your code triggers a crash in GetMesh method from vtkCesium3DTilesWriter.cxx file. VTK should never crash and provide a nice error message instead. @danlipsa could you please take a look?
(I can provide a quick patch if needed)

Best,
François