Hello,
I’m working on an URCap and I would like to know if it’s possible to get the number of nodes in the Robot Program. I find the API function getRootTreeNode(this).getChilden()
but I cannot find a way to use it at the Robot Program level.
Alternatively, there’s a way to constraint the Robot Program to have a single node (that will be a instance of my URCap)?
I’m working on an URCap and I would like to know if it’s possible to get the number of nodes in the Robot Program. I find the API function
getRootTreeNode(this).getChilden()
but I cannot find a way to use it at the Robot Program level.
Yes, this is because a program node’s scope of view is only within its own node. It was not designed to have “global” access to the entire program tree, only the children under it.
Alternatively, there’s a way to constraint the Robot Program to have a single node (that will be a instance of my URCap)?
As far as I know, there isn’t a built-in set of methods in the SDK that allows you to do this. What are you trying to achieve having a single node instance in the Robot Program?
The URCap should be the only know added by the user because the robot script I would like to create and execute is the one created in the generateScript of this URCap.
Could you maybe move the script code into the installation node’s generateScript method? That way you can guarantee there’s only one instance of your script code running.