How find out space status of a viewport ?

How find out space status of a viewport ?

mehdi-guida
Advocate Advocate
503 Views
6 Replies
Message 1 of 7

How find out space status of a viewport ?

mehdi-guida
Advocate
Advocate

Hi,

I have 4 viewports in a layout. Space of One of them is Model (highlighted and is in model space).

Is there any system variable or .Net code to find out which one is in mode space and which one is in paper space?

 

Thank you

0 Likes
Accepted solutions (1)
504 Views
6 Replies
Replies (6)
Message 2 of 7

Jeff_M
Consultant
Consultant

Editor.ActiveViewportId;

 

I would first check the CVPORT system variable. If it is 1 then no viewports are currently active in modelspace.

Jeff_M, also a frequent Swamper
EESignature
0 Likes
Message 3 of 7

mehdi-guida
Advocate
Advocate

Thank you for reply.

As you said If CVPORT is 1 then no viewports are currently active in modelspace. but I need to know which one is active?

 

0 Likes
Message 4 of 7

Jeff_M
Consultant
Consultant

@mehdi-guida wrote:

...but I need to know which one is active?

 


Then use the Editor.ActiveViewportId; property...

Jeff_M, also a frequent Swamper
EESignature
0 Likes
Message 5 of 7

mehdi-guida
Advocate
Advocate

Thank you

I used this property but that always return an ObjectId even in empty layout !

0 Likes
Message 6 of 7

Jeff_M
Consultant
Consultant
Accepted solution

The Layout is a Viewport. That is why CVPORT will return 1 when no viewports are active to modelspace. And also why I said you should check that sysvar.

Jeff_M, also a frequent Swamper
EESignature
0 Likes
Message 7 of 7

mehdi-guida
Advocate
Advocate

Hi,

Thank You again for your all answers. You helped me a lot.

Do you have any idea about finding current Mtext annotation scale? (below link)

https://forums.autodesk.com/t5/civil-3d-customization/get-annotation-scale-of-mtext/td-p/12624478

 

Thank You

Mehdi

0 Likes