Creates a new AcDbViewportTableRecord instance.
Gets or sets the ambient color.
Gets or sets the view aspect ratio (view width / view height).
Stored in the VPORT table as DXF group 41 for model-space saved views.
Gets the attributes object for this AcDbObject.
The AcCmObject instance containing all attributes
Gets or sets the back clipping plane distance.
The object dD of the new background for the view.
Gets or sets the brightness.
Gets the center point of the viewport.
The center point of the viewport
Gets or sets the view center point (DCS).
Gets or sets the circle zoom percent.
This controls the number of sides to the tessellation used when displaying curves. The value can be between 1 and 20000, with higher settings using more sides in the curve tessellation.
The number of sides used for circle tessellation
Gets or sets the contrast.
Gets the database in which this object is resident.
When an object isn't added to a database, this property returns the current working database. After it is added to a database, it will be set automatically. You should never set this value manually.
The database this object belongs to
Sets the database for this object.
This is typically set automatically when the object is added to a database. Manual setting should be avoided unless you know what you're doing.
The database to associate with this object
Gets or sets the default lighting type.
Gets the objectId of the extension dictionary owned by this object.
If the object does not have an extension dictionary, this returns undefined.
In ObjectARX terms, this is equivalent to AcDbObject::extensionDictionary().
The extension dictionary objectId, or undefined
Sets the objectId of the extension dictionary owned by this object.
This does not create or delete the dictionary object itself — it only establishes or clears the ownership relationship.
Passing undefined removes the association.
The extension dictionary objectId, or undefined
Gets or sets the front clipping plane distance.
An AcGePoint2d in which the X value represents the X spacing (in drawing units) of the grid and the Y value represents the Y spacing of the grid.
The number of minor grid lines between each major grid line in the viewport.
Gets or sets whether default lighting is on.
Returns true if this object is temporary and not yet committed to the database.
A temporary object is identified by its objectId starting with the TEMP prefix.
Gets or sets the lens length.
Gets or sets the lower left corner of the viewport window.
The X and Y values of this point are expressed as a value between (0.0, 0.0) for the lower left corner of the AutoCAD graphics area and (1.0, 1.0) for the upper right corner of the AutoCAD graphics area. For example, a lower left corner value of (0.5, 0.0) indicates that the viewport's lower left corner is along the bottom of the AutoCAD graphics area, midway between the left and right edges of the graphics area.
The lower left corner point
Gets or sets the name of the symbol table record.
This property corresponds to DXF group code 2 and is used for identifying and referencing the symbol table record.
The name of the symbol table record
Gets the object ID.
AutoCAD uses 64-bit integers to represent handles, which exceed the maximum integer value of JavaScript. Therefore, strings are used to represent object handles.
The object ID as a string
Sets the object ID.
The new object ID
Gets or sets the orthographic type.
Gets the object ID of the owner of this object.
The owner object ID
Sets the object ID of the owner of this object.
The new owner object ID
Gets or sets the render mode.
Gets or sets the shade plot object ID.
Gets or sets the shade plot setting.
The snap angle setting (in radians) for the viewport table record. The snap angle is measured within the UCS XY plane, with zero being the UCS X axis and positive angles going counterclockwise when looking down the UCS Z axis towards the UCS origin.
The snap basepoint (in UCS coordinates) for the viewport table record.
An AcGePoint2d in which the X value represents the X spacing of the snap grid and the Y value represents the Y spacing of the snap grid. Both values are in drawing units.
Gets or sets the UCS icon setting.
Gets or sets the UCS origin.
Gets or sets the UCS X axis.
Gets or sets the UCS Y axis.
The upper right corner of the viewport window. The X and Y values of this point are expressed as a value between (0.0, 0.0) for the lower left corner of the AutoCAD graphics area and (1.0, 1.0) for upper right corner of the AutoCAD graphics area. For example, an upper right corner value of (0.5, 1.0) indicates that the viewport's upper right corner is along the top of the AutoCAD graphics area, midway between the left and right edges of the graphics area.
Gets or sets the view direction from target.
Gets or sets the view height.
Gets or sets the view mode.
Gets or sets the view target.
Gets or sets the view twist angle (radians).
Gets or sets the visual style object ID.
ProtectedassignAssociates this object with a database. Subclasses may override database
and call this helper to avoid super setter restrictions.
Creates the extension dictionary for this object if it does not already exist.
This method closely mirrors the behavior of
AcDbObject::createExtensionDictionary() in ObjectARX.
The objectId of the extension dictionary
Writes DXF fields for this object.
DXF output writer.
The instance (for chaining).
Gets the value of the specified attribute.
This method will throw an exception if the specified attribute doesn't exist. Use getAttrWithoutException() if you want to handle missing attributes gracefully.
The name of the attribute to retrieve
The value of the specified attribute
Gets the value of the specified attribute without throwing an exception.
This method returns undefined if the specified attribute doesn't exist, making it safer for optional attributes.
The name of the attribute to retrieve
The value of the specified attribute, or undefined if it doesn't exist
Retrieves the XData associated with this object for a given application ID.
Extended Entity Data (XData) allows applications to attach arbitrary, application-specific data to an AcDbObject. Each XData entry is identified by a registered application name (AppId) and stored as an AcDbResultBuffer.
This method is conceptually equivalent to AcDbObject::xData() in ObjectARX,
but simplified to return the entire result buffer for the specified AppId.
The application ID (registered AppId name) that owns the XData
The AcDbResultBuffer associated with the AppId, or undefined
if no XData exists for that AppId
Builds the model-space WCS view rectangle from this VPORT record.
AutoCAD stores:
centerPoint)viewHeight)gsView.aspectRatio) — the AutoCAD graphics
window width/height at save time, not the model-space view on its ownView width = view height × aspect ratio. The viewer uses the current canvas aspect ratio so DWG/DXF exports of the same drawing frame identically even when group 41 differs.
Removes the XData associated with the specified application ID.
After removal, calls to getXData() for the same AppId will return undefined.
If no XData exists for the given AppId, this method has no effect.
This mirrors the behavior of clearing XData for a specific application in ObjectARX rather than removing all XData from the object.
The application ID whose XData should be removed
Returns the model-space view box from this record when structurally valid and plausible for the given drawing extents.
OptionaldrawingExtents: AcGeBox2dSets the value of an attribute.
The name of the attribute to set
Optionalval: AcDbSymbolTableRecordAttrs[A]The value to assign to the attribute
Attaches or replaces XData for this object.
If XData already exists for the given AppId, it is replaced by the provided AcDbResultBuffer. The caller is responsible for ensuring that:
This method is conceptually similar to AcDbObject::setXData() in ObjectARX.
The result buffer containing the XData to attach
StaticisReturns true if the specified name is the active viewport table record.
AutoCAD stores the current model-space viewport configuration as *Active.
DXF/DWG sources may emit different casing (*ACTIVE, *active, etc.), but
the names compare case-insensitively.
StaticisReturns whether a VPORT-derived view box is sane enough to frame the drawing
on open. Rejects stale saves that are zoomed far beyond the sheet (common
when $EXTMIN/$EXTMAX reflect the title block but *ACTIVE still stores
a huge view height) or panned to a corner with no real geometry.
Represents a viewport table record in AutoCAD.
This class represents viewport arrangements in AutoCAD, which define how the drawing is displayed in different areas of the screen or paper space. Viewports can have their own zoom levels, pan positions, grid settings, and other display properties.
Example