hexagon logo

If/go to help

This is probably very simple to those of you who need, or find the need to use code on a regular basis...but I am very rusty and need some guidance.

So, I have 2 dims, X and Z and a tolerance to each of those....I have created assignments to each deviation, so far so good. I have created 2 labels, "restart", and "continue"....

Ok, so what I am looking to do....after the measurement, I want the code to say, yes, this is in tolerance, jump to the "continue" label, if its not in tolerance, I want an operator prompt to pop up and say, "re adjust and try again" and obviously jumping back to the "restart label as well.....

I know what I need to do, but the syntax gets me every time....

Here is what I have so far...


RESTART =LABEL/
_B_ LOCATOR=FEAT/CONTACT/CIRCLE/DEFAULT,CARTESIAN,IN,LEAST_SQR
THEO/<621.234,802.112,688.115>,<0,-1,0>,10
ACTL/<621.262,802.161,688.074>,<0,-1,0>,10.085
TARG/<621.234,802.112,688.115>,<0,-1,0>
START ANG=0,END ANG=360
ANGLE VEC=<-1,0,0>
DIRECTION=CCW
SHOW FEATURE PARAMETERS=NO
SHOW CONTACT PARAMETERS=YES
NUMHITS=4,DEPTH=1,PITCH=0
SAMPLE METHOD=SAMPLE_HITS
SAMPLE HITS=1,SPACER=2
AVOIDANCE MOVE=NO,DISTANCE=10
FIND HOLE=DISABLED,ONERROR=NO,READ POS=NO
SHOW HITS=NO
DIM D4= LOCATION OF CIRCLE _B_ LOCATOR
AX NOMINAL +TOL -TOL MEAS DEV OUTTOL
X 621.234 0.075 0.075 621.262 0.028 0.000
Z 688.115 0.075 0.075 688.074 -0.041 0.000
END OF DIMENSION D4
MOVE/CLEARPLANE
_C_ LOCATOR=FEAT/CONTACT/CIRCLE/DEFAULT,CARTESIAN,IN,LEAST_SQR
THEO/<1428.069,605.06,1100.772>,<0,-1,0>,8
ACTL/<1428.057,605.06,1100.703>,<0,-1,0>,8.087
TARG/<1428.069,605.06,1100.772>,<0,-1,0>
START ANG=0,END ANG=360
ANGLE VEC=<1,0,0>
DIRECTION=CCW
SHOW FEATURE PARAMETERS=NO
SHOW CONTACT PARAMETERS=YES
NUMHITS=4,DEPTH=0,PITCH=0
SAMPLE METHOD=SAMPLE_HITS
SAMPLE HITS=0,SPACER=3
AVOIDANCE MOVE=AFTER,DISTANCE=5
FIND HOLE=DISABLED,ONERROR=NO,READ POS=NO
SHOW HITS=NO
DIM D5= LOCATION OF CIRCLE _C_ LOCATOR
AX NOMINAL +TOL -TOL MEAS DEV OUTTOL
X 1428.069 0.075 0.075 1428.057 -0.012 0.000
Z 1100.772 0.075 0.075 1100.703 -0.069 0.000
END OF DIMENSION D5
ASSIGN/V1=D4.X.DEV
ASSIGN/V2=D4.Z.DEV
ASSIGN/V3=D5.X.DEV
ASSIGN/V4=D5.Z.DEV
ASSIGN/V5=0
CONTINUE =LABEL/
  • Don't have the exact syntax either but I think the simplest method would be to test for an out of tolerance value greater than zero. That way you only have to test for one condition for each dimension instead of two. Something along the lines of IF D4.X.OUTTol greater or less than zero then goto RESTART.
  • IF/D4.X.OUTTOL>0 OR D4.Z.OUTTOL>0
    COMMENT/OPER,NO,FULL SCREEN=NO,AUTO-CONTINUE=NO,
    DIM D4 IS OUT OF TOLERANCE. PLEASE
    ADJUST AND CLICK CONTINUE
    GOTO/RESTART
    END_IF/
    IF/D5.X.OUTTOL>0 OR D5.Z.OUTTOL>0
    COMMENT/OPER,NO,FULL SCREEN=NO,AUTO-CONTINUE=NO,
    DIM D5 IS OUT OF TOLERANCE. PLEASE
    ADJUST AND CLICK CONTINUE
    GOTO/RESTART
    END_IF/
    


    You don't want to use DEV because your part will have deviation from nominal. You want to use the OUTTOL. Before the comments in the IF statements, you may want to add a move point to have the probe back off so it allows the part to be adjusted. You won't need a command to "continue" because if the statement is false, the program will just continue automatically.
  • IF/D4.X.OUTTOL>0 OR D4.Z.OUTTOL>0
    COMMENT/OPER,NO,FULL SCREEN=NO,AUTO-CONTINUE=NO,
    DIM D4 IS OUT OF TOLERANCE. PLEASE
    ADJUST AND CLICK CONTINUE
    GOTO/RESTART
    END_IF/
    IF/D5.X.OUTTOL>0 OR D5.Z.OUTTOL>0
    COMMENT/OPER,NO,FULL SCREEN=NO,AUTO-CONTINUE=NO,
    DIM D5 IS OUT OF TOLERANCE. PLEASE
    ADJUST AND CLICK CONTINUE
    GOTO/RESTART
    END_IF/
    


    You don't want to use DEV because your part will have deviation from nominal. You want to use the OUTTOL. Before the comments in the IF statements, you may want to add a move point to have the probe back off so it allows the part to be adjusted. You won't need a command to "continue" because if the statement is false, the program will just continue automatically.


    Also need a way to escape because of the part truly is out, you'll be stuck in an endless loop.


  • Also need a way to escape because of the part truly is out, you'll be stuck in an endless loop.


    ASSIGN/COUNTER=0
    RESTART =LABEL/
    _B_ =FEAT/CONTACT/CIRCLE/DEFAULT,CARTESIAN,IN,LEAST_SQR
    THEO/<0,0,0>,<0,1,0>,10
    ACTL/<0,0,0>,<0,1,0>,10
    TARG/<0,0,0>,<0,1,0>
    START ANG=0,END ANG=0
    ANGLE VEC=<0,0,1>
    DIRECTION=CCW
    SHOW FEATURE PARAMETERS=NO
    SHOW CONTACT PARAMETERS=YES
    NUMHITS=4,DEPTH=0,PITCH=0
    SAMPLE METHOD=SAMPLE_HITS
    SAMPLE HITS=0,SPACER=2.54
    AVOIDANCE MOVE=NO,DISTANCE=38.1
    FIND HOLE=DISABLED,ONERROR=NO,READ POS=NO
    SHOW HITS=NO
    DIM D4= LOCATION OF CIRCLE _B_ UNITS=MM ,$
    GRAPH=OFF TEXT=OFF MULT=10.00 OUTPUT=BOTH HALF ANGLE=NO
    AX NOMINAL MEAS +TOL -TOL DEV OUTTOL
    X 0.000 0.000 0.075 0.075 0.000 0.000 ---#----
    Z 0.000 0.000 0.075 0.075 0.000 0.000 ---#----
    END OF DIMENSION D4
    _C_ =FEAT/CONTACT/CIRCLE/DEFAULT,CARTESIAN,IN,LEAST_SQR
    THEO/<20,0,0>,<0,1,0>,10
    ACTL/<20.1,0,0>,<0,1,0>,10
    TARG/<20.1,0,0>,<0,1,0>
    START ANG=0,END ANG=0
    ANGLE VEC=<0,0,1>
    DIRECTION=CCW
    SHOW FEATURE PARAMETERS=NO
    SHOW CONTACT PARAMETERS=YES
    NUMHITS=4,DEPTH=0,PITCH=0
    SAMPLE METHOD=SAMPLE_HITS
    SAMPLE HITS=0,SPACER=2.54
    AVOIDANCE MOVE=NO,DISTANCE=38.1
    FIND HOLE=DISABLED,ONERROR=NO,READ POS=NO
    SHOW HITS=NO
    DIM D5= LOCATION OF CIRCLE _C_ UNITS=MM ,$
    GRAPH=OFF TEXT=OFF MULT=10.00 OUTPUT=BOTH HALF ANGLE=NO
    AX NOMINAL MEAS +TOL -TOL DEV OUTTOL
    X 20.000 20.100 0.075 0.075 0.100 0.025 ------->
    Z 0.000 0.000 0.075 0.075 0.000 0.000 ---#----
    END OF DIMENSION D5
    IF/D4.X.OUTTOL>0 OR D4.Z.OUTTOL>0 OR D5.X.OUTTOL>0 OR D5.Z.OUTTOL>0
    ASSIGN/COUNTER=COUNTER+1
    IF_GOTO/COUNTER==4,GOTO = CONTINUE
    MOVE/POINT,NORMAL,<20,15,0>
    COMMENT/OPER,NO,FULL SCREEN=NO,AUTO-CONTINUE=NO,
    DIM D4 AND/OR D5 IS OUT OF TOLERANCE.
    ADJUST THE PART AND CLICK OK.
    GOTO/RESTART
    END_IF/
    CONTINUE =LABEL/
    


    Here is a blank code. I set the target of _C_ to be at 0.1 off of nominal in X so it would flag the out of tolerance in the dimension. This code gives them 3 chances to adjust, otherwise it just continues automatically. Now you could move stuff around to nest another IF statement in there if COUNTER=4 add a comment to say that the part is still out of tolerance after 3 tries, the program will continue.