question

Jouky D avatar image
0 Likes"
Jouky D asked Jason Lightfoot commented

FlexScript: How to obtain the object selected?

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!

FlexSim 23.2.1
flexscriptselected objectsfunctions
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

Arun Kr avatar image
0 Likes"
Arun Kr answered Jason Lightfoot commented
selectedobject(activedocumentnode());
· 5
5 |100000

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

Jouky D avatar image Jouky D commented ·

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 0 ·
Jouky D avatar image Jouky D Jouky D commented ·

I found it! it's using:

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

return selectedobject(TN);

0 Likes 0 ·
Jason Lightfoot avatar image Jason Lightfoot ♦♦ Jouky D commented ·
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 0 ·
Jouky D avatar image Jouky D Jason Lightfoot ♦♦ commented ·
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).
1 Like 1 ·
Show more comments