Access Template Size

What Nick Mudge is doing in that demo (while very cool) is also not officially supported, and I would caution against building any kind of project that relies on its functionality; there’s no guarantee that it will continue to work in future versions.

That said, I was able to modify his drag and drop project to print the root template’s actual width/height - I’ll leave it to you to modify for your purposes if you so choose.

I added the following to lines 30 and 31 of the visionWindowOpened event handler script on the ‘Templates’ docked window:

template = XMLDeserializer.deserialize(context.createDeserializer(), obj.getSerializedBytes(), None) print template.getName(), template.getWidth(), template.getHeight()

Basically, Nick’s project is looking through the project’s resources from the backend, then deserializing them out of Ignition’s encoded format. The additional lines I added perform a second deserialization step to get the root template object directly from the project resources, before it’s actually created.