hexagon logo

SKIPPING OPS WITH IF AND STATEMENTS

Hey all,

A program begins with a basic alignment and then a DCC alignment. When the program starts it asks what op you're checking, 1, 2, or 3 for example. Depending on what you select the program should construct your alignments and then move on to that op. If you're only checking op2 for example, how do you first instruct pcdmis to run the alignment code before moving on to op2? 

It's been years since I've done this and I feel like Forrest Gump all of a sudden.

Thank You

Parents
  • I appreciate the answers, but I'm having the same problem with each. If I select op1 it will run through the alignments, and all the op1 features, but it continues on to op2, even though I have an END_IF/ after op1. This is just a sample I'm using while trying to work this out, so yeah, there really is just two diameters in op1.

    I did get it to skip op1 and jump to op2. 

    C1 =COMMENT/INPUT,NO,FULL SCREEN=NO,

    1
    2
    3

    IF/C1.INPUT == 1
    CIR3 =FEAT/CONTACT/CIRCLE/DEFAULT,CARTESIAN,IN,LEAST_SQR
    THEO/<4,-2,0>,<0,0,1>,2
    ACTL/<4,-2,0>,<0,0,1>,2
    TARG/<4,-2,0>,<0,0,1>
    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.0787,PITCH=0
    SAMPLE METHOD=SAMPLE_HITS
    SAMPLE HITS=0,SPACER=0.0197
    AVOIDANCE MOVE=NO
    FIND HOLE=DISABLED,ONERROR=NO,READ POS=NO
    SHOW HITS=NO


    CIR4 =FEAT/CONTACT/CIRCLE/DEFAULT,CARTESIAN,IN,LEAST_SQR
    THEO/<2,-4,0>,<0,0,1>,2
    ACTL/<2,-4,0>,<0,0,1>,2
    TARG/<2,-4,0>,<0,0,1>
    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.0787,PITCH=0
    SAMPLE METHOD=SAMPLE_HITS
    SAMPLE HITS=0,SPACER=0.0197
    AVOIDANCE MOVE=NO
    FIND HOLE=DISABLED,ONERROR=NO,READ POS=NO
    SHOW HITS=NO
    END_IF/

    L2 =LABEL/
    CIR5 =FEAT/CONTACT/CIRCLE/DEFAULT,CARTESIAN,IN,LEAST_SQR
    THEO/<6,-4,0>,<0,0,1>,2
    ACTL/<6,-4,0>,<0,0,1>,2
    TARG/<6,-4,0>,<0,0,1>
    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.0787,PITCH=0
    SAMPLE METHOD=SAMPLE_HITS
    SAMPLE HITS=0,SPACER=0.0197
    AVOIDANCE MOVE=NO
    FIND HOLE=DISABLED,ONERROR=NO,READ POS=NO
    SHOW HITS=NO

  • You need to have a label at the next part of the program each input needs to drive to. Since all the alignments are at the top, each one needs a GOTO to prevent PC-DMIS from going to them. Even if your input is to go to OP1, it will still execute all code below it. Including the OP2

    So at the end of your alignment feature you need to put a GOTO and whatever the label name you choose to continue the routine. If they all share the same program after the alignment, then just include 1 GOTO, if they do not, you'll need to include a GOTO for the reporting section as well

    ERROR1      =LABEL/
    C1         =COMMENT/INPUT,NO,FULL SCREEN=NO,
                1 For Part Number xxxxx
                2 For Part Number xxxxx
                3 For Part Number xxxxx
                IF/C1.INPUT <> 1 AND C1.INPUT <> 2 AND C1.INPUT <> 3
                  COMMENT/OPER,NO,FULL SCREEN=NO,AUTO-CONTINUE=NO,OVC=NO,
                  Invalid entry
                  GOTO/ERROR1
                END_IF/
                IF_GOTO/C1.INPUT == 1,GOTO = PART1
                IF_GOTO/C1.INPUT == 2,GOTO = PART2
                IF_GOTO/C1.INPUT == 3,GOTO = PART3
    PART1      =LABEL/
    $$ NO,
                Alignment data for Input 1
                GOTO/ROUTINE1
    PART2      =LABEL/
    $$ NO,
                Alignment data for Input 2
                GOTO/ROUTINE2
    PART3      =LABEL/
    $$ NO,
                Alignment data for Input 3
                GOTO/ROUTINE3
    $$ NO,
                Routine 1 Data
    ROUTINE1   =LABEL/
    $$ NO,
                Routine 2 Data
    ROUTINE2   =LABEL/
    $$ NO,
                Routine 3 Data
    ROUTINE3   =LABEL/

Reply
  • You need to have a label at the next part of the program each input needs to drive to. Since all the alignments are at the top, each one needs a GOTO to prevent PC-DMIS from going to them. Even if your input is to go to OP1, it will still execute all code below it. Including the OP2

    So at the end of your alignment feature you need to put a GOTO and whatever the label name you choose to continue the routine. If they all share the same program after the alignment, then just include 1 GOTO, if they do not, you'll need to include a GOTO for the reporting section as well

    ERROR1      =LABEL/
    C1         =COMMENT/INPUT,NO,FULL SCREEN=NO,
                1 For Part Number xxxxx
                2 For Part Number xxxxx
                3 For Part Number xxxxx
                IF/C1.INPUT <> 1 AND C1.INPUT <> 2 AND C1.INPUT <> 3
                  COMMENT/OPER,NO,FULL SCREEN=NO,AUTO-CONTINUE=NO,OVC=NO,
                  Invalid entry
                  GOTO/ERROR1
                END_IF/
                IF_GOTO/C1.INPUT == 1,GOTO = PART1
                IF_GOTO/C1.INPUT == 2,GOTO = PART2
                IF_GOTO/C1.INPUT == 3,GOTO = PART3
    PART1      =LABEL/
    $$ NO,
                Alignment data for Input 1
                GOTO/ROUTINE1
    PART2      =LABEL/
    $$ NO,
                Alignment data for Input 2
                GOTO/ROUTINE2
    PART3      =LABEL/
    $$ NO,
                Alignment data for Input 3
                GOTO/ROUTINE3
    $$ NO,
                Routine 1 Data
    ROUTINE1   =LABEL/
    $$ NO,
                Routine 2 Data
    ROUTINE2   =LABEL/
    $$ NO,
                Routine 3 Data
    ROUTINE3   =LABEL/

Children