Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Navigate Viewports

10 REPLIES 10
SOLVED
Reply
Message 1 of 11
Lineabove
922 Views, 10 Replies

Navigate Viewports

Would anyone be able to suggest a lisp (or keystrokes) to navigate thru multiple Viewports ?

 

When I am in Paper Space and have numerous Viewports, I would like to be able to use a lisp (or keystrokes) to navigate to the next Viewport or the previous Viewport.

 

Any suggestions would be appreciated.

 

10 REPLIES 10
Message 2 of 11
pbejse
in reply to: Lineabove


@Anonymous wrote:

....(or keystrokes) to navigate thru multiple Viewports ?....

 .

Any suggestions would be appreciated.

 


 

Ctrl+R 

Message 3 of 11
Lineabove
in reply to: pbejse

But what macro is associated with CTRL+R ?

 

Message 4 of 11
hmsilva
in reply to: Lineabove

Lineabove,

the system variable, that activates the viewport is CVPORT, if you type

 

Command: CVPORT

Enter new value for CVPORT <2>:

 

if you enter 3, it will activate the 'next viewport, if there are more than one,

 

Note that CVPORT 1, is if none viewport is active.

 

another approach, is to create a button in the tool palettes,

and in the command string just type   ^V

it will cycles all viewports.

 

Hope that helps

 

Henrique

EESignature

Message 5 of 11
Lineabove
in reply to: Lineabove

Thank you.

 

Message 6 of 11
hmsilva
in reply to: Lineabove

Lineabove,
perhaps something like

 

(defun c:test (/ num vp)
  (setq	num (sslength (ssget "x"
			     (list (cons 0 "VIEWPORT")
				   (cons 410 (getvar "ctab"))
			     )
		      )
	    )
  )
(if (= (setq vp (getvar "CVPORT")) num) (setvar "CVPORT" 2) (setvar "CVPORT" (+ vp 1)) );; if (princ) )

 

 

Henrique

EESignature

Message 7 of 11
pbejse
in reply to: Lineabove


@Anonymous wrote:

But what macro is associated with CTRL+R ?

 


 

Lineabove, let's say we play along. I think i have an idea how to do handle "Previous" and "next". How may viewports are we dealing with here? are these randomly created viewports? no order at all? 

 

I'm more curious on how or to what are you planning to use the macro/lisp ?  Can you be so kindly and explain more about this to us.

 

Cheers

 

 

Message 8 of 11
Lineabove
in reply to: Lineabove

I made a horrendous error in my original description and I apologize to those kind members who took the time to reply. My bad.

 

I used the term "Viewports" where I actually meant "TABS".

 

Currently I have a drawing with 19 Tabs, and each Tab has a descriptive label, ie: "A-05 Roof Plan"

 

I am trying to train myself to not have the Layout and Model Tabs visible so that I gain a little more screen real estate.

Also, when I use the QuickView Layouts button I will see the thumbnails but I usually need to scroll towards the end.

 

I do know that the command is CTAB and that I can enter a new value ie: "A-02.1 Basement Plan".

(A lot of typing to change TABS - too bad there is not a drop down list you could select from).

 

What I was hoping for was a key combination or lisp that would do nothing more than make the next (or previous) Layout Tab current, so ideally I could just click, click, click to navigate the LayoutTabs.

Message 9 of 11
pbejse
in reply to: Lineabove


@Anonymous wrote:

 

I used the term "Viewports" where I actually meant "TABS".

 .......

Currently I have a drawing with 19 Tabs, and each Tab has a descriptive label, ie: "A-05 Roof Plan"

 ......

What I was hoping for was a key combination or lisp that would do nothing more than make the next (or previous) Layout Tab current, so ideally I could just click, click, click to navigate the LayoutTabs.


 

I think theres one out there  that do just that.  try to do a google search or on this forum for Toggle Layout Tab. If you cant find a code you like , then i'll write you one for you.

 

I just remember, a couple of post ago,  somebody requested for layout order  and the OP was directed to this site

 

TabSort by Lee Mac  <----- 

 

One of its features is "current button: Makes the selected Tab the Current Drawing Layout

 

HTH

Message 10 of 11
Lineabove
in reply to: Lineabove

EXCELLENT !

 

Thank you.

Message 11 of 11
pbejse
in reply to: Lineabove


@Anonymous wrote:

EXCELLENT !

 

Thank you.


Glad you found what you need Lineabove

 

FWIW: Heres a mini rouitne to demonstrate CTAB [from an old routine of mine]

 

(defun c:tab ( / CDiaStr ListBoxDia StrDiaFnme lname)
;;;	pBe 12Jan2013	;;;
(defun CDiaStr (/ fnSTR)
  (setq StrDiaFnme
         (vl-filename-mktemp "tmp.DCL" ))
  (setq fnSTR (open StrDiaFnme "a"))
  (write-line
    "dcl_settings : default_dcl_settings { audit_level = 3; }
  ListofLayoutTabs : dialog 
  { label = \"\"; key= \"Base\";
  : list_box { key = \"StrListS\"; 
  width = 20; height = 20; } spacer ;
  ok_cancel;
  }" fnSTR )
  (close fnSTR)
  T
  )

(defun ListBoxDia  (DiaName Title Lst / el x)
            (setq StrDIA (load_dialog StrDiaFnme))
            (if (not (new_dialog DiaName StrDIA))
                  (exit)
                  )
            (start_list "StrListS")
            (mapcar 'add_list Lst)
            (end_list)
            (set_tile "Base" Title)
            (action_tile "StrListS" "(setq el (get_tile $key))")
            (action_tile "accept" "(done_dialog 1)(setq x T)")
            (action_tile "cancel" "(done_dialog 0)")
            (start_dialog)
            (unload_dialog StrDIA)
            (if x (read (strcat "(" el ")")))
            )
(cond ((and
	(CDiaStr)
	(setq lname (ListBoxDia
	   "ListofLayoutTabs"
	   "Select Layout Name"
	   (layoutlist)))
	   (vl-file-delete StrDiaFnme)
           (setvar 'ctab (nth (car lname) (layoutlist))
           )
        )
       )
      )
      (princ)
  )

 

HTH

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost