Good morning at all!
In my model I would like to create more than 1 agv using a for cicle.
int num_agv = 2; for(int a=1; a<=num_agv; a++) { //SHUTTLE CREATION: Object shuttle = createinstance(library().find("?TaskExecuter"), model()); shuttle.name = "Shuttle" + numtostring(a); shuttle.location.x = 0; shuttle.location.y = 0; shuttle.location.z = 0; shuttle.size.x = 2; shuttle.size.y = 2; shuttle.size.z = 1; shuttle.color = Color.green; treenode shutref = model().find("/Tools/ProcessFlow/ProcessFlow/Shuttle>variables/reference"); shutref.value = shuttle.name; treenode rotateOn2 = model().find("Shuttle" + numtostring(a)); rotateOn2.value= 0; //SATTELITE CREATION: Object satellite = createinstance(library().find("?TaskExecuter"), model()); satellite.name = "Satellite" + numtostring(a); satellite.location.x = 0; satellite.location.y = 0; satellite.location.z = 0; satellite.size.x = 2; satellite.size.y = 1; satellite.size.z = 0.5;
The problem is that the code create only the first shuttle and not the satellite and return this exeption:
exception: FlexScript exception: Property "value" accessed on invalid node. at /0 c: /testlink_instance i: /testlink_associated
Probably the code reguarding the reference is not correct and it doesn't recognize the agv.
Futhermore I have to insert other reference and I have to setting other data in the vehicles (like the speed or something else), does anyone have any idea how to write a correct code in the loop?