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


Loop On The Schematic In-Memory Diagrams Based On A Schematic Diagram Class Snippet (ArcObjects .NET 10.5 SDK)
ArcObjects Library Reference

Loop On The Schematic In-Memory Diagrams Based On A Schematic Diagram Class Snippet

Looping on all the SchematicInMemoryDiagram based on a given Schematic Diagram Class

[C#]
        /// <summary>
        /// Looping on all the SchematicInMemoryDiagram based on a given SchematicDiagramClass
        /// </summary>
        /// <param name="schemDiagramClass">The SchematicDiagramClass on which the diagrams are based</param>
        public void SchematicInMemoryDiagramFromDiagramClass(ESRI.ArcGIS.Schematic.ISchematicDiagramClass schemDiagramClass)
        {
                // cast SchematicDiagramClass into ISchematicInMemoryDiagramContainer
                ESRI.ArcGIS.Schematic.ISchematicInMemoryDiagramContainer schInMemoryDiagramCont=(ESRI.ArcGIS.Schematic.ISchematicInMemoryDiagramContainer)schemDiagramClass;

                // get the list of the SchematicInMemoryDiagram
                ESRI.ArcGIS.Schematic.IEnumSchematicInMemoryDiagram enumInMemoryDiagram=schInMemoryDiagramCont.SchematicInMemoryDiagrams;
                enumInMemoryDiagram.Reset();

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

                        if (isOk) break;

                        // get the next SchematicInMemoryDiagram
                        schInMemoryDiagram=enumInMemoryDiagram.Next();
                }
        }
[Visual Basic .NET]
        ''' <summary>
        ''' Looping on all the SchematicInMemoryDiagram based on a given SchematicDiagramClass
        ''' </summary>
        ''' <param name="schemDiagramClass">The SchematicDiagramClass on which the diagrams are based</param>
        Public Sub SchematicInMemoryDiagramFromDiagramClass(ByVal schemDiagramClass As ESRI.ArcGIS.Schematic.ISchematicDiagramClass)

                ' cast SchematicDiagramClass into ISchematicInMemoryDiagramContainer
                Dim schInMemoryDiagramCont As ESRI.ArcGIS.Schematic.ISchematicInMemoryDiagramContainer=TryCast(schemDiagramClass, ESRI.ArcGIS.Schematic.ISchematicInMemoryDiagramContainer)

                ' get the list of the SchematicInMemoryDiagram
                Dim enumInMemoryDiagram As ESRI.ArcGIS.Schematic.IEnumSchematicInMemoryDiagram=schInMemoryDiagramCont.SchematicInMemoryDiagrams
                enumInMemoryDiagram.Reset()

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

                        If (isOk) Then Exit While

                        ' get the next SchematicInMemoryDiagram
                        schInMemoryDiagram=enumInMemoryDiagram.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