question

Arun Kr avatar image
0 Likes"
Arun Kr asked Jordan Johnson answered

Capture View Of Dashboard Not On Active View Using Code

Is it possible to create a view of a dashboard that is not active? The command viewtofile() can only be used for active views.

Regards,

Arun KR

FlexSim 23.2.1
capture view
5 |100000

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

1 Answer

·
Jordan Johnson avatar image
1 Like"
Jordan Johnson answered

Here's one approach:

TestDasbhoardExport.fsm

You can't draw an invisible dashboard. But you can open the dashboard via code. In the past, this was not enough because the charts aren't immediately ready. Now, however, you can use coroutines to solve this issue:

var dashboards = Model.find("Tools/Dashboards").subnodes;
for (int i = 1; i <= dashboards.length; i++) {
    treenode view = applicationcommand("dashboard", dashboards[i]);
    
    // wait for the chart to load
    // For example, 2 seconds works for me
    await Delay.realTime(2);
    
    viewtofile(view, modeldir() + dashboards[i].name + ".png");
}

Using the await keyword, you can open the view, then wait for the view to open, then use viewtofile().


5 |100000

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

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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