SectionStyleTableItem Property |
Namespace: Rhino.DocObjects.Tables
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.