Issue with print commands

  • Filter
  • Time
  • Show
Clear All
new posts

  • Issue with print commands

    I have a form with a checkbox that the operator will use to tell the program whether or not to create an excel report. No matter what the checkbox says though, I need it to create the pdf report of the dimensions. I have an IF/ELSE statement with a print command inside that will trigger depending on the checkbox. Everything with the statement is working as it should, however when the code is present it will erase all of the stuff in the pdf report, so when the prompt comes up to save the pdf it has nothing to save. The excel is still saved properly and auto-indexed, and everything works with writing data to a .txt file, but the data in the pdf is being deleted. If I remove the IF/ELSE statement everything works as it should, but I need that in there for what we need. Any ideas?

  • #2
    Does your print command say DELETE_INSTANCES or KEEP_INSTANCES? After a print command with DELETE_INSTANCES there's nothing left to print...
    SW support - Hexagon Metrology Nordic AB


    • #3
      I tried to change it to keep_instances but it still deleted the pdf contents


      • #4
        Which version of PC-DMIS? I know the problem with multiple print commands has been discussed before, IIRC, SABarber showed a way to refresh the report data so it worked also a second time. Try searching the forums again...
        SW support - Hexagon Metrology Nordic AB


        • #5
          I beleive this is what AndersI was talking about. We use it to Autosave our reports refresh the report window, then print the reports.

          Sub main()
          Dim App As Object
          Set App = CreateObject("PCDLRN.Application")
          Dim Part As Object
          Set Part = App.ActivePartProgram
          Dim repwin As Object
          Set repwin = part.reportwindow
          repwin.refreshreport 'refresh report
          End Sub


          • #6
            It’s been mentioned before that a PRINT command will output the data up to that point. The next PRINT command will output data that was generated after the prior PRINT. You seem to have a print for excel and another for pdf. Why not combine the excel with pdf for excel output another print for just pdf wrapped with if/else to decide what output is desired. There are ways to drive the data into a report after a print (insert report template using the same template with the option other than switch. Not in front of pcdmis so can’t remember the option. INSERT if I recall correctly.) A report refresh will probably work but could have side effects if done before all features/dimensions are reported.
            Last edited by SABarber; 05-11-2019, 08:48 PM.


            Related Topics