API Reference

Detailed and full API reference helps you master Tekla development

This is the most recent version of Tekla Open API.
For older versions, please visit Tekla Warehouse.

DrawingEnumeratorBase Class

The DrawingEnumeratorBase class is a base class for DrawingObjectEnumerator and DrawingEnumerator.
Inheritance Hierarchy

Namespace:  Tekla.Structures.Drawing
Assembly:  Tekla.Structures.Drawing (in Tekla.Structures.Drawing.dll) Version: 2019.0.0.0 (2019.0.0.0)
public abstract class DrawingEnumeratorBase : IEnumerator

The DrawingEnumeratorBase type exposes the following members.

  Name Description
Public propertyStatic member AutoFetch
Indicates that the objects are fetched from the drawing when the enumerator is created. Object information is therefore not anymore fetched when 'Current' item is asked from the enumerator. Property value is used for all enumerators in application
  Name Description
Public method GetEnumerator
Allows the usage of the foreach statement with DrawingObjectEnumerator.
Public method GetSize
Returns the total amout of items.
Public method MoveNext
Moves to the next item in the enumerator.
Public method Reset
Resets the enumerator to the beginning.
  Name Description
Public field SelectInstances
Indicates that the instance Select() is called when the 'Current' item is asked from the enumerator. The user can set this to 'false' if no members are ever asked from the instance. This is the case when, for example, asking only a report property from the identifier. Warning: normally the user should not change this value.
The following example gets all the drawings and the objects of the drawings.
using Tekla.Structures.Drawing;
using System.Windows.Forms;

public class Example
       TreeView drawingListTreeView = new TreeView();
       DrawingHandler DrawingHandler = new DrawingHandler();
       CheckBox ShowViews = new CheckBox();
       CheckBox ShowObjectsInViews = new CheckBox();

       private void AddDrawingInformationToDrawingListTreeView()
           DrawingEnumerator DrawingList = DrawingHandler.GetDrawings(); // Get drawing list.

           while (DrawingList.MoveNext())
               Drawing CurrentDrawing = DrawingList.Current;

               // Add the drawing name to the UI tree.
               TreeNode DrawingNode = new TreeNode();
               DrawingNode.Tag = CurrentDrawing;
               DrawingNode.Text = "" + CurrentDrawing.GetType();

               if (ShowViews.Checked)
                   AddChildDrawingObjectsToTreeNode(DrawingNode, CurrentDrawing.GetSheet()); // Add all the objects placed to the sheet to the UI tree.

       private void AddChildDrawingObjectsToTreeNode(TreeNode Node, Tekla.Structures.Drawing.IHasChildren CurrentContainer)
           DrawingObjectEnumerator ObjectList = CurrentContainer.GetObjects(); // Gets the objects that are placed directly to the current container object.
           ObjectList.SelectInstances = false; // The instances don't need to be automatically selected, only whether the object exists or not has to be found out (objects properties are not used at all).

           while (ObjectList.MoveNext())
               if(ShowObjectsInViews.Checked || ObjectList.Current is ViewBase)
                   TreeNode CurrentNode = new TreeNode("" + ObjectList.Current.GetType());

                   CurrentNode.Tag = ObjectList.Current;

                   if (ObjectList.Current is Tekla.Structures.Drawing.IHasChildren)
                       AddChildDrawingObjectsToTreeNode(CurrentNode, ObjectList.Current as IHasChildren);

See Also