hexagon logo

Setting a Default for Report Window Printing

I have multiple operators creating/running programs that are stored on a network drive and understand that the report window print setup, by default, will 'print" the pdf report to the measurement routine folder with the program name and an index value. What we would like to do is override that in some way, for example:
Let say the default measurement routine directory is set to "S:\CMM_Programs".
When printing the report, we would like to have it automatically point the operator to a synced SharePoint file, lets call it "C:\users\(user name)\(SharePoint site)\CMM_Reports". The only thing they would need to do is find the existing part number folder, or create a new folder if one doesn't yet exist.
Now, I know we can do that by changing the file path in the report window print setup configuration, however that would need to be done for each program, either new or existing, due to the defaults defined in "set Search Path", and trying to have them use a program template with default print commands or having them "prompted" each time would be cumbersome at best.
I already have the desired SharePoint library synced to each of their user ID's, so I just need to know if we can set something like a "default measurement report directory" to point them there, regardless of where the measurement routine is stored. Thanks
  • I use the print report command at the end of the program. I write it manually each time, but everything in it can be pulled from the program or assigned a variable. Take this, the necessary code to populate the fields, and save it to a template file that all programs are built from. In the template file turn off the report outputs in the "Report Window Print Setup" File command. You can see in my sample below I already pull the job number and serial/run number from a variable that gets plugged in a the beginning of the program. Part number and Rev can be pulled from the routine. All that is left is to standardize the file structure of where you store your programs and reports.

    STARTUP    =ALIGNMENT/START,RECALL:USE_PART_SETUP,LIST=YES
                ALIGNMENT/END
                TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=CMM Operator ; CMM Operator : MADISON ROLLINGS
                TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=Job # ; Job # : XXXXXXXX
                TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=Serial # ; Serial # : XXX
                TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=Temperature ; Temperature : 65.9
                TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=Humidity ; Humidity : 31
                ASSIGN/V_JN=GETTRACEVALUE("Job #")
                ASSIGN/V_SN=GETTRACEVALUE("Serial #")
                ASSIGN/V_99="\\"+V_JN
    
    MEASUREMENT ROUTINE GOES HERE
    
    PRINT/REPORT,EXEC MODE=END,$
                  TO_FILE=ON,OVERWRITE="T:\CMM\PART #\RESULTS"+V_99+"\PART # REV # OP# "+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\PART #\RESULTS"+V_99+"\PART # REV # OP# "+V_JN+" SN "+V_SN+".XLSX",AUTO OPEN=ON,$
                  PREVIOUS_RUNS=DELETE_INSTANCES
    
  • I use the print report command at the end of the program. I write it manually each time, but everything in it can be pulled from the program or assigned a variable. Take this, the necessary code to populate the fields, and save it to a template file that all programs are built from. In the template file turn off the report outputs in the "Report Window Print Setup" File command. You can see in my sample below I already pull the job number and serial/run number from a variable that gets plugged in a the beginning of the program. Part number and Rev can be pulled from the routine. All that is left is to standardize the file structure of where you store your programs and reports.

    STARTUP =ALIGNMENT/START,RECALL:USE_PART_SETUP,LIST=YES
    ALIGNMENT/END
    TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=CMM Operator ; CMM Operator : MADISON ROLLINGS
    TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=Job # ; Job # : XXXXXXXX
    TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=Serial # ; Serial # : XXX
    TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=Temperature ; Temperature : 65.9
    TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=Humidity ; Humidity : 31
    ASSIGN/V_JN=GETTRACEVALUE("Job #")
    ASSIGN/V_SN=GETTRACEVALUE("Serial #")
    ASSIGN/V_99="\\"+V_JN
    
    MEASUREMENT ROUTINE GOES HERE
    
    PRINT/REPORT,EXEC MODE=END,$
    TO_FILE=ON,OVERWRITE="T:\CMM\PART #\RESULTS"+V_99+"\PART # REV # OP# "+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\PART #\RESULTS"+V_99+"\PART # REV # OP# "+V_JN+" SN "+V_SN+".XLSX",AUTO OPEN=ON,$
    PREVIOUS_RUNS=DELETE_INSTANCES
    


    Wondering if these two bits of code would work in subroutines? It's not uncommon for management to change their mind as to where results are to be stored and what information to include in the report name. Be a lot easier to edit 1 or 2 subroutines than to wade thru all of the measurement routines.
  • Thanks for the code, mrolling53. I had thought about using a print command but was stuck on getting the path to use variables the way I wanted them to, but I think I got it now.
    I'll throw a template together and see what kind of operator feedback I get (some of these guys can be challenging Wink )
  • The destination folder doesn't exist, or the folder structure is wrong if you get the "Save As" dialog box for the report at the end of the program.

    That V_99 variable takes the job number and adds it to the file path, because I sort my reports by job number. Sometimes I forget to create the job number folder in the results folder before I start the program.
  • The destination folder doesn't exist, or the folder structure is wrong if you get the "Save As" dialog box for the report at the end of the program.

    That V_99 variable takes the job number and adds it to the file path, because I sort my reports by job number. Sometimes I forget to create the job number folder in the results folder before I start the program.


    That is one of the challenges I need to try and overcome. I was going to try and use the FILE/EXISTS command to drive the operator to create a corresponding folder if one doesn't already exist prior to executing the program for the first time, but unfortunately that only looks for files and not folders.
    I was going to just add an operator comment to look for, and if needed, create a folder as needed at the start of the program, but already got push back from the operators for that. So, if it's not fully automated, it'll be a no go or them.
    I'm thinking we may be better off forgoing using a sub-folder structure completely and just drop the file in the main folder location.
    I also added another variable similar to V_99 for the CMM operator's user ID, which for us will be needed due to using a synced SharePoint file, as the synced file location is in the C:\users\<user ID>\ path and based on who is logged into the computer at that point in time ("C:\Users"+V_88+"\Company\CMM REPORTS"+V_99+"_"+V_RN+".PDF") I'm actually using the program header fields (Part Name, Rev number, Serial Number) and the GETTEXT command instead of trace fields and instructing the operator to enter the "USER ID" into the serial number field. That way they can still fill in the fields when creating a program as they would from the normal user interface.