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

How to tell if inside a paperspace's viewport?

7 REPLIES 7
SOLVED
Reply
Message 1 of 8
scot-65
2256 Views, 7 Replies

How to tell if inside a paperspace's viewport?

While in paperspace, and I double-click a viewport,

the following is displayed on the command prompt:

 

Command: _.MSPACE

 

What variable lets me know that I am now in (the viewport's) model space?

 

Command: _.MSPACE
Command: tilemode
Enter new value for TILEMODE <0>:
Command: _.PSPACE
Command: tilemode
Enter new value for TILEMODE <0>:

 

Thanks in advance.

scot-65

 


Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.


7 REPLIES 7
Message 2 of 8
hmsilva
in reply to: scot-65

CVPORT

1 - no viewport active

Henrique

EESignature

Message 3 of 8
BlackBox_
in reply to: scot-65

This code snippet is a more complete example (one of multiple), of how to identify 'where' you are:

 

(if (= 1 (getvar 'tilemode))
  ;; modelspace
  (if (= 1 (getvar 'cvport))
    ;; paperspace
    ;; pviewport active
  )
)

 

The problem comes from CVPORT not being changed when one switches betwen Model and Layout, as TILEMODE does, which is why one must use a Command reactor to 'trace' after the active space (i.e., Model, Paper, PViewport Active) has changed.

 

Cheers



"How we think determines what we do, and what we do determines what we get."

Message 4 of 8
scot-65
in reply to: hmsilva

(if (and (= (getvar "TILEMODE") 0)(< (getvar "CVPORT") 2));and

Thanks.

Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.


Message 5 of 8
hmsilva
in reply to: scot-65

You're welcome, scot-65

Another,
testing for an active viewpot

(if (and (= (getvar "TILEMODE") 0)(/= (getvar "CVPORT") 1));and

Henrique

EESignature

Message 6 of 8
BlackBox_
in reply to: hmsilva

scot-65 wrote:
(if (and (= (getvar "TILEMODE") 0)(< (getvar "CVPORT") 2));and

 

hmsilva wrote:

(if (and (= (getvar "TILEMODE") 0)(/= (getvar "CVPORT") 1));and

 

 

 

... Simpler still:

(< (getvar 'tilemode) 1 (getvar 'cvport))

 



"How we think determines what we do, and what we do determines what we get."

Message 7 of 8
msarqui
in reply to: BlackBox_

Hi guys,

 

Just for fun...

 

(defun c:WhereAmI ()

 

(if (and (= (getvar "TILEMODE") 1)(= (getvar "CVPORT") 2));and
(princ "\n  ** You are in Model Space **")
);if

(if (and (= (getvar "TILEMODE") 0)(= (getvar "CVPORT") 1));and
(princ "\n  ** You are in Paper Space **")
);if

(if (and (= (getvar "TILEMODE") 0)(> (getvar "CVPORT") 1));and
(princ "\n  ** You are in an Active Viewport **")
);if

 

(princ)
);defun

Message 8 of 8
scot-65
in reply to: msarqui

Good.
I have this same geometry inside a command reactor.
Still testing it though... Been placed aside for now.
Original post is almost 2 years old now...

Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.


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

Post to forums  

Autodesk Design & Make Report

”Boost