hexagon logo

Looping a Loop?

Good morning all I hope you are all having a good day, I have a program that contains a simple loop to check multiple pockets on a valve rotator body, We have recently set up a few other machines to make the same part and I want to loop the entire program Loop included to check multiple parts at once.

My question is, can you Loop a Loop?
Or will the end point of the Loop checking multiple pockets cancel out the Loop that would be needed at the start of the program.
  • Simple answer is, yes you can loop a loop.

    I have done multiple loops before where I have measured a 4x3 grid of separate parts and that worked well. I havnt done a loop of parts with a loop of features in the middle of them but the theory is the same so should work.

    save the program, make a copy and give it a try is the best way.
  • Since we brought up looping a loop. I was wondering if there was a simpler way on something related to this. Engineering has made me a fixture with 2 parts facing in X plus direction. and the other 2 in the X minus direction. Now the way I figure I will do this is, I will create a mirror program, and copy that into my existing program and put all the IF/END or GOTO commands in there that are needed or is there something I don't know about that will run the program mirrored?
  • Since we brought up looping a loop. I was wondering if there was a simpler way on something related to this. Engineering has made me a fixture with 2 parts facing in X plus direction. and the other 2 in the X minus direction. Now the way I figure I will do this is, I will create a mirror program, and copy that into my existing program and put all the IF/END or GOTO commands in there that are needed or is there something I don't know about that will run the program mirrored?


    When you create a mirrored program, it mirrors the code. There's nothing special inside the program, so you should be able to copy and paste as you would between other programs.

    You may be already aware, but it's not good to have features with the same name in the program, so when you copy and past, use paste with pattern. Set the number of times to 1 with no pattern. That will increment all the feature, alignment, and dimension names.
  • Well yeah, but I was wondering if there was an easy way to mirror without mirroring the program. So in short your saying NO, I assume? I guess my only other thought is to keep my dimensions called the same for all my information gets dumped in DataPage. Shut up , I know that's not a question to ask in this part of the forum. Just thinking out loud. Rolling eyes
  • I usually use loops, but I avoid inserting a loop inside another one, even if it's work well (because long time ago, it wasn't the case !!!!!)
    When I need to insert a loop in another one, I use while/end while in a loop or do/until, with a loop inside.
    I saw that do/until in a loop didn't work in 2014.1 (there's a thread about it)
    Happy week-end, all, it's friday !
  • Since we brought up looping a loop. I was wondering if there was a simpler way on something related to this. Engineering has made me a fixture with 2 parts facing in X plus direction. and the other 2 in the X minus direction. Now the way I figure I will do this is, I will create a mirror program, and copy that into my existing program and put all the IF/END or GOTO commands in there that are needed or is there something I don't know about that will run the program mirrored?


    Curiosity kicked in. I make many loops at my company sometimes with up to 4 loops in 1 program, haven't had the opportunity to loop parts the I think you explained it, now I want to try it. Are the HEX parts setup the same way as yours?



  • How mine looked and it worked fine. actually did not do a loop inside a loop, did 1 loop then another loop. a couple of my results are good but came out to negative numbers(I'll work on that later). Other than that it works beautiful.
  • As long as you mirror it in the right axis
  • IF_GOTO/C3.INPUT>=2,GOTO = CONTINUE
                IF_GOTO/C3.INPUT==1,GOTO = END
    CONTINUE     =LABEL/
             LOOP/END
                IF_GOTO/C3.INPUT==2,GOTO = END
                RECALL/ALIGNMENT,INTERNAL,3
    8          =ALIGNMENT/START,RECALL:3,LIST=YES
                  ALIGNMENT/TRANS_OFFSET,XAXIS,-83.11
                ALIGNMENT/END
                TIP/T1A-90B-90, SHANKIJK=-1, -0.007, 0.017, ANGLE=-90.548
    ALOOP_1    =LOOP/START,ID=YES,NUMBER=2,START=1,SKIP=,
                  OFFSET:XAXIS=0,YAXIS=50.8,ZAXIS=0,ANGLE=0
                  CLEARP/XMINUS,-7,XMINUS,0,ON

    This is what I do after the first loop. both loops are set at 2. At the beginning of program, I ask "How Many Parts Do You Want To Run?" C3.INPUT
    IF_GOTO/C3.INPUT==4,GOTO = CONTINUE_2
              IF_GOTO/C3.INPUT==3,GOTO = END
    CONTINUE_2   =LABEL/
             LOOP/END
    END        =LABEL/

    This is at the End of second loop
    INCORRECT_INPUT=LABEL/
    C3         =COMMENT/INPUT,NO,FULL SCREEN=NO,
                How Many Parts Do You Want To Run?
                IF_GOTO/C3.INPUT<1,GOTO = INCORRECT_INPUT
                IF_GOTO/C3.INPUT>4,GOTO = INCORRECT_INPUT
    LOOP_1     =LOOP/START,ID=YES,NUMBER=2,START=1,SKIP=,
                  OFFSET:XAXIS=0,YAXIS=50.8,ZAXIS=0,ANGLE=0

    just to idiot proof it. since my fixture can only hold 4 pieces, any other number besides 1-4, wont work. This is at the beginning
  • Can you run this with say 3 parts?

    I have been doing some experiments to run a 5x3 fixture so I can measure 15 parts. Obviously there are times where there may be less parts than that. I can easily select how many loops are needed in blocks of 5, but say I wanted to run 12 parts the only way I can make it work is to have a on hit error command in there which then continues the loop. but it has to do it three times for the missing parts.

    Was just wondering if you had a way of telling it to miss that final part off if you were running less than 4.