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


Get A SchematicAttribute Related To A SchematicDiagramClass Snippet (ArcObjects .NET 10.4 SDK)
ArcObjects Library Reference

Get A SchematicAttribute Related To A SchematicDiagramClass Snippet

Retrieve a SchematicAttribute related to a given SchematicDiagramClass from its name

[C#]
        /// <summary>
        /// Retrieve a SchematicAttribute related to a given SchematicDiagramClass from its name
        /// </summary>
        /// <param name="schemDiagramClass">The SchematicDiagramClass the attribute is related to</param>
        /// <param name="AttributeName">The schematic attribute name</param>
        /// <returns>The retrieved ESRI.ArcGIS.Schematic.ISchematicAttribute</returns>
        public ESRI.ArcGIS.Schematic.ISchematicAttribute GetSchematicAttributeFromDiagramClassByName(ESRI.ArcGIS.Schematic.ISchematicDiagramClass schemDiagramClass, string AttributeName)
        {
                // cast SchematicDiagramClass into ISchematicAttributeContainer
                ESRI.ArcGIS.Schematic.ISchematicAttributeContainer schAttributeCont=(ESRI.ArcGIS.Schematic.ISchematicAttributeContainer)schemDiagramClass;

                // the second parameter is set to True for a recursive search
                return schAttributeCont.GetSchematicAttribute(AttributeName, true);
        }
[Visual Basic .NET]
        ''' <summary>
        ''' Retrieve a SchematicAttribute related to a given SchematicDiagramClass from its name
        ''' </summary>
        ''' <param name="schemDiagramClass">The SchematicDiagramClass the attribute is related to</param>
        ''' <param name="AttributeName">The schematic attribute name</param>
        ''' <returns>The retrieved ESRI.ArcGIS.Schematic.ISchematicAttribute</returns>
        Public Function GetSchematicAttributeFromDiagramClassByName(ByVal schemDiagramClass As ESRI.ArcGIS.Schematic.ISchematicDiagramClass, ByVal AttributeName As String) As ESRI.ArcGIS.Schematic.ISchematicAttribute

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

                ' the second parameter is set to True for a recursive search
                Return schAttributeCont.GetSchematicAttribute(AttributeName, True)
        End Function

Additional Requirements
  • The code in this document requires the following References added to the Visual Studio project:
  • ESRI.ArcGIS.Schematic