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__
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
@property
def Bounds(self) -> DisplayBox
Gets the box that holds the item.
CenterX
@property
def CenterX(self) -> float
Gets the X of the centre of the frame, in paper units.
CenterY
@property
def CenterY(self) -> float
Gets the Y of the centre of the frame, in paper units.
Clip
@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
@property
def FrozenLayers(self) -> System.Collections.Generic.ISet[str]
Gets the layers frozen in this viewport.
Height
@property
def Height(self) -> float
Gets the height of the frame in paper units.
Model
@property
def Model(self) -> DisplayList2
Gets the model-space items the viewport shows.
ModelToPaper
@property
def ModelToPaper(self) -> Affine2
Gets the transformation from model space to the paper, as the viewport shows it.
Scale
@property
def Scale(self) -> float
Gets the paper length of one unit of model space.
Twist
@property
def Twist(self) -> float
Gets the angle the view is turned by, in radians.
ViewCenterX
@property
def ViewCenterX(self) -> float
Gets the X of the point of model space at the centre of the frame.
ViewCenterY
@property
def ViewCenterY(self) -> float
Gets the Y of the point of model space at the centre of the frame.
Width
@property
def Width(self) -> float
Gets the width of the frame in paper units.
Methods
DistanceTo
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.