question

Afonso Teberga avatar image
0 Likes"
Afonso Teberga asked Afonso Teberga commented

Call viewtofile command at the end of a replication

Hi everyone

Is it possible to call the viewtofile command at the end of a replication? I would like to capture and save each model view (as a bitmap file) for each model run. My objective is to have these images as support for understanding scenario/replication results.

I created a user command to perform this task (viewstofile.fsm), but it only works if I run the 3D model... It won't save model views while running the experimenter.

// Variables
treenode views = Model.find("Tools/PerspViews");
treenode perspectiveView = applicationcommand("perspectiveview"); 

// Actions
for (int iView = 1; iView <= views.subnodes.length; iView++){
   treenode view = views.subnodes[iView];
   applicationcommand("changeperspview", view.name, perspectiveView);
   string filePath = modeldir() + view.name + ".bmp";
   viewtofile(perspectiveView, filePath);
}


Thanks in advance!

FlexSim 21.1.5
experimentersave view
viewstofile.fsm (30.3 KiB)
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
2 Likes"
Jordan Johnson answered Afonso Teberga commented

It isn't possible to call viewtofile during a replication. The view tree isn't present, so none of the perspective views are available.

However, you can check the "save state for each replication" box on the Experimenter. This should produce a state file on your hard drive (I think in the same directory as the model), which you can then open, and take a screenshot of the resulting model.

If you upgrade to version 22.0, it might be easier to examine many state files. We did make a change, that state files are initially stored in the result database file, so you'll need to open them using the Performance Measures window. But that window lets you pick a replication and open the state file for that replication (once you save it with whatever name you want). It will open in a new FlexSim automatically, instead of launching a FlexSim and choosing file->open.

· 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.

Afonso Teberga avatar image Afonso Teberga commented ·
Thanks Jordan!
0 Likes 0 ·