The distance between 2 points it's not affected by UCS change, but you need the 2 points "living" in the same UCS. Just translate the points to some UCS and calculate the distance as usual.
I gave you the same reply as gaston here:
Y showed you the way to translate points with Editor.CurrentCoordinateSystem in the same thread.
Do you think you'll have better replies when multiplying threads for the same task ?
Do you read the replies I gave you ?
Access a broad range of knowledge to help get the most out of your products and services.