# Templates master size by scripting

**URL:** <https://forum.inductiveautomation.com/t/templates-master-size-by-scripting/8005>\
**Category:** Ignition\
**Created:** [February 14, 2014, 11:27am UTC](https://forum.inductiveautomation.com/t/templates-master-size-by-scripting/8005 "2014-02-14T11:27:09Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![marioquark](https://avatars.discourse-cdn.com/v4/letter/m/22d042/32.png) [@marioquark](https://forum.inductiveautomation.com/u/marioquark)\
**Post date:** [February 14, 2014, 11:27am UTC](https://forum.inductiveautomation.com/t/templates-master-size-by-scripting/8005/1 "2014-02-14T11:27:09Z")

</div>

Is there a way to get them?  
Tnx!

---

<div class="post-metadata">

**Author:** ![marioquark](https://avatars.discourse-cdn.com/v4/letter/m/22d042/32.png) [@marioquark](https://forum.inductiveautomation.com/u/marioquark)\
**Post date:** [February 24, 2014, 3:25pm UTC](https://forum.inductiveautomation.com/t/templates-master-size-by-scripting/8005/2 "2014-02-24T15:25:19Z")

</div>

I’m going crazy…  
I’ve a template changing on TemplatePath property, but and i want to resize it to the original template size using scripting… I’ve tried anything… no way! 😢  
Any idea?!

---

<div class="post-metadata">

**Author:** ![weertske](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/weertske/32/3353_2.png) [@weertske](https://forum.inductiveautomation.com/u/weertske)\
**Post date:** [March 10, 2016, 12:04am UTC](https://forum.inductiveautomation.com/t/templates-master-size-by-scripting/8005/3 "2016-03-10T00:04:47Z")

</div>

Did you ever come up with an answer to this question? I need to do the same thing.

---

<div class="post-metadata">

**Author:** ![marioquark](https://avatars.discourse-cdn.com/v4/letter/m/22d042/32.png) [@marioquark](https://forum.inductiveautomation.com/u/marioquark)\
**Post date:** [March 10, 2016, 10:18am UTC](https://forum.inductiveautomation.com/t/templates-master-size-by-scripting/8005/4 "2016-03-10T10:18:05Z")

</div>

Try something like:

[code]from com.inductiveautomation.factorypmi.application.components.util import FPMILayout  
from com.inductiveautomation.factorypmi.application.model import TemplateManager  
from com.inductiveautomation.ignition.client.util.gui import DrawingUtilities

root = event.source.parent #or whatever  
templateManager = root.getAppContext().getApp().getTemplateManager()  
templateId = templateManager.getId()  
template = templateManager.getTemplateInstance(templateId)  
mastersize = DrawingUtilities.round(FPMILayout.getBounds(template))[/code]

![8)](https://us1.discourse-cdn.com/inductiveautomation/original/1X/587d7fe0d6822f36e81815ab06aa7164e9d2e057.gif "Cool")

---

<div class="post-metadata">

**Author:** ![weertske](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/weertske/32/3353_2.png) [@weertske](https://forum.inductiveautomation.com/u/weertske)\
**Post date:** [March 10, 2016, 7:33pm UTC](https://forum.inductiveautomation.com/t/templates-master-size-by-scripting/8005/5 "2016-03-10T19:33:22Z")

</div>

Works great! Thank you.

---

<div class="post-metadata">

**Author:** ![rrebro](https://avatars.discourse-cdn.com/v4/letter/r/3da27b/32.png) [@rrebro](https://forum.inductiveautomation.com/u/rrebro)\
**Post date:** [April 8, 2021, 1:28pm UTC](https://forum.inductiveautomation.com/t/templates-master-size-by-scripting/8005/6 "2021-04-08T13:28:50Z")

</div>

This does not work for me, I think it has something to do with root = event.source.parent, what is the parent in context of this example?
