Is it possible to get the mouse x,y position when clicking the mouse?

Is it possible to get the mouse x,y position when clicking the mouse?

patrickABAWF
Collaborator Collaborator
13 Views
2 Replies
Message 1 of 3

Is it possible to get the mouse x,y position when clicking the mouse?

patrickABAWF
Collaborator
Collaborator

[ FlexSim 24.1.0 ]

I'm trying to build an interactive model in which the user would interact with the 3D view with the mouse. For example by clicking where a TaskExecuter should go next.

To do this I need to obtain the mouse x,y coordinates when I click the mouse button.

Is there a way to reference the mouse position and its button?

I tried with cursorinfo() but couldn't make it work.

Thanks,

0 Likes
Accepted solutions (1)
14 Views
2 Replies
Replies (2)
Message 2 of 3

joerg_vogel_HsH
Mentor
Mentor
Accepted solution

https://docs.flexsim.com/en/24.1/Reference/CodingInFlexSim/CommandReference/CommandGroups.html#click...

I would search for view treenode functions called similar to onClick.

0 Likes
Message 3 of 3

patrickABAWF
Collaborator
Collaborator

After much trial and error I was able to make it work with clickcode and cursorinfo.

I placed this code in a billboard text just because it continuously refreshes:

if (clickcode()==2){         // when I click left mouse button
Model.find("TaskExecuter1").gotox= cursorinfo(sv,2,1,1);   // record mouse x pos
Model.find("TaskExecuter1").gotoy= cursorinfo(sv,2,2,1);   // record mouse y pos
}

Thanks,