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


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

Loop On The Schematic Diagram Classes In A Schematic Dataset Snippet

Looping on all the schematic diagram classes stored in a given schematic dataset

[C#]
/// <summary>
/// Looping on all the schematic diagram classes in a SchematicDataset
/// </summary>
/// <param name="schemDataset">The SchematicDataset which contains the schematic diagram classes</param>
        public void SchematicDiagramClassesFromSchematicDataset(ESRI.ArcGIS.Schematic.ISchematicDataset schemDataset)
        {
                // cast SchematicDataset into ISchematicDiagramClassContainer
                ESRI.ArcGIS.Schematic.ISchematicDiagramClassContainer schDiagramClassCont=(ESRI.ArcGIS.Schematic.ISchematicDiagramClassContainer)schemDataset;

                // retrieve all the SchematicDiagramClass in the specified SchematicDataset
                ESRI.ArcGIS.Schematic.IEnumSchematicDiagramClass enumDiagramClass=schDiagramClassCont.SchematicDiagramClasses;
                enumDiagramClass.Reset();

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

                        if (isOk) break;

                        // get the next SchematicDiagramClass
                        schDiagramClass=enumDiagramClass.Next();
                }
        }
[Visual Basic .NET]
''' <summary>
''' Looping on all the schematic diagram classes in a SchematicDataset
''' </summary>
''' <param name="schemDataset">The SchematicDataset which contains the schematic diagram classes</param>
Public Sub SchematicDiagramClassesFromSchematicDataset(ByVal schemDataset As ESRI.ArcGIS.Schematic.ISchematicDataset)
       ' cast SchematicDataset into ISchematicDiagramClassContainer
        Dim schDiagramClassCont As ESRI.ArcGIS.Schematic.ISchematicDiagramClassContainer=TryCast(schemDataset, ESRI.ArcGIS.Schematic.ISchematicDiagramClassContainer)

       ' retrieve all the SchematicDiagramClass in the schematic dataset container
        Dim enumDiagramClass As ESRI.ArcGIS.Schematic.IEnumSchematicDiagramClass=schDiagramClassCont.SchematicDiagramClasses
        enumDiagramClass.Reset()

       ' get the first SchematicDiagramClass
        Dim schDiagramClass As ESRI.ArcGIS.Schematic.ISchematicDiagramClass=enumDiagramClass.Next()
        Dim isOk As Boolean=False
        While (schDiagramClass IsNot Nothing)

           ' TODO: add your code here, set isOk to true to exit the loop

           If (isOk) Then Exit While

           ' get the next SchematicDiagramClass
                schDiagramClass=enumDiagramClass.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