How do I create a program that drops a part ff at inspection site every 10 parts?

Need a program made string or idea for a simple program. Want the robot to place the part in a different location every 10 parts. Any help or a program snip would be great. Beginner here.

I do this for a few different tasks. It’s fairly simple and quick.

Create a counter variable then use logic to increase the counter every cycle and use an if statement to branch off when the variable hits the target count. Then reset the variable and continue repeat.

This example pauses for the operator to clean out the vise every 4 parts (I haven’t added a blow gun to this robot yet and the fans don’t get all the chips out).

The variable “CleanVise=0” goes in the Init Variable or Before Start sections of the program.


1 Like

So I would just have it refer to a subprogram to drop part off at another location and then reset that number so it does it every 10?

@fuknrekd’s method works perfectly, and is great for keeping things explicit and easy to follow. If you want something that doesn’t involve creating additional variables, you can use the “modulo” command % to leverage a “total cycles” counter for all your “every x operations do BLANK” logic. This would look something like this:


Just a slightly different way to achieve the same thing. In this case, there’s no reason to reset your Total_Cycles variable. So it’s one line of code less. That said, I would stick with fuknrekd’s example, as it is easier to follow (in my opinion).

Edit: For your second question, yes replacing the Popup instruction with a Subprogram call is generally a good way to achieve this. Just be aware that you can’t call Subprograms from within Subprograms via the Polyscope buttons. So if your gripper dropoff routine is already a subprogram, you’ll have to use a script node to call a subprogram from inside another one.

You’d just have: