It is possible can offset the rectangs and check what do they touch which if dwg is 100% correct would be the green *lines.
(defun c:test ( / )
(setq olsnap (getvar 'Osmode))
(While (setq obj1 (entsel"\nPick rectangle Enter to exit "))
(setvar 'osmode 0)
(setq co-ord (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget (car obj1)))))
(setq pt (getvar 'extmax))
(setq pt (list (car pt)(cadr pt)))
(command "offset" 200 obj1 pt "")
(setq co-ord2 (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget (entlast)))))
(setq co-ord2 (cons (last co-ord2) co-ord2))
(command "erase" (entlast) "")
(setq obj2 (vlax-ename->vla-object (ssname (ssget "F" co-ord2 (list (cons 0 "*LINE"))) 0)))
(setq end (vlax-curve-getendpoint obj2))
(setq start (vlax-curve-getstartpoint obj2))
(if (> (distance (nth 0 co-ord) start) (distance (nth 0 co-ord) end))
(command "point" start)
(command "point" end)
)
(setvar 'pdmode 35)
)
(setvar 'osmode oldsnap)
(princ)
)