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
  • Wlayton is correct, however, I'd do it in another manner.

    You are using a while clause to determine if the circle should be executed or not. I'd use a label to return the operator to the selection screen again if they choose to enter anything lower than 1 and higher than 5.

    Like this:

    TOP        =LABEL/
    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
                IF_GOTO/C20.INPUT < 1 OR C20.INPUT > 5,GOTO = TOP
                SELECT/C20.INPUT
                CASE/1
                ASSIGN/A1=1
                ASSIGN/B1=1
                ASSIGN/C1=1
                ASSIGN/D1=1
                END_CASE/
                CASE/2
                ASSIGN/A1=2
                ASSIGN/B1=2
                ASSIGN/C1=2
                ASSIGN/D1=2
                END_CASE/
                CASE/3
                ASSIGN/A1=3
                ASSIGN/B1=3
                ASSIGN/C1=3
                ASSIGN/D1=3
                END_CASE/
                CASE/4
                ASSIGN/A1=4
                ASSIGN/B1=4
                ASSIGN/C1=4
                ASSIGN/D1=4
                END_CASE/
                CASE/5
                ASSIGN/A1=5
                ASSIGN/B1=5
                ASSIGN/C1=5
                ASSIGN/D1=5
                END_CASE/
                END_SELECT/
    CIR1       =FEAT/CONTACT/CIRCLE/DEFAULT,CARTESIAN,IN,LEAST_SQR
                THEO/<0,0,0>,<0,0,1>,C1
                ACTL/<0,0,0>,<0,0,1>,2
                TARG/<0,0,0>,<0,0,1>
                START ANG=0,END ANG=360
                ANGLE VEC=<1,0,0>
                DIRECTION=CCW
                SHOW FEATURE PARAMETERS=NO
                SHOW CONTACT PARAMETERS=NO


    You'd need to edit the variables values to suit your application though - before running this...
Reply
  • Wlayton is correct, however, I'd do it in another manner.

    You are using a while clause to determine if the circle should be executed or not. I'd use a label to return the operator to the selection screen again if they choose to enter anything lower than 1 and higher than 5.

    Like this:

    TOP        =LABEL/
    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
                IF_GOTO/C20.INPUT < 1 OR C20.INPUT > 5,GOTO = TOP
                SELECT/C20.INPUT
                CASE/1
                ASSIGN/A1=1
                ASSIGN/B1=1
                ASSIGN/C1=1
                ASSIGN/D1=1
                END_CASE/
                CASE/2
                ASSIGN/A1=2
                ASSIGN/B1=2
                ASSIGN/C1=2
                ASSIGN/D1=2
                END_CASE/
                CASE/3
                ASSIGN/A1=3
                ASSIGN/B1=3
                ASSIGN/C1=3
                ASSIGN/D1=3
                END_CASE/
                CASE/4
                ASSIGN/A1=4
                ASSIGN/B1=4
                ASSIGN/C1=4
                ASSIGN/D1=4
                END_CASE/
                CASE/5
                ASSIGN/A1=5
                ASSIGN/B1=5
                ASSIGN/C1=5
                ASSIGN/D1=5
                END_CASE/
                END_SELECT/
    CIR1       =FEAT/CONTACT/CIRCLE/DEFAULT,CARTESIAN,IN,LEAST_SQR
                THEO/<0,0,0>,<0,0,1>,C1
                ACTL/<0,0,0>,<0,0,1>,2
                TARG/<0,0,0>,<0,0,1>
                START ANG=0,END ANG=360
                ANGLE VEC=<1,0,0>
                DIRECTION=CCW
                SHOW FEATURE PARAMETERS=NO
                SHOW CONTACT PARAMETERS=NO


    You'd need to edit the variables values to suit your application though - before running this...
Children
No Data