hexagon logo

How to Insert Multiple Images Into the Report

Hi All,

A bit over a year ago I asked this question on how to have an image generated on the fly shown in the report. The very helpful answer provided by was to create a custom report label template and use an Events script to update the image when the label is run. This works great when I only have one image. What I'm trying to do now, though, is run multiple similar calculations using subroutines and bring an image from each into my program.

Right now, my subroutine uses a particular custom label template, containing a single image. The subroutine copies the image I want to show to the file referenced in the label and then shows the label. When I run my test program, the report as shown in the report window looks as I would expect - a different image is shown for each subroutine call. However, the printed PDF shows the last shown image repeated each time the label is used. The same thing happens if I hit the refresh icon in the report window - the refreshed report shows the same image repeated.

Here's the code that calls my label in the subroutine. The image is copied into the right name using the FILE/COPY command, and the label name is specified by a variable so I can switch between development/test and production versions:

ASSIGN/IMAGENAME=TMPDIR + QUEUESTRUCT.OUTFILENAME + ".bmp"
FILE/COPY,IMAGENAME,TMPDIR + "SHOW_temporary_image_file.bmp",OVERWRITE
REPORT/LABEL, FILENAME= REPTLABEL​


Here's the event update code in the label template, under event "EventReportData":

this.Bitmap = "C:\CMM_local_data\tmp\SHOW_temporary_image_file.bmp"


The only thing in my label template is this bitmap object.

Is there some way (perhaps specifying a different event? How would I do that?) to "lock" the label template to the image it loads when the REPORT/LABEL command is called? Is there another way to accomplish loading multiple different images through a label template like this?
Parents
  • Thanks for bringing this up. I haven't played with this way of putting images into a report until now. I'm now seeing that it may have helped me with some projects in the past.

    To put multiple static images into a report using report labels I think it might work best to create a separate label for each image and then insert each of those into your measuring routine using separate commands.

    The method you described to use an even to select the image would not be necessary for a single static image. You could just create a new report label, adjust the size so it works with the rest of your reporting, then add an image object. When you do that the following dialog window opens.


    Clicking the Load button will open a dialog window to let you select an image ​to use. If the Link check box is checked, the picture will be loaded from that file each time the label is used. If the box is unchecked it will embed the image into the label and will always remain the same, even if the original image is edited or moved.

    I tested this a bit and found that using the Link option doesn't work as dynamically as expected. I created a label and put in a picture using the link option. I inserted that into a measuring routine. I then edited the picture and ran the measuring routine offline. The picture did not update to the new edited image. I tried closing and reopening the measuring routine and then re-running the routine again. Still, the image in the report label did not update. I completely closed PC-DMIS, re-opened it and re-ran the measuring routine. Now, the image updated on the report. So, 's method would still be the way to go if you want to put in an image on the fly. But for an image that will only be updated occasionally, you could just use the link option.

    Also, just a note, I was having issues using .jpg images. They didn't scale right. .Bmp images worked better.
Reply
  • Thanks for bringing this up. I haven't played with this way of putting images into a report until now. I'm now seeing that it may have helped me with some projects in the past.

    To put multiple static images into a report using report labels I think it might work best to create a separate label for each image and then insert each of those into your measuring routine using separate commands.

    The method you described to use an even to select the image would not be necessary for a single static image. You could just create a new report label, adjust the size so it works with the rest of your reporting, then add an image object. When you do that the following dialog window opens.


    Clicking the Load button will open a dialog window to let you select an image ​to use. If the Link check box is checked, the picture will be loaded from that file each time the label is used. If the box is unchecked it will embed the image into the label and will always remain the same, even if the original image is edited or moved.

    I tested this a bit and found that using the Link option doesn't work as dynamically as expected. I created a label and put in a picture using the link option. I inserted that into a measuring routine. I then edited the picture and ran the measuring routine offline. The picture did not update to the new edited image. I tried closing and reopening the measuring routine and then re-running the routine again. Still, the image in the report label did not update. I completely closed PC-DMIS, re-opened it and re-ran the measuring routine. Now, the image updated on the report. So, 's method would still be the way to go if you want to put in an image on the fly. But for an image that will only be updated occasionally, you could just use the link option.

    Also, just a note, I was having issues using .jpg images. They didn't scale right. .Bmp images worked better.
Children
No Data