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


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

Loop On The Schematic Diagrams In A Schematic Dataset Snippet

Looping on all the schematic diagrams stored in a given schematic dataset

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

                // retrieve all the SchematicDiagram in the schematic dataset container
                ESRI.ArcGIS.Schematic.IEnumSchematicDiagram enumDiagram=schDiagramCont.SchematicDiagrams;
                enumDiagram.Reset();

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

                        if (isOk) break;

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

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

                ' retrieve all the SchematicDiagram in the schematic dataset container
                Dim enumDiagram As ESRI.ArcGIS.Schematic.IEnumSchematicDiagram=schDiagramCont.SchematicDiagrams
                enumDiagram.Reset()

                ' get the first SchematicDiagram
                Dim schDiagram As ESRI.ArcGIS.Schematic.ISchematicDiagram=enumDiagram.Next()
                Dim isOk As Boolean=False
                While (schDiagram IsNot Nothing)

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

                         If (isOk) Then Exit While

                        ' get the next SchematicDiagram
                        schDiagram=enumDiagram.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