So I made a template that works exactly how I want. It represents a type of tool/machine in our factory. The problem, though, is that I can’t use it in my factory overview project everywhere I need to use it because some locations have that tool/machine rotated 90, 180, or 270 degrees. I’m really surprised I can’t do that. I dont’ want to have to make several templates for the tool… that kinda defeats the purpose of having a reusable template if I have to make one for every orientation… ???
I create a custom property on the template called angle, then inside the template I bind the angle of the objects to that.
Then on a window you just set the angle property and it adjusts the contents of the template.
I know about the “Angle” property for polygons and whatnot and “Rotation” property for text. My template has text too, which doesn’t have an “Angle” property, it has a “Rotation” property which only applies to text direction has misbehaves with object size metrics.
The problem is that it all needs to rotate as a group, not individual objects. If the text objects had an Angle property which worked the exact same way as the “Angle” property for a polygon, then I could just group it all and bind to the “Angle” of the group, and that’d work great.
I mean I guess I could remove all the dynamic text from the template, then group everything and bind to the Angle tag, and place all the dynamic text outside the template on top of it separately for each instance of the template… Blah.
I group any objects and set rotation on those, for text objects like labels, I create 2 or 3 of them bound to the same thing but at different positions or angles, and then do a visible binding on those checking the value of the angle custom property.
Not ideal, but templates are a design once, reuse thing.
Thanks for the feedback!
I may group it all (except text) and bind to the Angle property (which I only ever expect to be 0, 90, 180, or 270)… is it possible to animate the x,y position of the upper left corner of a text object within the template?
You’ll need to tie in an event to trigger though- maybe from the template on propertyChange of the angle custom property so it re-evaluates and sets its position based on that.
Yes just use system.gui.transform(Text,x,y)
if you want get the x,y value use
txt = event.source.parent.getComponent(‘Text’)
bounds = txt.getBounds()