# Template: How to read x, y, height and width from a template component at runtime

**URL:** <https://forum.inductiveautomation.com/t/template-how-to-read-x-y-height-and-width-from-a-template-component-at-runtime/62961>\
**Category:** Ignition\
**Tags:** ignition81\
**Created:** [August 12, 2022, 4:37pm UTC](https://forum.inductiveautomation.com/t/template-how-to-read-x-y-height-and-width-from-a-template-component-at-runtime/62961 "2022-08-12T16:37:09Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mrutten](https://avatars.discourse-cdn.com/v4/letter/m/c0e974/32.png) [@mrutten](https://forum.inductiveautomation.com/u/mrutten)\
**Post date:** [August 12, 2022, 4:37pm UTC](https://forum.inductiveautomation.com/t/template-how-to-read-x-y-height-and-width-from-a-template-component-at-runtime/62961/1 "2022-08-12T16:37:10Z")

</div>

The reason I want to read the X, Y, Width, Height is because I am using the development mode as my design tool. I am working in a template and I have several components on the template. so what I do is move these components around to create a new design and then once I have the new design I go to run mode and press a button to save the x, y, width and height of all the components together with its new design name to a data set property that is part of the template. this way I do not have to update all my components in the design mode manually. When I finally use the template in a window, I select a design and the template will move all the components around to show the selected design.

Problem that I have is I do not know how to read the x, y, width, height programmatically from a component on a template. for instance I am using templates within this template but I am also using several painting canvased and drawn boxes.

---

<div class="post-metadata">

**Author:** ![jwilliams](https://avatars.discourse-cdn.com/v4/letter/j/c2a13f/32.png) [@jwilliams](https://forum.inductiveautomation.com/u/jwilliams)\
**Post date:** [August 12, 2022, 5:28pm UTC](https://forum.inductiveautomation.com/t/template-how-to-read-x-y-height-and-width-from-a-template-component-at-runtime/62961/2 "2022-08-12T17:28:16Z")

</div>

Are you using Perspective or Vision?

---

<div class="post-metadata">

**Author:** ![witman](https://avatars.discourse-cdn.com/v4/letter/w/d2c977/32.png) [@witman](https://forum.inductiveautomation.com/u/witman)\
**Post date:** [August 12, 2022, 6:17pm UTC](https://forum.inductiveautomation.com/t/template-how-to-read-x-y-height-and-width-from-a-template-component-at-runtime/62961/3 "2022-08-12T18:17:30Z")

</div>

I'm not sure I fully understand what you're aiming for here, but, if you are using Vision, this thread covering template designed size, instance size, and runtime size may help:

> [@Get template instance size before runtime scaling](https://forum.inductiveautomation.com/t/get-template-instance-size-before-runtime-scaling/20835):
>
> Within a template, we can get template original size via Rectangle.relWidth on a rectangle the same size as the template with layout anchored to top, bottom, and sides. We can get template runtime size into internal template properties via the following expression bindings: runscript('self.height', 50) runscript('self.width', 50) What we’d like to get is template instance size in Designer. In other words, if original template was 200x200 and we stretch it to 300x150 in Designer, we want to ge…

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [August 12, 2022, 11:03pm UTC](https://forum.inductiveautomation.com/t/template-how-to-read-x-y-height-and-width-from-a-template-component-at-runtime/62961/4 "2022-08-12T23:03:06Z")

</div>

You might want to look into using the template canvas

---

<div class="post-metadata">

**Author:** ![mrutten](https://avatars.discourse-cdn.com/v4/letter/m/c0e974/32.png) [@mrutten](https://forum.inductiveautomation.com/u/mrutten)\
**Post date:** [August 15, 2022, 11:47am UTC](https://forum.inductiveautomation.com/t/template-how-to-read-x-y-height-and-width-from-a-template-component-at-runtime/62961/5 "2022-08-15T11:47:29Z")

</div>

I am using vision. I will try to use the template canvas.

But reducing the issue to the smallest issue.  
Lets say you use a template within a template.  
In designer you move the template position and size.  
when I go to run mode in the designer I want to record the position and size of the template that was in the template.

By would I want to do that:  
I have multiple electrical component, like multiple wire a relay or a transformer, multiple connectors etc… So for each component. lets say a fuse, the wires and connectors connected to this fuse are in a certain location and have a certain size, but for a relay I use the same wires and connectors but they need to be in a different location and have a different size.  
I move the wires and connectors around for the new design I am building and then **manually** record all of that information in a dataset. At run time I can reconstruct the design based on what the user selects Fuse versa relay etc… today I am manually recording the X,Y and position in the dataset, but it is time intensive. so I was hoping to position and size my wires and connectors in design mode, switch to run mode and press a button that will save all the x,y, size in the dataset to save me all that time to enter it in manually.
