Jump to content

Recommended Posts

Posted

This should be simple but my brain has already gone on holiday for the weekend.

I am simply trying to count the total number of viewports in the active drawing. Each time I try this I only show "1", which is the active viewport.

Any information would be greatly appreciated.

Posted

Are you refering to Pviewports? Something like this perhaps:

 

        [CommandMethod("PVP")]
       static public void test() 
       {
           Document doc = Application.DocumentManager.MdiActiveDocument;
           Database db = doc.Database;
           Editor ed = doc.Editor;
           ObjectIdCollection oidc = db.GetViewports(false);
           ed.WriteMessage("\nThe number of pviewports is " + oidc.Count.ToString());
       }

Posted

Thank you. That worked great. I was trying to over complicate it. Sometimes simpler is better. :oops:

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...