1. Constrain movement by DynamicCoordinates command
To constrain the movement of the free point P on gird only, the following DynamicCoordinates command is used to define P.
P = DynamicCoordinates(B, round(x(B)), round(y(B)))
where B is a hidden free point.