question

William Proctor avatar image
1 Like"
William Proctor asked Jordan Johnson commented

Automatic Exporting of Dashboard Image

I would like to quickly export all of the dashboard images for experiments. I know how to export the raw data used to generate the images and know that the images can be manually exported to the PNG format. Is there a way, however, to export the image to a file automatically at the end of a run?

FlexSim 16.1.2
exportautomaticpngimage
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Sam Stubbs avatar image
1 Like"
Sam Stubbs answered Jordan Johnson commented

So we were able to achieve this by exploring the structure of the dashboard properites panel, and looking at the Save as PNG file. In there it calls the function_s() function which calls a predefined "savePNG" function. So when we took it apart we came up with the following code.:

  1. treenode view = node("/1>Documents/Dashboard/1+/..",views());
  2. function_s(ownerobject(view),"savePNG");

Where the treenode view is a reference to the view of the dashboard. The function_s(ownerobject(view),"savePNG"); executes a function that will bring up a file save window where you can name and save your PNG file.

So call this code at some point in your logic at the end of your runtime, and then when it hits that point it will pop up with the option for you to save the view of your file as a PNG. I've attached the model below with the code snippet in it, so you can try it.

testpngmodel.fsm


testpngmodel.fsm (13.0 KiB)
· 10
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Joerg Vogel avatar image
0 Likes"
Joerg Vogel answered William Proctor commented

Since the capture screen shortcut key "p" was lost in previous Flexsim versions sometime in the past, you can still use external programs with the command:

  1. runprogram(str commandline); // runprogram("c:/myprogram.exe")

For example the program irfanView has some command line options to capture the screen or a rectangle area and save the area in different graphical formats:

  1. i_view32.exe /capture=2
  2. /convert=c:\capture_$U(%d%m%Y_%H%M%S).jpg

This example from the manual faqs save the screen with a time stamp in the file name.

· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.