jdavid22 Posted April 27, 2016 Share Posted April 27, 2016 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 (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 Quote Link to comment Share on other sites More sharing options...
pBe Posted April 27, 2016 Share Posted April 27, 2016 (setvar "ctab" layout)? Quote Link to comment Share on other sites More sharing options...
Tharwat Posted April 27, 2016 Share Posted April 27, 2016 (setvar "ctab" layout) Quote Link to comment Share on other sites More sharing options...
jdavid22 Posted April 27, 2016 Author Share Posted April 27, 2016 Yeah that was the problem. Thanks. On a side note would something like this be possible in a script file? Quote Link to comment Share on other sites More sharing options...
BIGAL Posted April 28, 2016 Share Posted April 28, 2016 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) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.