DrawingEnumeratorBase Class |
The DrawingEnumeratorBase class is a base class for DrawingObjectEnumerator and DrawingEnumerator.
Inheritance Hierarchy
SystemObject
Tekla.Structures.DrawingDrawingEnumeratorBase
Tekla.Structures.DrawingDrawingEnumerator
Tekla.Structures.DrawingDrawingObjectEnumerator
Tekla.Structures.DrawingDrawingEnumeratorBase
Tekla.Structures.DrawingDrawingEnumerator
Tekla.Structures.DrawingDrawingObjectEnumerator
Namespace: Tekla.Structures.Drawing
Assembly: Tekla.Structures.Drawing (in Tekla.Structures.Drawing.dll) Version: 2024.0.0+a110b435391768740483e3032720a566518c9a63
Syntax
The DrawingEnumeratorBase type exposes the following members.
Properties
Name | Description | |
---|---|---|
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
|
Methods
Name | Description | |
---|---|---|
GetEnumerator |
Allows the usage of the foreach statement with DrawingObjectEnumerator.
| |
GetSize |
Returns the total amout of items.
| |
MoveNext |
Moves to the next item in the enumerator.
| |
Reset |
Resets the enumerator to the beginning.
|
Fields
Name | Description | |
---|---|---|
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.
|
Examples
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() { drawingListTreeView.Nodes.Clear(); 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. drawingListTreeView.Nodes.Add(DrawingNode); } } 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); Node.Nodes.Add(CurrentNode); } } } }
See Also