Jump to content

Editing Every Layout Tab in a drawing - Autolisp


jdavid22

Recommended Posts

Hey,

I'm having trouble getting an autolisp to work. I need an autolisp program to zoom extents for every tab on a certain drawing. I've come up with the following code, but I can't get it to work :cry:

 

(Defun C:LayoutChange ()

(foreach layout (layoutlist)

(setq "ctab" layout)

(command "zoom" "e")

)

)

 

 

I haven't done autolisp programing in awhile so I would also like verification that my process to load/run the lisp is correct too. See below

Step 1: I copy the code above into ms notepad and save it as LayoutChange.lsp

Step 2: I verify that the lsp file is located in the support directory within the options dialog box.

Step 3: I use appload to select the lsp file I want to run.

Step 4: I type LayoutChange into the command line.

 

Thanks

Link to comment
Share on other sites

The problem you would have in a script is the layout name and how many. ctab layout3 will work.

My version

; goes trhough all layout tabs and zooms all
; By Alan H june 2011
(vl-load-com)
(command "_.pspace")
(setq curtab (getvar "Ctab"))
(setq this_dwg (vlax-get-acad-object))
(foreach d (layoutlist)
 (setvar "CTAB" d)
 (COMMAND "pSPACE")
 (command "zoom" "C" "400,277" 600) ; in case junk around title block
)
(setvar "ctab" curtab)
(princ)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...