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
  • I think you might be missing the ("), ie =="10".
    Also make sure that global print is checked in the print options.
  • you don't mention where/how PRINTART is set. Nor where the PRINT statement is in the part program.
    I've only used MODE=END and placed the PRINT command at the end of the part program. Have you added a COMMENT command to see if the correct IF PRINTART value has been selected?
  • @SABarber:
    The PRINTART is set by adding variable-values.
    First I ASSIGN PRINTART to 0
    If I want a paper print, I have a variable (PAPER) which will be ASSIGN to the value of 1
    If I want a pdf print, I have a variable (PDF) which will be ASSIGN to the value of 10
    Then I ASSIGN PRINTART to str(PAPER+PDF)
    This gives my the 3 combinations (1, 10 or 11)

    The PRINT is set at the bottom of the program. The last thing that the program makes.

    In my report I have made several prints of values along the way to check that my formulas are right.
    Everything is as it's supposed to be.
    I also have a variable that puts my PDF-filename together, and it works fine as well.

    The problem is my PRINT commands.
    I can't get them to work.
    If I uncheck the global, nothing happens.


    @bphillips:
    If I let my marked sets have the global checked, it by-passes my 3 combinations, and prints to paper AND to PDF, no matter what I answer/choose.



    Is it possible that I'm hit by some kind of software bug?
  • I would:
    1) change the MODE to END
    2) add comments within the various IF blocks to make sure the code is being called.

    Looking at the help seems to indicate MODE=START is used by DMIS import files.
  • I would:
    1) change the MODE to END
    2) add comments within the various IF blocks to make sure the code is being called.

    Looking at the help seems to indicate MODE=START is used by DMIS import files.


    +1

    Mode = Start (the help on this isn't very clear if I remember!)
  • Once you checked the global print and closed the marked sets window did you go back into File>Printing>Report Window Print Setup and UNcheck the file and printer?
    The global print check box forces dmis to execute the edit window commands but if the File>Printing>Report Window Print Setup is still checked dmis will execute that instead.
    At least that is what I had to do to get my double print commands to work. I'm using a Comment/YES NO to do one or the other.

    Still unsure how you tell dmis which print command to use 1,10 or 11?
  • 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
  • @SABarber:
    No I haven't tried it lately, but when I first started up with this "project", I read taht I should use START.
    I'll give it a try.

    @bphillips:
    I can't use Marked Sets in this case.


    It's a bit difficult for me to explain, but buttomline is that I have three combinations, that doen't work as I'd like them to.
    The execution of the one of the three PRINT commands.
    I can't get my head around this, and somhow it doesn't make sence to me why it has to be that difficult.

    I guess that I'm not the first one thinking in this direction - or?

    Never the less: Thank you all for putting your head into this. I hope I one day can pay you back.


    I'm working on four levels. Meaning that I have one Marked Set for production measurement [1] and another one for the CNC-guy with setting the part up [2].
    (Production measurement doesn't measure all dimentions)
    Furthermore I have option [3] and [4], which gives a option for
    Please se my first posting:

    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.


    These option are also ASSIGN the PRINTART.
    According to the three options "YES", "NO" and "ASK".
    Sometimes the ASSIGN is forced, and in other options the program ask the operator if he/she want something else.