I am working on a lisp routine and want to make an IF statement based on whether the user is in paper space or model space.
How do I determine the current space?
This seems like a basic request and I assume this information is stored in a system variable but a 10 minute search has come up empty.
(if(and(zerop(getvar"tilemode"))(= 1 (getvar"cvport")))(princ"\nPspace")(princ"\nMspace"))
Thanks guys.
I never have much time to work on lisp so I ended up making two routines for now, one for PS and one for MS.
I will take a cloder look at your suggestions when I have more time. I did test Paul's code at the command line and it was able to acuratley determine what space was current. I will probably look at this option first.
Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.
Only the CVPORT system variable need be tested:
(if (= 1 (getvar 'cvport)) < user is in paperspace > < user is in modelspace > )
Nice one Lee_Mac
@Lee_Mac wrote:Only the CVPORT system variable need be tested:
(if (= 1 (getvar 'cvport)) < user is in paperspace > < user is in modelspace > )
Depending on program intent it can be handy to know if you are in floating modelspace. Determining that requires more than testing only CVPORT.
Only the CVPORT system variable need be tested:
(if (= 1 (getvar 'cvport)) < user is in paperspace > < user is in modelspace > )
Depending on program intent it can be handy to know if you are in floating modelspace. Determining that requires more than testing only CVPORT.
Correct - TILEMODE must also be tested if it is necessary to differentiate between the Model layout & viewing Modelspace through a Paperspace Viewport, but I believe my above suggestion is the most succinct way to determine the current space, as the OP requested.
@Lee_Mac wrote:Correct - TILEMODE must also be tested if it is necessary to differentiate between the Model layout & viewing Modelspace through a Paperspace Viewport.
I suppose it doesn't have to be TILEMODE. One could also use CTAB, since you can't rename the model layout. Same difference in the end.