Hello Community
Would need some help again:
I know it`s possible to get object info froma clicked point in the active view, with Pivy obserers for example.
(getObjectInfo())
I`m wondering whether it`s possible to get this also from a given 2D world coordinates point?
E.g. we have point x= 200, y=0. Is there an object on that point.
Or is there a chnace to convert the world coordinates to the pixel coordinates?
So, the opposite of getPoint(pos).
Thanks for help.
Regards
Chris
How to get objectInfo from given world coordinates
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
Re: How to get objectInfo from given world coordinates
Can't check now, but AFAIR there is a function
Code: Select all
getObjectsInfo(x, y)
Re: How to get objectInfo from given world coordinates
Code: Select all
getObjectInfo(x, y)
coordinates (from placement).
If I wanna use this function I have to convert, but I don`t know whether this is possible somehow.
Re: How to get objectInfo from given world coordinates
This isn't exactly same function (notice the 's' at the end of 'objects'). But indeed not very reliable information as I'm with a mobile now and using my memory.
Re: How to get objectInfo from given world coordinates
What I found out by myself is, the difference between the both (one with "s" the other without) is just
the number of objects under the cursor.
If using returns only information of 1 object.
returns a list with information of all objects.
Maybe I`m wrong ?
the number of objects under the cursor.
If using
Code: Select all
getObjectInfo
Code: Select all
getObjectsInfo
Maybe I`m wrong ?
Re: How to get objectInfo from given world coordinates
Not sure to understand. Only the viewport is 2D. The scene is 3D everywhere actually. So as well is a Placement. Would you provide a simple example to explain?
Re: How to get objectInfo from given world coordinates
I have a solution. With this
I get the cursor position and not the coordinates and I can work with
.
Thanks for help.
Greetings
Chris
Code: Select all
FreeCADGui.activeDocument().activeView().getCursorPos()
Code: Select all
getObjectInfo
Thanks for help.
Greetings
Chris