i'm trying to create a photoeye on a conveyor. i'm using a modified code based on great answers in "Build Decision Point with Code - FlexSim Community" and "Create conveyor system in code - FlexSim Community", my problem is i'm not able to use Event trigger source "On cover", i've to reset the model first, is there any solution to trriger "on Cover" without reset?
string conveyorname = "conveyor";
int conveyorgroup = 1;
int conveyornum = duniform(1,4,1);
conveyorname = conveyorname + conveyorgroup + conveyornum;
Object conveyor=Model.find(conveyorname);
double conveyorlen = getvarnum(conveyor, "length");
double distalong=uniform(1,conveyorlen,2);
Object photoEye= createPhotoeye(conveyor,distalong);
// Add label to find the associated PE
token.PE = photoEye;
//Add to Photo Eye Group
Group("PhotoEyes").addMember(photoEye);
current.PE=photoEye;