hexagon logo

Printing reports with serial # as file name.

I output a PDF report for every part I check and I currently use auto indexing to name them. There is a report comment at the beginning of the program that asks for the serial # of the part. I was wondering if it's possible to instead have PC DMIS automatically add that same serial # to the end of the file name instead of the index #. This would be helpful if I need to find the report for a specific piece later. I know I could just manually type it in each time. I'm just looking for a more efficient method since the serial #'s are often over 20 characters and I never remember what it was at the end of the program and I'd rather not take it off the machine before viewing the report in case I need to remeasure something. Am I asking too much here?
  • This will do what you need.

    Add an input to the program for serial number or use your existing one. Insert a "PRINT/" command. Click on it and do F9 to set the File path and file name. Save that. Then in the edit window, next to Auto, set it so the SN's comment input. [EX. =C1.INPUT]

    C1 =COMMENT/INPUT,NO,FULL SCREEN=NO,
    Serial Number
    PRINT/REPORT,EXEC MODE=END,$
    TO_FILE=ON,AUTO=C1.INPUT,OUTPUT_FORMAT/PDF,$
    RESET_REPORT=YES,AUTO OPEN=OFF,$
    TO_PRINTER=OFF,COPIES=1,$
    TO_DMIS_REPORT=OFF,FILE_OPTION=INDEX,FILENAME=,$
    REPORT_THEORETICALS=NONE,REPORT_FEATURE_WITH_DIMEN SIONS=NO,$
    TO_EXCEL=OFF,$
    PREVIOUS_RUNS=DELETE_INSTANCES​
  • Actually instead of adding an input comment, you can just assign the serial number from the header by:
    ASSIGN/V1=GETPROGRAMINFO("SERIALNUM")
  • Thank you, I will try that. I figured there might be a way to do it by going into command mode and editing the code, but knowing how to do that is way beyond me. I'm not a computer programmer and I'm still very new with writing CMM programs. I appreciate the help.
  • I got it to work once, but now it appears that it just takes the same serial # and puts it in the index box and ignores whatever I put in the comment.
  • But where would the header get the serial number without a report comment?
  • You need to create assignments to build your file name/file path. Then you want to put that completed assignment name into the print command at the end of your program.
    There are many examples for building your file path with varied complexities in this forum.
    One of the best is on conditioning the output to display if the report has any outtol items.

    For the issue of 'work once' in post 5, I believe you set the title using the File>Printing>Report Window Print Setup, which you would then need to adjust every run unless you select 'Prompt'.
  • Copied from this thread: https://www.pcdmisforum.com/forum/pc-dmis-enterprise-metrology-software/pc-dmis-for-cmms/517800-setting-a-default-for-report-window-printing

    I have the file header label modified to use these tracefields for the report instead of the default PC-DMIS items.

    STARTUP    =ALIGNMENT/START,RECALL:USE_PART_SETUP,LIST=YES
                ALIGNMENT/END
                FORMAT/TEXT,OPTIONS,ID,HEADINGS,SYMBOLS, ;MEAS,NOM,TOL,DEV,OUTTOL, ,
                TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=CMM Operator ; CMM Operator :
                TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=Job # ; Job # :
                TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=Serial # ; Serial # :
                TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=Room Temperature ; Room Temperature :
                TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=Room Humidity ; Room Humidity :
                TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=Bubble drawing location ; Drawing Location :
                ASSIGN/V1=GETPROGRAMINFO("PCDMISVERSION")
                COMMENT/REPT,
                
                
                COMMENT/REPT,
                "PC-DMIS VERSION: " +V1
                COMMENT/REPT,
                
                
                ASSIGN/V_JN=GETTRACEVALUE("Job #")
                ASSIGN/V_SN=GETTRACEVALUE("Serial #")
                ASSIGN/V_99="\\"+V_JN
                ASSIGN/V_DATE=SYSTEMDATE("MMM dd, yyyy")
                ASSIGN/V_TIME=SYSTEMTIME("HH:mm")
                ASSIGN/V_NAME=GETPROGRAMINFO("PARTNAME")
                ASSIGN/V_REV=GETPROGRAMINFO("REVISION")
    
    MEASUREMENT ROUTINE GOES HERE
    
                PRINT/REPORT,EXEC MODE=END,$
                  TO_FILE=ON,OVERWRITE="T:\\CMM\\"+V_NAME+"\\RESULTS"+V_99+"\\"+V_NAME+" REV "+V_REV+" "+V_JN+" SN "+V_SN+".PDF",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=ON,OVERWRITE,FILENAME="T:\\CMM\\"+V_NAME+"\\RESULTS"+V_99+"\\"+V_NAME+" REV "+V_REV+" "+V_JN+" SN "+V_SN+".XLSX",AUTO OPEN=OFF,$
                  PREVIOUS_RUNS=DELETE_INSTANCES​
    


    Edited to use my current version of this print command. It is completely automated for the format we want.
  • Thanks for all the advice, but I think this is now out of my league.
  • Try this. If you are looping your program, this code must be inside loop, at the beginning.

    C5         =COMMENT/INPUT,YES,FULL SCREEN=NO,
                Serial Number
                ASSIGN/SER_NUM=C5.INPUT​


    Add a Print Command at the end of the loop and F9 on the Report Command. In the Report tab, check the Report output box, click on the drop-down and navigate to the destination folder for the report.
    In the File name box at the bottom, type the intended name of the reports followed by an underscore(_). Ex: X4262148_
    Save and click "OK" in the Report command.

    Back in the Edit window change the "1" after AUTO to "SER_NUM"

    PRINT/REPORT,EXEC MODE=END,$
                  TO_FILE=OFF,AUTO=SER_NUM,AUTO OPEN=OFF,$
                  TO_PRINTER=OFF,COPIES=1,$
                  TO_DMIS_REPORT=OFF,FILE_OPTION=OVERWRITE,FILENAME=,$
                  REPORT_THEORETICALS=NONE,REPORT_FEATURE_WITH_DIMENSIONS=NO,$
                  TO_EXCEL=OFF,$
                  PREVIOUS_RUNS=DELETE_INSTANCES​


    Each report will have the serial number as part of the filename.
  • You will have to do something about the header, if I'm not mistaken, only the first print will have a header and the rest wont. There's a way to call the header programmically though I resorted to text based header as it was desired for post processing outside of Pc-Dmis, I don't recall how to call the header.