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


Loop On The Parent In-Memory Schematic Feature In An In-Memory Schematic Diagram Snippet (ArcObjects .NET 10.5 SDK)
ArcObjects Library Reference

Loop On The Parent In-Memory Schematic Feature In An In-Memory Schematic Diagram Snippet

Looping on all the parent in-memory schematic features contained in an in-memory schematic diagram

[C#]
        /// <summary>
        /// Looping on all the parent in-memory schematic features contained in an in-memory schematic diagram
        /// </summary>
        /// <param name="schemInMemoryDiagram">The ISchematicInMemoryDiagram that contains the parent in-memory schematic features</param>
        public void ParentsFromInMemoryFeature(ESRI.ArcGIS.Schematic.ISchematicInMemoryDiagram schemInMemoryDiagram)
        {
                ESRI.ArcGIS.Schematic.ISchematicRelationController schRelCont=new ESRI.ArcGIS.Schematic.SchematicRelationController();

                ESRI.ArcGIS.Schematic.IEnumSchematicInMemoryFeature enumFeature=schRelCont.FindParents(schemInMemoryDiagram);
                enumFeature.Reset();
                // get the first parent in-memory schematic feature
                ESRI.ArcGIS.Schematic.ISchematicFeature schFeature=enumFeature.Next();
                bool isOk=false;
                while (schFeature != null)
                {
                        // TODO: add your code here, set isOk to true to exit the loop

                        if (isOk) break;

                        // get the next parent in-memory schematic feature
                        schFeature=enumFeature.Next();
                }
        }
[Visual Basic .NET]
        ''' <summary>
        ''' Looping on all the parent in-memory schematic features contained in an in-memory schematic diagram 
        ''' </summary>
        ''' <param name="schemInMemoryDiagram">The ISchematicInMemoryDiagram that contains the parent in-memory schematic features</param>
        Public Sub ParentsFromInMemoryFeature(ByVal schemInMemoryDiagram As ESRI.ArcGIS.Schematic.ISchematicInMemoryDiagram)

                Dim schRelCont As ESRI.ArcGIS.Schematic.ISchematicRelationController=New ESRI.ArcGIS.Schematic.SchematicRelationController()

                Dim enumFeature As ESRI.ArcGIS.Schematic.IEnumSchematicInMemoryFeature=schRelCont.FindParents(schemInMemoryDiagram)

                enumFeature.Reset()
                ' get the first parent in-memory schematic feature
                Dim schFeature As ESRI.ArcGIS.Schematic.ISchematicFeature=enumFeature.Next()
                Dim isOk As Boolean=False
                While (schFeature IsNot Nothing)
                        ' TODO: add your code here, set isOk to true to exit the loop

                         If (isOk) Then Exit While

                        ' get the next parent in-memory schematic feature
                        schFeature=enumFeature.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