# How to switch transform from global to local

**URL:** <https://discourse.slicer.org/t/how-to-switch-transform-from-global-to-local/5539>\
**Category:** Development\
**Created:** [January 28, 2019, 1:39pm UTC](https://discourse.slicer.org/t/how-to-switch-transform-from-global-to-local/5539 "2019-01-28T13:39:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![timeanddoctor](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/timeanddoctor/32/5839_2.png) [@timeanddoctor](https://discourse.slicer.org/u/timeanddoctor)\
**Post date:** [January 28, 2019, 1:39pm UTC](https://discourse.slicer.org/t/how-to-switch-transform-from-global-to-local/5539/1 "2019-01-28T13:39:51Z")

</div>

How to switch transform from global to local with python script. Are there any example codes?  
By the way, where can I found the setting of the transform attribute in python code?

---

<div class="post-metadata">

**Author:** ![timeanddoctor](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/timeanddoctor/32/5839_2.png) [@timeanddoctor](https://discourse.slicer.org/u/timeanddoctor)\
**Post date:** [January 29, 2019, 2:25pm UTC](https://discourse.slicer.org/t/how-to-switch-transform-from-global-to-local/5539/2 "2019-01-29T14:25:24Z")

</div>

I can create a transform and set translation on local manually. But are there any code could change translation from global to Local with python code?  
I checked github code found: `setCoordinateReference(LOCAL)`, while a error happen as follows:  
‘vTransformr.setCoordinateReference(LOCAL)  
Traceback (most recent call last):  
File “”, line 1, in   
AttributeError: ‘vtkCommonTransformsPython.vtkTransform’ object has no attribute 'setCoordinateReference’

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [January 30, 2019, 1:21am UTC](https://discourse.slicer.org/t/how-to-switch-transform-from-global-to-local/5539/3 "2019-01-30T01:21:07Z")

</div>

Local/global means if translation is performed before or after the rotation. You can achieve this by decomposing transformation into a translation and rotation part and changing up their order.
