hexagon logo

Saving Pdf and Csv reports without prompting the user

Currently I am trying to write a C# app that will run a PCDmis program and then save the reports with specific names, in a specific folder based on some inputs from another source. I found an example of what I'm trying to do but it involves changing the prg file directly and I was wondering if I can do the same thing in C#?

I found this code from from 2021 but it's an embedded script.

GROUP_PRINT_COMMANDS=GROUP/SHOWALLPARAMS=YES
ASSIGN/NUMOOT=GETPROGRAMINFO("NUMOOT")
ASSIGN/PROG_NAME=GETPROGRAMINFO ("PARTNAME")
ASSIGN/DATE=STR(SYSTEMDATE ("dMMMyyyy"))
ASSIGN/TIME=STR(SYSTEMTIME ("HHmmss"))
ASSIGN/REJECT="____REJECT____"
IF/NUMOOT=="0"
ASSIGN/REPORT_NAME="O:\\CMM PROGRAMS\\CMM_PDF_PC DMIS\\AG0OFFLINETEST\\"+PROG_NAME+"__"+VAR_SERIAL_ NUMBER+"__"+VAR_RUNNUMBER+"__"+DATE+"__"+TIME+"__. PDF"
END_IF/
ELSE/
ASSIGN/REPORT_NAME="O:\\CMM PROGRAMS\\CMM_PDF_PC DMIS\\AG0OFFLINETEST\\"+PROG_NAME+"__"+VAR_SERIAL_ NUMBER+"__"+VAR_RUNNUMBER+"__"+DATE+"__"+TIME+"__" +REJECT+".PDF"
END_ELSE/
PRINT/REPORT,EXEC MODE=END,$
TO_FILE=ON,AUTO=1,AUTO OPEN=OFF,$
TO_PRINTER=OFF,COPIES=1,$
TO_DMIS_REPORT=OFF,FILE_OPTION=OVERWRITE,FILENAME= [B]REPORT_NAME[/B],$
REPORT_THEORETICALS=NONE,REPORT_FEATURE_WITH_DIMENSIONS=NO,$
TO_EXCEL=OFF,$
PREVIOUS_RUNS=KEEP_INSTANCES
ENDGROUP/ID=GROUP_PRINT_COMMANDS
Parents
  • hi

    maybe the global print option is not toggled off?


    File -> Printing -> Report window print setup
    this setup is the same like the print command, but it will be fired after the execution of the measurement routine.
    check if it is switched on in your measurement program.

    this global print dialog can be altered too with an external program like this:
    but be careful, to this dialog all information are passed as parameters


    I think in your example it should simply be switched off because the print command from before already takes over the printing.
    means setting the first two parameters to 0
    Part.EditWindow.SetPrintOptionsEx 0, 0, 5, 1, vPath, 1, False
    



    docu is here for this SetPrintOptionsEx
    https://docs.hexagonmi.com/pcdmis/20...OptionsEx.html
  • second option:
    is your path really correct? if the print dialog cannot find the path, the user is asked for a correct one

    third possibility
    write permissions ? and again, if the file cannot be saved for whatever reason, the user will be asked
Reply Children
No Data