Section style table

Properties

ActiveCount

#Since v9.0
Returns number of section styles in the table, excluding deleted section styles.
public int ActiveCount { get; }

ComponentType

#Since v9.0
public override ModelComponentType ComponentType { get; }

Count

#Since v9.0
Returns number of section styles in the section style table, including deleted section styles.

This count also spans table slots emptied by a purge, so it can be larger than the number of section styles that are actually there. See the remarks on the indexer.

public int Count { get; }

Document

#Since v9.0
Document that owns this table.
public RhinoDoc Document { get; }

Indexers

this[]

#Since v9.0
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.
public SectionStyle this[
index
zero based array index.
] { get; }
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.

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.

Methods

Add

#Since v9.0
Adds a new section style with specified definition to the table.
public int Add(
sectionstyle
Definition of new section style. The information in sectionstyle is copied. If sectionstyle.Name is empty then a unique name of the form "SectionStyle 01" will be automatically created.
)
Index of new section style type or -1 on error.

AddReferenceSectionStyle

#Since v9.0
Adds a reference section style that will not be saved in files.
public int AddReferenceSectionStyle(
sectionstyle
Definition of new section style. The information in sectionstyle is copied. If sectionstyle.Name is empty then a unique name of the form "SectionStyle 01" will be automatically created.
)
Index of new section style or -1 on error.

Clear

Marks all items as deleted.
public void Clear()
inherited fromCommonComponentTable<T>

Delete

#Since v9.0
Deletes a section style.
public bool Delete(
index,
zero based index of section style to delete.
quiet
If true, no warning message box appears if a section style is in use.
)
true if successful. false if index is out of range or the section style is referenced by active geometry.

Delete

#Since v9.0
Deletes a section style.
public override bool Delete(
item
The section style to delete.
)
true if successful, false otherwise.

Delete

#Since v9.0
Delete multiple section styles.
public int Delete(
sectionStyleIndices,
An enumeration of section style indices.
quiet,
If true, no warning message box appears if a section style is in use.
deleteWarning
Action to take when multiple delete warnings occur, where: 0 == No to all, 1 == Yes to all, 2 == Ask the user.
)
The number of section styles that were deleted.

Delete

#Since v9.0
Delete multiple section styles.
public int Delete(
sectionStyleIndices,
An enumeration of section style indices.
quiet
If true, no warning message box appears if a section style is in use.
)
The number of section styles that were deleted.

Find

#Since v9.0
Finds a section style with a matching ID.
public int Find(
id,
The ID of the section style to be found.
ignoreDeletedSectionStyles
If true, deleted section styles are not checked.
)
If the section style was found, the section style index, >=0, is returned. If the section style was not found, -1 is returned.

Find

#Since v9.0
Finds the section style with a given name.
public int Find(
name
The name of the section style to find. The search ignores case.
)
If the section style was found, the section style index, >=0, is returned. If the section style was not found, -1 is returned.

FindId

Uses the guid to find a model component. Deleted objects cannot be found by id. The guid is the value that is stored in the .Id property. In a single document, no two active objects have the same guid. If an object is replaced with a new object, then the guid persists. For example, if the _Move command moves an object, then the moved object inherits its guid from the starting object. If the Copy command copies an object, then the copy gets a new guid. This guid persists through file saving/opening operations. This function will not find grip objects.
public virtual T FindId(
id
ID of model component to search for.
)
inherited fromCommonComponentTable<T>
Reference to the rhino object with the objectId or null if no such object could be found.
FindId

FindIndex

#Since v9.0
Retrieves a section style based on Index. This search type of search is discouraged. We are moving towards using only IDs for all tables.
public SectionStyle FindIndex(
index
The index to search for.
)
A SectionStyle object, or null if none was found.

FindName

#Since v9.0
Finds the section style with a given name.
public SectionStyle FindName(
name
The name of the section style to find.
)
The section style if found; otherwise null.

GetEnumerator

#Since v9.0
public override IEnumerator<SectionStyle> GetEnumerator()

GetUnusedSectionStyleName

#Since v9.0
Gets unused section style name used as default when creating new section styles.
public string GetUnusedSectionStyleName()
The unused name.

InUse

#Since v9.0
Returns true if a section style is use by an object, layer, or instance definition.
public bool InUse(
index,
The index of the section style to query.
out int
instanceDefinitionCount,
The number of instance definitions using this section style.
out int
objectCount,
The number of Rhino objects using this section style.
out int
layerCount
The number of layers using this section style.
)
True if the section style is in use, false otherwise.

Modify

#Since v9.0
Modify section style settings.
public bool Modify(
sectionstyle,
New sections style settings. This information is copied.
index,
Zero based index of section style to set.
quiet
if true, information message boxes pop up when illegal changes are attempted.
)
true if successful. false if index is out of range.
Explicit

ICollection<SectionStyle>.Add

#Since v9.0