Author Topic: Unknown VIEWPORT Entity  (Read 1927 times)

0 Members and 1 Guest are viewing this topic.

Lerner

  • Newt
  • Posts: 33
Unknown VIEWPORT Entity
« on: March 25, 2016, 08:51:13 PM »
I am using AutoCAD 2016 and ran across something unusual with one of my drawings. I have determined this is a general issue and nothing to do with my drawing. The situation can be demonstrated like this - create a new drawing using "Open with no Template". Delete the all visible viewports from all layout tabs. The drawing should be empty. But there is one entity still left as shown by (entget (entnext)). It is a VIEWPORT. This entity cannot be selected in any manor nor deleted with entdel. The only difference between it and a normal viewport seems to be the existence of an application defined group code: (102 . "{ACAD_XDICTIONARY"). I'm not sure what an "application defined group" is but I am running straight AutoCAD with no addons or enhancements.

So I guess first of all I'd like more information about what this VIEWPORT is all about. I would also like to know if there is anyway to delete it. And finally, is there anyway to use it as a normal viewport with a visible and selectable border and showing a view of model space?

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Unknown VIEWPORT Entity
« Reply #1 on: March 25, 2016, 10:30:14 PM »
My guess (not having access to AutoCAD at the moment and not familiar with 2016) is the viewport entity you're observing is in fact paperspace and thus can be ignored.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

David Bethel

  • Swamp Rat
  • Posts: 656
Re: Unknown VIEWPORT Entity
« Reply #2 on: March 26, 2016, 06:48:28 AM »
Unless something has changed, when start a new drawing with no template, layout tabs are empty. The model tab is automatically active.  The paperspace viewport is only created when a layout tab is activated.  Until then, then layout tabs are for display only.  I have my display configured in some cases not shown any tabs.

As MP said, once the paperspace viewport is crated, it cannot be deleted

-David
R12 Dos - A2K

Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1454
  • Marco
Re: Unknown VIEWPORT Entity
« Reply #3 on: March 28, 2016, 10:18:52 AM »
From help:
vports (AutoLISP)
Returns a list of viewport descriptors for the current viewport configuration
(vports)
Return Values
One or more viewport descriptor lists consisting of the viewport identification number and the coordinates of the viewport's lower-left and upper-right corners.
If the AutoCAD TILEMODE system variable is set to 1 (on), the returned list describes the viewport configuration created with the AutoCAD VPORTS command. The corners of the viewports are expressed in values between 0.0 and 1.0, with (0.0, 0.0) representing the lower-left corner of the display screen's graphics area, and (1.0, 1.0) the upper-right corner. If TILEMODE is 0 (off), the returned list describes the viewport objects created with the MVIEWcommand. The viewport object corners are expressed in paper space coordinates. Viewport number 1 is always paper space when TILEMODE is off.
Examples
Given a single-viewport configuration with TILEMODE on, the vports  function might return the following:
((1 (0.0 0.0) (1.0 1.0)))
...
So, Paper Space itself is a special kind of VIEWPORT.  :-)


Lerner

  • Newt
  • Posts: 33
Re: Unknown VIEWPORT Entity
« Reply #4 on: March 30, 2016, 01:39:23 AM »
Ah, very good. Thanks for the info. In fact, the VIEWPORT entity does not exist when the drawing is first created and you are in model space. It only exists after you switch to paper space for the first time. After that, you can't get rid of it, probably because you can never delete all layouts. Well you can, but AutoCAD will always create a new one if you do. So that answers my first two questions. And based on that information, I suspect the answer to my third is no because I can't think of how you would even go about it.

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Unknown VIEWPORT Entity
« Reply #5 on: March 30, 2016, 10:05:52 AM »
If you don't want viewports created in new layouts uncheck this:


Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1454
  • Marco
Re: Unknown VIEWPORT Entity
« Reply #6 on: March 31, 2016, 03:52:17 AM »
If you don't want viewports created in new layouts uncheck this:
Viewports to which Lerner refers is the "Paper Space itself is that is a special kind of VIEWPORT",
Try this:
Code: [Select]
(defun C:test ( / Ss_Tmp Countr EntDat)
  (if (setq Ss_Tmp (ssget "_X"))
    (progn
      (repeat (setq Countr (sslength Ss_Tmp))
        (setq Countr (1- Countr)  EntDat (entget (ssname Ss_Tmp Countr)))
        (print
          (strcat
            "Entity:" (cdr (assoc 0 EntDat))  " "
            "Name:" (cdr (assoc 410 EntDat))
          )
        )
      )
      (print
        (strcat
          "CTAB:" (getvar "CTAB")
          " CVPORT:" (itoa (getvar "CVPORT"))
        )
      )
    )
    (print
      (strcat
        "No Viewport (model space) CTAB:"
        (getvar "CTAB") " CVPORT:"
        (itoa (getvar "CVPORT"))
      )
    )
  )
  (princ)
)
Starting from a new empty DWG with default metric (2 Layout in my 2013 ITA):

Comando: TEST
"No Viewport (model space) CTAB:Model CVPORT:2"

Comando: TILEMODE
Digitare nuovo valore per TILEMODE <1>: 0
Rigenerazione layout in corso.

Comando: TEST
"Entity:VIEWPORT Name:Layout1"
"CTAB:Layout1 CVPORT:1"

Comando: TILEMODE
Digitare nuovo valore per TILEMODE <0>: 1
Ripristino finestre memorizzate nella cache in corso.

Comando: TEST
"Entity:VIEWPORT Name:Layout1"
"CTAB:Model CVPORT:2"

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Unknown VIEWPORT Entity
« Reply #7 on: March 31, 2016, 08:37:05 AM »
You can also take a look at this old thread which will omit the *Paper_Space block viewports & return a list of actual viewports.

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC