Export element distance by dynamo

I created a Dynamo code to calculate the distance between elements. It works Like this:
select an element face as a reference and select a point to calculate the perpendicular distance between them. It was OK. but when I want to select a family face as a reference, it defines Revit Project Base Point as the reference Plan and it doesn’t work.