Table of Contents

PickIndex

from OpenCAD2D import PickIndex

class PickIndex(System.Object) ยท PickIndex in the .NET reference

A grid over the items of one display list that answers, without looking at every item, which of them lie near a point or in a box. Picking and window selection never use the pixels: they ask this index in drawing coordinates.

The selections by a polygon and by a fence: WPolygon, CPolygon, Fence and the lasso.

Constructors

__init__

.NET

def __init__(self, list: DisplayList2) -> None

Indexes a display list.

Properties and fields

List

.NET

@property
def List(self) -> DisplayList2

Gets the display list this index was made from.

Methods

Crossing

.NET

def Crossing(self, box: DisplayBox) -> System.Collections.Generic.IReadOnlyList[str]

Gets the entities that cross or lie in a box, as a crossing selection takes them.

CrossingPolygon

.NET

def CrossingPolygon(
    self,
    ring: System.Collections.Generic.IReadOnlyList[GeoPoint2],
) -> System.Collections.Generic.IReadOnlyList[str]

Gets the entities a polygon touches, as AutoCAD's CPolygon takes them, and a lasso drawn counter-clockwise: those an item of which lies inside it or crosses its edges, and a fill it lies inside.

Fence

.NET

def Fence(
    self,
    fence: System.Collections.Generic.IReadOnlyList[GeoPoint2],
) -> System.Collections.Generic.IReadOnlyList[str]

Gets the entities a fence crosses, as AutoCAD's Fence takes them: those an item of which meets one of the fence's segments, touching it counted. A fence from (0, 5) to (30, 5) takes a line from (10, 0) to (10, 10), not one from (10, 6) to (20, 6). A fence of fewer than two points takes nothing.

IndicesIn

.NET

def IndicesIn(self, box: DisplayBox) -> System.Collections.Generic.IReadOnlyList[int]

Gets the items whose box meets a box, by their place in PickIndex.List, in the order they are drawn, items with no handle among them: what the canvas draws of a view. A view of a tenth of a drawing of 100 000 items looks at about a tenth of them.

IndicesOf

.NET

def IndicesOf(self, handle: str) -> System.Collections.Generic.IReadOnlyList[int]

Gets the items an entity is drawn as, by their place in PickIndex.List, in the order they are drawn: a block of 40 lines inserted once gives 40 places. The canvas draws a hovered or selected entity again over the drawing from them, without looking at the other items.

ItemsNear

.NET

def ItemsNear(self, box: DisplayBox) -> System.Collections.Generic.IReadOnlyList[DisplayItem2]

Gets the items whose box meets a box, in the order they are drawn, as object snaps ask for what lies under the cursor's aperture. Items with no handle are left out, and so is a line without end (XLINE, RAY) that passes the box by further than the box's own size, unless it is drawn for a block reference, whose insertion point a snap takes from any of its items: an XLINE level through (0, 300) comes for the box from (5000, 299) to (5002, 301), not for the one from (5000, 310) to (5002, 312).

Pick

.NET

def Pick(self, x: float, y: float, tolerance: float) -> System.Collections.Generic.IReadOnlyList[str]

Gets the entities whose drawing lies within a distance of a point, in the order AutoCAD picks them. The distance is in drawing units, so a caller working in pixels divides by the zoom first. While the drawing's SORTENTS holds its bit 1 for object selection, as AutoCAD's default 127 does, the one drawn on top (last in the draw order) comes first, however much nearer the others lie; else the one drawn first. AutoCAD 2021's (ssget pt) on two level lines, the one drawn later 0.9 of the pickbox off the point and the other through it, picks the later one, and under SORTENTS 0 the one drawn first. A line through the point and one drawn on top of it 2.7 off, with a tolerance of 3, come back the one on top first.

Window

.NET

def Window(self, box: DisplayBox) -> System.Collections.Generic.IReadOnlyList[str]

Gets the entities drawn wholly inside a box, as a window selection takes them.

WindowPolygon

.NET

def WindowPolygon(
    self,
    ring: System.Collections.Generic.IReadOnlyList[GeoPoint2],
) -> System.Collections.Generic.IReadOnlyList[str]

Gets the entities drawn wholly inside a polygon, as AutoCAD's WPolygon takes them, and a lasso drawn clockwise: every item of the entity inside it and none crossing its edges. A line from (10, 10) to (20, 10) lies in the square from (0, 0) to (30, 30); a line without end never does.