surface position and normal from mouse click?

Is there an API (or set of API's) that gives us the the position (and normal direction) of a point clicked on the geometry?

SolidworksApi macros
Answers 4
JS
JS 2013-10-22 Best Answer

You can use ISelectionMgr::GetSelectedObject6 and ISelectionMgr::GetSelectionPoint2 along with the INormal property of the IFace2 class.

Keep in mind there is no 'normal' direction for a point such as a vertex.  It would have to be a face, or your would have to get the face of he selected object (component, body, etc).

Jim S.

RB
RB 2013-10-22

Thanks Jim,

Unfortunately, INormal only returns the normal of a PLANAR face. I want the normal at any given point on a face, even non-planar faces.  ie the reflected normal of a ray that would fire from the camera to the point selected.

JS
JS 2013-10-22

In that case, use the above along with IFace2::GetSurface follwed by ISurface::EvaluateAtPoint.

Jim S.

RB
RB 2013-10-22

Perfect!  Thanks for the help.