@Omar Aguilera Rico
treenode.find() (or Object.find()) is what is mainly used to convert strings to nodes. You have to pass in the path to the node you want a reference to, relative to the treenode/Object.
For your model, you will probably want to use getvarnode() to get a reference to a variable node in an Object (like the Operator's collisionobjects node). The following example code will get the collisionobjects node of Operator1 in your model and store it in a variable:
Object operator1 = Model.find("Operator1");
treenode collisionObjects = getvarnode(operator1, "collisionobjects");
The other important thing to know is that all the subnodes of collisionobjects are coupling nodes (their datatype is DATATYPE_COUPLING). Each coupling node in the tree is a pointer node that is pointing to a different node in the tree. And the second node is pointing back to the first node. With coupling nodes, when one of the nodes is removed, the other node is also removed so you don't have leftover nodes with a 0x0 reference.
Here is example code that is similar to what FlexSim uses when you add a new Collision Member to a Task Executer in its Collision tab (with updated dot syntax):
treenode operator1 = Model.find("Operator1"); // Change this to reference the first Task Executer (TE)
treenode operator2 = Model.find("Operator1_2"); // Change this to reference the second TE
treenode op1CollisionObjects = getvarnode(operator1, "collisionobjects"); // Get collisionobjects node on first TE
treenode op1NewCollObj = op1CollisionObjects.subnodes.add(); // Add new collisionobjects subnode
op1NewCollObj.dataType = DATATYPE_COUPLING; // Set new subnode's datatype to be coupling
op1NewCollObj.name = getname(operator2); // Name new subnode to name of second TE
treenode op2CollisionObjects = getvarnode(operator2, "collisionobjects"); // Get collisionobjects node on second TE
treenode op2NewCollObj = op2CollisionObjects.subnodes.add(); // Add new collisionobjects subnode
op2NewCollObj.dataType = DATATYPE_COUPLING; // Set new subnode's datatype to be coupling
op2NewCollObj.name = getname(operator1); // Name new subnode to name of first TE
nodejoin(op1NewCollObj, op2NewCollObj); // Join both subnodes together to complete the bidirectional coupling
It looks like you're trying to reference the two different Operators using for loops in your model, so you should be able to add this example code to your logic after getting a reference to both Operators. Just be sure to change the first two lines to however you are referencing those two Operators. The rest of the code should work after that without needing to modify it.