I'm looking at implementing external calculations for some of our measurement routines. I'll have a subroutine save scan data and then call an external program that processes it. The external program will output a graph as an image file as well as a couple of values. Including the values in the report is easy using generic features; however, how can I go about including the graph?
I looked into
External Objects, but even when the link to external file box is checked, the image only updates when it's marked to execute, which also pops open MS Paint and pauses PC-DMIS. This is not at all what I want; I need the current, updated image file shown in the report, but without stopping the running program. Is there any way to do this?
I would create a report label. File/Reporting/New/Label Template.
Add an Image object to the label - resize as needed.
Select the output file as the input for the label image - this is a fixed image unless you add the Event to update it.
Use the following to update the image before going to the report.
Select the Events property for the Image object.
Add the following code to the script.
this.bitmap = "D:\Temp\ImageToUse.jpg" -- define your filename and path.
Save the label.
Then use the REPORT/LABEL command to point to the label you created. This will add the image to the report.
REPORT/LABEL, FILENAME= imageLabel.lbl
I prefer to insert an external object. The thing you must know about doing that is that there are 4 different states to marking/unmarking inserted objects. If you choose the right configuration it won't open the image, it will just put it in the report.
Here is the table from the help file. For images, replace the word 'Execute' with the words 'Pause the measuring routine, open the image file with MS Paint, and hide the open image behind the PC-DMIS application window so the operator is confused as to why it has stopped'
I tried that first, but when the image is set to an option that doesn't include "Execute", it doesn't reload the image file, at least not in 2019 R1. The only way I could get it to reload the image file is to set it to "Execute", with all of the accompanying undesirable side effects.
SABarber 's solution, while highly involved, allows the use of VBA code to force an update without any MS Paint action.
Well, it was worth a try. Most of the time it works just fine for me, but sometimes I have had issues with it displaying images when I have it marked not to. At least SABarber had a nice workaround!