Retrieve the coordinate of mouse

Retrieve the coordinate of mouse

youssefGC
Advocate Advocate
684 Views
2 Replies
Message 1 of 3

Retrieve the coordinate of mouse

youssefGC
Advocate
Advocate

Hi everyone,
I have a question: is it possible to retrieve the coordinate of position of the mouse cursor at the moment the user picks an entity using "PromptEntityOptions"? In other words, can I obtain the coordinates of the point where the user makes the selection?

11111.png
Thank you.

 

0 Likes
685 Views
2 Replies
Replies (2)
Message 2 of 3

kerry_w_brown
Mentor
Mentor

The  PromptEntityResult Class has a    PromptEntityResult.PickedPoint Property

 

Perhaps try that.

The description says 'Gets the point that was used to pick the entity.'

. . but I don't recall exactly if that is the center of the pickbox or the nearest point on the entity, you'd need to check before relying on it to be sure.

 

I think it is the pickbox center, so you may need something like

Curve.GetClosestPointTo([PickedPoint], false) 

https://help.autodesk.com/view/OARX/2025/ENU/?query=GetClosestPointTo

 

Regards,

 


// Called Kerry or kdub in my other life.

Everything will work just as you expect it to, unless your expectations are incorrect. ~ kdub
Sometimes the question is more important than the answer. ~ kdub

NZST UTC+12 : class keyThumper<T> : Lazy<T>;      another  Swamper
Message 3 of 3

Norman_Yuan
Mentor
Mentor

PromptEntityResult.PickedPoint, which is where the mouse location when clicked and may not be right on the curve (in your case). If you need to know the exact point on the curve, you need to calculate it with:

 

Curve.GetClosestPointTo([PickedPoint], false) to obtain the exact point on the curve.

Norman Yuan

Drive CAD With Code

EESignature