hexagon logo

Variables in Print command for csv file naming.

I have a program where I am looping 15 parts. I am appending my csv file output using print command inside the loop so all the data for the parts on the fixture load end up in the same file. That works fine. Now I want to control the file naming with an operator input variable and Date and Time. Assign the variable values before starting the loop. When I run the program, it hits the print command and brings up a save file window every part iteration. It seems to somehow think that I am proposing a new file name each time. Thank you for any suggestions.

Parents
  • I do something like this with PDFs. However, I do not use the native CSV command within PC-DMIS. I do my own customized CSV to work with our ERP.:

    ---BEFORE THE LOOP----
    
    ASSIGN/PDFINDEX=SYSTEMDATE("yyMMdd")+"_"+SYSTEMTIME("HHmmss")
    ASSIGN/PDFFILE="M:\Quality\CMM Reports\\"+VPN+"\\Data\True Positions\\"+VPN+"_TP_"+PDFINDEX+".PDF"
    
    ---PRINT COMMANDS---
    
    IF/LOOP1=="1"
    PRINT/REPORT,EXEC MODE=END,$
    TO_FILE=ON,OVERWRITE=PDFFILE,AUTO OPEN=OFF,$
    TO_PRINTER=OFF,COPIES=1,$
    TO_DMIS_REPORT=OFF,FILE_OPTION=OVERWRITE,FILENAME=,$
    REPORT_THEORETICALS=ALL,REPORT_FEATURE_WITH_DIMENSIONS=NO,$
    TO_EXCEL=OFF,$
    PREVIOUS_RUNS=DELETE_INSTANCES
    GOTO/L2
    END_IF/
    IF/LOOP1>"1"
    PRINT/REPORT,EXEC MODE=END,$
    TO_FILE=ON,APPEND=PDFFILE,AUTO OPEN=OFF,$
    TO_PRINTER=OFF,COPIES=1,$
    TO_DMIS_REPORT=OFF,FILE_OPTION=OVERWRITE,FILENAME=,$
    REPORT_THEORETICALS=ALL,REPORT_FEATURE_WITH_DIMENSIONS=NO,$
    TO_EXCEL=OFF,$
    PREVIOUS_RUNS=DELETE_INSTANCES
    GOTO/L2
    END_IF/
    L2 =LABEL/
    IF/LOOP1==FORM4
    COMMENT/REPT,
    .
    "TOTAL RUNTIME: "+ELAPSEDEXECUTIONTIME()
    .
    PRINT/REPORT,EXEC MODE=END,$
    TO_FILE=ON,APPEND=PDFFILE,AUTO OPEN=ON,$
    TO_PRINTER=OFF,COPIES=1,$
    TO_DMIS_REPORT=OFF,FILE_OPTION=OVERWRITE,FILENAME=,$
    REPORT_THEORETICALS=ALL,REPORT_FEATURE_WITH_DIMENSIONS=NO,$
    TO_EXCEL=OFF,$
    PREVIOUS_RUNS=DELETE_INSTANCES
    END_IF/
    L3 =LABEL/

    The last print command appends the runtime to the report if the total number of loops equals the total number designated at the beginning of the program.

  • Yes but in pdf reports you are not trying to append to an existing file as far as I am aware.

  • Sure I am. The first command "overwrites" which creates the initial PDF. Then if the Loop is greater than 1, it will append. Once the loop equals the number of parts, then it appends the runtime. 

  • That's exactly where my thought was going on as well using loop  counts. Nice stuff.

Reply Children
No Data