hexagon logo

Print to TEXT and PDF at the same time

Any tips on printing to TEXT and PDF on the same program? (Without having to go in to the Report window print setup every time I change format)
We are using DISCUS and are wanting to keep our report output to pdf standard and then also have an output to text that we can pull in to DISCUS.
I am playing around with the excel output and might just go that route to avoid the headache of not being able to output to text and pdf at the same time.

I have already tried using two print commands in the same program. It didnt work for me.

thanks for the help!
  • Oh, I was only speaking in hypothetical... lol. Sorry, it does the same thing for me as described above in 2017 R1.
  • LOL
    No big deal! I will figure out excel with DISCUS!
  • I did not try text and pdf. I have only used pdf. and to excel in the past with 2 print commands and it worked fine. Guess i should have tested before ASSumming it worked with other outputs.
  • I just tried pdf on one and text on the other and got exactly what y'all describe. Like i said, I have only needed to use PDF and excel in the past and the 2 commands have worked and continue to work from 2017R1 through 2019R1.
  • some time ago I played around with this issue. There is a trick and scripts. I have a sample prg which runs a script to set the output to TEXT, then a PRINT, followed by an REPORT command to INSERT the same template. This should make pcdmis re-populate the report. I follow this with another script to change the output to PDF. Followed by another PRINT command. This seems to work for at least 2018R1.

    Attached Files
  • I won't be able to verify this as my weekend is about to start, but if you can't print to a text file and a PDF file, you should be able to print to a text file and a *printer*. Setup CutePDF Writer (or another program) as the default printer and PC-DMIS will have nothing to do with making the PDF file.
  • some time ago I played around with this issue. There is a trick and scripts. I have a sample prg which runs a script to set the output to TEXT, then a PRINT, followed by an REPORT command to INSERT the same template. This should make pcdmis re-populate the report. I follow this with another script to change the output to PDF. Followed by another PRINT command. This seems to work for at least 2018R1.


    Dang, that is intense! It works great! thanks for the code, Idk how hard it will be to standardize my programs like this but I am going to keep playing with it
  • This is what i use to get a PDF and TXT output every time we run a part program.
    You will need to define the file path and naming that you want in the 1st 2 ASSIGN lines.

    The CS1 is the path/location of the BAS that it will use.


    PUT THIS AT END OF PROGRAM
    ASSIGN/PDFPRTSTRING="M:\SM-All Parts (DMS)\Electronic Inspection Results\CUSTOMER NAME"+C1.INPUT+"\\PART NUMBER."+C2.INPUT+"_cmm.PDF"
    ASSIGN/TXTPRTSTRING="M:\SM-All Parts (DMS)\Electronic Inspection Results\CUSTOMER NAME"+C1.INPUT+"\\PART NUMBER."+C2.INPUT+"_cmm.TXT"
    CS1 =SCRIPT/FILENAME= V:\ALLPROGRAMSQC\CMM SCRIPTS\PRINT_TEXT_PDF.BAS
    FUNCTION/Main,SHOW=YES,,
    STARTSCRIPT/
    ENDSCRIPT/
    COMMENT/REPT,
    "RUN TIME: "+T100
    PRINT/REPORT,EXEC MODE=END,$
    TO_FILE=ON,OVERWRITE="M:\SM-All Parts (DMS)\Electronic Inspection Results\CUSTOMER NAME\"+ LOT.INPUT + "\" + FILE_NAME.INPUT + "" + SERIAL.INPUT + "_cmm" + ".PDF",AUTO OPEN REPORT=OFF,$
    TO_PRINTER=ON,COPIES=1,$
    TO_DMIS_REPORT=OFF,FILE_OPTION=INDEX,FILENAME=,$
    REPORT_THEORETICALS=NONE,REPORT_FEATURE_WITH_DIMEN SIONS=NO,$
    TO_EXCEL_OUTPUT=OFF,
    PREVIOUS_RUNS=DELETE_INSTANCES



    THIS IS THE CODE INSIDE THE bas FILE.

    Dim DmisApp As Object Dim DmisPart As Object Dim DmisCommands As Object Dim DmisCommand As Object Dim Var As Object Sub Main() Set DmisApp =CreateObject ("PCDLRN.Application") Set DmisPart = DmisApp.ActivePartProgram Set DmisCommands = DmisPart.Commands Dim defaultreport As String defaultreport = "C:\Users\Public\Documents\Hexagon\PC-DMIS\2017 R2\Reporting\default.rtp" Set Var = DmisPart.GetVariableValue ("TXTPRTSTRING") DmisPart.EditWindow.SetPrintOptionsEx PCD_FILE, DMIS_OFF, PCD_OVERWRITE, 1, Var.StringValue , PCD_TXT, True DmisPart.ReportWindow.LoadReportTemplate defaultreport DmisPart.ReportWindow.FullReportMode DmisPart.ReportWindow.Visible = True DmisPart.ReportWindow.RefreshReport DmisPart.ReportWindow.PrintReport Dim textonly As String textonly = "C:\Users\Public\Documents\Hexagon\PC-DMIS\2017 R2\Reporting\textonly.rtp" Set Var = DmisPart.GetVariableValue ("PDFPRTSTRING") DmisPart.EditWindow.SetPrintOptionsEx PCD_FILE, DMIS_OFF, PCD_OVERWRITE, 1, Var.StringValue , PCD_PDF, True DmisPart.ReportWindow.LoadReportTemplate textonly DmisPart.ReportWindow.FullReportMode DmisPart.ReportWindow.Visible = True DmisPart.ReportWindow.RefreshReport DmisPart.ReportWindow.RefreshReport DmisPart.ReportWindow.PrintReport DmisPart.EditWindow.SetPrintOptionsEx PCD__OFF, DMIS_off, PCD_OVERWRITE, 1, "" , PCD_PDF, False End Sub


    This is not my work it is the work of a Colleague in one of our facilities.

    I forgot to add that this will automatically save both at end of run at what ever location you choose. So you can send each one to a different location.
  • some time ago I played around with this issue. There is a trick and scripts. I have a sample prg which runs a script to set the output to TEXT, then a PRINT, followed by an REPORT command to INSERT the same template. This should make pcdmis re-populate the report. I follow this with another script to change the output to PDF. Followed by another PRINT command. This seems to work for at least 2018R1.


    Could you possibly link one for V2016.0? I'd like to see but can't open it cause I use 2016 and it was saved in 2017 Neutral face