Jump to content

How to Activate next Layout from command line


Recommended Posts

Posted

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,

Posted

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

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

Posted

Without entering the layout name? OK. I'll poke around. Maybe a LISP routine would work here?

Posted

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

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

Posted

Give this a whirl:

 

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

Posted

Cool ron; is it possible to modify that so that it will move to the previous layout ?

Posted
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

Posted

Dear Ron,

 

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

 

Command: NL

; error: AutoCAD variable setting rejected: CTAB nil

Posted

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

Posted

not forgetting to include

(vl-load-com)

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

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