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
  • I don't use "tracefield" functions... Disappointed
    I would try it :
    ASSIGN/XX=ARRAY(0,2.25,4.5,6.75,9)
    ASSIGN/YY=ARRAY(0,-5,-10)
    ASSIGN/COUNT_X=1
    ASSIGN/ZERO=0
    LOOP_ORIGIN =GENERIC/POINT,DEPENDENT,CARTESIAN,$
    NOM/XYZ,<ZERO,ZERO,ZERO>,$
    MEAS/XYZ,<ZERO,ZERO,ZERO>,$
    NOM/IJK,<ZERO,ZERO,1>,$
    MEAS/IJK,<ZERO,ZERO,1>
    A1 =ALIGNMENT/START,RECALL:USE_ACTIVE_ALIGNMENT(STARTUP),LIST=YE S
    ALIGNMENT/TRANS,XAXIS,LOOP_ORIGIN
    ALIGNMENT/TRANS,YAXIS,LOOP_ORIGIN
    ALIGNMENT/END
    DO/
    ASSIGN/FIXTURE_X=XX[COUNT_X]
    ASSIGN/COUNT_Y=1
    DO/
    RECALL/ALIGNMENT,INTERNAL,A1
    ASSIGN/FIXTURE_Y=YY[COUNT_Y]
    ACTUAL_ORIGIN =GENERIC/POINT,DEPENDENT,CARTESIAN,$
    NOM/XYZ,<FIXTURE_X,FIXTURE_Y,ZERO>,$
    MEAS/XYZ,<FIXTURE_X,FIXTURE_Y,ZERO>,$
    NOM/IJK,<ZERO,ZERO,1>,$
    MEAS/IJK,<ZERO,ZERO,1>
    A2 =ALIGNMENT/START,RECALL:A1,LIST=YES
    ALIGNMENT/TRANS,XAXIS,ACTUAL_ORIGIN
    ALIGNMENT/TRANS,YAXIS,ACTUAL_ORIGIN
    ALIGNMENT/END
    CIR1 =FEAT/CONTACT/CIRCLE/ADAPTIVE_CIRCLE_SCAN,CARTESIAN,IN,LEAST_SQR
    THEO/<ZERO,ZERO,ZERO>,<ZERO,ZERO,1>,0.5
    ACTL/<ZERO,ZERO,ZERO>,<ZERO,ZERO,1>,0.5
    TARG/<ZERO,ZERO,ZERO>,<ZERO,ZERO,1>
    START ANG=0,END ANG=360
    ANGLE VEC=<0,1,0>
    DIRECTION=CCW
    SHOW FEATURE PARAMETERS=NO
    SHOW CONTACT PARAMETERS=NO
    DIM LOC1= LOCATION OF CIRCLE CIR1 UNITS=IN ,$
    GRAPH=OFF TEXT=OFF MULT=20.00 OUTPUT=BOTH HALF ANGLE=NO
    AX NOMINAL MEAS +TOL -TOL OUTTOL DEV MAX MIN
    D 0.5000 0.5000 0.0010 0.0010 0.0000 0.0000 0.5000 0.5000 --------#---------
    END OF DIMENSION LOC1
    ASSIGN/COUNT_Y=COUNT_Y+1
    UNTIL/COUNT_Y==4
    ASSIGN/COUNT_X=COUNT_X+1
    UNTIL/X_COUNTER==6
  • Will this allow me to run 1 part or 4 parts or 8 parts by choosing total parts Jeffery? Basically my fixtures are 3 sets of 5
Reply Children
No Data