DisplayRay2
from OpenCAD2D import DisplayRay2
class DisplayRay2(DisplayItem2) ยท DisplayRay2 in the .NET reference
A line without end: an XLINE, running both ways through its base point, or a RAY, running on from it. Its box reaches without end the ways it runs, so that every view it crosses draws it and a pick anywhere along it finds it; the box of its DisplayList2 holds its base point alone, as AutoCAD's ZOOM Extents does. The canvas draws the part the view shows (DisplayRay2.TryClip).
Constructors
__init__
def __init__(
self,
x: float,
y: float,
dx: float,
dy: float,
bothWays: bool,
style: DisplayStyle,
handle: str,
layer: str,
) -> None
Makes a line without end.
Properties and fields
Bounds
@property
def Bounds(self) -> DisplayBox
Gets the box the line reaches: without end along each axis it runs along, its base point's along one it runs across. An XLINE level through (200, 300) has the box from minus to plus infinity in X and from 300 to 300 in Y.
Dx
@property
def Dx(self) -> float
Gets the X of the way it runs, of unit length.
Dy
@property
def Dy(self) -> float
Gets the Y of the way it runs, of unit length.
IsBothWays
@property
def IsBothWays(self) -> bool
Gets whether it runs both ways, as an XLINE; false for a RAY.
X
@property
def X(self) -> float
Gets the X of the base point.
Y
@property
def Y(self) -> float
Gets the Y of the base point.
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.
Touches
def Touches(self, box: DisplayBox) -> bool
Gets whether any part of the item touches a box, as a crossing selection asks.
TryClip
def TryClip(self, box: DisplayBox) -> tuple[bool, float, float, float, float]
Gets the part of the line inside a box, as the canvas draws it in the view: an XLINE level through (200, 300) in the box from (500, 290) to (510, 310) is the segment from (500, 300) to (510, 300). The ends run the way the line does.