Table of Contents

Method Drag

Namespace
OpenCAD2D
Assembly
OpenCAD2D.Core.dll

Drag(CadDocument, string, int, GeoPoint2)

Drags a grip of an entity to a point, as AutoCAD's stretch mode does: one undo step through ApplyEdit(string, IReadOnlyList<CadEditRecord>, Action<CadEditScope>). An arc dragged by an end or its middle is the arc through the three points then (the moved one and the two kept); a quadrant makes a circle's radius the distance to the point. A dimension's grip rewrites its points of definition and its picture is drawn anew: an extension line's origin moved keeps the dimension line where it is (an aligned one's at the same distance from what it measures); an end of the dimension line moves the line through the point, words the user placed going with it; the words go where DIMTEDIT puts them, the dimension line with them where DIMTMOVE is 0; a radius's or a diameter's chord point goes round its circle towards the point, words the user placed turning with it. A corner of an MTEXT's box takes its two edges to the point, as AutoCAD 2021's does: the width of the MTEXT is the box's then and its words wrap anew, its defined height the box's (at least its text height; left as it is in a file before R2007, which holds none), and its location stays at the point of the box its attachment names: the top right corner of a box 60 wide dragged 5 right and 3 down makes it 65 wide and moves a location at the top left 3 down. A grip of an MTEXT in columns changes the columns as AutoCAD 2021's MoveGripPointsAt does, the step taken the way the grip points, the location kept (see the kinds from MTextColumnWidth on): two static columns 120 wide with a gutter of 20 have, dragged 50 out, columns 130 wide and no gutter by the first column's grip (the total kept), a gutter of 70 by the last column's; widths and heights stop at the text height, a gutter at nought. A corner of a clip boundary (ClipVertex) takes the two sides of a rectangle it is on, the opposite corner kept, or a polygon's vertex alone, the clip kept inside out where it is: the corner (1020, 520) of the rectangle (1020, 520) to (1080, 570) dragged to (1010, 510) leaves (1010, 510) to (1080, 570); a boundary of no area is refused. A corner of an OLE frame scales the frame about the corner across from it, as AutoCAD 2021 does: each side by the distance of the point from that corner over the distance of the grip, the frame staying on its side of the corner however far the point goes past it, so that no frame turns over; with Lock aspect on, both sides by the larger of the two factors. The corner (50, 40) of a frame 40 by 20 from (10, 20) dragged to (60, 45) makes it 50 by 25, and dragged to (50, 50), 60 by 30; a frame of no width or height, or a point on the line of the corner across from it, is refused. A vertex of a multiline moves as AutoCAD 2021's MoveVertexAt moves it (MoveVertexAt(int, GeoPoint3)): a segment that keeps its way keeps its cuts, one that turns is whole again. A grip of a revision cloud with few grips (see Shown(CadDocument, DxfEntity)) changes the shape the cloud goes round and draws the cloud again along it, in place, as AutoCAD 2021's MoveGripPointsAt does: the arcs a tenth longer than the mean chord of the cloud was (a cloud of 20 arcs 10 long round a rectangle 60 by 40, its top middle grip dragged up by 5, is 19 vertices 11 apart), a cloud too small for two arcs refused.

public static CadEditResult Drag(CadDocument document, string handle, int gripIndex, GeoPoint2 to)

Parameters

document CadDocument

The document.

handle string

The handle of the entity.

gripIndex int

The index of the grip, as Shown(CadDocument, DxfEntity) gives it.

to GeoPoint2

The point it is dragged to, in drawing units.

Returns

CadEditResult

What came of it: refused for an entity on a locked layer, a grip it has not, or a shape that cannot be (an arc through three points in a line, a circle of no radius, a chord point dragged to its centre); failed, the drawing as it was, for a dimension that would measure nothing.

Exceptions

ArgumentNullException

Thrown when the document is null.