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

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

(vl-load-com)
(cond
((and
(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:"
(vla-get-effectivename
(vlax-ename->vla-object ent)))))

))

(setq pl1 (car (entsel "\nSelect polyline: ")))

(setq odist1 (getdist "\nDistance between Blocks:"))

(command "_measure" pl1 "_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))
)
)
)
)

(c:mbl)

Advertisements