Class Viewport
Represents a view in paper space of the model.
Inherited Members
Namespace: netDxf.Entities
Assembly: CADability.dll
Syntax
public class Viewport : EntityObject, IHasXData, ICloneable
Remarks
The viewport with id equals 1 is the view of the paper space layout itself and it does not show the model.
Constructors
| Improve this Doc View SourceViewport()
Initializes a new viewport object.
Declaration
public Viewport()
Viewport(EntityObject)
Declaration
public Viewport(EntityObject clippingBoundary)
Parameters
| Type | Name | Description |
|---|---|---|
| EntityObject | clippingBoundary |
Viewport(Vector2, Vector2)
Declaration
public Viewport(Vector2 bottomLeftCorner, Vector2 topRightCorner)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector2 | bottomLeftCorner | |
| Vector2 | topRightCorner |
Viewport(Vector2, Double, Double)
Declaration
public Viewport(Vector2 center, double width, double height)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector2 | center | |
| System.Double | width | |
| System.Double | height |
Properties
| Improve this Doc View SourceBackClipPlane
Gets or sets the back clip plane Z value.
Declaration
public double BackClipPlane { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double |
Center
Gets or sets the center point in paper space units.
Declaration
public Vector3 Center { get; set; }
Property Value
| Type | Description |
|---|---|
| Vector3 |
CircleZoomPercent
Gets or sets the circle zoom percent.
Declaration
public short CircleZoomPercent { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int16 |
ClippingBoundary
Entity that serves as the viewport clipping boundary (only present if viewport is non-rectangular).
Declaration
public EntityObject ClippingBoundary { get; set; }
Property Value
| Type | Description |
|---|---|
| EntityObject |
Remarks
AutoCad does not allow the creation of viewports from open shapes such as LwPolylines, Polylines, or ellipse arcs;
but if they are edited afterward, making them open, it will not complain, and they will work without problems.
So, it is possible to use open shapes as clipping boundaries, even if it is not recommended.
It might not be supported by all programs that read DXF files and a redraw of the layout might be required to show them correctly inside AutoCad.
Only X and Y coordinates will be used the entity normal will be considered as UnitZ.
When the viewport is added to the document this entity will be added too.
Elevation
Gets or sets the elevation.
Declaration
public double Elevation { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double |
FrontClipPlane
Gets or sets the front clip plane Z value.
Declaration
public double FrontClipPlane { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double |
FrozenLayers
Gets the list of layers that are frozen in this viewport.
Declaration
public List<Layer> FrozenLayers { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.List<Layer> |
GridSpacing
Gets or sets the grid spacing.
Declaration
public Vector2 GridSpacing { get; set; }
Property Value
| Type | Description |
|---|---|
| Vector2 |
Height
Gets or sets the height in paper space units.
Declaration
public double Height { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double |
LensLength
Gets or sets the perspective lens length.
Declaration
public double LensLength { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double |
SnapAngle
Gets or sets the snap angle.
Declaration
public double SnapAngle { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double |
SnapBase
Gets or sets the snap base point.
Declaration
public Vector2 SnapBase { get; set; }
Property Value
| Type | Description |
|---|---|
| Vector2 |
SnapSpacing
Gets or sets the snap spacing.
Declaration
public Vector2 SnapSpacing { get; set; }
Property Value
| Type | Description |
|---|---|
| Vector2 |
Stacking
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
1 = Stacking value reserved for the layout view.
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.
Declaration
public short Stacking { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int16 |
Status
Gets or sets the ViewportStatusFlags:
Declaration
public ViewportStatusFlags Status { get; set; }
Property Value
| Type | Description |
|---|---|
| ViewportStatusFlags |
TwistAngle
Gets or sets the view twist angle.
Declaration
public double TwistAngle { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double |
UcsOrigin
Gets or sets the UCS origin.
Declaration
public Vector3 UcsOrigin { get; set; }
Property Value
| Type | Description |
|---|---|
| Vector3 |
UcsXAxis
Gets or sets the UCS X axis.
Declaration
public Vector3 UcsXAxis { get; set; }
Property Value
| Type | Description |
|---|---|
| Vector3 |
UcsYAxis
Gets or sets the UCS Y axis.
Declaration
public Vector3 UcsYAxis { get; set; }
Property Value
| Type | Description |
|---|---|
| Vector3 |
ViewCenter
Gets or sets the view center point (in DCS).
Declaration
public Vector2 ViewCenter { get; set; }
Property Value
| Type | Description |
|---|---|
| Vector2 |
ViewDirection
Gets or sets the view direction vector (in WCS).
Declaration
public Vector3 ViewDirection { get; set; }
Property Value
| Type | Description |
|---|---|
| Vector3 |
ViewHeight
Gets or sets the view height (in model space units).
Declaration
public double ViewHeight { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double |
ViewTarget
Gets or sets the view target point (in WCS).
Declaration
public Vector3 ViewTarget { get; set; }
Property Value
| Type | Description |
|---|---|
| Vector3 |
Width
Gets or sets the width in paper space units.
Declaration
public double Width { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double |
Methods
| Improve this Doc View SourceClone()
Creates a new viewport that is a copy of the current instance.
Declaration
public override object Clone()
Returns
| Type | Description |
|---|---|
| System.Object | A new viewport that is a copy of this instance. |
Overrides
| Improve this Doc View SourceOnClippingBoundaryAddedEvent(EntityObject)
Declaration
protected virtual void OnClippingBoundaryAddedEvent(EntityObject item)
Parameters
| Type | Name | Description |
|---|---|---|
| EntityObject | item |
OnClippingBoundaryRemovedEvent(EntityObject)
Declaration
protected virtual void OnClippingBoundaryRemovedEvent(EntityObject item)
Parameters
| Type | Name | Description |
|---|---|---|
| EntityObject | item |
TransformBy(Matrix3, Vector3)
Moves, scales, and/or rotates the current entity given a 3x3 transformation matrix and a translation vector.
Declaration
public override void TransformBy(Matrix3 transformation, Vector3 translation)
Parameters
| Type | Name | Description |
|---|---|---|
| Matrix3 | transformation | Transformation matrix. |
| Vector3 | translation | Translation vector. |
Overrides
Remarks
Matrix3 adopts the convention of using column vectors to represent a transformation matrix.
Events
| Improve this Doc View SourceClippingBoundaryAdded
Declaration
public event Viewport.ClippingBoundaryAddedEventHandler ClippingBoundaryAdded
Event Type
| Type | Description |
|---|---|
| Viewport.ClippingBoundaryAddedEventHandler |
ClippingBoundaryRemoved
Declaration
public event Viewport.ClippingBoundaryRemovedEventHandler ClippingBoundaryRemoved
Event Type
| Type | Description |
|---|---|
| Viewport.ClippingBoundaryRemovedEventHandler |