I took the guts of this code and refactored it, then added another command - PT2PROFILE - that will datum-adjust existing points based on any of the profiles in your drawing.
In the process, I created a couple of class hierarchies that illustrate C# keywords like PROTECTED, ABSTRACT, VIRTUAL, OVERRIDE, and NEW, and can serve as a working example for someone trying to learn when, why, and how to use these keywords.