Hi, you can try to implement this routine for your problem along with your already coded solutions by @dlanorh
http://www.theswamp.org/index.php?topic=55550.msg597049#msg597049
It should work for blocks and dynamic blocks, but for xrefs that are complex, there are some lacks I hope someone can help to be overcome problem...
Regards, M.R.
[EDIT : I know this is hijacking topic, but if someone is willing to try to solve the problem from posted link, in attachment is my *.zip posted at theswamp...]
findclosestpointtonestedinblkref - problem with xrefs.zip