Snap to midpoint

Hello. Say I make an edge using e.g. BRepBuilderAPI_MakeEdge. I would like to have the mouse snap to the endpoints AND to the midpoint of this edge. How can I do this?

Cauchy Ding's picture

Hi John,

Tring to move cursor to those key points' GDI positions is not a good choice in my experience, you can try to change cursor type instead, such changing "Arrow" to "Point".
To catch those snapping message, you can use soft picking method. In your mouse moving procedure, transform all 3D key points to 2D GDI points (using OPenGL API), and try to find the nearest one ( under the threshold also), then change the cursor type.

Ding