Universal Robots Forum

Sharing one dropdown list between ProgramNodeContribution and InstallationNodeContribution

Hello!

Has anyone figured out a clever way to share a dropdown list between the installation node and program node?

What I want to do is add items to a dropdown list and set coordinates to the various items in the dropdown list. Then I want the program node tab to get the data from the installation node tab and create waypoints based on it. I got most of this down, the part im struggling with is getting the program node dropdown to point to the installation drop down and get the data from there. Has anyone else implemented something similar to this and are willing to share how they went about doing it?

What about saving data in the data model and then import the data from the data model on the programNode?

Store the general data in the Installation node.
From the program node, you can use the API to get the Installation Node.
Check out the method getInstallationNode(Class<T> installationType) which in HTML nodes are used as:

HelloWorldInstallationNodeContribution contribution = api.getInstallationNode(HelloWorldInstallationNodeContribution.class)

And where api is your instance of the URCapsAPI from the program node contribution constructor.

This gives you the instance loaded of the installation node contribution, and allows you to call any public method in this class.
Then, in your Installation node, create a public method, to hand over the data the program node needs;

public List<String> getStringListForProgramNode() {
   return someList;
}

And in your program node by:

List<<String> myStringList = api.getInstallationNode(HelloWorldInstallationNodeContribution.class).getStringListForProgramNode()`;

This is also used in the Hello World program node, to get the Title stored in the Installation.

2 Likes