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
  • Beck's,
    Give this code a try and see if you can get this to work. With this code I am able to execute both rows without the infinity loop.

    One issue I did find during my testing was that the DO/UNTIL in PC-DMIS sometimes needs to be recreated in order to get the code to work. Especially if it is copy and paste to another routine.

    ​PART NAME  : LoopTempate1 mm - 2 - 20231019
    REV NUMBER :
    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/PC1_4BY20_T1_4BY50_5W_CTM2_10E_35E_X4
                TIP/TIP1, SHANKIJK=0, 0, 1, ANGLE=0
                MODE/DCC
                TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=Enter Serial numbers per-part ; partSerialNo : 1,2,3,4,5,6,7,8,9,10
                TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=Enter number of Parts for Pallet ; totalParts : 10
                TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=Skip part Ex.(1) or parts Ex.(1,2,3) Enter in ascending order ; skipPartTrace :
                TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=Report the skip part information? ; skipPartReportInfo : No
                TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=Enter number of parts - First row X ; xCounterTrace : 5
                TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=Enter number of parts - First column Y ; yCounterTrace : 2
                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 : 24
                TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=Enter offset distance - First row X Part 3 ; xOffsetPart3 : 48
                TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=Enter offset distance - First row X Part 4 ; xOffsetPart4 : 72
                TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=Enter offset distance - First row X Part 5 ; xOffsetPart5 : 96
                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 : -26.7
    CYL1       =FEAT/CONTACT/CYLINDER/DEFAULT,CARTESIAN,IN,LEAST_SQR
                THEO/<366.132,200.761,94.127>,<0,0,1>,6,7.708
                ACTL/<366.133,200.761,94.127>,<0,0,1>,6,7.708
                TARG/<366.132,200.761,94.127>,<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=5,NUMLEVELS=3,DEPTH=2,END OFFSET=2,PITCH=0
                  SAMPLE METHOD=SAMPLE_HITS
                  SAMPLE HITS=0,SPACER=0
                  AVOIDANCE MOVE=BOTH,DISTANCE=10
                  FIND HOLE=DISABLED,ONERROR=NO,READ POS=NO
                SHOW HITS=NO
    LIN2       =FEAT/CONTACT/LINE/DEFAULT,CARTESIAN,UNBOUNDED
                THEO/<329.132,201.2,42.083>,<0,-1,0>,<0,0,1>,<-1,0,0>,48.261
                ACTL/<329.132,201.2,42.083>,<0,-1,0>,<0,0,1>,<-1,0,0>,48.261
                TARG/<329.132,201.2,42.083>,<0,-1,0>,<0,0,1>,<-1,0,0>
                SHOW FEATURE PARAMETERS=NO
                SHOW CONTACT PARAMETERS=YES
                  NUMHITS=3,DEPTH=3
                  SAMPLE METHOD=SAMPLE_HITS
                  SAMPLE HITS=0,SPACER=0,INDENT1=0,INDENT2=0
                  AVOIDANCE MOVE=BOTH,DISTANCE=10
                SHOW HITS=NO
    PNT2       =FEAT/CONTACT/VECTOR POINT/DEFAULT,CARTESIAN
                THEO/<362.145,200.856,99.017>,<0,0,1>
                ACTL/<362.145,200.856,99.017>,<0,0,1>
                TARG/<362.145,200.856,99.017>,<0,0,1>
                SHOW FEATURE PARAMETERS=NO
                SHOW CONTACT PARAMETERS=YES
                  AVOIDANCE MOVE=BOTH,DISTANCE=10
                SHOW HITS=NO
    A5         =ALIGNMENT/START,RECALL:STARTUP,LIST=YES
                  ALIGNMENT/LEVEL,ZPLUS,CYL1
                  ALIGNMENT/ROTATE,XPLUS,TO,LIN2,ABOUT,ZPLUS
                  ALIGNMENT/TRANS,XAXIS,CYL1
                  ALIGNMENT/TRANS,YAXIS,CYL1
                  ALIGNMENT/TRANS,ZAXIS,PNT2
                  ALIGNMENT/ROTATE_OFFSET,90,ABOUT,ZPLUS
                ALIGNMENT/END
                ASSIGN/NUMBER_PARTS_EXECUTED=GETTRACEVALUE("totalParts")
                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/
                  ASSIGN/X_COUNTER=0
                  DO/
                    ASSIGN/PART_COUNT=PART_COUNT+1
                    IF_GOTO/(PART_COUNT-1)==NUMBER_PARTS_EXECUTED,GOTO = EXIT_DO
                    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/
                    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:A5,LIST=YES
                      ALIGNMENT/TRANS,XAXIS,LOOP_ORIGIN
                      ALIGNMENT/TRANS,YAXIS,LOOP_ORIGIN
                    ALIGNMENT/END
    CYL_D6         =FEAT/CONTACT/CYLINDER/ADAPTIVE_CYLINDER_CONCENTRIC_CIRCLE_SCAN,CARTESIAN,IN,LEAST_SQR
                    THEO/<0,0,-1.4>,<0,0,1>,6,14
                    ACTL/<0,0,-1.4>,<0,0,1>,6,14
                    TARG/<0,0,-1.4>,<0,0,1>
                    START ANG=0,END ANG=0
                    ANGLE VEC=<1,0,0>
                    DIRECTION=CCW
                    SHOW FEATURE PARAMETERS=NO
                    SHOW CONTACT PARAMETERS=YES
                      NUMHITS=5,NUMLEVELS=3,DEPTH=0,END OFFSET=0,PITCH=0
                      SAMPLE METHOD=SAMPLE_HITS
                      SAMPLE HITS=0,SPACER=0
                      AVOIDANCE MOVE=NO,DISTANCE=10
                      FIND HOLE=DISABLED,ONERROR=NO,READ POS=NO
                    SHOW HITS=NO
    SKIP_PART_L1    =LABEL/
                  UNTIL/X_COUNTER==X_LOOP_END_COUNT
                UNTIL/Y_COUNTER==Y_LOOP_END_COUNT
    EXIT_DO    =LABEL/​
    
  • Thank you Dave!. I'll try it out when I find the time
Reply Children
No Data