Finally finished what I was working on. Give this a try, Gary...
(I took my original BX code and just changed the functionality of the foo subroutine.)
(defun c:BXX (/ foo _dist p1 p2 p3 ang)
;; Alan J. Thompson, 12.08.10
(vl-load-com)
(defun foo (l / e)
((lambda (area)
(vl-some
(function (lambda (o / off)
(if (> area (vla-get-area (setq off (car (vlax-invoke e 'Offset o)))))
(not (vla-delete e))
(vla-delete off)
)
)
)
'(-18. 18.)
)
)
(vla-get-area
(setq e
(vlax-ename->vla-object
(entmakex
(append
'((0 . "LWPOLYLINE") (100 . "AcDbEntity") (100 . "AcDbPolyline") (90 . 4) (70 . 129))
(mapcar (function (lambda (p) (cons 10 (reverse (cdr (reverse (trans p 1 0))))))) l)
)
)
)
)
)
)
)
(defun _dist (a b) (distance (list (car a) (cadr a)) (list (car b) (cadr b))))
(if (and (setq p1 (getpoint "\nSpecify first point: "))
(setq p2 (getpoint p1 "\nSpecify second point: "))
(not (grdraw p1 p2 3 1))
)
(if (setq p3 (initget 0 "Left Right")
p3 (getpoint p2 "\nSpecify third point or Square box or [Left/Right]: ")
)
(cond ((vl-consp p3) (foo (list p1 p2 p3 (polar p3 (angle p2 p1) (_dist p1 p2)))))
((eq (type p3) 'STR)
(cond
((eq p3 "Left") (setq ang (+ (/ pi 2.) (angle p1 p2))))
((eq p3 "Right") (setq ang (+ (* pi 1.5) (angle p1 p2))))
)
(foo (list p1 p2 (polar p2 ang (_dist p1 p2)) (polar p1 ang (_dist p1 p2))))
)
)
)
)
(redraw)
(princ)
)
Edited to reverse offset value list (more times that not, the negative offset will be the one - no reason to offset the other if you don't have to.