Here you are :
(defun c:ssoffset ( / ss i e ll ur lls urs d )
(vl-load-com)
(prompt "\nSelect entities you want to enclose with offset lwpolyline...")
(if (setq ss (ssget))
(progn
(repeat (setq i (sslength ss))
(setq e (ssname ss (setq i (1- i))))
(vla-getboundingbox (vlax-ename->vla-object e) 'll 'ur)
(mapcar 'set '(ll ur) (mapcar 'safearray-value (list ll ur)))
(setq lls (cons ll lls) urs (cons ur urs))
)
(setq ll (apply 'mapcar (cons 'min lls)))
(setq ur (apply 'mapcar (cons 'max urs)))
(initget 5)
(setq d (getdist "\nPick or specify offset distance : "))
(setq ll (list (- (car ll) d) (- (cadr ll) d)))
(setq ur (list (+ (car ur) d) (+ (cadr ur) d)))
(entmake
(list
(cons 0 "LWPOLYLINE")
(cons 100 "AcDbEntity")
(cons 100 "AcDbPolyline")
(cons 90 4)
(cons 70 (1+ (* 128 (getvar 'plinegen))))
(cons 38 0.0)
(cons 10 ll)
(cons 10 (list (car ur) (cadr ll)))
(cons 10 ur)
(cons 10 (list (car ll) (cadr ur)))
(list 210 0.0 0.0 1.0)
)
)
)
)
(princ)
)
HTH.
M.R.