I'm trying to par down some drawings to what's contained just in model space.....basically i'm wanting to delete all the layout tabs without mouse/keyboard imput. The layouts vary in quantity and in name.
I am aware that there is a need for at least one layout, but this can be the default one generated by ACAD.
BTW, how goes one create a selection set of viewports and one of layouts.
Thanks in advance
Dom
Try this. You might remove the confirm checking part, if so desired. That would be
Jason's original code.
;; original code by Jason Piercy
;; modified JB 7/26/2004 to add Y/N caution
(defun c:DelTabs ( / confirm )
(princ "\nCaution: this will delete all layouts and data contained in layouts. ")
(initget 1 "Y N ")
(setq confirm (getkword "\nProceed? [Yes/No] <Y>: "))
(if (or (= confirm "") (= confirm "Y"))
(vlax-for x (vla-get-layouts (vla-get-activedocument (vlax-get-acad-object)))
(if (/= "Model" (vla-get-name x))
(vla-delete x)
)
)
(princ "\nLayouts were not deleted. ")
)
(princ)
) ;end
Joe Burke
I've parred your code down and it works fine. I'm new to AutoLISP, even newer to VLISP, just for reference, what do the commands mean and how does it work!?
thanks again
dom
You're welcome.
Following is Jason's original code.
(defun c:DelTabs ()
(vl-load-com)
(vlax-for x
(vla-get-layouts (vla-get-activedocument (vlax-get-acad-object)))
(if (/= "Model" (vla-get-name x)) (vla-delete x))
)
)
It looks at the layout collection in the active document. The (vlax-for x... function
is similar to the foreach function in standard LISP. Rather than accepting a list as
an argument, it expects a collection argument. See developer help regarding what
qualifies as a collection when using vlisp/activeX.
Post more questions here if you are still confused.
Regards
Joe Burke
"dhorton" <nos...@address.withheld> wrote in message
news:16771882.109300803...@jiveforum2.autodesk.com...
i think a bit of reading is required!
thanks once again
dom