Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

Hull and Outfitting

Iterators

  • Last UpdatedOct 27, 2023
  • 1 minute read

The DBElementCollection class can be used to iterate through the database hierarchy. The iterator is created with a root element and an optional filter. There are then methods to step through the hierarchy and return the element at the current location.

For example, to look for all nozzles below a given element:

TypeFilter filt = new TypeFilter(DbElementTypeInstance.NOZZLE);

DBElementCollection collection;

collection = new DBElementCollection(ele, filt);

The collection can then be iterated through using foreach

foreach (DbElement ele in collection)

{

…. Do something

}

The iterator class has been written to avoid unnecessarily scanning parts of the database that will not match the filter. for example, if looking for all boxes then the iterator will not bother to look below pipes.

Related Links
TitleResults for “How to create a CRG?”Also Available in