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


Loop On The Schematic Attributes Related To A Schematic Diagram Class Snippet (ArcObjects .NET 10.4 SDK)
ArcObjects Library Reference

Loop On The Schematic Attributes Related To A Schematic Diagram Class Snippet

Looping on all the schematic attributes related to a given SchematicDiagramClass

[C#]
        /// <summary>
        /// Looping on all the schematic attributes related to a SchematicDiagramClass
        /// </summary>
        /// <param name="schemDiagramClass">The SchematicDiagramClass the attributes are related to</param>
        public void SchematicAttributeFromDiagramClass(ESRI.ArcGIS.Schematic.ISchematicDiagramClass schemDiagramClass)
        {
                // cast SchematicDiagramClass into ISchematicAttributeContainer
                ESRI.ArcGIS.Schematic.ISchematicAttributeContainer schAttributeCont=(ESRI.ArcGIS.Schematic.ISchematicAttributeContainer)schemDiagramClass;

                // retrieve all the SchematicAttribute in the schematic attribute container
                ESRI.ArcGIS.Schematic.IEnumSchematicAttribute enumAttribute=schAttributeCont.SchematicAttributes;
                enumAttribute.Reset();

                // get the first SchematicAttribute
                ESRI.ArcGIS.Schematic.ISchematicAttribute schAttribute=enumAttribute.Next();
                bool isOk=false;
                while (schAttribute != null)
                {
                        // TODO: add your code here, set isOk to true to exit the loop
                        
                        if (isOk) break;

                        // get the next SchematicAttribute
                        schAttribute=enumAttribute.Next();
                }
        }

[Visual Basic .NET]
        ''' <summary>
        ''' Looping on all the schematic attributes related to a SchematicDiagramClass
        ''' </summary>
        ''' <param name="schemDiagramClass">The SchematicDiagramClass the attributes are related to</param>
        Public Sub SchematicAttributeFromDiagramClass(ByVal schemDiagramClass As ESRI.ArcGIS.Schematic.ISchematicDiagramClass)

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

                ' retrieve all the SchematicAttribute in the schematic attribute container
                Dim enumAttribute As ESRI.ArcGIS.Schematic.IEnumSchematicAttribute=schAttributeCont.SchematicAttributes
                enumAttribute.Reset()

                ' get the first SchematicAttribute
                Dim schAttribute As ESRI.ArcGIS.Schematic.ISchematicAttribute=enumAttribute.Next()
                Dim isOk As Boolean=False
                While (schAttribute IsNot Nothing)

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

                        If (isOk) Then Exit While

                        ' get the next SchematicAttribute
                        schAttribute=enumAttribute.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