Peter,
I appears that the value held internally in the AcEd.PromptEntityResult IS in the DCS when there is no manual Osnap Override.
With your Test2 Drawing,
Rotate the UCS about X 90 and run the routine again.
Currently in the drawing, The active UCS is world ; so any selection , reported in UCS, will be the same as world.
For instance, before UCS rotation ;
the top of the line marked with a circle is now ;
Command: id
Specify point: _ENDP of X = 837.3668 Y = 811.1579 Z = 1178.9697
when I rotate the ucs X 90 [ front ]
the top point is ;
Command: id
Specify point: _ENDP of X = 837.3668 Y = 1178.9697 Z = -811.1579
Run Listit selecting the ' _END' of the same line ;
PromptEntityResult :
((OK,),(2130633624),(837.36683616951, 1178.96967277117, -811.157907859751))
PickedPoint in UCS : (837.36683616951,1178.96967277117,-811.157907859751)
Picked Point in WCS : (837.36683616951,811.157907859753,1178.96967277117)
Change code to : (similar to your mod but using "_ENDPOINT" )
{I know _ENDP would hardly ever be used , but it does select at a demonstrable known point}
selecting the same line, at the upper end ;
PromptEntityResult : ((OK,),(2130633624),(1649.62730512099, 2001.15440070052, 0))
PickedPoint in UCS : (837.36683616951,1178.96967277117,-811.157907859751)
Picked Point in WCS : (837.36683616951,811.157907859753,1178.96967277117)
Interesting bit of a testing exercise