Jump to content

Recommended Posts

Posted

Hi,

 

Like CTRL-TAB cycles through open drawings, is there a way I can cycle through the current drawing's layouts with lisp and tie it into a keyboard shortcut like CTRL-ALT-TAB or something?

 

I can set up the keyboard shortcut afterwards of course, its just the lips routine for cycling to the next layout i need help with..

 

I could do this in VBA but wouldn't lisp be slightly quicker and easier to incorporate?

Posted
(defun c:slay(/ actDoc)
 (vl-load-com)
 (vlax-for l (vla-get-Layouts
	(setq actDoc(vla-get-ActiveDocument
	  (vlax-get-acad-object))))
   (getint "\nPress Spacebar for next Layout or Esc to Quit... ")
   (vla-put-ActiveLayout actDoc l)
   ); end vlax-for
 (princ)
 ); end of c:slay

Posted

Hi ASMI,

 

That works great, but I have added it to a command and created a keyboard shortcut for it (CTRL+RIGHT) (right arrow key) and everytime it asked me for the input, but i just want it to step to the next layout to the right. I commented out the input line and it just crashed my pc as it was trying to loop through all layouts by the seems of it..

 

Anyway, sorry if i wasn't clear in my first post. But now i know what i want, I want one command to step to the next layout to the right and one for the going back one, stepping to the left, which i'll tag to a CTRL+LEFT shortcut command..

Posted

What about standard CTRL+Page Up and CTRL+Page Down?

Posted

Hahahaha, i didn't even know that existed, what a donut, lol

 

Ok, well i shall use that then, lol. Thanks ASMI

  • 6 years later...
Posted

i'm looking for autocad lisp routine for using arrow key to advance layout tabs

 

thank you

Posted

Have a look at my GOTO.lsp wrote it to do just that goto any layout note goto 0 is modelspace. This is not latest version as can use page 99 and it will go to last page will post later.

(defun C:goto ( / lay num)

(setq num (getint "\nEnter tab number"))

(vlax-for lay (vla-get-Layouts (vla-get-activedocument (vlax-get-acad-object)))
(if (= num (vla-get-taborder lay))
 (setvar "ctab" (vla-get-name lay))
) ; if
) ; for
) ; defun
(C:goto)

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...