Your picture shows the work.
My final goal is to work with the selection point to calculate the distance between it and the ends of the block.
IMO alot more efficient would be if you include that axis line into the block's definition, so we could skip all the nasty explode stuff.
And this one should give you everything you need, both distances and the coordinates of the closest point:
(defun C:test ( / p pick e enx BothDistances ClosestPoint)
(while
(not
(and
(setq p (getpoint "\nSelect the line: "))
(setq pick (nentselp p))
(setq e (car pick))
(= "LINE" (cdr (assoc 0 (setq enx (entget e)))))
(if (apply '< (setq BothDistances (mapcar '(lambda (x) (distance p (cdr (assoc x enx)))) (list 10 11))))
(setq ClosestPoint (cdr (assoc 10 enx)))
(setq ClosestPoint (cdr (assoc 11 enx)))
)
)
)
p
)
(alert
(strcat
"\nFirst distance: " (rtos (car BothDistances) 2) " units."
"\nSecond Distance: " (rtos (cadr BothDistances) 2) " units."
"\nClosest Point is located at: " (vl-princ-to-string ClosestPoint) " coordinates."
)
)
(princ)
)
Although it was an interesting practice!