question

Patrick Cloutier avatar image
1 Like"
Patrick Cloutier asked Dirk Boumans commented

How to capture view in code ?

Hello, I'm trying to capture model views as the model is running.

I put this code in a User Event:

viewtofile(node("VIEW:/active/ortho"),modeldir() + "CapturedView1.bmp");

pt("captured");

The word captured appears in the output console but no file is created anywhere. I searched the entire computer for a file named as I did and there is none.

What am I doing wrong?

FlexSim 18.2.2
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

Phil BoBo avatar image
1 Like"
Phil BoBo answered Dirk Boumans commented

node("VIEW:/active/ortho") probably is NULL. You need a correct path to the view you want to capture.

Try using activedocumentnode() instead.

· 6
5 |100000

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

Patrick Cloutier avatar image Patrick Cloutier commented ·

Thanks ! That works!

0 Likes 0 ·
Dirk Boumans avatar image Dirk Boumans commented ·

Hi this thread helps me in the right direction to capture a view during a simulation run. However I want to capture a specific predefined view and I can't get the correct reference to this view. How to do this?

0 Likes 0 ·
Patrick Cloutier avatar image Patrick Cloutier Dirk Boumans commented ·

Model.find("Tools/PerspViews/View 1")

Replace View 1 with the name of your view.


0 Likes 0 ·
Dirk Boumans avatar image Dirk Boumans Patrick Cloutier commented ·

Hi Patrick thanks for your answer, I've tried that but it doesn't seem to work. I've uploaded a test model which represents the logic I would like to use. I use process flow to trigger the capture event. When I put in activedocumentnode() instead of Model.find("Tools/PerspViews/Test") it does work.

testmodel.fsm

0 Likes 0 ·
testmodel.fsm (35.3 KiB)
Show more comments