In my model, there is a palletizing area where a palletizer agent moves to a location adjacent to an accumulating conveyor, picks up the last box on that conveyor, and transfers it to a pallet.
I am trying to find the best way to refer to that last box on the conveyor and store it in a variable.
I am aware of ConveyorPath.getAgent(), documented here but it does not seem to function properly, throwing the following error:
Code : v_box = v_conveyorPath.getAgent(0);
Error : Description: Type mismatch: cannot convert from Agent to Box.
I have gone into my conveyor markups and changed the "Material item type" fields to "Box", to no avail.
What am I doing wrong here? How can I get the ConveyorPath to return a Box type instead of an Agent type?
Thank you.
EDIT: After running tests, I can confirm that the agents present on my conveyor are of Class Box.
traceln(conveyor.getAgent(0).getClass());
Output : class modelname.Box
And yet I still cannot store a reference to that Box inside of a variable.

