How to change the unit of an attribute at runtime

Hi all,

Anyone knows how to change the unit of an attribute during runtime?

thanks for helping,

regards,

Florent.
Hi Florent,

An easy way is to start an atkpanel on your device and to click on the "…" button at the right of the attribute you want to change the units.
Then you can refer to the Tango documentation for the meaning of the parameters:
https://tango-controls.readthedocs.io/en/latest/development/advanced/reference.html#general-purpose-parameters

You can also change it from jive by expanding your device node and then click on "Attribute config" in the tree.
Then you will have to select the Unit tab on the right.

Hoping this help,
Reynald
Rosenberg's Law: Software is easy to make, except when you want it to do something new.
Corollary: The only software that's worth making is software that does something new.
Hi Reynald,

thanks for your reply !
I was talking about changing the unit by c++ code into the device server itself.

Florent.
Edited 4 years ago
Hi Florent

This is what I am doing
Hoping this helps

Cheers

    Tango::Attribute &att = get_device_attr()->get_attr_by_name("MyAttName);
Tango::MultiAttrProp<Tango::DevDouble> att_prop; // For a DevDouble att type
att.get_properties(att_prop);

att_prop.unit = "WhatAUnit!";

att.set_properties(att_prop);
Great!!
it helps a lot !

thank you Reynald

Cheers

Florent.
flanglois
thank you Reynald

Thanks Manu for this one smile
Rosenberg's Law: Software is easy to make, except when you want it to do something new.
Corollary: The only software that's worth making is software that does something new.
Oups, didn't see it was Manu that answer …

Florent.
 
Register or login to create to post a reply.