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


Loop On The Schematic Rules Configured On A SchematicDiagramClass Snippet (ArcObjects .NET 10.5 SDK)
ArcObjects Library Reference

Loop On The Schematic Rules Configured On A SchematicDiagramClass Snippet

Looping on all the schematic rules configured on a SchematicDiagramClass

[C#]
        /// <summary>
        /// Looping on all the schematic rules configured on a SchematicDiagramClass
        /// </summary>
        /// <param name="schemDiagramClass">The SchematicDiagramClass where the schematic rules are configured</param>
        public void SchematicBuilderRulesFromDiagramClass(ESRI.ArcGIS.Schematic.ISchematicDiagramClass schemDiagramClass)
        {
                // cast SchematicDiagramClass into ISchematicBuilderRuleContainer
                ESRI.ArcGIS.Schematic.ISchematicBuilderRuleContainer schBuilderRuleCont=(ESRI.ArcGIS.Schematic.ISchematicBuilderRuleContainer)schemDiagramClass;

                // retrieve all the SchematicBuilderRule in the schematic builder rule container
                ESRI.ArcGIS.Schematic.IEnumSchematicBuilderRule enumBuilderRule=schBuilderRuleCont.OrderedSchematicBuilderRules;
                enumBuilderRule.Reset();

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

                        if (isOk) break;

                        // get the next SchematicBuilderRule
                        schBuilderRule=enumBuilderRule.Next();
                }
        }
[Visual Basic .NET]
        ''' <summary>
        ''' Looping on all the schematic rules configured on a SchematicDiagramClass
        ''' </summary>
        ''' <param name="schemDiagramClass">The SchematicDiagramClass where the schematic rules are configured</param>
        ''' <remarks></remarks>
        Public Sub SchematicBuilderRulesFromDiagramClass(ByVal schemDiagramClass As ESRI.ArcGIS.Schematic.ISchematicDiagramClass)

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

                ' retrieve all the SchematicBuilderRule in the schematic builder rule container
                Dim enumBuilderRule As ESRI.ArcGIS.Schematic.IEnumSchematicBuilderRule=schBuilderRuleCont.OrderedSchematicBuilderRules
                enumBuilderRule.Reset()

                ' get the first SchematicBuilderRule
                Dim schBuilderRule As ESRI.ArcGIS.Schematic.ISchematicBuilderRule=enumBuilderRule.Next()
                Dim isOk As Boolean=False
                While (schBuilderRule IsNot Nothing)

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

                        If (isOk) Then Exit While

                        ' get the next SchematicBuilderRule
                        schBuilderRule=enumBuilderRule.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