Table of Contents

Method AddStretchAction

Namespace
GeometryHelper.Dxf
Assembly
GeometryHelper.dll

AddStretchAction(DxfBlockLinearParameter, GeoPoint2, GeoPoint2, IEnumerable<DxfEntity>)

Gives the block a stretch action tied to a linear parameter of it, AutoCAD's Stretch action as its Block Editor makes one: as the parameter's distance grows by an amount, the points of the entities inside the frame move by that amount along the line from the parameter's base point to its end point and the points outside stay, so an entity across the frame stretches and one inside it moves whole.

public void AddStretchAction(DxfBlockLinearParameter parameter, GeoPoint2 frameCorner, GeoPoint2 oppositeCorner, IEnumerable<DxfEntity> entities)

Parameters

parameter DxfBlockLinearParameter

The parameter of this block the action follows, by its end point.

frameCorner GeoPoint2

A corner of the stretch frame, a rectangle along the block's x and y.

oppositeCorner GeoPoint2

The corner across from it.

entities IEnumerable<DxfEntity>

The entities of the block to stretch, each with one point in the frame at least: a LINE's (DxfLine) start or end, a LWPOLYLINE's (DxfPolyline) vertex, or the one point of the other kinds the remarks list.

Remarks

The rectangle 100 by 50 of the lines (100, 0)-(100, 50), (0, 0)-(100, 0), (0, 50)-(100, 50) and (0, 50)-(0, 0), its Width from (0, 0, 0) to (100, 0, 0), given the frame from (90, -10) to (110, 60) and the first three lines, holds the right edge whole and the right ends of the bottom and the top: AutoCAD 2021 set Width to 200 and moved them to x = 200, the left edge staying at x = 0 (plugin v17). A point is in the frame within the point tolerance of Default, on its border among them. The action is written as AutoCAD writes one: its frame as two corners, the least first, each entity with the indices of its points in the frame (0 a line's start, 1 its end, a polyline's vertex by its index), and the edge from the parameter in the evaluation graph; its element is named Stretch, the next Stretch1 and on. A parameter may be followed by several actions.

A polyline's vertices are taken in the block's coordinates (GetPoint3dAt(int)), their x and y. An entity of one point moves whole where its point is in the frame, as AutoCAD's STRETCH moves it: a circle (DxfCircle) by its centre, a text (DxfDBText) by the point it is held by (its position where it stands left on its baseline, else its alignment point), a multiline text (DxfMText) by its location, an INSERT (DxfBlockReference) by its insertion point; each is written as its point 0, as AutoCAD's files write the one point of a text. An arc (DxfArc) is numbered by its ends, 0 its start and 1 its end as AutoCAD numbers them (plugin v20, 24d-k): with both in the frame it moves whole; with one, that end moves and the other stays, the arc keeping the height of its middle off its chord, as AutoCAD 2021 kept 2.929 for the arc of the radius 10 from (100, 25) to (90, 35) whose start went to (150, 25) and then to (200, 25), its radius becoming 159.37 and then 522.13. An arc held by one end lies flat in the block, its normal along z. A text aligned or fitted between two points and an INSERT of rows and columns are refused. An attribute definition (DxfAttributeDefinition) locked in the block (LockPositionInBlock) is held by its point as a text is, and each INSERT's ATTRIB of its tag moves with it: MARK at (100, 10) stands at (150, 10) when Width is set from 100 to 150, as AutoCAD 2021 moved it (check D30); AutoCAD moved one not locked in the block but left its ATTRIB, and such a one is refused, as AutoCAD's Block Editor refuses it. An entity given twice is taken once.

Exceptions

ArgumentNullException

Thrown when the parameter, a corner, the entities or one of them is null.

ArgumentException

Thrown when the parameter is of another block or no longer in its graph, the frame is no wider or no higher than the point tolerance, there are no entities, or an entity is not of this block, is erased, is of a kind not taken, is an attribute definition not locked in the block, has no point in the frame, or is an arc with one end only in it whose normal is not along z. Nothing is written then.

InvalidOperationException

Thrown when the block cannot be dynamic, as AddLinearParameter(string, string, GeoPoint3, GeoPoint3, double, DxfBlockParameterValueSet) says.

NotSupportedException

Thrown when the block has a flip action, or an entity is also copied by an array action or turned by a polar stretch, or turned or scaled by a rotate or a scale action: AutoCAD 2021 worked a flip with a stretch out from each INSERT's last state and did not flip an INSERT of such a block itself (plugins v20 and v20b), and stretched a line it turned or scaled from where its last set left it (plugin v21, 24e-g). Nothing is written then.

AddStretchAction(DxfBlockLinearParameter, GeoPoint2, GeoPoint2, IEnumerable<DxfEntity>, double, double)

Gives the block a stretch action tied to a linear parameter of it, as AddStretchAction(DxfBlockLinearParameter, GeoPoint2, GeoPoint2, IEnumerable<DxfEntity>) does, of a distance multiplier and an angle offset, AutoCAD's Distance Multiplier and Angle Offset of the action: the points in the frame move by the change of the parameter's end point times the multiplier, turned by the offset.

public void AddStretchAction(DxfBlockLinearParameter parameter, GeoPoint2 frameCorner, GeoPoint2 oppositeCorner, IEnumerable<DxfEntity> entities, double distanceMultiplier, double angleOffset)

Parameters

parameter DxfBlockLinearParameter

The parameter of this block the action follows, by its end point.

frameCorner GeoPoint2

A corner of the stretch frame, a rectangle along the block's x and y.

oppositeCorner GeoPoint2

The corner across from it.

entities IEnumerable<DxfEntity>

The entities of the block to stretch, as the overload of no multiplier takes them.

distanceMultiplier double

What the change of the end point is multiplied by, a finite number: 0.5 moves the points in the frame half as far as the end point; 1 as far.

angleOffset double

The angle the move is turned by, counter-clockwise in radians, a finite number: Math.PI / 2 turns a move along x to one along y; nought keeps it.

Remarks

The rectangle 100 by 50 whose right edge is stretched by a Width from (0, 0, 0) to (100, 0, 0) of the multiplier 0.5 has its right edge at x = 150 when Width is set to 200. The multiplier and the offset are written as AutoCAD writes them (140 and 141 of the action); 1 and nought, the values of the overload of none, write the action that overload writes. An INSERT whose value is set keeps the offset in the record of the action in its cache (40), as AutoCAD 2021 kept it for a move; it moved along x, unturned, a circle of the offset of a quarter turn on an INSERT whose record held nought (plugin v21, 24e-b).

Exceptions

ArgumentNullException

Thrown when the parameter, a corner, the entities or one of them is null.

ArgumentException

Thrown as AddStretchAction(DxfBlockLinearParameter, GeoPoint2, GeoPoint2, IEnumerable<DxfEntity>) says. Nothing is written then.

ArgumentOutOfRangeException

Thrown when the multiplier or the offset is not a finite number.

InvalidOperationException

Thrown when the block cannot be dynamic, as AddLinearParameter(string, string, GeoPoint3, GeoPoint3, double, DxfBlockParameterValueSet) says.

NotSupportedException

Thrown as AddStretchAction(DxfBlockLinearParameter, GeoPoint2, GeoPoint2, IEnumerable<DxfEntity>) says. Nothing is written then.

AddStretchAction(DxfBlockXYParameter, GeoPoint2, GeoPoint2, IEnumerable<DxfEntity>)

Gives the block a stretch action tied to an XY parameter of it, AutoCAD's Stretch action of the XY type as its Block Editor makes one: as the parameter's end point moves, by its distance along x and along y, the points of the entities inside the frame move with it both ways and the points outside stay.

public void AddStretchAction(DxfBlockXYParameter parameter, GeoPoint2 frameCorner, GeoPoint2 oppositeCorner, IEnumerable<DxfEntity> entities)

Parameters

parameter DxfBlockXYParameter

The XY parameter of this block the action follows, by its end point.

frameCorner GeoPoint2

A corner of the stretch frame, a rectangle along the block's x and y.

oppositeCorner GeoPoint2

The corner across from it.

entities IEnumerable<DxfEntity>

The entities of the block to stretch, of the kinds and with the points that AddStretchAction(DxfBlockLinearParameter, GeoPoint2, GeoPoint2, IEnumerable<DxfEntity>) takes.

Remarks

A rectangle 100 by 50 from the origin given an XY parameter from (0, 0, 0) to (100, 50, 0) and the frame from (90, 40) to (110, 60) over its top right corner holds the corner: Width set to 160 and Depth to 80 move it to (160, 80), the right edge and the top following it and the bottom left corner staying. The action is written as the stretch of a linear parameter is, its connections EndXDelta and EndYDelta of the XY parameter, of the XY type (280 of nought).

Exceptions

ArgumentNullException

Thrown when the parameter, a corner, the entities or one of them is null.

ArgumentException

Thrown as AddStretchAction(DxfBlockLinearParameter, GeoPoint2, GeoPoint2, IEnumerable<DxfEntity>) says. Nothing is written then.

InvalidOperationException

Thrown when the block cannot be dynamic, as AddLinearParameter(string, string, GeoPoint3, GeoPoint3, double, DxfBlockParameterValueSet) says.

NotSupportedException

Thrown as AddStretchAction(DxfBlockLinearParameter, GeoPoint2, GeoPoint2, IEnumerable<DxfEntity>) says. Nothing is written then.

AddStretchAction(DxfBlockXYParameter, GeoPoint2, GeoPoint2, IEnumerable<DxfEntity>, double, double)

Gives the block a stretch action tied to an XY parameter of it, as AddStretchAction(DxfBlockXYParameter, GeoPoint2, GeoPoint2, IEnumerable<DxfEntity>) does, of a distance multiplier and an angle offset: the points in the frame move by the move of the parameter's end point times the multiplier, turned by the offset.

public void AddStretchAction(DxfBlockXYParameter parameter, GeoPoint2 frameCorner, GeoPoint2 oppositeCorner, IEnumerable<DxfEntity> entities, double distanceMultiplier, double angleOffset)

Parameters

parameter DxfBlockXYParameter

The XY parameter of this block the action follows, by its end point.

frameCorner GeoPoint2

A corner of the stretch frame, a rectangle along the block's x and y.

oppositeCorner GeoPoint2

The corner across from it.

entities IEnumerable<DxfEntity>

The entities of the block to stretch, as the overload of no multiplier takes them.

distanceMultiplier double

What the move of the end point is multiplied by, a finite number; 1 as far.

angleOffset double

The angle the move is turned by, counter-clockwise in radians, a finite number; nought keeps it.

Remarks

The top right corner (100, 50) of a rectangle stretched by an XY parameter from (0, 0, 0) to (100, 50, 0) of the multiplier 2 goes to (220, 110) when Width is set to 160 and Depth to 80.

Exceptions

ArgumentNullException

Thrown when the parameter, a corner, the entities or one of them is null.

ArgumentException

Thrown as AddStretchAction(DxfBlockLinearParameter, GeoPoint2, GeoPoint2, IEnumerable<DxfEntity>) says. Nothing is written then.

ArgumentOutOfRangeException

Thrown when the multiplier or the offset is not a finite number.

InvalidOperationException

Thrown when the block cannot be dynamic, as AddLinearParameter(string, string, GeoPoint3, GeoPoint3, double, DxfBlockParameterValueSet) says.

NotSupportedException

Thrown as AddStretchAction(DxfBlockLinearParameter, GeoPoint2, GeoPoint2, IEnumerable<DxfEntity>) says. Nothing is written then.

AddStretchAction(DxfBlockPolarParameter, GeoPoint2, GeoPoint2, IEnumerable<DxfEntity>)

Gives the block a stretch action tied to a polar parameter of it, AutoCAD's Stretch action as its Block Editor makes one on a polar parameter: as the parameter's end point moves, by its distance and its angle, the points of the entities inside the frame move with it, along x and along y, unturned, and the points outside stay.

public void AddStretchAction(DxfBlockPolarParameter parameter, GeoPoint2 frameCorner, GeoPoint2 oppositeCorner, IEnumerable<DxfEntity> entities)

Parameters

parameter DxfBlockPolarParameter

The polar parameter of this block the action follows, by its end point.

frameCorner GeoPoint2

A corner of the stretch frame, a rectangle along the block's x and y.

oppositeCorner GeoPoint2

The corner across from it.

entities IEnumerable<DxfEntity>

The entities of the block to stretch, of the kinds and with the points that AddStretchAction(DxfBlockLinearParameter, GeoPoint2, GeoPoint2, IEnumerable<DxfEntity>) takes.

Remarks

A rectangle 100 by 50 whose right edge a polar parameter from (0, 0, 0) to (100, 0, 0) stretches by the frame from (90, -10) to (110, 60) has its right edge from (0, 150) to (0, 200) when Length is set to 150 and Angle to a quarter turn: the end point moves from (100, 0) to (0, 150), and the edge with it, upright still, as AutoCAD 2021 drew it (plugin D25b). The action is written as the stretch of a linear parameter is, its connections EndXDelta and EndYDelta of the polar parameter. Where a polar stretch should turn the entities too, AddPolarStretchAction(DxfBlockPolarParameter, GeoPoint2, GeoPoint2, IEnumerable<DxfEntity>, IEnumerable<DxfEntity>) does.

Exceptions

ArgumentNullException

Thrown when the parameter, a corner, the entities or one of them is null.

ArgumentException

Thrown as AddStretchAction(DxfBlockLinearParameter, GeoPoint2, GeoPoint2, IEnumerable<DxfEntity>) says. Nothing is written then.

InvalidOperationException

Thrown when the block cannot be dynamic, as AddLinearParameter(string, string, GeoPoint3, GeoPoint3, double, DxfBlockParameterValueSet) says.

NotSupportedException

Thrown as AddStretchAction(DxfBlockLinearParameter, GeoPoint2, GeoPoint2, IEnumerable<DxfEntity>) says. Nothing is written then.

AddStretchAction(DxfBlockPolarParameter, GeoPoint2, GeoPoint2, IEnumerable<DxfEntity>, double, double)

Gives the block a stretch action tied to a polar parameter of it, as AddStretchAction(DxfBlockPolarParameter, GeoPoint2, GeoPoint2, IEnumerable<DxfEntity>) does, of a distance multiplier and an angle offset: the points in the frame move by the move of the parameter's end point times the multiplier, turned by the offset.

public void AddStretchAction(DxfBlockPolarParameter parameter, GeoPoint2 frameCorner, GeoPoint2 oppositeCorner, IEnumerable<DxfEntity> entities, double distanceMultiplier, double angleOffset)

Parameters

parameter DxfBlockPolarParameter

The polar parameter of this block the action follows, by its end point.

frameCorner GeoPoint2

A corner of the stretch frame, a rectangle along the block's x and y.

oppositeCorner GeoPoint2

The corner across from it.

entities IEnumerable<DxfEntity>

The entities of the block to stretch, as the overload of no multiplier takes them.

distanceMultiplier double

What the move of the end point is multiplied by, a finite number; 1 as far.

angleOffset double

The angle the move is turned by, counter-clockwise in radians, a finite number; nought keeps it.

Remarks

The right edge (100, 0)-(100, 50) of a rectangle stretched by a polar parameter from (0, 0, 0) to (100, 0, 0) of the multiplier 0.5 goes to (50, 75)-(50, 125) when Length is set to 150 and Angle to a quarter turn, half the end point's move from (100, 0) to (0, 150).

Exceptions

ArgumentNullException

Thrown when the parameter, a corner, the entities or one of them is null.

ArgumentException

Thrown as AddStretchAction(DxfBlockLinearParameter, GeoPoint2, GeoPoint2, IEnumerable<DxfEntity>) says. Nothing is written then.

ArgumentOutOfRangeException

Thrown when the multiplier or the offset is not a finite number.

InvalidOperationException

Thrown when the block cannot be dynamic, as AddLinearParameter(string, string, GeoPoint3, GeoPoint3, double, DxfBlockParameterValueSet) says.

NotSupportedException

Thrown as AddStretchAction(DxfBlockLinearParameter, GeoPoint2, GeoPoint2, IEnumerable<DxfEntity>) says. Nothing is written then.