Program for Surface Profile

Program for Surface Profile

I am trying to write a program for a part that needs to check Surface profile and Perpendicularity. I am having trouble getting consistent results, and assuming I am messing up somewhere. The part is essentially a cylinder with a groove wrapped around it length with a cover plate on one end. From how I am reading the print I am supposed to get a profile from the two ends and perpendicularity from one end to the side of the cylinder. I tried reading the articles here, however, I think they confused me more than helped.
I thought initially it was because I adjusted the rotation of the part, but even without moving it I was still getting bad results. I ran the same part five times and got anywhere from .0005" from nominal to ~.022" out of spec.
Any help would be appreciated, Thank you in advance.