# Cylindrical grid dataset with VTK

**URL:** https://discourse.vtk.org/t/cylindrical-grid-dataset-with-vtk/8820
**Category:** Support
**Created:** [June 28, 2022, 7:13am UTC](https://discourse.vtk.org/t/cylindrical-grid-dataset-with-vtk/8820 "2022-06-28T07:13:55Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![RemDelaporteMathurin](https://discourse.vtk.org/user_avatar/discourse.vtk.org/remdelaportemathurin/32/5401_2.png) [@RemDelaporteMathurin](https://discourse.vtk.org/u/RemDelaporteMathurin)
#### Post date: [June 28, 2022, 7:13am UTC](https://discourse.vtk.org/t/cylindrical-grid-dataset-with-vtk/8820/1 "2022-06-28T07:13:55Z")

</div>

Hi all,

I have a set of data that in a cylindrical system of coordinates.  
I was able in the past to write rectilinear datasets to vtk with `vtkRectilinearGrid` (see snipset below).

I would like to know if there is an equivalent for cylindrical grids?

Is `vtkStructuredData` the way to go?

 ![image](https://discourse.vtk.org/uploads/default/original/2X/c/c485f070d0689e60f9d9b6cac928e56e52e8ee46.png)

```python
import vtk
import numpy as np

vtk_box = vtk.vtkRectilinearGrid()

mesh_coords_x = np.linspace(1, 2, num=3)
mesh_coords_y = np.linspace(1, 2, num=3)
mesh_coords_z = np.linspace(1, 2, num=3)

vtk_box.SetDimensions(len(mesh_coords_x), len(mesh_coords_y), len(mesh_coords_z))

vtk_x_array = vtk.vtkDoubleArray()
vtk_x_array.SetName("x-coords")
vtk_x_array.SetArray(mesh_coords_x, mesh_coords_x.size, True)
vtk_box.SetXCoordinates(vtk_x_array)

vtk_y_array = vtk.vtkDoubleArray()
vtk_y_array.SetName("y-coords")
vtk_y_array.SetArray(mesh_coords_y, mesh_coords_y.size, True)
vtk_box.SetYCoordinates(vtk_y_array)

vtk_z_array = vtk.vtkDoubleArray()
vtk_z_array.SetName("z-coords")
vtk_z_array.SetArray(mesh_coords_z, mesh_coords_z.size, True)
vtk_box.SetZCoordinates(vtk_z_array)

my_data = np.random.uniform(low=0.5, high=13.3, size=(2, 2, 2))

data = vtk.vtkDoubleArray()
data.SetName("my_data")
data.SetArray(my_data, my_data.size, True)

vtk_box.GetCellData().AddArray(data)

```

Thanks!
