Lee Mac has a routine that puts text on a polyline and his routine caught key presses to modify the location of the text.
I think that technique could also be used here to swap the direction of the offset.
You can create both offsets and then check which of the two has all its points inside the bounding polyline.
; draw offsets from points for random shape object making pline
; By Alan H AUG 2019
(defun ah:ploffs (/ offdir offd x pt1 pt2 pt3 oldsnap ssp)
(defun drawline (/ ang pt3 obj)
(setq ang (angle pt1 pt2))
(if (= offdir "L")
(setq pt3 (polar pt2 (+ ang (/ pi 2.0)) 10))
(setq pt3 (polar pt2 (- ang (/ pi 2.0)) 10))
)
(setvar 'osmode 0)
(command "line" pt1 pt2 "")
(setq obj (entlast))
(command "offset" offd obj pt3 "")
(setq ssp (ssadd (entlast) ssp))
(command "erase" obj "")
(setq pt1 pt2)
)
(defun swapr-l (/)
(if (= (strcase offdir) "L")
(setq offdir "R")
(setq offdir "L")
)
(setvar 'osmode oldsnap)
(setq pt1 (getpoint "\nPick next point"))
(setq pt2 (getpoint "\nPick next point"))
(drawline)
)
; starts here
; add side pick
(setq oldsnap (getvar 'osmode))
(setq ssp nil)
(initget 6 "R L")
(setq offdir (strcase (getstring "Right or Left")))
(setq offd (getreal "Enter offset distance"))
(setq pt1 (getpoint "pick 1st point"))
(setq ssp (ssadd))
(initget 6 "1 2 3 4 5 6 7 8 9 0 a b c d e f g h i j k l m n o p q r s t u v w x y z")
(while (setq pt2 (getpoint "\nPick next point or [S Swap sides]:<"))
(cond
((= (type pt2) 'LIST) (drawline))
((= (type pt2) 'str) (swapr-l)) ; also calls drawlines
((= pt2 nil) (quit))
)
(setvar 'osmode oldsnap)
(initget 6 "Swap")
)
(setq x 0)
(repeat (- (sslength ssp) 1)
(setvar 'filletrad 0)
(command "fillet" (ssname ssp x) (ssname ssp (1+ x)))
(setq x (1+ x))
)
(setq x 0)
(command "pedit" (entlast) "Y" "J")
(repeat (- (sslength ssp) 1)
(command (ssname ssp x))
(setq x (1+ x))
)
(command "" "")
(princ)
)
(ah:ploffs)