Is there any way to make a Subprogram be associated with a global variable, can you change a load to a variable? If I was to add all of my part numbers to the program then there would be 600 subprograms in my main program because each part number has to have a different program with different way points and camera locates. I will be running two different parts at a time and I am trying to figure out a way to get the robot to use a variable to pull the necessary program up or something. When I open the command file for the Subprogram it says I can load a file but there aren’t any variables there. I’m just trying to find a way from having my main program loaded with all the Subprograms when it will only need two at a time.
@kakimmy there is indeed the equivalent of global variables with UR, they are called installation variables. In Polyscope you can go to the Installation tab, then into Variables and add variables that you can use in your program.
@kakimmy I am trying to understand what you are asking. Are you asking can the program load a different subprogram based on what particular part number you are running and have the program know which one to load based on a variable? It can do that in a round about fashion but would still require you to have something in the program to tell it what subprogram to run for each variable. The installation variables that @Etienne_Samson references can only hold integers, not strings. You could have two installation variables, one for part A and one for part B and then use a switch statement in the program to call the correct subprogram but you will still have to have all of them in the program for it to know what to do. At the start of the program you would need to ask the user which parts are running. You really wouldn't have to have an installation variable for that. Yes your subprograms can reference the variables from your main program or even each other.
Is there any way to make a Subprogram be associated with a global variable, can you change a load to a variable? If I was to add all of my part numbers to the program then there would be 600 subprograms in my main program because each part number has to have a different program with different way points and camera locates. I will be running two different parts at a time and I am trying to figure out a way to get the robot to use a variable to pull the necessary program up or something. When I open the command file for the Subprogram it says I can load a file but there aren’t any variables there. I’m just trying to find a way from having my main program loaded with all the Subprograms when it will only need two at a time.