How do you get a reference to the 3D Model view?

How do you get a reference to the 3D Model view?

aaron_c
Not applicable
39 Views
7 Replies
Message 1 of 8

How do you get a reference to the 3D Model view?

aaron_c
Not applicable

[ FlexSim 19.1.0 ]

I want to follow different objects in first-person view at different points in my Process Flow. I found a reference here

https://answers.flexsim.com/questions/45622/ser-view-on-video-recorder-as-first-person-from-op.html

in which @Jacob Gillespie mentioned:

"function_s(view, "follow", object)"
and
"function_s(view, "setFollowFirstPerson", boolean);".

This looks like what I need, but I can't figure out how to get Jacob's "view" reference.

0 Likes
Accepted solutions (1)
40 Views
7 Replies
Replies (7)
Message 2 of 8

Matthew_Gillespie
Autodesk
Autodesk
Accepted solution

You need to get a reference to the 3D view you want to tell to start following something. This line of code will get you the first open 3D view:

views().find("active>Documents/Perspective/1+/~")

If you had multiple 3D views open and you wanted to set the follow setting on all of them you could do something like this:

treenode perspViews = views().find("active>Documents/Perspective");
for(int i = 1; perspViews.subnodes.length; i++) {
	treenode view = ownerobject(perspViews.subnodes.value);
	function_s(view, "follow", object);
}


Matthew Gillespie
FlexSim Software Developer

Message 3 of 8

Jacob_Gillespie
Autodesk
Autodesk

If you want to set it to follow in a first person view then add this to your code after calling the follow command.

function_s(view, "setFollowFirstPerson", 1);
0 Likes
Message 4 of 8

aaron_c
Not applicable

Works perfectly! Thanks!!

0 Likes
Message 5 of 8

yehua_z
Not applicable
Hi, @Matthew Gillespie ,

May I ask where to put the codes at? Thank you

0 Likes
Message 6 of 8

Matthew_Gillespie
Autodesk
Autodesk
@Cass Z What are you trying to do?


Matthew Gillespie
FlexSim Software Developer

0 Likes
Message 7 of 8

yehua_z
Not applicable
so in my model, the source "on creation" triggers different labels on different boxes, and I want to follow one specific type number. Thank you
0 Likes
Message 8 of 8

jason_lightfootVL7B4
Autodesk
Autodesk
Then you're going to put the code in the source oncreation trigger I guess or at the point you want to set the follow. If you have multiple objects of the follow type then you might want to set a global variable to the item you're following and then only activate the follow on a new items and set the variable again, when the global variable is NULL.
0 Likes