Method AddArrayAction
- Namespace
- GeometryHelper.Dxf
- Assembly
- GeometryHelper.dll
AddArrayAction(DxfBlockLinearParameter, IEnumerable<DxfEntity>, double)
Gives the block an array action tied to a linear parameter of it, AutoCAD's Array action as its Block Editor makes one: as the parameter's distance grows, the entities are copied along the line from the parameter's base point to its end point, a copy at each column spacing, as many in all as the spacing goes whole into the distance.
public void AddArrayAction(DxfBlockLinearParameter parameter, IEnumerable<DxfEntity> entities, double columnSpacing)
Parameters
parameterDxfBlockLinearParameterThe parameter of this block the action follows.
entitiesIEnumerable<DxfEntity>The entities of the block to copy; the first copy is each entity itself.
columnSpacingdoubleThe distance from one copy to the next along the parameter, above the point tolerance of Default.
Remarks
A post, a circle of the radius 5 at (0, 0), of a fence whose Length runs from (0, 0, 0) to (100, 0, 0), given an array of the column spacing 60, is one post, as the block draws it; Length set to 250, the INSERT shows four, at x = 0, 60, 120 and 180, as AutoCAD 2021 drew them, and one post for 119 (plugin v21, 24e-c). The count is the distance over the spacing, rounded down, one at least, as AutoCAD's save of ACadSharp's XY sample shows too: four columns of the spacing 25 in 100.59, five rows of 20 in 104.30. A block whose own distance holds the spacing twice or more draws one copy still, which its INSERTs show until a value is set.
The action is written as AutoCAD saved the array of that sample: the entities it copies, its connections Base, End, UpdatedBase and UpdatedEnd, the row offset (140) nought and the column offset (141) the spacing; its element named Array; the edge from the parameter of four connections; no record of the INSERT's cache. A linear parameter's array is written as the XY sample's with no rows, which AutoCAD 2021 worked out as above. Each copy but the entity itself is tagged as AutoCAD tags the copies of its arrays (AcDbBlockArrayActionTag, 1070 1), without which AutoCAD 2021 refused to set again an INSERT whose value had been set (eInvalidInput, plugin v21). An entity given twice is taken once; one an array copies is moved by no other action.
Exceptions
- ArgumentNullException
Thrown when the parameter, the entities or one of them is null.
- ArgumentException
Thrown as AddMoveAction(DxfBlockLinearParameter, IEnumerable<DxfEntity>) says, and when an entity is an attribute definition, locked or not. Nothing is written then.
- ArgumentOutOfRangeException
Thrown when the spacing is not a finite number above the point tolerance.
- 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 moved, stretched, scaled, turned or copied by another action. Nothing is written then.
AddArrayAction(DxfBlockXYParameter, IEnumerable<DxfEntity>, double, double)
Gives the block an array action tied to an XY parameter of it, AutoCAD's Array action as its Block Editor makes one: as the parameter's end point moves, the entities are copied in rows and columns from the base point the way the end point lies, a column at each column spacing along x and a row at each row spacing along y.
public void AddArrayAction(DxfBlockXYParameter parameter, IEnumerable<DxfEntity> entities, double columnSpacing, double rowSpacing)
Parameters
parameterDxfBlockXYParameterThe XY parameter of this block the action follows.
entitiesIEnumerable<DxfEntity>The entities of the block to copy; the first copy is each entity itself.
columnSpacingdoubleThe distance from one column to the next along x, above the point tolerance of Default.
rowSpacingdoubleThe distance from one row to the next along y, above the point tolerance.
Remarks
A bolt, a circle of the radius 5 at (0, 0), of a plate whose XY parameter runs from (0, 0, 0) to (40, 30, 0), given an array of the column spacing 25 and the row spacing 20, is one bolt; Width set to 100 and Depth to 70 show four columns of three rows, the bolts at x = 0, 25, 50, 75 and y = 0, 20, 40. Each count is the distance over its spacing, rounded down, as AutoCAD's save of ACadSharp's XY sample shows: four columns of 25 in 100.59, five rows of 20 in 104.30, the rows running down from the base point to an end point below it; AutoCAD 2021 drew one column of three rows for 40 by 70 and two columns of one row for 60 by 30 (plugin v21, 24e-d). Where a count is nought nothing is copied, the entity standing alone, as AutoCAD 2021 drew the one circle of that sample set to 80 by 5 (24e-s2).
The action is written as AutoCAD saved the array of that sample: the entities it copies, its connections Base, End, UpdatedBase and UpdatedEnd, the row offset (140) and the column offset (141); its element named Array; the edge from the parameter of four connections; no record of the INSERT's cache. Each copy but the entity itself is tagged as AutoCAD tags the copies of its arrays, as AddArrayAction(DxfBlockLinearParameter, IEnumerable<DxfEntity>, double) says. An entity given twice is taken once; one an array copies is moved by no other action.
Exceptions
- ArgumentNullException
Thrown when the parameter, the entities or one of them is null.
- ArgumentException
Thrown as AddMoveAction(DxfBlockLinearParameter, IEnumerable<DxfEntity>) says, and when an entity is an attribute definition, locked or not. Nothing is written then.
- ArgumentOutOfRangeException
Thrown when a spacing is not a finite number above the point tolerance.
- InvalidOperationException
Thrown when the block cannot be dynamic, as AddLinearParameter(string, string, GeoPoint3, GeoPoint3, double, DxfBlockParameterValueSet) says.
- NotSupportedException
Thrown as AddArrayAction(DxfBlockLinearParameter, IEnumerable<DxfEntity>, double) says. Nothing is written then.