Jump to content

How to Activate next Layout from command line


apsonwane

Recommended Posts

Hi,

 

When you are in layout tab, is it possible to Activate next Layout (in multiple layout drawing) from command line instead of clicking on next layout tab.

 

Tnx,

Link to comment
Share on other sites

Wild guess here. Would it be the system variable CTAB?

 

Thanks ReMark,

"CTAB" returns the name of current active tab. I would like to activate next layout tab without entering next layout name.

Link to comment
Share on other sites

Not command line input as such but Ctrl + Page Up / Down will cycle through layouts.

 

Tnx bonehead411,

 

This was new for me & serves purpose.

However to make is more handy, is it possible to modify CUI or create a lsp routine so that when I input "NL" on command line to activate next layout.

Link to comment
Share on other sites

Give this a whirl:

 

(defun c:nl () (setvar 'ctab (cadr (member (getvar 'ctab) (layoutlist)))))

 

Thanks "ron" from prompt answer.

This is what I was looking for.

Simple & Perfect.

 

 

 

Tnx all, :D

Link to comment
Share on other sites

Dear Ron,

 

Works in layouts. But doesn't work when model space is active.

 

Command: NL

; error: AutoCAD variable setting rejected: CTAB nil

Link to comment
Share on other sites

This one should work as advertised :)

 

(defun c:nl (/ lay next)
(vl-load-com)
 (vlax-map-collection
   (vla-get-layouts (vla-get-activedocument (vlax-get-acad-object)))
   '(lambda (x) (setq lay (cons x lay)))
 )
 (if (setq
   next (cadr
          (member
        (getvar 'ctab)
        (mapcar 'vla-get-name
            (vl-sort lay '(lambda (x y) (< (vla-get-taborder x) (vla-get-taborder y))))
        )
          )
        )
     )
   (setvar 'ctab next)
(setvar 'ctab "Model")
 )
 (princ)
)

Link to comment
Share on other sites

not forgetting to include

(vl-load-com)

immediately after the line beginning defun.... and immediately before the line beginning (vla-get-layouts.....

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