hexagon logo

Do Until Pallet using Element function and Trace Fields

Do Until Pallet using Element function and Trace Fields

Here is a sample routine using the Do Until loop for a Pallet routine. I came across a post that Josh Carpenter posted a brief example of a Do Until routine.
I decided to give this a try using PC-DMIS 2022.1 with Trace Fields and the Element function. His example measurement units are in metric and I converted this sample to inches.
This example allows the routine to skip multiple pallet stations.
Josh Carpenter post link for Looping question: Unique Input for Each Part plus Skipping Stations - Starting on Post 2
Link: https://www.pcdmisforum.com/forum/pc...pping-stations

Here is the sample routine.


PART NAME  : Looping DoUntil Forum
REV NUMBER : 20220805
SER NUMBER :
STATS COUNT : 1
 
STARTUP    =ALIGNMENT/START,RECALL:USE_PART_SETUP,LIST=YES
            ALIGNMENT/END
            MODE/MANUAL
            FORMAT/TEXT,OPTIONS, ,HEADINGS,SYMBOLS, ;NOM,TOL,MEAS,DEV,OUTTOL, ,
            LOADPROBE/5BY50_M3_SH
            TIP/TIP1, SHANKIJK=0, 0, 1, ANGLE=0
            TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=Enter Serial numbers per-part ; partSerialNo : 101,,103,104,105,,107,108,109,110,111,112,113,114,115,116
            TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=Skip part Ex.(1) or parts Ex.(1,2,3) Enter in ascending order ; skipPartTrace : 2,6
            TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=Report the skip part information? ; skipPartReportInfo : Yes
            TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=Enter number of parts - First row X ; xCounterTrace : 4
            TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=Enter number of parts - First column Y ; yCounterTrace : 4
            TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=Enter offset distance - First row X Part 1 ; xOffsetPart1 : 0
            TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=Enter offset distance - First row X Part 2 ; xOffsetPart2 : 3.937008
            TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=Enter offset distance - First row X Part 3 ; xOffsetPart3 : 7.874016
            TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=Enter offset distance - First row X Part 4 ; xOffsetPart4 : 11.81102
            TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=Enter offset distance - First column Y Part 1 ; yOffsetPart1 : 0
            TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=Enter offset distance - First column Y Part 2 ; yOffsetPart2 : -3.937008
            TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=Enter offset distance - First column Y Part 3 ; yOffsetPart3 : -7.874016
            TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=Enter offset distance - First column Y Part 4 ; yOffsetPart4 : -11.81102
            ASSIGN/SKIP_TRACE_CNT=1
            ASSIGN/PART_COUNT=0
            ASSIGN/Y_COUNTER=0
            ASSIGN/X_LOOP_END_COUNT=GETTRACEVALUE("xCounterTrace")
            ASSIGN/Y_LOOP_END_COUNT=GETTRACEVALUE("yCounterTrace")
            DO/
              ASSIGN/Y_COUNTER=Y_COUNTER+1
              IF/Y_COUNTER==1
                ASSIGN/FIXTURE_Y=GETTRACEVALUE("yOffsetPart1")
              END_IF/
              IF/Y_COUNTER==2
                ASSIGN/FIXTURE_Y=GETTRACEVALUE("yOffsetPart2")
              END_IF/
              IF/Y_COUNTER==3
                ASSIGN/FIXTURE_Y=GETTRACEVALUE("yOffsetPart3")
              END_IF/
              IF/Y_COUNTER==4
                ASSIGN/FIXTURE_Y=GETTRACEVALUE("yOffsetPart4")
              END_IF/
              ASSIGN/X_COUNTER=0
              DO/
                ASSIGN/PART_COUNT=PART_COUNT+1
                ASSIGN/X_COUNTER=X_COUNTER+1
                ASSIGN/SKIP_PART_TRACE=ELEMENT(SKIP_TRACE_CNT,",",GETTRACEVALUE("skipPartTrace"))
                ASSIGN/SKIP_PART=SKIP_PART_TRACE
                IF/PART_COUNT==SKIP_PART
                  ASSIGN/SER_NO_TRACE=ELEMENT(PART_COUNT,",",GETTRACEVALUE("partSerialNo"))
                  ASSIGN/SER_NO=SER_NO_TRACE
                  IF/GETTRACEVALUE("skipPartReportInfo")=="Yes"
                    COMMENT/REPT,
                    "SER_NO SKIP: "+SER_NO
                    "PART_COUNT SKIP: "+PART_COUNT
                    .
                  END_IF/
                  ASSIGN/SKIP_TRACE_CNT=SKIP_TRACE_CNT+1
                  IF_GOTO/PART_COUNT==SKIP_PART,GOTO = SKIP_PART_L1
                END_IF/
                ASSIGN/SER_NO_TRACE=ELEMENT(PART_COUNT,",",GETTRACEVALUE("partSerialNo"))
                ASSIGN/SER_NO=SER_NO_TRACE
                COMMENT/REPT,
                "SER_NO: "+SER_NO
                "PART_COUNT: "+PART_COUNT
                IF/X_COUNTER==1
                  ASSIGN/FIXTURE_X=GETTRACEVALUE("xOffsetPart1")
                END_IF/
                IF/X_COUNTER==2
                  ASSIGN/FIXTURE_X=GETTRACEVALUE("xOffsetPart2")
                END_IF/
                IF/X_COUNTER==3
                  ASSIGN/FIXTURE_X=GETTRACEVALUE("xOffsetPart3")
                END_IF/
                IF/X_COUNTER==4
                  ASSIGN/FIXTURE_X=GETTRACEVALUE("xOffsetPart4")
                END_IF/
LOOP_ORIGIN    =GENERIC/POINT,DEPENDENT,CARTESIAN,$
                NOM/XYZ,<0+0,0+0,0+0>,$
                MEAS/XYZ,<FIXTURE_X,FIXTURE_Y,0+0>,$
                NOM/IJK,<0+0,0+0,1+0>,$
                MEAS/IJK,<0+0,0+0,1+0>
A1             =ALIGNMENT/START,RECALL:USE_ACTIVE_ALIGNMENT(STARTUP),LIST=YES
                  ALIGNMENT/TRANS,XAXIS,LOOP_ORIGIN
                  ALIGNMENT/TRANS,YAXIS,LOOP_ORIGIN
                ALIGNMENT/END
F1             =GENERIC/CIRCLE,DEPENDENT,CARTESIAN,OUT,$
                NOM/XYZ,<0,0,0>,$
                MEAS/XYZ,<0,0,0>,$
                NOM/IJK,<0,0,1>,$
                MEAS/IJK,<0,0,1>,$
                DIAMETER/1,1
    DIM LOC1= LOCATION OF CIRCLE F1  UNITS=IN ,$
    GRAPH=OFF  TEXT=OFF  MULT=10.00  OUTPUT=BOTH  HALF ANGLE=NO
    AX    NOMINAL       +TOL       -TOL       MEAS        DEV     OUTTOL
    X       0.0000     0.0020     0.0020     0.0000     0.0000     0.0000 ----#----
    Y       0.0000     0.0020     0.0020     0.0000     0.0000     0.0000 ----#----
    Z       0.0000     0.0020     0.0020     0.0000     0.0000     0.0000 ----#----
    END OF DIMENSION LOC1
                ASSIGN/DATE=SYSTEMDATE("ddMMMyyyy")
                ASSIGN/TIME=SYSTEMTIME("HHmm")
                ASSIGN/PARTNAME=STR(GETTEXT(191,1,{FILEHEDR}))
                ASSIGN/PDFNAME="C:\\Users\\Public\\Documents\\"+PARTNAME+"_"+TIME+"_"+DATE+".PDF"
SKIP_PART_L1    =LABEL/
              UNTIL/X_COUNTER==X_LOOP_END_COUNT
            UNTIL/Y_COUNTER==Y_LOOP_END_COUNT
            ASSIGN/TOTAL_PART_COUNT=PART_COUNT-(SKIP_TRACE_CNT-1)
$$ YES,
            "TOTAL PART_COUNT: "+TOTAL_PART_COUNT+" of "+PART_COUNT
            PRINT/REPORT,EXEC MODE=END,$
              TO_FILE=OFF,OVERWRITE=PDFNAME,AUTO OPEN=OFF,$
              TO_PRINTER=OFF,COPIES=1,$
              TO_DMIS_REPORT=OFF,FILE_OPTION=INDEX,FILENAME=,$
              REPORT_THEORETICALS=NONE,REPORT_FEATURE_WITH_DIMENSIONS=NO,$
              TO_EXCEL=OFF,$
              PREVIOUS_RUNS=KEEP_INSTANCES

Parents
  • KIRBSTER269,
    Here is the sample Pallet Routine Template with some of your changes and I removed the skip part from the routine. The number of columns multiple the number of rows will equal the number of parts in this sample routine. Is there another method you want to use the Total Parts for?

                MODE/DCC
                TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=Enter Unit Numbers ; unitNumber : 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
                TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=Number of Columns ; xCounterTrace : 5
                TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=Number of Rows ; yCounterTrace : 3
                TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=First Part X ; xOffsetPart1 : 0
                TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=Second Part X ; xOffsetPart2 : 2.25
                TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=Third Part X ; xOffsetPart3 : 4.5
                TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=Fourth Part X ; xOffsetPart4 : 6.75
                TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=Fifth Part X ; xOffsetPart5 : 9
                TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=First row Y ; yOffsetPart1 : 0
                TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=Second row Y ; yOffsetPart2 : -5
                TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=Third row Y ; yOffsetPart3 : -10
                ASSIGN/SKIP_TRACE_CNT=1
                ASSIGN/PART_COUNT=0
                ASSIGN/Y_COUNTER=0
                ASSIGN/X_LOOP_END_COUNT=GETTRACEVALUE("xCounterTrace")
                ASSIGN/Y_LOOP_END_COUNT=GETTRACEVALUE("yCounterTrace")
                DO/
                  ASSIGN/Y_COUNTER=Y_COUNTER+1
                  IF/Y_COUNTER==1
                    ASSIGN/FIXTURE_Y=GETTRACEVALUE("yOffsetPart1")
                  END_IF/
                  IF/Y_COUNTER==2
                    ASSIGN/FIXTURE_Y=GETTRACEVALUE("yOffsetPart2")
                  END_IF/
                  IF/Y_COUNTER==3
                    ASSIGN/FIXTURE_Y=GETTRACEVALUE("yOffsetPart3")
                  END_IF/
                  ASSIGN/X_COUNTER=0
                  DO/
                    ASSIGN/PART_COUNT=PART_COUNT+1
                    ASSIGN/X_COUNTER=X_COUNTER+1
                    ASSIGN/SER_NO_TRACE=ELEMENT(PART_COUNT,",",GETTRACEVALUE("unitNumber"))
                    ASSIGN/SER_NO=SER_NO_TRACE
                    COMMENT/REPT,
                    "SER_NO: "+SER_NO
                    "PART_COUNT: "+PART_COUNT
                    IF/X_COUNTER==1
                      ASSIGN/FIXTURE_X=GETTRACEVALUE("xOffsetPart1")
                    END_IF/
                    IF/X_COUNTER==2
                      ASSIGN/FIXTURE_X=GETTRACEVALUE("xOffsetPart2")
                    END_IF/
                    IF/X_COUNTER==3
                      ASSIGN/FIXTURE_X=GETTRACEVALUE("xOffsetPart3")
                    END_IF/
                    IF/X_COUNTER==4
                      ASSIGN/FIXTURE_X=GETTRACEVALUE("xOffsetPart4")
                    END_IF/
                    IF/X_COUNTER==5
                      ASSIGN/FIXTURE_X=GETTRACEVALUE("xOffsetPart5")
                    END_IF/
    LOOP_ORIGIN    =GENERIC/POINT,DEPENDENT,CARTESIAN,$
                    NOM/XYZ,<0+0,0+0,0+0>,$
                    MEAS/XYZ,<FIXTURE_X,FIXTURE_Y,0+0>,$
                    NOM/IJK,<0+0,0+0,1+0>,$
                    MEAS/IJK,<0+0,0+0,1+0>
    A4             =ALIGNMENT/START,RECALL:A7,LIST=YES
                      ALIGNMENT/TRANS,XAXIS,LOOP_ORIGIN
                      ALIGNMENT/TRANS,YAXIS,LOOP_ORIGIN
                    ALIGNMENT/END
    CIR1           =FEAT/CONTACT/CIRCLE/DEFAULT,CARTESIAN,IN,LEAST_SQR
                    THEO/<0,0,0>,<0,0,1>,0.5906
                    ACTL/<0,0,0>,<0,0,1>,0.5906
                    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=YES
                      NUMHITS=4,DEPTH=0.1969,PITCH=0
                      SAMPLE METHOD=SAMPLE_HITS
                      SAMPLE HITS=0,SPACER=0.1
                      AVOIDANCE MOVE=BOTH,DISTANCE BEFORE=0.3937,DISTANCE AFTER=0.3937,DIRECTION=ALONG TIP VECTOR
                      FIND HOLE=DISABLED,ONERROR=NO,READ POS=NO
                    SHOW HITS=NO
                  UNTIL/X_COUNTER==X_LOOP_END_COUNT
                UNTIL/Y_COUNTER==Y_LOOP_END_COUNT​
    


Reply
  • KIRBSTER269,
    Here is the sample Pallet Routine Template with some of your changes and I removed the skip part from the routine. The number of columns multiple the number of rows will equal the number of parts in this sample routine. Is there another method you want to use the Total Parts for?

                MODE/DCC
                TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=Enter Unit Numbers ; unitNumber : 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
                TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=Number of Columns ; xCounterTrace : 5
                TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=Number of Rows ; yCounterTrace : 3
                TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=First Part X ; xOffsetPart1 : 0
                TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=Second Part X ; xOffsetPart2 : 2.25
                TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=Third Part X ; xOffsetPart3 : 4.5
                TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=Fourth Part X ; xOffsetPart4 : 6.75
                TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=Fifth Part X ; xOffsetPart5 : 9
                TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=First row Y ; yOffsetPart1 : 0
                TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=Second row Y ; yOffsetPart2 : -5
                TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=Third row Y ; yOffsetPart3 : -10
                ASSIGN/SKIP_TRACE_CNT=1
                ASSIGN/PART_COUNT=0
                ASSIGN/Y_COUNTER=0
                ASSIGN/X_LOOP_END_COUNT=GETTRACEVALUE("xCounterTrace")
                ASSIGN/Y_LOOP_END_COUNT=GETTRACEVALUE("yCounterTrace")
                DO/
                  ASSIGN/Y_COUNTER=Y_COUNTER+1
                  IF/Y_COUNTER==1
                    ASSIGN/FIXTURE_Y=GETTRACEVALUE("yOffsetPart1")
                  END_IF/
                  IF/Y_COUNTER==2
                    ASSIGN/FIXTURE_Y=GETTRACEVALUE("yOffsetPart2")
                  END_IF/
                  IF/Y_COUNTER==3
                    ASSIGN/FIXTURE_Y=GETTRACEVALUE("yOffsetPart3")
                  END_IF/
                  ASSIGN/X_COUNTER=0
                  DO/
                    ASSIGN/PART_COUNT=PART_COUNT+1
                    ASSIGN/X_COUNTER=X_COUNTER+1
                    ASSIGN/SER_NO_TRACE=ELEMENT(PART_COUNT,",",GETTRACEVALUE("unitNumber"))
                    ASSIGN/SER_NO=SER_NO_TRACE
                    COMMENT/REPT,
                    "SER_NO: "+SER_NO
                    "PART_COUNT: "+PART_COUNT
                    IF/X_COUNTER==1
                      ASSIGN/FIXTURE_X=GETTRACEVALUE("xOffsetPart1")
                    END_IF/
                    IF/X_COUNTER==2
                      ASSIGN/FIXTURE_X=GETTRACEVALUE("xOffsetPart2")
                    END_IF/
                    IF/X_COUNTER==3
                      ASSIGN/FIXTURE_X=GETTRACEVALUE("xOffsetPart3")
                    END_IF/
                    IF/X_COUNTER==4
                      ASSIGN/FIXTURE_X=GETTRACEVALUE("xOffsetPart4")
                    END_IF/
                    IF/X_COUNTER==5
                      ASSIGN/FIXTURE_X=GETTRACEVALUE("xOffsetPart5")
                    END_IF/
    LOOP_ORIGIN    =GENERIC/POINT,DEPENDENT,CARTESIAN,$
                    NOM/XYZ,<0+0,0+0,0+0>,$
                    MEAS/XYZ,<FIXTURE_X,FIXTURE_Y,0+0>,$
                    NOM/IJK,<0+0,0+0,1+0>,$
                    MEAS/IJK,<0+0,0+0,1+0>
    A4             =ALIGNMENT/START,RECALL:A7,LIST=YES
                      ALIGNMENT/TRANS,XAXIS,LOOP_ORIGIN
                      ALIGNMENT/TRANS,YAXIS,LOOP_ORIGIN
                    ALIGNMENT/END
    CIR1           =FEAT/CONTACT/CIRCLE/DEFAULT,CARTESIAN,IN,LEAST_SQR
                    THEO/<0,0,0>,<0,0,1>,0.5906
                    ACTL/<0,0,0>,<0,0,1>,0.5906
                    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=YES
                      NUMHITS=4,DEPTH=0.1969,PITCH=0
                      SAMPLE METHOD=SAMPLE_HITS
                      SAMPLE HITS=0,SPACER=0.1
                      AVOIDANCE MOVE=BOTH,DISTANCE BEFORE=0.3937,DISTANCE AFTER=0.3937,DIRECTION=ALONG TIP VECTOR
                      FIND HOLE=DISABLED,ONERROR=NO,READ POS=NO
                    SHOW HITS=NO
                  UNTIL/X_COUNTER==X_LOOP_END_COUNT
                UNTIL/Y_COUNTER==Y_LOOP_END_COUNT​
    


Children