FlexScript: How to obtain the object selected?

FlexScript: How to obtain the object selected?

jouky_d
Not applicable
57 Views
6 Replies
Message 1 of 7

FlexScript: How to obtain the object selected?

jouky_d
Not applicable

[ FlexSim 23.2.1 ]

Hello everyone,

I am trying to know which object is selected (selected in yellow (click), not in red (control click)). I know there is the funcition: switch_selected(Object, -1) to know if is selected (with control + Click) or not. But how do I know which object is selected with only a Click? Is there a function for that?

Thank you!

0 Likes
Accepted solutions (1)
58 Views
6 Replies
Replies (6)
Message 2 of 7

arunTTT2P
Explorer
Explorer
Accepted solution
selectedobject(activedocumentnode());
0 Likes
Message 3 of 7

jouky_d
Not applicable

How do I choose the Model view instead of using activedocumentnode()? If I use it and I am on another view, the script returns error. I have searched on the View treenode, however, I didn't find anything.

0 Likes
Message 4 of 7

jouky_d
Not applicable

I found it! it's using:

treenode TN = ownerobject(views().find("active>Documents/Perspective/1").value);

return selectedobject(TN);

0 Likes
Message 5 of 7

jason_lightfootVL7B4
Autodesk
Autodesk
Can you explain more about your intention here? Normally you have actions on the model object set the objectfocus so that you have a reference to it in your view. What is invoking the view? Why do you need to detect a subsequent click on an object? Should the object be handling the click?
0 Likes
Message 6 of 7

jouky_d
Not applicable
Hi @Jason Lightfoot! Simply, I wanted to call the object the user is selecting as a parameter of a function to be more userfriendly and to not insert all the parameters. The view is invoking the model. I need it to differentiate the selected by click and the selected by Control Click. (The question is solved).
Message 7 of 7

jason_lightfootVL7B4
Autodesk
Autodesk
Understood - thanks.
0 Likes