;;; Block Offset with user specified offset distance, distance between blocks and nd Rotate Blocks Around it Base Point
;;; Created by Igal Averbuh 2017
;;; Inspired by some subroutines of different authors

(defun C:BOR ( / pl1 pl2 bname pt1 odist)

(setq ent (car (entsel "\nSelect Block Entity: ")))
(setq bname (cdr (assoc 2 (entget ent))))
(eq (cdr (assoc 0 (entget ent))) "INSERT")
(princ (strcat "Block Name:"
(vlax-ename->vla-object ent)))))


; (setq bname (getstring "\nType Block name: "))
(setq pl1 (car (entsel "\nSelect polyline: ")))
(setq pt1 (getpoint "\nPick side to offset to: "))
(setq odist (getdist pt1 "\nDistance to offset Polyline:"))
(setq odist1 (getdist pt1 "\nDistance between Blocks:"))
(command "_offset" odist pl1 pt1 "")
(setq pl2 (entlast))
(command "_measure" pl2 "_b" bname "_y" odist1)

(setq ss (ssget "P"))
(if (not ss) (setq ss (ssx)))
(setq num (sslength ss))
(setq x 0)
(if ss
(if (setq ang (getreal "Enter Rotation Angle: "))
(repeat num
(setq ename (ssname ss x))
(setq elist (entget ename))
(setq pnt (cdr(assoc 10 elist)))
(command "Rotate" ename "" pnt ang)
(setq x (1+ x))