Method AddPolarStretchAction
- Namespace
- GeometryHelper.Dxf
- Assembly
- GeometryHelper.dll
AddPolarStretchAction(DxfBlockPolarParameter, GeoPoint2, GeoPoint2, IEnumerable<DxfEntity>, IEnumerable<DxfEntity>)
Gives the block a polar stretch action tied to a polar parameter of it, AutoCAD's Polar Stretch action as its Block Editor makes one: as the parameter's angle turns and its distance grows, the entities turn about the parameter's base point by the change of the angle, and the points of the entities inside the frame move besides along the new line by the change of the distance, so an entity across the frame stretches as it turns; the entities to turn only turn whole about the base point.
public void AddPolarStretchAction(DxfBlockPolarParameter parameter, GeoPoint2 frameCorner, GeoPoint2 oppositeCorner, IEnumerable<DxfEntity> entities, IEnumerable<DxfEntity> rotateOnly)
Parameters
parameterDxfBlockPolarParameterThe polar parameter of this block the action follows, by its end point.
frameCornerGeoPoint2A corner of the stretch frame, a rectangle along the block's x and y.
oppositeCornerGeoPoint2The corner across from it.
entitiesIEnumerable<DxfEntity>The entities of the block to stretch, each with one point in the frame at least: a LINE's start or end, a LWPOLYLINE's vertex, an arc's two ends, or the one point of a circle, a text or an attribute definition held by one point, a multiline text or an INSERT, as AddStretchAction(DxfBlockLinearParameter, GeoPoint2, GeoPoint2, IEnumerable<DxfEntity>) takes them.
rotateOnlyIEnumerable<DxfEntity>The entities of the block to turn only, AutoCAD's Objects to Rotate Only; none for none.
Remarks
The pointer from (0, 0) to (100, 0) of a Length and an Angle from (0, 0, 0) to (100, 0, 0), given the frame from (90, -10) to (110, 10), the line, the circle of the radius 5 at its tip and a polyline from (50, -5) to (100, -5), and a tick from (20, 0) to (20, 10) to turn only, is drawn as AutoCAD 2021 drew it (plugin D25) when Length is set to 150 and Angle to a quarter turn: the line's start stays at the base point and its end goes to (0, 150), the circle with it, the polyline's end held in the frame turns and moves to (5, 150) while its start, outside it, turns alone to (5, 50), and the tick turns alone to (0, 20)-(-10, 20). A circle, a text, a multiline text or an INSERT held by its point, and an arc held by both ends, turn and move whole, a text turned with the line. AutoCAD 2021 worked each set out from the block's own values, not from the last set, and an INSERT scaled by 2 in its own units. A point is in the frame within the point tolerance of Default, on its border among them.
An attribute definition locked in its block (LockPositionInBlock) is taken to stretch or to turn only, and each INSERT's ATTRIB of it turns and moves with it, as AutoCAD 2021 worked them out (check D34): a left one at (100, 10) in the frame above goes, at a Distance of 150 and an Angle of 30 degrees, to (124.904, 83.660), turned by 30 degrees, and one centred on (100, -10) to turn only to (91.603, 41.340).
The action is written as AutoCAD saved the polar stretch of ACadSharp's sample and of AutoCAD's own Annotation sample: the entities it stretches (330), its six connections of the parameter's end point, its frame of two corners (73, 1011 and 1021), the entities it turns only (72, 331), each entity it stretches with the indices of its points in the frame (74, 332, 75 and 76, numbered as a stretch numbers them), the distance multiplier 1 (141) and the angle offset nought (140); its element named Polar Stretch, the next Polar Stretch1 and on; the edge from the parameter, of six connections. An entity to turn only is not among the 330s: named there too, AutoCAD 2021 turned the tick and moved it by the change of the distance besides, to (70, 0)-(70, 10) for a Length of 150. An entity given twice is taken once. The INSERT's cache keeps the record of the parameter (its base point, its end point, the normal down and the base point 10 along x, as AutoCAD keeps it) and of the action (its angle offset), as AutoCAD 2021 wrote them.
Exceptions
- ArgumentNullException
Thrown when the parameter, a corner, the entities, the entities to turn only 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 to stretch, an entity is not of this block, is erased, is of a kind not taken, has no point in the frame, is an arc with one end only in it, or is an attribute definition not locked in its block, or an entity to turn only is not of this block, is erased, is of a type the library keeps as it is, is an attribute definition not locked in its block, or is among the entities to stretch. Nothing is written then.
- InvalidOperationException
Thrown when the block cannot be dynamic, as AddLinearParameter(string, string, GeoPoint3, GeoPoint3, double, DxfBlockParameterValueSet) says.
- NotSupportedException
Thrown when an entity is also worked on by another action of the block, other than a lookup: no sample of AutoCAD shows the order they would take. Nothing is written then.