@E.S.7.9 wrote:
i have too many layouts in my drawing and they have some viewports exactly the same location in alll layouts , i want to delete this viewports from all layouts but i dont want to do it one by one ...
...
can anybody share with me the similar lisp code ? or explain how to easily delete them
...
Hi E.S.7.9,
try
(vl-load-com)
(defun c:demo (/ *error* I LL LLPT ORG_LLPT ORG_URPT ORG_VP S SS UR URPT VP)
(defun *error* (msg)
(if adoc
(vla-Endundomark adoc)
)
(cond ((not msg))
((member msg '("Function cancelled" "quit / exit abort")))
((princ (strcat "\n** Error: " msg " ** ")))
)
(princ)
)
(or adoc (setq adoc (vla-get-activedocument (vlax-get-acad-object))))
(vla-Startundomark adoc)
(if (and (princ "\nSelect a Viewport to erase ALL Viewports in the same place, in ALL layouts: ")
(setq s (ssget "_+.:E:S" '((0 . "VIEWPORT") (-4 . "!=") (69 . 1))))
(setq ss (ssget "_X" '((0 . "VIEWPORT") (-4 . "!=") (69 . 1))))
)
(progn
(setq org_vp (vlax-ename->vla-object (ssname s 0)))
(vlax-invoke-method org_vp 'GetBoundingBox 'll 'ur)
(setq org_llpt (vlax-safearray->list ll)
org_urpt (vlax-safearray->list ur)
)
(repeat (setq i (sslength ss))
(setq vp (vlax-ename->vla-object (ssname ss (setq i (1- i)))))
(vlax-invoke-method vp 'GetBoundingBox 'll 'ur)
(setq llpt (vlax-safearray->list ll)
urpt (vlax-safearray->list ur)
)
(if (and (equal org_llpt llpt 1e-6)
(equal org_urpt urpt 1e-6)
(vlax-write-enabled-p vp)
)
(vla-delete vp)
)
)
)
)
(*error* nil)
(princ)
)
Hope this helps,
Henrique