Using the [Script Editor] feature, an analog clock can be created. To accomplish this, the user will need to create 4 tags, all of them ‘INT16’ tags on a local device as shown in the below image.
Once the tags have been created, the user can create a clock interface on their own, or drop in the ‘3D Silver Clock’ object from the [Graphic Library]. Once this clock has been created, use the line tool to create two hands for the clock, as shown below.
Once the clock has been created, the user will need to create three scripts. One script establishes a real-time clock and writes the current hour and minute into their own tags, and the other two are used to control the rotation of the hands of the clock.
The ‘RTC’ script should be configured to run on startup from the script properties window, the other two scripts should be configured to run when manually called. Next, the user can configure the ‘MinuteHandIncrement’ script to run when the tag ‘CurrentMin’ changes values. A similar setup can be applied for the ‘HourHandIncrement’ script and the ‘CurrentHour’ tag as shown in the below screenshot.
Lastly, the user will need to bind the rotation of the clock hands to the ‘HoursRot’ and ‘MinutesRot’ tags, as shown in the below images.
With the current configuration, the scripts will now update the position of the hands on the clock to match the current time.