Click or drag to resize

SectionStyleTableItem Property

Conceptually, the section style table is an array of section styles. The operator[] can be used to get individual section styles. A section style is either active or deleted and this state is reported by SectionStyle.IsDeleted.

Namespace:  Rhino.DocObjects.Tables
Assembly:  RhinoCommon (in RhinoCommon.dll)
Since: 9.0
Syntax
public SectionStyle this[
	int index
] { get; }

Parameters

index
Type: SystemInt32
zero based array index.

Return Value

Type: SectionStyle
Reference to the section style. If index is out of range, null is returned. Note that this reference may become invalid after AddSectionStyle() is called.
Remarks

Detaching a worksession reference model, or purging a linked instance definition, removes its section styles but leaves the table slots they occupied empty. The slots cannot be closed up, because table indices are persistent references that objects store, so renumbering would repoint existing objects at the wrong component. Count spans the empty slots, and they accumulate for the life of the document - one per purge.

An index that lands on an empty slot returns a SectionStyle that throws DocumentCollectedException on every property access, so code that walks this table by index must expect it. To tell a real section style from an empty slot, compare the index you asked for with SectionStyle.Index: an empty slot never reports the index you asked for. Enumerating the table with foreach goes through the document manifest rather than the raw table array, so it does not visit empty slots at all and is the safer way to walk the table.

The layer, linetype, material and hatch pattern tables answer the same situation differently: they return a stand-in component whose Index is -1 rather than one that throws. See RH-97389.

See Also