hexagon logo

Looping question: Unique Input for Each Part plus Skipping Stations

I'd like to write a program capable of inspecting 4 identical parts mounted to fixtures, pitched 100mm apart from one another.
The user will be asked where each part came from (location on on the CNC machine)
Each report pdf will be named to identify where each part came from.
It will be possible to skip one or several of the parts.

The program I have allows me to do all of this except for the looping.

Manual alignment
Ask user part location
DCC alignment
Features
Dimensions
Report with pdf name identifying part location


Using the help file, I can create a simple looping program to measure the four parts, but I'm not sure how to include part identification and part skipping. I'd rather not have to have the program pause between parts while waiting for user input.
Parents
  • Step 0: don't use the PC-DMIS Loop & End Loop commands.
    They work great for simple jobs without variation, not for complex work.

    My #1 choice is a Do Until Loop.

    The Do Until Loop is a pair of commands, Do and Until, bracketing your inspection code with the "stop looping" condition being in the Until statement that's at the end of the loop.

    Step 1:
    There is no automatic loop # iteration tracking, you have to code that into the beginning of the loop.
    That's easy - before the loop declare a variable and set it's value to zero
    ASSIGN/COUNTER=0

    Then the very first line after the Do command begins the loop is
    ASSIGN/COUNTER=COUNTER+1


    Here's a sample of that structure:
    ASSIGN/COUNTER=0
                DO/
                ASSIGN/COUNTER=COUNTER+1
    $$ NO,
                "measure the part
                UNTIL/COUNTER==4

    So you see the code inside the Do -Until pair is going to get run 4 times.

    Step 2:
    There is no automatic alignment offsetting, you have to code that into the beginning of the loop.
    To handle this, I find a very effective method is to have a simple Generic Point with:
    a) fixed permanent zeros (0+0 formulas) in the Nom fields,
    b) variables on the Meas fields.
    Then a simple Origin Only alignment that sets the Generic Point as origin.
    But the real trick is that the Meas or actual values of the generic point come from some simple IF statements based on the COUNTER # of the loop corresponding to which fixture station.


    ASSIGN/COUNTER=0
                DO/
                ASSIGN/COUNTER=COUNTER+1
                IF/COUNTER==1
                  ASSIGN/FIXTURE_X=0
                END_IF/
                IF/COUNTER==1
                  ASSIGN/FIXTURE_X=100
                END_IF/
                IF/COUNTER==1
                  ASSIGN/FIXTURE_X=200
                END_IF/
                IF/COUNTER==1
                  ASSIGN/FIXTURE_X=300
                END_IF/
    LOOP_ORIGIN=GENERIC/POINT,DEPENDENT,CARTESIAN,$
                NOM/XYZ,<0+0,0+0,0+0>,$
                MEAS/XYZ,<FIXTURE_X,0+0,0+0>,$
                NOM/IJK,<0+0,0+0,1+0>,$
                MEAS/IJK,<0+0,0+0,1+0>
    
    A1         =ALIGNMENT/START,RECALL:STARTUP,LIST=YES
                  ALIGNMENT/TRANS,XAXIS,LOOP_ORIGIN
                ALIGNMENT/END
    $$ NO,
                "measure the part
                UNTIL/COUNTER==4


    With this method, the nominals of the code inside the loop can NEVER be modified accidentally by PC-DMIS.

    Chew on that for a minute while I check on my students.


Reply
  • Step 0: don't use the PC-DMIS Loop & End Loop commands.
    They work great for simple jobs without variation, not for complex work.

    My #1 choice is a Do Until Loop.

    The Do Until Loop is a pair of commands, Do and Until, bracketing your inspection code with the "stop looping" condition being in the Until statement that's at the end of the loop.

    Step 1:
    There is no automatic loop # iteration tracking, you have to code that into the beginning of the loop.
    That's easy - before the loop declare a variable and set it's value to zero
    ASSIGN/COUNTER=0

    Then the very first line after the Do command begins the loop is
    ASSIGN/COUNTER=COUNTER+1


    Here's a sample of that structure:
    ASSIGN/COUNTER=0
                DO/
                ASSIGN/COUNTER=COUNTER+1
    $$ NO,
                "measure the part
                UNTIL/COUNTER==4

    So you see the code inside the Do -Until pair is going to get run 4 times.

    Step 2:
    There is no automatic alignment offsetting, you have to code that into the beginning of the loop.
    To handle this, I find a very effective method is to have a simple Generic Point with:
    a) fixed permanent zeros (0+0 formulas) in the Nom fields,
    b) variables on the Meas fields.
    Then a simple Origin Only alignment that sets the Generic Point as origin.
    But the real trick is that the Meas or actual values of the generic point come from some simple IF statements based on the COUNTER # of the loop corresponding to which fixture station.


    ASSIGN/COUNTER=0
                DO/
                ASSIGN/COUNTER=COUNTER+1
                IF/COUNTER==1
                  ASSIGN/FIXTURE_X=0
                END_IF/
                IF/COUNTER==1
                  ASSIGN/FIXTURE_X=100
                END_IF/
                IF/COUNTER==1
                  ASSIGN/FIXTURE_X=200
                END_IF/
                IF/COUNTER==1
                  ASSIGN/FIXTURE_X=300
                END_IF/
    LOOP_ORIGIN=GENERIC/POINT,DEPENDENT,CARTESIAN,$
                NOM/XYZ,<0+0,0+0,0+0>,$
                MEAS/XYZ,<FIXTURE_X,0+0,0+0>,$
                NOM/IJK,<0+0,0+0,1+0>,$
                MEAS/IJK,<0+0,0+0,1+0>
    
    A1         =ALIGNMENT/START,RECALL:STARTUP,LIST=YES
                  ALIGNMENT/TRANS,XAXIS,LOOP_ORIGIN
                ALIGNMENT/END
    $$ NO,
                "measure the part
                UNTIL/COUNTER==4


    With this method, the nominals of the code inside the loop can NEVER be modified accidentally by PC-DMIS.

    Chew on that for a minute while I check on my students.


Children
No Data