cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Help us improve the PTC Community by taking this short Community Survey! X

How to calculate the position of the mouse pick on the model .

NT_10507751
10-Marble

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!

 

 

ACCEPTED SOLUTION

Accepted Solutions
RPN
17-Peridot
17-Peridot
(To:NT_10507751)

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”

 

 

View solution in original post

3 REPLIES 3

Use this function to get the point position.

NT_10507751_0-1679043099553.png

 

RPN
17-Peridot
17-Peridot
(To:NT_10507751)

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”

 

 

NT_10507751
10-Marble
(To:RPN)

yes, thank you!

Announcements


Top Tags