# Move object to origin

**URL:** https://discourse.vtk.org/t/move-object-to-origin/10830
**Category:** Support
**Tags:** python
**Created:** [February 28, 2023, 6:35am UTC](https://discourse.vtk.org/t/move-object-to-origin/10830 "2023-02-28T06:35:49Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![shadyx](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/s/e99b99/32.png) [@shadyx](https://discourse.vtk.org/u/shadyx)
#### Post date: [February 28, 2023, 6:35am UTC](https://discourse.vtk.org/t/move-object-to-origin/10830/1 "2023-02-28T06:35:49Z")

</div>

Greetings. I started studying VTK, I don’t understand a lot of things.  
Now there is a problem. There are several objects in .vtk format that are very far from the origin (see example screenshot from Blender).

> **Example**
>
> ![image](https://discourse.vtk.org/uploads/default/original/2X/e/ec03d2741ee7e9cf0da6563f04b870e5e9d9e601.jpeg)

I have the following python code which receives a PolyData output.

```auto
import os
import vtk

files = [f for f in os.listdir('.') if os.path.isfile(f)]
for f in files:
    if ".vtk" in f:
        reader = vtk.vtkPolyDataReader()
        reader.SetFileName(f)
        reader.Update()
        polyData = reader.GetOutput()

```

How, based on this data, move the object to the middle of the scene (the origin)? In other words, I need to move the object to the coordinates (0, 0, z) (we do not touch the z coordinate).

---

<div class="post-metadata">

### Author: ![Jens\_Munk\_Hansen](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jens_munk_hansen/32/1215_2.png) [@Jens\_Munk\_Hansen](https://discourse.vtk.org/u/Jens_Munk_Hansen)
#### Post date: [March 1, 2023, 6:51pm UTC](https://discourse.vtk.org/t/move-object-to-origin/10830/2 "2023-03-01T18:51:38Z")

</div>

You can use `vtkTransformPolyDataFilter`. You can find a good example of how to use the filter here, [https://kitware.github.io/vtk-examples/site/Python/GeometricObjects/OrientedArrow/](https://kitware.github.io/vtk-examples/site/Python/GeometricObjects/OrientedArrow/)
