hexagon logo

Printing reports to paper, pdf and SPC

Hi guys/gurus.

I've been trying to make a Master-template that saves paper everytime I run a measurement.
I have 4 input-values, and depending on the answer there is a different "print set-up".

1) Production-measurement - running according to a time/pieceplan.
2) Set-up - used until CNC-machine is setup for producing "usable" parts.
3) Complains - Yes they happen :-)
4) Test - used when we have smaller programs that will be run once or other tasks.

My plan is:
If OoT=0 and [1], then NO PRINT TO PAPER - PRINT TO PDF - SEND TO SPC.
If OoT>0 and [1], then PRINT TO PAPER - NO PDF - NO SPC.

If [2], then PRINT TO PAPER - ASK FOR PDF - NO SPC.
If [3], then ASK IF PAPER - ASK IF PDF - NO SPC.
If [4], then ASK IF PAPER - ASK IF PDF - ASK IF SPC.


All in all, this gives me 3 combinations:
PRINTART=1 Print to paper and NO PDF.
PRINTART=10 NO paper-print, but PDF.
PRINTART=11 Print to paper, and to PDF.

It doesn't print at all!
I have to print it manually from the Report window, and that wasn't the intension.

MY CODE:

IF/PRINTART== 1
PRINT/REPORT,EXEC MODE=START,$
TO_FILE=OFF,AUTO=1,$
TO_PRINTER=ON,$
TO_DMIS_REPORT=OFF,FILE_OPTION=INDEX,FILENAME=,$
REPORT_THEORETICALS=NONE,REPORT_FEATURE_WITH_DIMENSIONS=NO,$
PREVIOUS_RUNS=DELETE_INSTANCES
END_IF/
IF/PRINTART== 10
PRINT/REPORT,EXEC MODE=START,$
TO_FILE=ON,OVERWRITE=REP_NAME,$
TO_PRINTER=OFF,$
TO_DMIS_REPORT=OFF,FILE_OPTION=INDEX,FILENAME=,$
REPORT_THEORETICALS=NONE,REPORT_FEATURE_WITH_DIMENSIONS=NO,$
PREVIOUS_RUNS=DELETE_INSTANCES
END_IF/
IF/PRINTART== 11
PRINT/REPORT,EXEC MODE=START,$
TO_FILE=ON,OVERWRITE=REP_NAME,$
TO_PRINTER=ON,$
TO_DMIS_REPORT=OFF,FILE_OPTION=INDEX,FILENAME=,$
REPORT_THEORETICALS=NONE,REPORT_FEATURE_WITH_DIMENSIONS=NO,$
PREVIOUS_RUNS=DELETE_INSTANCES
END_IF/


Please notice the MODE=START, which was made after reading the help in PC-DMIS


What am I doing wrong, or have I forgotten something?
Please help or comment.


Best regards
Michael
Parents
  • I am suspecting my software to making fun with me.
    I have tried several combinations (just to do SOMETHING), but I think that bphillips is into something, about the order of which thing are done.
    When I look at my print set-up, the global is checked, but I took for granted that the PRINT command in the program, was "more important", than the global set-up (File>Printing>Report Window Print Setup).
    I'll have to try that out, but it doesn't seem logical to me, but on the other hand it is PC-DMIS :-)
    I have tried to let the program take control over the PRINT set-up, so that the global set-up was blank, but without any luck so far.


    $$ NO,
    This comes at the program-start.
    ---------------------------------
    ASSIGN/PROFILNR=STR("XXX")
    ASSIGN/PARTTYPE=STR("1234")
    ASSIGN/PARTVARI=STR("56")
    ASSIGN/PARTREVI=STR("00")
    ASSIGN/PDF_PATH="J:\\GR_BEA3D\\Målerapporter\\"+PROFILNR+"\\"+PROFILNR+PARTTYPE+"\\"
    ASSIGN/EXCEL="NO"
    $$ NO,

    Here comes the program, and report-printing

    $$ NO,
    This comes at the very end of the program.
    --------------------------------------
    ASSIGN/PRINTART="0"
    ASSIGN/PRINTPAP=0
    ASSIGN/PRINTPDF=0
    IF/PAPIR=="ASK"
    RAP_PAPIR =COMMENT/YESNO,YES,FULL SCREEN=NO,AUTO-CONTINUE=NO,
    Report on paper?
    IF/RAP_PAPIR.INPUT=="YES"
    ASSIGN/PRINTPAP=1
    END_IF/
    END_IF/
    IF/PDF=="ASK"
    RAP_PDF =COMMENT/YESNO,YES,FULL SCREEN=NO,AUTO-CONTINUE=NO,
    Report to PDF?
    IF/RAP_PDF.INPUT=="YES"
    ASSIGN/PRINTPDF=10
    END_IF/
    END_IF/
    IF/SPC=="ASK"
    RAP_SPC =COMMENT/YESNO,YES,FULL SCREEN=NO,AUTO-CONTINUE=NO,
    Results to SPC?
    IF/RAP_SPC.INPUT=="YES"
    ASSIGN/SPC="YES"
    END_IF/
    END_IF/
    RAP_EXCEL =COMMENT/YESNO,YES,FULL SCREEN=NO,AUTO-CONTINUE=NO,
    Results to Excel?
    IF/RAP_EXCEL.INPUT=="YES"
    ASSIGN/EXCEL="YES"
    END_IF/
    ASSIGN/PRINTART=STR(PRINTPAP + PRINTPDF)
    $$ NO,

    ASSIGN/SEP=" - "
    ASSIGN/DATE=SYSTEMDATE("yyyy-MM-dd")
    ASSIGN/TIME=SYSTEMTIME("HH-mm")
    ASSIGN/REP_NAME=PDF_PATH + PROFILNR + PARTTYPE + "-" + PARTVARI + "-" + PARTREVI + SEP + DATE + SEP + TIME + ".PDF"
    COMMENT/REPT,
    "PDF-filnavn ........ : "+REP_NAME
    COMMENT/REPT,

    STATS/UPDATE
    COMMENT/REPT,
    "PRINTART ... : "+PRINTART
    IF/PRINTART=="1"
    PRINT/REPORT,EXEC MODE=START,$
    TO_FILE=OFF,OVERWRITE=REP_NAME,$
    TO_PRINTER=ON,$
    TO_DMIS_REPORT=OFF,FILE_OPTION=OVERWRITE,FILENAME=REP_NAME,$
    REPORT_THEORETICALS=NONE,REPORT_FEATURE_WITH_DIMENSIONS=NO,$
    PREVIOUS_RUNS=DELETE_INSTANCES
    END_IF/
    IF/PRINTART=="10"
    PRINT/REPORT,EXEC MODE=START,$
    TO_FILE=ON,OVERWRITE=REP_NAME,$
    TO_PRINTER=OFF,$
    TO_DMIS_REPORT=ON,FILE_OPTION=OVERWRITE,FILENAME=REP_NAME,$
    REPORT_THEORETICALS=NONE,REPORT_FEATURE_WITH_DIMENSIONS=NO,$
    PREVIOUS_RUNS=DELETE_INSTANCES
    END_IF/
    IF/PRINTART=="11"
    PRINT/REPORT,EXEC MODE=START,$
    TO_FILE=ON,OVERWRITE=REP_NAME,$
    TO_PRINTER=ON,$
    TO_DMIS_REPORT=ON,FILE_OPTION=OVERWRITE,FILENAME=REP_NAME,$
    REPORT_THEORETICALS=NONE,REPORT_FEATURE_WITH_DIMENSIONS=NO,$
    PREVIOUS_RUNS=DELETE_INSTANCES
    END_IF/
    IF/SPC=="YES"
    EXTERNALCOMMAND/NO_DISPLAY, NO_WAIT ; J:\GR_BEA3D\Script\BAT\RenameXSTATS.BAT
    $$ NO,
    The RenameXSTATS.BAT is adding a date and time to the XSTATS11.TMP filename => XSTATS11_2015-04-14_15-55.TMP
    After tjat the files is copied to two directories. One where it will be looked into by a SPC program, and one for a local backup (in case theres no network connection)
    The backup-directory is emptied when the network is up and running.
    END_IF/
    IF/EXCEL=="YES"
    EXTERNALCOMMAND/NO_DISPLAY, NO_WAIT ; C:\Program Files (x86)\WAI\PC-DMIS 2012\Wizards\PCD2EXCEL.EXE A
    END_IF/

    END OF MEASUREMENT


    @SABarber:
    All my IF's are okay. I have some comments that shows me the result of the input, and I haven't found any mistakes around that, that hasn't been corrected.
    So everything is (should be) running smoothly.


    I don't undertand why it has to be that complicated. At the end of the day, it's just a Print command, for crying out load.


    Thanks guys for your effort. I really appriciate it, and I hope that I can make a "How-to"-guide, when all this is fixed.


    Regards
    Michael
Reply
  • I am suspecting my software to making fun with me.
    I have tried several combinations (just to do SOMETHING), but I think that bphillips is into something, about the order of which thing are done.
    When I look at my print set-up, the global is checked, but I took for granted that the PRINT command in the program, was "more important", than the global set-up (File>Printing>Report Window Print Setup).
    I'll have to try that out, but it doesn't seem logical to me, but on the other hand it is PC-DMIS :-)
    I have tried to let the program take control over the PRINT set-up, so that the global set-up was blank, but without any luck so far.


    $$ NO,
    This comes at the program-start.
    ---------------------------------
    ASSIGN/PROFILNR=STR("XXX")
    ASSIGN/PARTTYPE=STR("1234")
    ASSIGN/PARTVARI=STR("56")
    ASSIGN/PARTREVI=STR("00")
    ASSIGN/PDF_PATH="J:\\GR_BEA3D\\Målerapporter\\"+PROFILNR+"\\"+PROFILNR+PARTTYPE+"\\"
    ASSIGN/EXCEL="NO"
    $$ NO,

    Here comes the program, and report-printing

    $$ NO,
    This comes at the very end of the program.
    --------------------------------------
    ASSIGN/PRINTART="0"
    ASSIGN/PRINTPAP=0
    ASSIGN/PRINTPDF=0
    IF/PAPIR=="ASK"
    RAP_PAPIR =COMMENT/YESNO,YES,FULL SCREEN=NO,AUTO-CONTINUE=NO,
    Report on paper?
    IF/RAP_PAPIR.INPUT=="YES"
    ASSIGN/PRINTPAP=1
    END_IF/
    END_IF/
    IF/PDF=="ASK"
    RAP_PDF =COMMENT/YESNO,YES,FULL SCREEN=NO,AUTO-CONTINUE=NO,
    Report to PDF?
    IF/RAP_PDF.INPUT=="YES"
    ASSIGN/PRINTPDF=10
    END_IF/
    END_IF/
    IF/SPC=="ASK"
    RAP_SPC =COMMENT/YESNO,YES,FULL SCREEN=NO,AUTO-CONTINUE=NO,
    Results to SPC?
    IF/RAP_SPC.INPUT=="YES"
    ASSIGN/SPC="YES"
    END_IF/
    END_IF/
    RAP_EXCEL =COMMENT/YESNO,YES,FULL SCREEN=NO,AUTO-CONTINUE=NO,
    Results to Excel?
    IF/RAP_EXCEL.INPUT=="YES"
    ASSIGN/EXCEL="YES"
    END_IF/
    ASSIGN/PRINTART=STR(PRINTPAP + PRINTPDF)
    $$ NO,

    ASSIGN/SEP=" - "
    ASSIGN/DATE=SYSTEMDATE("yyyy-MM-dd")
    ASSIGN/TIME=SYSTEMTIME("HH-mm")
    ASSIGN/REP_NAME=PDF_PATH + PROFILNR + PARTTYPE + "-" + PARTVARI + "-" + PARTREVI + SEP + DATE + SEP + TIME + ".PDF"
    COMMENT/REPT,
    "PDF-filnavn ........ : "+REP_NAME
    COMMENT/REPT,

    STATS/UPDATE
    COMMENT/REPT,
    "PRINTART ... : "+PRINTART
    IF/PRINTART=="1"
    PRINT/REPORT,EXEC MODE=START,$
    TO_FILE=OFF,OVERWRITE=REP_NAME,$
    TO_PRINTER=ON,$
    TO_DMIS_REPORT=OFF,FILE_OPTION=OVERWRITE,FILENAME=REP_NAME,$
    REPORT_THEORETICALS=NONE,REPORT_FEATURE_WITH_DIMENSIONS=NO,$
    PREVIOUS_RUNS=DELETE_INSTANCES
    END_IF/
    IF/PRINTART=="10"
    PRINT/REPORT,EXEC MODE=START,$
    TO_FILE=ON,OVERWRITE=REP_NAME,$
    TO_PRINTER=OFF,$
    TO_DMIS_REPORT=ON,FILE_OPTION=OVERWRITE,FILENAME=REP_NAME,$
    REPORT_THEORETICALS=NONE,REPORT_FEATURE_WITH_DIMENSIONS=NO,$
    PREVIOUS_RUNS=DELETE_INSTANCES
    END_IF/
    IF/PRINTART=="11"
    PRINT/REPORT,EXEC MODE=START,$
    TO_FILE=ON,OVERWRITE=REP_NAME,$
    TO_PRINTER=ON,$
    TO_DMIS_REPORT=ON,FILE_OPTION=OVERWRITE,FILENAME=REP_NAME,$
    REPORT_THEORETICALS=NONE,REPORT_FEATURE_WITH_DIMENSIONS=NO,$
    PREVIOUS_RUNS=DELETE_INSTANCES
    END_IF/
    IF/SPC=="YES"
    EXTERNALCOMMAND/NO_DISPLAY, NO_WAIT ; J:\GR_BEA3D\Script\BAT\RenameXSTATS.BAT
    $$ NO,
    The RenameXSTATS.BAT is adding a date and time to the XSTATS11.TMP filename => XSTATS11_2015-04-14_15-55.TMP
    After tjat the files is copied to two directories. One where it will be looked into by a SPC program, and one for a local backup (in case theres no network connection)
    The backup-directory is emptied when the network is up and running.
    END_IF/
    IF/EXCEL=="YES"
    EXTERNALCOMMAND/NO_DISPLAY, NO_WAIT ; C:\Program Files (x86)\WAI\PC-DMIS 2012\Wizards\PCD2EXCEL.EXE A
    END_IF/

    END OF MEASUREMENT


    @SABarber:
    All my IF's are okay. I have some comments that shows me the result of the input, and I haven't found any mistakes around that, that hasn't been corrected.
    So everything is (should be) running smoothly.


    I don't undertand why it has to be that complicated. At the end of the day, it's just a Print command, for crying out load.


    Thanks guys for your effort. I really appriciate it, and I hope that I can make a "How-to"-guide, when all this is fixed.


    Regards
    Michael
Children
No Data