[Solved] Get coordinates of point on surface under cursor

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
thyssentishman
Posts: 82
Joined: Mon May 16, 2022 10:35 am

[Solved] Get coordinates of point on surface under cursor

Post by thyssentishman »

Hi all,

I want to know if it's possible to get the coordinates of a point on a surface that is selected with the cursor. I know it's possible to get the position of the cursor (x,y) on the screen, but I want the coordinates of the first point on a surface under that cursor position. Here is what I mean:

example.png
example.png (251.16 KiB) Viewed 1887 times
Last edited by thyssentishman on Thu May 19, 2022 7:56 am, edited 1 time in total.
chrisb
Veteran
Posts: 53920
Joined: Tue Mar 17, 2015 9:14 am

Re: Get coordinates of point on surface under cursor

Post by chrisb »

You mean the coordinates that are shown in the status bar?
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
edwilliams16
Veteran
Posts: 3106
Joined: Thu Sep 24, 2020 10:31 pm
Location: Hawaii
Contact:

Re: Get coordinates of point on surface under cursor

Post by edwilliams16 »

View|Status Bar or left click, then

Code: Select all

Gui.Selection.getSelectionEx()[0].PickedPoints
in the Python Console returns coordinates.
thyssentishman
Posts: 82
Joined: Mon May 16, 2022 10:35 am

Re: Get coordinates of point on surface under cursor

Post by thyssentishman »

Thank you chrisb and edwilliams16, this is exactly what I wanted. Amazing!
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: [Solved] Get coordinates of point on surface under cursor

Post by Kunda1 »

Please mark OP title [Fixed] by prepending it.
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
thyssentishman
Posts: 82
Joined: Mon May 16, 2022 10:35 am

Re: [Solved] Get coordinates of point on surface under cursor

Post by thyssentishman »

Hi @Kunda1,
Kunda1 wrote: Sun May 29, 2022 1:51 pm Please mark OP title [Fixed] by prepending it.
I don't know exactly what you mean. Should I change [Solved] for [Fixed]?
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: [Solved] Get coordinates of point on surface under cursor

Post by Kunda1 »

No it's all good! They are synonymous ;)
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
mea08kw
Posts: 82
Joined: Sun Oct 09, 2022 6:22 am

Re: [Solved] Get coordinates of point on surface under cursor

Post by mea08kw »

Hi

With the position of the cursor (x, y), we could print out the coordinates of the red point (x, y, z).

What if we know the coordinates of the red point, how do I get its position on screen (only x, y)?

Mea08kw
User avatar
Roy_043
Veteran
Posts: 8450
Joined: Thu Dec 27, 2018 12:28 pm

Re: [Solved] Get coordinates of point on surface under cursor

Post by Roy_043 »

@mea08kw Why the same question 3 times? That is just crazy. Please stop doing that!
viewtopic.php?p=661297#p661297
viewtopic.php?p=661300#p661300
mea08kw
Posts: 82
Joined: Sun Oct 09, 2022 6:22 am

Re: [Solved] Get coordinates of point on surface under cursor

Post by mea08kw »

No problem, Roy.
Post Reply