Table of Contents

DisplayViewport2

from OpenCAD2D import DisplayViewport2

class DisplayViewport2(DisplayItem2) ยท DisplayViewport2 in the .NET reference

A viewport of a layout: a window onto model space at a scale, which the canvas draws by clipping to its frame and drawing the model-space items under the viewport's transformation.

Constructors

__init__

.NET

def __init__(
    self,
    centerX: float,
    centerY: float,
    width: float,
    height: float,
    viewCenterX: float,
    viewCenterY: float,
    scale: float,
    twist: float,
    model: DisplayList2,
    frozenLayers: System.Collections.Generic.ISet[str],
    style: DisplayStyle,
    handle: str,
    layer: str,
) -> None

Makes a viewport.

Properties and fields

Bounds

.NET

@property
def Bounds(self) -> DisplayBox

Gets the box that holds the item.

CenterX

.NET

@property
def CenterX(self) -> float

Gets the X of the centre of the frame, in paper units.

CenterY

.NET

@property
def CenterY(self) -> float

Gets the Y of the centre of the frame, in paper units.

Clip

.NET

@property
def Clip(self) -> DisplayClip2 | None

Gets the outline the viewport is clipped to (VPCLIP), in paper units: model space shows through it in place of the frame, and it is the border of the viewport; null for a viewport that is its frame.

FrozenLayers

.NET

@property
def FrozenLayers(self) -> System.Collections.Generic.ISet[str]

Gets the layers frozen in this viewport.

Height

.NET

@property
def Height(self) -> float

Gets the height of the frame in paper units.

Model

.NET

@property
def Model(self) -> DisplayList2

Gets the model-space items the viewport shows.

ModelToPaper

.NET

@property
def ModelToPaper(self) -> Affine2

Gets the transformation from model space to the paper, as the viewport shows it.

Scale

.NET

@property
def Scale(self) -> float

Gets the paper length of one unit of model space.

Twist

.NET

@property
def Twist(self) -> float

Gets the angle the view is turned by, in radians.

ViewCenterX

.NET

@property
def ViewCenterX(self) -> float

Gets the X of the point of model space at the centre of the frame.

ViewCenterY

.NET

@property
def ViewCenterY(self) -> float

Gets the Y of the point of model space at the centre of the frame.

Width

.NET

@property
def Width(self) -> float

Gets the width of the frame in paper units.

Methods

DistanceTo

.NET

def DistanceTo(self, x: float, y: float) -> float

Gets the distance from a point to the item, the shortest to any part that is drawn; the distance to the nearest edge for a fill, nought inside it.