CadGrips
from OpenCAD2D import CadGrips
class CadGrips(System.Object) ยท CadGrips in the .NET reference
The grips on the clip boundary of a block reference (XCLIP), as AutoCAD 2021's GetGripPoints gives them.
The grips of each kind of entity and what dragging each does, as AutoCAD's: a line's two ends and middle, a circle's centre and four quadrants, an arc's ends, middle and centre, a polyline's vertices and the middles of its segments, a text's and a block reference's insertion point, a hatch's grip at the middle of the box its loops fill and those of its boundary where it follows no objects, an MTEXT's location and the corners of its box or the grips of its columns, a viewport's four corners and middle, and a dimension's as AutoCAD 2021 gives them (see CadGrips.Of), its picture drawn anew after each drag. Entities of other kinds have none.
The grips of dimensions, as AutoCAD 2021 gives them, and what dragging each writes into the dimension.
The edits of the hover menu of a hatch's grip: its pattern's scale, angle and origin.
The grips of the boundary of a hatch that follows no objects (not associative), as AutoCAD 2021's GetGripPoints gives them after the grip of the middle: for each loop a grip on each vertex followed by one in the middle of the segment that leaves it, or the four quadrants of a loop that is one circle.
The edits of the hover menus of a line's and an arc's grips: Lengthen at an end, Radius in the middle of an arc.
The grips of a multiline: one at each vertex, which drags the vertex and builds the multiline anew.
The grips of an MTEXT: its location and the corners of its box, or the grips of its columns, as AutoCAD 2021 gives them.
The edits of a polyline's hover menu: add a vertex, remove one, make a segment an arc or a line. They work on a light polyline and on a 2D POLYLINE of straight and arc segments alike; Add Vertex and Remove Vertex on a spline's points too.
The edits of the grips of a 2D POLYLINE of straight and arc segments (DxfPolyline2d of type DxfPoly2dType.SimplePoly), the same as a light polyline's: stretch a vertex or a segment, add a vertex, remove one, make a segment an arc or a line. A curve-fit or spline-fit one has a grip on each vertex of its frame, which CadGrips.DragPolyline2d moves and fits again, and no menu.
The grips of a revision cloud while REVCLOUDGRIPS is on, as AutoCAD 2021's GetGripPoints gives them.
The grips of a spline and the edits of their hover menu: stretch a point, add one, take one out.
The grips of a whole table selected, as AutoCAD 2021 gives them.
Methods
AddVertex
@staticmethod
def AddVertex(document: CadDocument, handle: str, gripIndex: int, point: GeoPoint2) -> CadEditResult
Adds a vertex to a polyline at a point, as the Add Vertex item of a polyline's grip menu does, one undo step: the new vertex goes after the vertex of the grip, or after the vertex the segment of a segment middle grip leaves from, so that it lies between that vertex and the next (after the last vertex of an open polyline it extends the end). The new segment is straight; the segment split keeps its widths, the width at the point being the one where the point falls along it. A straight segment splits in two straight ones; an arc segment in two arcs of the one arc through its start, the point and its end: a half circle from (0, 0) to (20, 0) given the point (10, -10) is two quarter circles, a bulge of 0.4142 each. A spline's point (CadGripKind.Vertex) gets a fit point after it where the spline has fit data, else a control point, with the knot at the point of the curve nearest the point given.
ChangeHatchAngle
@staticmethod
def ChangeHatchAngle(document: CadDocument, handle: str, angle: float) -> CadEditResult
Sets the angle of a hatch's pattern, as the Hatch Angle item of the menu of its grip does, one undo step: the pattern is laid from the same origin as before.
ChangeHatchScale
@staticmethod
def ChangeHatchScale(document: CadDocument, handle: str, scale: float) -> CadEditResult
Sets the scale of a hatch's pattern, as the Hatch Scale item of the menu of its grip does, one undo step: the pattern is laid from the same origin as before.
ChangeRadius
@staticmethod
def ChangeRadius(document: CadDocument, handle: str, gripIndex: int, point: GeoPoint2) -> CadEditResult
Changes the radius of an arc, as the Radius item of the menu of its middle grip does, one undo step: the radius is the distance of the point from the centre, the centre and the two angles kept, so that the ends move along their rays. An arc of radius 50 about (0, 0) given the point (0, 30) has radius 30.
ClickClipFlip
@staticmethod
def ClickClipFlip(document: CadDocument, handle: str, gripIndex: int) -> CadEditResult
Clicks the arrow of a clipped reference, as AutoCAD 2021's clip frame does: the clip is turned inside out, so that what the boundary held is hidden and what lay outside it shown, or back; one undo step through CadDocument.ApplyEdit. A clip turned inside out is kept as a keyhole in the boundary, a rectangle kept as two corners again when it is turned back.
ConvertToArc
@staticmethod
def ConvertToArc(document: CadDocument, handle: str, gripIndex: int, point: GeoPoint2) -> CadEditResult
Makes a straight segment of a polyline an arc through a point, as the Convert to Arc item does, one undo step: the arc from the segment's start through the point to its end. A chord of 100 with the point 20 off its middle is a bulge of 0.4 (the sagitta over half the chord), above nought where the point is to the right of the way the segment runs.
ConvertToLine
@staticmethod
def ConvertToLine(document: CadDocument, handle: str, gripIndex: int) -> CadEditResult
Makes an arc segment of a polyline straight, as the Convert to Line item does once its pick is made, one undo step.
Drag
@staticmethod
def Drag(document: CadDocument, handle: str, gripIndex: int, to: GeoPoint2) -> CadEditResult
Drags a grip of an entity to a point, as AutoCAD's stretch mode does: one undo step through CadDocument.ApplyEdit. 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 CadGripKind.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 (CadGripKind.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 (DxfMlineBuilder.MoveVertexAt): 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 CadGrips.Shown) 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.
Lengthen
@staticmethod
def Lengthen(document: CadDocument, handle: str, gripIndex: int, point: GeoPoint2) -> CadEditResult
Lengthens or shortens a line or an arc at one end, as the Lengthen item of the menu of an end grip does, one undo step. A line's end goes to where the point falls along the line's own way, the other end and the way kept: a line from (0, 0) to (100, 0) lengthened at its end by (150, 40) runs to (150, 0). An arc's end goes round the arc to the angle the point has from the centre, the centre, the radius and the other end kept: an arc of radius 50 from 0 to 90 degrees lengthened at its end by (-10, 30) ends at the angle of that point, 108.4 degrees.
Of
@staticmethod
def Of(entity: DxfEntity) -> System.Collections.Generic.IReadOnlyList[CadGrip]
Gets the grips of an entity. A dimension's, as AutoCAD 2021's: a linear or aligned one's two extension line origins, the two ends of its dimension line, then its words; a radius's chord point and its words, a diameter's two chord points and its words; a three-point angle's vertex, its two line points, its arc and its words, an angle between two lines the two ends of each line, its arc and its words; an ordinate's feature and its leader's end. A dimension drawn in no plan, or with no picture of its own, has none. An MTEXT's, as AutoCAD 2021's: the four corners of its box (its defined width by its defined height, or with none the height of its lines) from the top left, the top right, the bottom left to the bottom right, the corner its location is at the grip of its insertion; its location first, a fifth grip, where it is at no corner (held at a middle); the top right, bottom left and bottom right corners carry the way their triangles point (CadGrip.Direction). In columns, as AutoCAD 2021's: its location, the first column's width at its top right, then for columns of one height the corner of the last column and the height under the location, for dynamic columns of their own heights a height grip under the middle of each column, and last, in two columns or more, the gutter grip at the last column's top right; two static columns 120 wide with a gutter of 20 and a height of 100, held at the top left, have them at (0, 0), (120, 0), (260, -100), (0, -100) and (260, 0). Held at the right or the bottom they stand at the other side, pointing the other way. Its location alone for an MTEXT of no width or out of the plan. A TOLERANCE's, as AutoCAD 2021 shows it: its insertion point alone. A table's, as AutoCAD 2021's: its move grip at the top left, a column grip at each line between columns on its top edge, its width, height and size stretch grips at the top right, bottom left and bottom right, and the table breaking grip under the middle of its bottom edge, which is not offered. A block reference's, after its insertion point and its dynamic block's grips, where it is clipped by XCLIP, as AutoCAD 2021's: an arrow at the middle of the boundary's first side (CadGripKind.ClipFlip, its CadGrip.Direction across the side to what the clip hides) and a grip at each corner of a rectangle, from its lower left counter-clockwise, or each vertex of a polygon (CadGripKind.ClipVertex); a block 100 by 100 clipped to the rectangle (20, 20) to (60, 70) has grips at (40, 20), the arrow, then (20, 20), (60, 20), (60, 70) and (20, 70). An OLE frame's, as AutoCAD 2021 gives them: a grip at each corner, from the lower left, the upper left and the upper right to the lower right (CadGripKind.Corner); a frame 40 by 20 with its lower left corner at (10, 20) has them at (10, 20), (10, 40), (50, 40) and (50, 20). A frame of no size has none. A multiline's, as AutoCAD 2021's: one at each vertex of the line it is drawn on, (0, 0), (100, 0) and (100, 100) for one through those points. A 2D POLYLINE of straight and arc segments has a light polyline's grips (a vertex grip on each vertex, then a segment middle grip on each segment); one fitted with a curve or a spline has a vertex grip on each vertex of its frame alone (four for a frame of four, whatever the curve has added), as AutoCAD 2021's GetGripPoints gives them, and dragging one fits the curve or the spline again. A spline's, as AutoCAD 2021's: a vertex grip on each fit point, or on each control point where it has no fit data; a cubic through (0, 0), (30, 40), (60, 0) and (90, 40) has grips at those four points. A hatch's, one at the middle of the box its loops fill (CadGripKind.Center): a rectangle 100 by 60 has it at (50, 30); where the hatch follows no objects (is not associative) then those of its boundary, as AutoCAD 2021's GetGripPoints gives them: for each loop a vertex grip and one in the middle of the segment that leaves it (CadGripKind.Vertex and CadGripKind.Middle), or the east, west, north and south of a loop that is one circle (CadGripKind.Quadrant); a rectangle 100 by 60 has eight, from (0, 0), (50, 0), (100, 0), (100, 30) to (0, 30), after the one at (50, 30).
RemoveVertex
@staticmethod
def RemoveVertex(document: CadDocument, handle: str, gripIndex: int) -> CadEditResult
Takes a vertex out of a polyline, as the Remove Vertex item does, one undo step: the segment that now joins its two neighbours is straight, even where the segments either side of the vertex were arcs. A polyline of two vertices keeps them, as AutoCAD keeps them; a closed one of three leaves two. A spline keeps two fit points, or as many control points as its degree and one.
SetHatchOrigin
@staticmethod
def SetHatchOrigin(document: CadDocument, handle: str, origin: GeoPoint2) -> CadEditResult
Lays a hatch's pattern from a point, as the Origin Point item of the menu of its grip does, one undo step: each line of the pattern moves by what the origin moves, as HATCHSETORIGIN moves them.
Shown
@staticmethod
def Shown(document: CadDocument, entity: DxfEntity) -> System.Collections.Generic.IReadOnlyList[CadGrip]
Gets the grips of an entity as a document shows them: those CadGrips.Of gives, but for a revision cloud while the document's CadDocument.RevCloudGrips is on, which has the few grips of the shape it goes round. A cloud (a closed polyline of six vertices or more with REVCLOUD's data) round a rectangle (0, 0) to (60, 40) with arcs 10 long has eight: (0, 0), (0, 20), (0, 40), (30, 40), (60, 40), (60, 20), (60, 0) and (30, 0), a vertex grip at each corner and a middle grip at each side in turn from the first vertex. A cloud round the polygon (100, 0), (160, 0), (160, 40), (130, 60), (100, 40) has ten, (130, 60) among them, a corner the arcs cut off. A cloud round a circle has five, its centre and its quadrants to the right, left, above and below. Dragging one draws the cloud again along the new shape (see CadGrips.Drag); the grips of its vertices come back with REVCLOUDGRIPS 0.