Universal Robots Forum

How to change the child nodes name in the program tree

Hello everybody,

I am searching a way to change the name of my child nodes.

I found a way to do it but the update is not automatic. What I want is the same function as the rename waypoint button.

Can somebody help me please.

Best regards, Arnaud

1 Like

Not all built-in child nodes may be renamed.
Waypoints are not supported by rename functionality in SDK 1.2.

Ok but, the ones that CAN be renamed… How can they be renamed dinamically?
For example, the URCap custom nodes. We define the name before the creation, before the genetarion of the script with ‘writer’… But then, what is the best way to rename them or to allow the user to rename them? Any sample code will help.

Thanks in advance! Regards, David

Since the release of SDK 1.4, naming of waypoints are now supported.

The name of a URCap node in the program tree is always refelected by the String returned by “getTitle()” in the Contribution.
In order for a parent node to be able to rename the program node, you should consider a CustomAPI.

1 Like

Thank you for the answer @jbm. I was able to change my node name using “getTitle()” and it is working to perfection. I just thougth it wont update automatically on the program tree, but it does.

Polyscope calls the method getTitle() to update the title in the program tree any time something is changed in the DataModel of that program nodes’ contribution, thus, in order to change the title live, use something like:

public void getTitle()
    return model.get("title", defaultTitle);

Then whenever you need the title to update, simply do model.set("title", newTitle) and the title in the tree will update, since the DataModel changed