See the top rated post in this thread. Click here

Results 1 to 6 of 6

Thread: Invisible paper space viewports

  1. #1
    Member jrd.chapman's Avatar
    Join Date
    2000-11
    Location
    Ontario, Canada
    Posts
    49
    Login to Give a bone
    0

    Default Invisible paper space viewports

    If I do a selection set of viewports in a drawing, the number of viewports returned includes one "invisible" paper space viewport per layout...i.e., if I have a drawing in which I've created 20 viewports on 10 layouts, then (ssget "x" '((0 . "viewport"))) will return a selection set of 30 viewports.

    I want to be able to omit the 10 "invisible" ones from that selection set. Are there any differences (that can be seen with an ENTGET) between these "invisible" paper space viewports and the ones I've created myself.

    Since I'm doing more than just counting the viewports, counting the layouts with (length (layoutlist)) and subtracting that number from the total of my selection set does me no good. I need to work on only the ones I've created, and omit the "invisible" ones.

    Thanks in advance for any advice offered.

    John D. Chapman

  2. #2
    I could stop if I wanted to
    Join Date
    2003-05
    Posts
    335
    Login to Give a bone
    2

    Default Re: Invisible paper space viewports

    John,

    The Layout is considered Viewport ID # 1. Anything greater than 1 is another viewport on that Layout Tab. The DXF number is 69. Include these two lists in your SSGET filter list for all ids greater than 1.

    Code:
     '(-4 . ">") '(69 . 1)
    You can also included this code to eliminate viewports that are not within the sheet size of the layout.

    Code:
     '(-4 . ">") '(68 . 1)
    HTML Code:
    68 Viewport status field:
    –1 = On, but is fully off screen, or is one of the viewports that is not active 
    because the $MAXACTVP count is currently being exceeded.
    0 = Off
    <positive value > = On and active. The value indicates the order of stacking 
    for the viewports, where 1 is the active viewport, 2 is the next, and so forth.

    This is some code I have used to search for all viewports within the sheet size not including the layout for each layouttab:

    Code:
     
    (ssget "X"
    	  (list '(0 . "VIEWPORT")
    	 (cons 410 (getvar "ctab"))
    	 '(-4 . ">")
    	 '(69 . 1)
    	 '(-4 . ">")
    	 '(68 . 1)
    	  )
    	  )
    Hope this helps,

  3. #3
    Member jrd.chapman's Avatar
    Join Date
    2000-11
    Location
    Ontario, Canada
    Posts
    49
    Login to Give a bone
    0

    Default Re: Invisible paper space viewports

    Thanks for the reply Will.

    I thought I could achieve what I needed with code 69, however, code 69 returns 0 for any viewports found in the selection set that do not reside on the current layout tab (or in the last active tab if in model space when creating the selection set). So, If I make a selection set of ALL viewports in a drawing, and include the filter for ID's greater than one, the selection set will only return the number of viewports with ID's greater than one on the active (or last active) layout tab.

    So, code 69, while providing the ability to weed the invisible viewport per layout, it does not allow me to globally weed out all invisible viewports, short of having a routine switch to each layout, run a selection set, and weed out ID # 1, which would take too long in drawings with numerous layout tabs.

    I'd like to be able to grab all viewports in a drawing globally, and omit the invisible ones from that global selection set.

    Thanks again for the reply, and thanks in advance to anyone else who may respond.

  4. #4
    Member jrd.chapman's Avatar
    Join Date
    2000-11
    Location
    Ontario, Canada
    Posts
    49
    Login to Give a bone
    0

    Default Re: Invisible paper space viewports

    Corrections to that last post:

    Code 69 returns 0 for any viewports residing on layout tabs that have not been visited in the current drawing session. If you have 10 layouts in a drawing, but you have only visited 3 of them in the current session, than a selection set with a filter for code 69 will only return the proper ID # for viewports on the 3 layout tabs that have been visited in the current drawing session. All other viewports will return a value of 0 for code 69.

    All this in AutoCAD 2000i (actually LDD R2i). I Apologize for not specifying earlier. I assume things have not changed in newer releases with the way code 69 gets returned, but I could be wrong.
    Last edited by jrd.chapman; 2004-08-16 at 08:12 PM.

  5. #5
    All AUGI, all the time
    Join Date
    2015-12
    Location
    Central Oregon
    Posts
    591
    Login to Give a bone
    1

    Default Re: Invisible paper space viewports

    Give this a try. I think it will accomplish what you want. This output is from a drawing with 9 PS Viewports.

    Command: (sslength (setq ss (get_ps_vports)))
    21

    Command: (sslength (ssget "x" '((0 . "VIEWPORT"))))
    30

    Code:
    (defun get_ps_vports (/ ss count)
      (setq ss (ssadd))
      (vlax-for lay (vla-get-layouts (vla-get-activedocument (vlax-get-acad-object)))
        (setq count 0)
        (vlax-for ents (vla-get-block lay)
          (cond ((and (= count 0); this will skip the first VP found, which is always the Layout itself
    		  (= (vla-get-objectname ents) "AcDbViewport"))
    	     (setq count (1+ count)))
    	    ((= (vla-get-objectname ents) "AcDbViewport")
    	     (ssadd (vlax-vla-object->ename ents) ss))
    	    (t)
    	    )
          )
        )
      (if (> (sslength ss) 0)
        ss
        nil
        )    
      )
    HTH

  6. #6
    Member jrd.chapman's Avatar
    Join Date
    2000-11
    Location
    Ontario, Canada
    Posts
    49
    Login to Give a bone
    0

    Default Re: Invisible paper space viewports

    Miff,

    Thank you very much. Your code was able to accomplish my goal. I can now work on all the viewports in a drawing globally, omitting the layouts themselves.

    Thanks so much for your help! Much appreciated!

Similar Threads

  1. 2010: Switching Between Viewports in Paper space
    By WileECoyote in forum AutoCAD General
    Replies: 5
    Last Post: 2013-11-22, 05:34 PM
  2. 2004: Viewports in paper space
    By gsteffen642486 in forum ACA General
    Replies: 0
    Last Post: 2012-05-22, 02:49 PM
  3. Viewports in paper space
    By ntormey in forum AutoCAD General
    Replies: 5
    Last Post: 2012-03-31, 03:15 AM
  4. Annotative objects invisible when x-refed (model & paper space)
    By mockdeep in forum AutoCAD Annotation
    Replies: 0
    Last Post: 2008-11-10, 03:13 PM
  5. Invisible Layout / Paper space
    By artisteroi in forum AutoCAD General
    Replies: 5
    Last Post: 2008-07-30, 05:04 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •