(defun c:avpr (/ *error* acdoc cmd ss i e)
(setq acdoc (vla-get-activedocument (vlax-get-acad-object))
cmd (getvar 'cmdecho))
(vla-startundomark acdoc)
(setvar 'cmdecho 0)

(defun *error* (msg)
(and
msg
(not (wcmatch (strcase msg) "*CANCEL*,*QUIT*,*EXIT*"))
(princ (strcat "\nError: " msg))
)
(setvar 'cmdecho cmd)
(vla-endundomark acdoc)
(princ)
)

(foreach lo (layoutlist)
(setvar 'ctab lo)
(vla-put-mspace acdoc :vlax-false)
(if
(setq ss (ssget "_X" (list '(0 . "VIEWPORT") (cons 410 lo) '(-4 . ">") '(68 . 1))))
(repeat (setq i (sslength ss))
(setq e (ssname ss (setq i (1- i))))
(if
(= (logand 65536 (cdr (assoc 90 (entget e)))) 65536); or (assoc 340 (entget e)) ??? -> clipped viewport
(command "_clip" e "_d")
)
)
)
)

(*error* nil)
(princ)
)
(c:avpr)

Advertisements