Showing results for 
Search instead for 
Did you mean: 

Click -> get mouse position or run method




I would like to know if it is possible to get the position of the mouse after I click somewhere on a frame (preferably)

Left or right click is also fine. Thank you in advance! Smiley Happy



This option does not fit my needs, but this was included in the first version of this post:

or run a method when I click on the frame.



Re: Click -> get mouse position or run method

Valued Contributor
Valued Contributor

as below picture  ,you can enter a method in "select"


Re: Click -> get mouse position or run method


Thank you really much, fox! Smiley Happy


Unfortunately, I can't work with the second option I wrote about.


I wanted to use a script (outside Plant Simulation) that would save the coordinates of the mouse when I click, and write them to the clipboard, then I would read that from the Plant Simulation method. The problem is that I can't find a way to calculate the Plant Simulation frame coordinates from the Windows mouse coordinates, so I can't make the second option work. I edited the initial post. But thank you really much! I wasn't definite enough in my question.

Re: Click -> get mouse position or run method

Hi Lemongrass38,

I don't exactly understand, what you want to do, but probably it's not possible in a really reliable way...

Perhaps you can get close to what you want with the folloing methods:

  • getXYWH(x,y,w,h): gives you the position and size of a frame within the grey background area.
  • xpos and ypos gives you the position of an object within the frame

See the arrows in my screenshot.

Perhaps you can add all the other sizes (like the height of ribbonbar, toolbox, etc.) statically?




Re: Click -> get mouse position or run method


Hi @Andreas_SimPlan @Lemongrass38

thanks for info about get(X,Y,W,H) and (XPOS ,YPOS).

i have also one similar question:


In My model there is one main frame(Production_System) and inside Production_System there is somany different Area(Cutting, surface treatment,Assembly--These all are subframes).. And inside these Area, there are different stations (Singleproc,Buffer) and some frame ( Line) also.

Now, Production_system and All area has own workerpool.  Worker are doing job as only transportation means take a part from one stations and then travelling to the next station and unload there. they can only move to other frame  (when they have next goal in other frame).


Now at the end of simulation, we are exporting travelling distance of worker and  layout(position of all frame and station).. And developing new different layout (around 10) with the help of different optimization methd(Outside the plantsim)  and for these layouts,make a model run and take data(travelling distance ) and find which is optimized layout.



i am confuse to understand traveling route of workers ((means on which route worker can travel))

i want to understand, From which position(Xpos;Ypos) worker can walk inside that area.And from which position, worker can leave that area and run toward to next area..similar for all Line(subframe).


Que 2:

Are Entry and exit of worker (in Area--chipping_1) only related to co-ordinate system of that area(chipping_1)?? or its related to get(X,Y) ??


Please can you explain more about get(x,y,w,h) and XPos and Ypos. and which is related to worker travelling route if there is somany frame and subframe and worker have to travel from one frame to other..


Thanks in advanceSmiley HappySmiley Happy



Re: Click -> get mouse position or run method


Thank you , Andreas_Simplan! Smiley Happy


I wanted to have method that runs when I click on a frame, and the method would get the XPos and the YPos of the mouse in the frame I clicked in. As I see, this can't really be done in a reliable way, as you mentioned. The project I work in changed to another direction, so I do not really need the solution now.

I didn't know about these two Plant Simulation commands before, so thank you for sharing these with me! Smiley Happy Who knows, maybe I will need that some day.


@Niks1: I did not really understand your thoughts. Unfortunately I don't know whether the size of an object affects delivery time.

Re: Click -> get mouse position or run method



1. I think you had better start a new topic with your question. People just won't find your question here. That is what I would do.

2. I think a simulation model would really help a lot to understand your questions. Or if you can't attach your model, then you could create a sample model.

3. As I know, XPos and YPos are the coordinates of an object in the frame. There is a scaling factor that sets the scale of the coordinate systems, that surely has something to do with worker travel distances. As for XPos and YPos and travel distance: I don't know if there is a correlation or not. Maybe you can do some experimenting in Plant Simulation.