Here's how I do that.
I have my own screenset with a lot of useful buttons/macros. You will also need to add new buttons to your screenset.
Assume I have a clear zero mark on my physical part, and a line along desired X or Y.
Step 1. I get the part zero by using a ring probe, a camera or just visually aligning any tool with a pointed tip. X and Y are zeroed.
Step 2. I position a tool on the other end of the line (by the same means) but not alter X and Y.
Step 3. Current coordinates are copied to the dedicated DROs - I have a button for that. The code below assumes they are #1002 and 1003.
Step 4. A special button (I call it "Calc Angle") executes the following code.
Code:
dx = GetUserDRO( 1002 )
dy = GetUserDRO( 1003 )
Pi = atn( 1 ) * 4
If Abs( dx ) > Abs( dy ) Then ' horizontal, near X axis
angle = atn( dy / dx )
Else ' vertical, near Y axis
angle = atn( - dx / dy )
End If
angle = angle / Pi * 180
ret = MachMsg("A = " & roun(angle) & "° - set?", "Axis Rotation", 4)
If ret = 6 Then ' Yes
SetOEMDRO(118, angle) 'Code("G68X0Y0R" & angle)
End If
Message("A = " & roun(angle) & "°")
If you answer Yes, the computed angle will be in effect for machining. Otherwise, it just displays the result.
NOTE: if you have to interrupt the work and restart the system, the part offset are saved, but the axis rotation is reset. Hopefully the user DROs are preserved, and all you have to do is Step 4 above.