Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TugboatEng on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Toggle between multiple view ports 2

Status
Not open for further replies.

shadow

Computer
Joined
Mar 1, 2001
Messages
321
Location
US
ok i know this much the hotkey commnad is
CTRL+R that toggles thru the viewports ok
the command i think it uses is this
CVPORTS and whatever its variable is set to thats what vport is set as current
but if your not in a vport it returns an error so what im propossing to do is this create a button macro so that you can do the same as the CTRL+R hotkey set
im thinking the macro should start out something like this

^C^CMS;cvport;1;
but this is all well and good but im wanting to incrementally set this and also start at number one when first implemented so what the macro should do is this
1 change to model space
2 start the CVPORT command
3 look to see if cvport has been used and if so start
at vport no.1
4 incremintally add 1 to the CVPORT setting but restart
at 1 when the number of vports has been reached

If i figure out how to do this via a button macro ill post it here but if someone thinks that it can't be done this way and a lisp would have to be written then i guess for now im out of luck till i learn lisp or someone does it for me but even if i could just get some hints cause i know in button macros i can use some of the lisp functions
 
A few lines of LISP will take care of most of your requirements:

; TVP.lsp - Viewport Toggling LISP Routine

(DEFUN C:TVP()

(if (= (getvar "TILEMODE") 1)(setvar "TILEMODE" 0))
(command "MSPACE")
(setq ss1 (ssget "X" (list (cons 0 "VIEWPORT"))))
(setq numvports (sslength ss1))
(if (< (getvar &quot;CVPORT&quot;) numvports)
(setvar &quot;CVPORT&quot; (1+ (getvar &quot;CVPORT&quot;)))
(setvar &quot;CVPORT&quot; 2)
)

(princ)

)

This routine can be initiated from model space or paper space, and also when tilemode is set to 1.

If you want to ensure that you start at viewport 1 the first time, the best way to do it is by initializing CVPORT in the acad.lsp file, not in this routine. Also note that viewport 1 is the paper space viewport - model space viewports begin at 2 and increment from there.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top