Method AddBlockPropertiesTable
- Namespace
- GeometryHelper.Dxf
- Assembly
- GeometryHelper.dll
AddBlockPropertiesTable(GeoPoint3, IEnumerable<DxfBlockPropertiesTableColumn>, IEnumerable<DxfBlockPropertiesTableRow>)
Makes the block dynamic, where it is not, and gives it a block properties table: rows of values, each setting several properties of the block's parameters and attributes at once, which each INSERT of the block shows as the dynamic property Block Table1, the index of its row, AutoCAD's Block Properties Table as its Block Editor makes one. Set to a row's index, the property sets each column to the row's value; it reads the index of the first row of the values the INSERT shows, else -1.
public void AddBlockPropertiesTable(GeoPoint3 location, IEnumerable<DxfBlockPropertiesTableColumn> columns, IEnumerable<DxfBlockPropertiesTableRow> rows)
Parameters
locationGeoPoint3Where the table's grip stands, in the block's coordinates.
columnsIEnumerable<DxfBlockPropertiesTableColumn>The columns of the table, each the property of a parameter of this block (Distance(DxfBlockLinearParameter) and the others), its visibility state (Visibility(DxfBlockTableRecord)) or an attribute definition of it (Attribute(DxfAttributeDefinition)), each once.
rowsIEnumerable<DxfBlockPropertiesTableRow>The rows, each a value for each column (DxfBlockPropertiesTableRow): a number for a parameter's column, the name of a state for the visibility's, a text or null, an empty cell, for an attribute definition's; no two rows the same.
Remarks
A plate of a Width and a Height and the attribute MARK given AddBlockPropertiesTable(new GeoPoint3(0, -20, 0),
new[] { DxfBlockPropertiesTableColumn.Distance(width), DxfBlockPropertiesTableColumn.Distance(height),
DxfBlockPropertiesTableColumn.Attribute(mark) }, new[] { new DxfBlockPropertiesTableRow(100.0, 50.0, "P100"), new
DxfBlockPropertiesTableRow(200.0, 80.0, "P200") }) gives every INSERT the property Block Table1, a
short; set to 1, Width goes to 200 and Height to 80, stretching what they stretch, and the INSERT's
attribute MARK reads P200. Width set to 150 afterwards, Block Table1 reads -1.
The table is written as AutoCAD 2021 keeps one (plugin D26, AutoCAD's Parking sample and a column added through its
BlockPropertiesTable): its element named Block Table and its property Block Table1, its grip and the grip's
two location components, four nodes of the evaluation graph; the edge of the grip to the table and of the table to
each component; a pair of edges each way between the table and each parameter of a column, of the flags 4, the table
first; the graph's extended data AcadBPTGraphNodeId naming the table. Each column names its parameter's node, or the
attribute definition, of no connection; each cell is a real, a text, of the type 40 and 1 as AutoCAD writes them.
The rows need not match, and no column is constant. An empty cell, of an attribute definition's column only, is
written of the type -9999 as AutoCAD writes one; set to its row, the INSERT's attribute reads an empty text, as
AutoCAD 2021 gave MARK, and its audit of the table found no fault, where it refused one of an empty cell of a
parameter's column (eNotApplicable) and took the property Block Table1 away once a row was set (plugin D26b). A
column of the visibility state is written as AutoCAD 2021's AddItem wrote one, its cells texts; a column of an
angle is flagged so (293 of 1), as AutoCAD wrote the one it added of a rotation parameter (plugin D26b).
Exceptions
- ArgumentNullException
Thrown when the columns, the rows or one of them is null.
- ArgumentException
Thrown when a coordinate of the location is not a finite number, there are no columns or no rows, a column is of another block or given twice, an attribute definition is erased or constant, a row has not one value for each column or a value not of its column's kind (an empty cell outside an attribute definition's column, a text naming no state of the visibility parameter among them), a distance is not above the point tolerance of Default or not of its parameter's value set, an angle is not of its parameter's value set, or two rows are the same. Nothing is written then.
- InvalidOperationException
Thrown when the block has a block properties table already, as AutoCAD's Block Editor gives a block one, or cannot be dynamic, as AddLinearParameter(string, string, GeoPoint3, GeoPoint3, double, DxfBlockParameterValueSet) says.
- NotSupportedException
Thrown when the block has a flip parameter, as AddLinearParameter(string, string, GeoPoint3, GeoPoint3, double, DxfBlockParameterValueSet) says. Nothing is written then.