Section style table

Properties

ActiveCount

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

ComponentType

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

Count

#Since v9.0
public int Count { get; }
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.

Document

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

Indexers

this[]

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

index (int)zero based array index.
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
public int Add(SectionStyle sectionstyle)
Adds a new section style with specified definition to the table.
sectionstyle (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
public int AddReferenceSectionStyle(SectionStyle sectionstyle)
Adds a reference section style that will not be saved in files.
sectionstyle (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

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

Delete

#Since v9.0
public bool Delete(int index, bool quiet)
Deletes a section style.
index (int)zero based index of section style to delete.
quiet (bool)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
public override bool Delete(SectionStyle item)
Deletes a section style.
item (SectionStyle)The section style to delete.
true if successful, false otherwise.

Delete

#Since v9.0
public int Delete(IEnumerable<int> sectionStyleIndices, bool quiet, int deleteWarning)
Delete multiple section styles.
sectionStyleIndices (IEnumerable<int>)An enumeration of section style indices.
quiet (bool)If true, no warning message box appears if a section style is in use.
deleteWarning (int)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
public int Delete(IEnumerable<int> sectionStyleIndices, bool quiet)
Delete multiple section styles.
sectionStyleIndices (IEnumerable<int>)An enumeration of section style indices.
quiet (bool)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
public int Find(Guid id, bool ignoreDeletedSectionStyles)
Finds a section style with a matching ID.
id (Guid)The ID of the section style to be found.
ignoreDeletedSectionStyles (bool)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
public int Find(string name)
Finds the section style with a given name.
name (string)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

public virtual T FindId(Guid id)
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.
inherited fromCommonComponentTable<T>
id (Guid)ID of model component to search for.
Reference to the rhino object with the objectId or null if no such object could be found.
FindId

FindIndex

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

FindName

#Since v9.0
public SectionStyle FindName(string name)
Finds the section style with a given name.
name (string)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
public string GetUnusedSectionStyleName()
Gets unused section style name used as default when creating new section styles.
The unused name.

InUse

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

Modify

#Since v9.0
public bool Modify(SectionStyle sectionstyle, int index, bool quiet)
Modify section style settings.
sectionstyle (SectionStyle)New sections style settings. This information is copied.
index (int)Zero based index of section style to set.
quiet (bool)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
item (SectionStyle)