Nirtec Studio Forum

General Category => Machines Simulator => Topic started by: jvblade on June 26, 2025, 04:49:40 AM

Title: Float display precision
Post by: jvblade on June 26, 2025, 04:49:40 AM
I am using a display object on a machine and want to display a float value of an analog input value, however it is displaying the float value to several decimal places. I only want to display it to one or two decimal places. How can I do this?
Title: Re: Float display precision
Post by: EasyPLC_Master on June 26, 2025, 12:55:30 PM
In the Wind Turbine scene, you have an example.

If you display object is called panel1 and the float variable is vr, you can use this sentence:

panel1.Value(vr.ToString("0.#")) //Shows only one decimal

panel1.Value(vr.ToString("0.##")) //Shows two decimal places.
Title: Re: Float display precision
Post by: jvblade on June 28, 2025, 10:53:04 PM
Worked great. Thanks  :)