Another rotation question

I want to rotate a group of vision components that include a rectangle and a Line [Sinusoidal] but I can only get the rectangle to rotate. I’ve added a custom property to the group that pointed to the rectangle Angle but only it rotates. The line component doesn’t appear to have an Angle property. What am I missing?

Using Ignition 8.0.8


Lines can’t directly rotate; they’re not defined (in the code) as a polygon; they’re just a relationship between two specific points. You’d have to do the math and rotate the points around some coordinate yourself using scripting.

Thanks Paul.

Being new to scripting, would anyone have a reference or links that could help get me started on the basics of doing this rotation?

Thanks for any information and stay safe out there!

You should be using the system.gui.transform function to move non-drawing elements. By altering the x and y coordinates of both points, as well as altering if it’s going uphill or downhill, you can get it to rotate. There will just be a number of sines and cosines involved (read wikipedia: Rotation matrix for the theory).

However, if you just want to rotate a line, I would make a 1px wide rectangle, or import an SVG line, then you’ll have direct access to the angle property.

1 Like

Thank you.