(defun c:avpr ( / cmd ctb ent enx idx sel )

;Change All Vports from Polygonal to Rectangular (Lee Mac Solution for 4 corner viewports.)

(setq cmd (getvar 'cmdecho)

ctb (getvar 'ctab)

)

(setvar 'cmdecho 0)

(foreach lay (layoutlist)

(setvar 'ctab lay)

(if (setq sel (ssget "_X" (list '(0 . "VIEWPORT") (cons 410 lay))))

(repeat (setq idx (sslength sel))

(setq ent (ssname sel (setq idx (1- idx)))

enx (entget ent)

)

(if (and (< 0 (logand 65536 (cdr (assoc 90 enx))))

(= 4 (cdr (assoc 90 (entget (cdr (assoc 340 enx))))))

)

(command "_.vpclip" ent "_d")

)

)

)

)

(setvar 'ctab ctb)

(setvar 'cmdecho cmd)

(princ)

)

(c:avpr)

Advertisements