Universal Robots Forum

How to get the type of a UR CAP Node?

I have a somewhat specific question here. I currently have 2 CAPs: One is for welding, and one is for controlling an external positioner/axis.

The welding CAP consists of a parent node, with the children being moves allowed while welding. I don’t want to allow any other nodes to be inserted as children. So originally I set the childLockSequence to true, and inserted Welding moves via my screens on the CAP. Works great.

Now I want to ALSO allow the insertion of the external positioner’s moves (a seperate CAP) inside the Welding parent. So now I unlock the childSequence and perform a traversal check in the generateScript to stop the program if I find any nodes that aren’t either my Welding moves, or the Positioner’s moves.

However, I cannot find the right method to return the exact type of the URCAPnode. This has to be possible, because I am able to crash the program by attempting to cast the positioner move to a customAPI of the Welding move. This doesn’t work (obviously) but the stack trace says: cannot cast from com.myCompany.RotaryCAP.RotaryProgramNodeContribution to com.myCompany.WeldingCAP.myCustomAPI

So ultimately my question is: What is the correct method to call on a programNode such that it returns com.myCompany.RotaryCAP.RotaryProgramNodeContribution? Or more generally, returns the exact name of the node’s contribution?