question

Julio R avatar image
0 Likes"
Julio R asked Noah Z commented

Change view perspective with code

Hello,

I´m trying to make a simple code that replicate de effect on clicking on the save views name in the Quick properties when we click on the model floor.

Is there a command or a different way to accomplish this?

FlexSim 18.0.2
codeview
asdf.png (25.5 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

Matthew Gillespie avatar image
1 Like"
Matthew Gillespie answered Noah Z commented
string viewName = "View 1";
applicationcommand("changeperspview", viewName, activedocumentnode());
· 4
5 |100000

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

Julio R avatar image Julio R commented ·

Thank you so much, that's exactly what I needed.

0 Likes 0 ·
Noah Z avatar image Noah Z commented ·

This works well running in the script window if the 3D view is already the selected window. Is there a way to make this work when some non-3D window is active? For example, I want someone to be able to push a button (run the code in the onPress) on a dashboard and have the model open up a 3D window in the specified view.

@Matthew Gillespie

0 Likes 0 ·
Matthew Gillespie avatar image Matthew Gillespie ♦♦ Noah Z commented ·

This answer shows you how to loop through all open 3D views.

To open a new 3D view you can use this command:

treeenode newView = applicationcommand("perspectiveview"); 

Either way you just replace activedocumentnode() with your chosen view.

0 Likes 0 ·
Noah Z avatar image Noah Z Matthew Gillespie ♦♦ commented ·

That worked great. Thanks!

0 Likes 0 ·