How to calculate the position of the mouse pick on the model .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
How to calculate the position of the mouse pick on the model .
Hello everyone!
I want to calculate the coordinates of the mouse left click point on the solid model.
So I tried the following, but the calculation is wrong.
pfcSession_ptr mysess = pfcGetProESession();
pfcMouseStatus_ptr MouseStatus = mysess->UIGetNextMousePick(pfcMOUSE_BTN_LEFT);
pfcPoint3D_ptr Position = MouseStatus->GetPosition();
pfcView_ptr view = mysess->GetCurrentModel()->GetCurrentView();
pfcTransform3D_ptr Transform3D = view->GetTransform();
Transform3D->Invert();
pfcPoint3D_ptr model_point = Transform3D->TransformPoint(Position);
The “model_point” is wrong .
And I can't select points through the function "pfcBaseSession::select()", because there are no points on the surface, I want to calculate the position of the mouse click on the point position on the surface of the solid model.
Can anyone tell me how to do it, or is there any other way,thanka!
Solved! Go to Solution.
- Labels:
-
ProToolkit
- Tags:
- protoolkit
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I guess you get only the screen coordinates, no z value.
in Toolkit I would use this:
extern ProError ProSelectionPoint3dGet( ProSelection selection,
ProPoint3d point );
/*
Purpose: Retrieves the coordinates of the selected point in the member
coordinate system.
Input Arguments:
selection - The selection object
Output Arguments:
point - The point coordinates
Return Values:
PRO_TK_NO_ERROR - The function successfully retrieved the information.
PRO_TK_BAD_INPUTS - The selection or depth is NULL.
PRO_TK_INVALID_PTR - The selection argument is an invalid pointer.
*/
My assumption is, this will return a point on the surface, if your type Is “surface”
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Use this function to get the point position.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I guess you get only the screen coordinates, no z value.
in Toolkit I would use this:
extern ProError ProSelectionPoint3dGet( ProSelection selection,
ProPoint3d point );
/*
Purpose: Retrieves the coordinates of the selected point in the member
coordinate system.
Input Arguments:
selection - The selection object
Output Arguments:
point - The point coordinates
Return Values:
PRO_TK_NO_ERROR - The function successfully retrieved the information.
PRO_TK_BAD_INPUTS - The selection or depth is NULL.
PRO_TK_INVALID_PTR - The selection argument is an invalid pointer.
*/
My assumption is, this will return a point on the surface, if your type Is “surface”
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
yes, thank you!
