how is it possible to switch a ComponentContainer in an TransportNode during Simulation?
The ComponentContainer is in the correct link and each link has a frame for define the position of the Container!
Different TransportIn’s in the Process adresses on of the PositionFrames of the Container… → The problem is that the products are always in the Container of the TransportNode which just can adress one ComponentContainer!
I hope there exist a clean solution for assign an incoming product to correct container??
No, you can’t have different containers nor should you change the container associated to the transport node during simulation.
Why would you want to have the products in different containers, are you trying to move them independently during the process using that servo controller?
You can try using TransportOut to a container to move your products from some “input” container to something else. Trying to do TransportOut again after that might not work, though.
You could also have multiple executors and transport nodes, at which point it probably becomes easier to just use multiple “Process Node” type components instead of a single component.
I wonder if you can use a Python script to attach a component to a vcNode without moving it to a different container.
If that is possible, you could have a script react to arriving products by listening on the vcTransportNode’s events and attach them to your servo-controlled links.
I tested both of my ideas but in the end they don’t work.
Using TransportOut to move the product to another container works if you have 2 containers with the output port of first connected to the second and the TransportOut to the first one. This is because TransportOut to container doesn’t actually put it into the container, but looks for a connected output port and then puts the product through that output connection of the target container.
However, this approach fails when trying to move the product out from the process, the TransportOut gets confused even if I move the product back to the transport node’s container using this method first. If you TransportOut to e.g. a Sink process, you get “Product was destroyed” and “Matched Need was destroyed” errors once the sink deletes the product.
I think the TransportOut to next process not working if you have taken the product out of the node’s container and later put it back before the TransportOut could be considered a bug worth reporting to VC support.
The other approach of using vcNode.attach() to attach product to a link doesn’t work because it also takes the product out of the transport node’s container. Seems that there is no way in Python API to attach without changing container as well.
Have you tried to make a Script, that gets a Handler for each ComponentContainer, a Handler for the TransportNode, and then, with the OnProductArriving Event, call a function that sets TransportNode.ComponentContainer with the ComponentContainer that you want?
I have made some changes in your DEMO, now, the TransportNode swaps the ComponentContainer depending on Toggle Property as I see you use this to change from Link_1 to Link2. There’s a message error from the ProcessExecutor but it seems there is no problem. I’ve done some changes in your “PythonScript_ContainerHandling”.
I didn’t understand your question, now I do. I attach a new vcmx that apparently works. I just assign the container when the product leaves the feeder, so when it arrives to the node, the container has already change. The solution its in the UrwikScript.
The last thing in your script is how to make it generic, so that the process find automatically the connected process before… → Maybe you have also an idea for this?
I would like to reiterate that changing the associated container during simulation is not a good idea, especially if you have a running process when you do it.