Measuring a corner

The following cycles determine the X and Y values of the corner and the rotation of the workpiece. The determined values are transferred to the selected zero offset.