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

  • I would put a label at the end of the program and then put a GOTO to that label at the end of each operation.

  • I need to revisit this topic. I have a program with 3ops. My comment asks the operator to select which op they're running, 1,  2,  3 or 4 for the full program. If they select either 1, 2 or 3, it runs fine. If they select 4 however, it has issues. FYI, this program only has one alignment. I'm assuming there doesn't need to be any code if they select op4, as it should skip 1, 2, and 3.

    This is the code below. If I select op 1, it will properly go to the XMINUS clearplane and run through op1. If however I select op 4, it will immediately try going through the part to XPLUS.

    My last issue with this is that the probe makes unintended and unnecessary rotations when selecting independent ops. We use a 90° probe on this part and at some points it will point the probe straight up to ZPLUS, then rotate back to it's correct position. It appears it's reading the angle from the probe above it, but that code is in a different op so I'm unsure why it's using it.


    A_B_C =ALIGNMENT/START,RECALL:BASIC_ALN,LIST=YES
    ALIGNMENT/LEVEL,XMINUS,DAT_A
    ALIGNMENT/TRANS,XAXIS,DAT_A
    ALIGNMENT/ROTATE_CIRCLE,YPLUS,TO,DAT_B,AND,DAT_C,ABOUT,XMINUS
    ALIGNMENT/TRANS,YAXIS,DAT_B
    ALIGNMENT/TRANS,ZAXIS,DAT_B
    ALIGNMENT/END


    DATDEF/A,FEATURES=DAT_A,,
    DATDEF/B,FEATURES=DAT_B,,
    DATDEF/C,FEATURES=DAT_C,,


    IF/C1.INPUT == 1
    GOTO/OP1
    END_IF/

    IF/C1.INPUT == 2
    MOVE/CLEARPLANE
    CLEARP/XMINUS,-4,XMINUS,0,OFF
    CLEARP/XMINUS,-25,XMINUS,0,ON
    TIP/T1A90B90, SHANKIJK=-1, -0.001, 0.003, ANGLE=89.773
    MOVE/POINT,NORMAL,<-4,0,0>
    MOVE/POINT,NORMAL,<-4,0,350>
    MOVE/POINT,NORMAL,<300,0,350>
    GOTO/OP2
    END_IF/


    IF/C1.INPUT == 3

    MOVE/CLEARPLANE
    MOVE/POINT,NORMAL,<-23.975,3.559,395.34>
    MOVE/POINT,NORMAL,<158.601,3.775,395.557>
    LOADPROBE/3MM_X_50MM_5
    TIP/T1A0B180, SHANKIJK=0.001, -1, -0.001, ANGLE=-0.15
    GOTO/OP3
    END_IF/

    OP1 =LABEL/
    CLEARP/XMINUS,-4,XMINUS,0,ON
    MOVE/CLEARPLANE

  • Setup one startup point, let each OP block share this beginning point, all alignments needed for OP do inside OP block

    Use goto command for navigating through operations.
    put Labels in each OP with START and END label, in the beginning of block check for operator input and navigate to labels according it.

Reply Children
No Data