hexagon logo

Case statement help

Having trouble getting this to work. In the input field I have entered 3. My c1 variable should be 1.378 in the auto circle at the end of the code. it is showing in my auto feature as the 5th case - as if it is returning a false value? Can anyone look at the code below and see the issue?
2011 Mr1 - offline seat.
Thanks!!

DO/
C20 =COMMENT/INPUT,NO,FULL SCREEN=NO,
enter a digit for part number.
81024905 TYPE - 1
81024904 TYPE - 2
81024903 TYPE - 3
81024901 TYPE - 4
81024900 TYPE - 5
SELECT/C20.INPUT
CASE/1
ASSIGN/A1=4.132
ASSIGN/B1=.378
ASSIGN/C1=1.614
ASSIGN/D1=.704
END_CASE/
CASE/2
ASSIGN/A1=4.073
ASSIGN/B1=.473
ASSIGN/C1=1.496
ASSIGN/D1=.704
END_CASE/
CASE/3
ASSIGN/A1=4.014
ASSIGN/B1=.496
ASSIGN/C1=1.378
ASSIGN/D1=.704
END_CASE/
CASE/4
ASSIGN/A1=3.955
ASSIGN/B1=.555
ASSIGN/C1=1.26
ASSIGN/D1=.604
END_CASE/
CASE/5
ASSIGN/A1=3.896
ASSIGN/B1=.614
ASSIGN/C1=1.142
ASSIGN/D1=.604
END_CASE/
END_SELECT/
UNTIL/C20.INPUT >1 OR C20.INPUT <5
BOLT HOLE 2=FEAT/CONTACT/CIRCLE/DEFAULT,CARTESIAN,OUT,LEAST_SQR
THEO/<0,0.03,0>,<0,-1,0>,C1,0
ACTL/<0,0.03,0>,<0,-1,0>,1.142,0
TARG/<0,0.03,0>,<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=3,DEPTH=0,PITCH=0
SAMPLE HITS=0,SPACER=0
AVOIDANCE MOVE=BOTH,DISTANCE=0.5
FIND HOLE=DISABLED,ONERROR=NO,READ POS=NO
SHOW HITS=NO
Parents
  • I've always prefered to use the simple IF/GOTO statement. No end statements required, just simple (KISS) programming.
    (also.... 'spaces' in ID's? numbers, letters, and the underscore only to be safe!)

    TOP        =LABEL/
    C1         =COMMENT/INPUT,NO,'enter value for part number
                                ,1 = part a
                                ,2 = part b
                                ,3 = part c
                                ,4 = part d
                                ,5 = part e'
                IF_GOTO/C1.INPUT<1,GOTO = TOP
                IF_GOTO/C1.INPUT>5,GOTO = TOP
                IF_GOTO/C1.INPUT<2,GOTO = L1
                IF_GOTO/C1.INPUT<3,GOTO = L2
                IF_GOTO/C1.INPUT<4,GOTO = L3
                IF_GOTO/C1.INPUT<5,GOTO = L4
                GOTO/L5
    L1         =LABEL/
                COMMENT/DOC,NO,PART-A
                ASSIGN/V1 = 1
                ASSIGN/V2 = 2
                ASSIGN/V3 = 3
                ASSIGN/V4 = 4
                GOTO/L6
    L2         =LABEL/
                COMMENT/DOC,NO,PART-B
                ASSIGN/V1 = 11
                ASSIGN/V2 = 12
                ASSIGN/V3 = 13
                ASSIGN/V4 = 14
                GOTO/L6
    L3         =LABEL/
                COMMENT/DOC,NO,PART-C
                ASSIGN/V1 = 21
                ASSIGN/V2 = 22
                ASSIGN/V3 = 23
                ASSIGN/V4 = 24
                GOTO/L6
    L4         =LABEL/
                COMMENT/DOC,NO,PART-D
                ASSIGN/V1 = 31
                ASSIGN/V2 = 32
                ASSIGN/V3 = 33
                ASSIGN/V4 = 34
                GOTO/L6
    L5         =LABEL/
                COMMENT/DOC,NO,PART-E
                ASSIGN/V1 = 41
                ASSIGN/V2 = 42
                ASSIGN/V3 = 43
                ASSIGN/V4 = 44
                GOTO/L6
    L6         =LABEL/
    P001       =AUTO/CIRCLE,SHOWALLPARAMS = YES,SHOWHITS = NO
                THEO/0,0,0,0,0,1,V3
                ACTL/0,0,0,0,0,1,33
                TARG/0,0,0,0,0,1
                THEO_THICKNESS = 0,RECT,IN,STRAIGHT,LEAST_SQR,ONERROR = NO,$
                AUTO MOVE = BOTH,DISTANCE = 7,RMEAS = None,None,None,$
                READ POS = NO,FIND HOLE = NO,REMEASURE = NO,$
                NUMHITS = 4,INIT = 0,PERM = 0,SPACER = 3,PITCH = 0,$
                START ANG = 0,END ANG = 0,DEPTH = 3,$
                ANGLE VEC = 1,0,0
    


    When I ran it offline, I told it that it was part 3, and you can see the actual diameter came out as a match for the #3 variable.
Reply
  • I've always prefered to use the simple IF/GOTO statement. No end statements required, just simple (KISS) programming.
    (also.... 'spaces' in ID's? numbers, letters, and the underscore only to be safe!)

    TOP        =LABEL/
    C1         =COMMENT/INPUT,NO,'enter value for part number
                                ,1 = part a
                                ,2 = part b
                                ,3 = part c
                                ,4 = part d
                                ,5 = part e'
                IF_GOTO/C1.INPUT<1,GOTO = TOP
                IF_GOTO/C1.INPUT>5,GOTO = TOP
                IF_GOTO/C1.INPUT<2,GOTO = L1
                IF_GOTO/C1.INPUT<3,GOTO = L2
                IF_GOTO/C1.INPUT<4,GOTO = L3
                IF_GOTO/C1.INPUT<5,GOTO = L4
                GOTO/L5
    L1         =LABEL/
                COMMENT/DOC,NO,PART-A
                ASSIGN/V1 = 1
                ASSIGN/V2 = 2
                ASSIGN/V3 = 3
                ASSIGN/V4 = 4
                GOTO/L6
    L2         =LABEL/
                COMMENT/DOC,NO,PART-B
                ASSIGN/V1 = 11
                ASSIGN/V2 = 12
                ASSIGN/V3 = 13
                ASSIGN/V4 = 14
                GOTO/L6
    L3         =LABEL/
                COMMENT/DOC,NO,PART-C
                ASSIGN/V1 = 21
                ASSIGN/V2 = 22
                ASSIGN/V3 = 23
                ASSIGN/V4 = 24
                GOTO/L6
    L4         =LABEL/
                COMMENT/DOC,NO,PART-D
                ASSIGN/V1 = 31
                ASSIGN/V2 = 32
                ASSIGN/V3 = 33
                ASSIGN/V4 = 34
                GOTO/L6
    L5         =LABEL/
                COMMENT/DOC,NO,PART-E
                ASSIGN/V1 = 41
                ASSIGN/V2 = 42
                ASSIGN/V3 = 43
                ASSIGN/V4 = 44
                GOTO/L6
    L6         =LABEL/
    P001       =AUTO/CIRCLE,SHOWALLPARAMS = YES,SHOWHITS = NO
                THEO/0,0,0,0,0,1,V3
                ACTL/0,0,0,0,0,1,33
                TARG/0,0,0,0,0,1
                THEO_THICKNESS = 0,RECT,IN,STRAIGHT,LEAST_SQR,ONERROR = NO,$
                AUTO MOVE = BOTH,DISTANCE = 7,RMEAS = None,None,None,$
                READ POS = NO,FIND HOLE = NO,REMEASURE = NO,$
                NUMHITS = 4,INIT = 0,PERM = 0,SPACER = 3,PITCH = 0,$
                START ANG = 0,END ANG = 0,DEPTH = 3,$
                ANGLE VEC = 1,0,0
    


    When I ran it offline, I told it that it was part 3, and you can see the actual diameter came out as a match for the #3 variable.
Children
No Data