This document is archived and information here might be outdated.  Recommended version.


Loop On the Schematic Element Classes In A Schematic Dataset Snippet (ArcObjects .NET 10.5 SDK)
ArcObjects Library Reference

Loop On the Schematic Element Classes In A Schematic Dataset Snippet

Lopping on all the schematic element classes stored in a given SchematicDataset

[C#]
        /// <summary>
        ///Looping on all the schematic element classes stored in a given SchematicDataset
        /// </summary>
        /// <param name="schemDataset">The SchematicDataset which contains the schematic element classes</param>
        public void SchematicElementClassFromSchematicDataset(ESRI.ArcGIS.Schematic.ISchematicDataset schemDataset)
        {
                // cast SchematicDataset into ISchematicElementClassContainer
                ESRI.ArcGIS.Schematic.ISchematicElementClassContainer schemElementClassCont=(ESRI.ArcGIS.Schematic.ISchematicElementClassContainer)schemDataset;

                // retrieve all the SchematicElementClass in the schematic dataset container
                ESRI.ArcGIS.Schematic.IEnumSchematicElementClass enumElementClass=schemElementClassCont.SchematicElementClasses;
                enumElementClass.Reset();

                // get the first SchematicElementClass
                ESRI.ArcGIS.Schematic.ISchematicElementClass schemElementClass=enumElementClass.Next();
                bool isOk=false;
                while (schemElementClass != null)
                {
                        // TODO: add your code here, set isOk to true to exit the loop

                        if (isOk) break; 

                        // get the next SchematicElementClass
                        schemElementClass=enumElementClass.Next();
                }
        }
[Visual Basic .NET]
        ''' <summary>
        ''' Looping on all the schematic element classes stored in a given SchematicDataset
        ''' </summary>
        ''' <param name="schemDataset">The SchematicDataset which contains the schematic element classes</param>
        Public Sub SchematicElementClassFromSchematicDataset(ByVal schemDataset As ESRI.ArcGIS.Schematic.ISchematicDataset)

                ' cast SchematicDataset into ISchematicElementClassContainer
                Dim schElementClassCont As ESRI.ArcGIS.Schematic.ISchematicElementClassContainer=TryCast(schemDataset, ESRI.ArcGIS.Schematic.ISchematicElementClassContainer)

                ' retrieve all the SchematicElementClass in the schematic dataset container
                Dim enumElementClass As ESRI.ArcGIS.Schematic.IEnumSchematicElementClass=schElementClassCont.SchematicElementClasses
                enumElementClass.Reset()

                ' get the first SchematicElementClass
                Dim schElementClass As ESRI.ArcGIS.Schematic.ISchematicElementClass=enumElementClass.Next()
                Dim isOk As Boolean=False
                While (schElementClass IsNot Nothing)
                        ' TODO: add your code here, set isOk to true to exit the loop

                        If (isOk) Then Exit While

                        ' get the next SchematicElementClass
                        schElementClass=enumElementClass.Next()
                End While
        End Sub

Additional Requirements
  • The code in this document requires the following References added to the Visual Studio project:
  • ESRI.ArcGIS.Schematic