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


Get A Schematic Attribute On An In-Memory Schematic Feature Snippet (ArcObjects .NET 10.4 SDK)
ArcObjects Library Reference

Get A Schematic Attribute On An In-Memory Schematic Feature Snippet

Retrieve a SchematicAttribute related to an in-memory schematic feature from its name

[C#]
        /// <summary>
        /// Retrieve a SchematicAttribute related to an in-memory schematic feature from its name
        /// </summary>
        /// <param name="schemFeature">The ISchematicInMemoryFeature where the schematic attribute is defined</param>
        /// <param name="AttributeName">The schematic attribute name</param>
        /// <returns>The retrieved SchematicAttribute</returns>
        public ESRI.ArcGIS.Schematic.ISchematicAttribute GetAttributeFromSchematicFeatureByName(ESRI.ArcGIS.Schematic.ISchematicInMemoryFeature schemFeature, string AttributeName)
        {
                // cast SchematicInMemoryFeature.SchematicElementClass into ISchematicAttributeContainer
                ESRI.ArcGIS.Schematic.ISchematicAttributeContainer schAttribCont=(ESRI.ArcGIS.Schematic.ISchematicAttributeContainer)schemFeature.SchematicElementClass;

                // the second parameter is set to True for recursive search
                return schAttribCont.GetSchematicAttribute(AttributeName, true);
        }
[Visual Basic .NET]
        ''' <summary>
        ''' Retrieve a SchematicAttribute related to an in-memory schematic feature from its name
        ''' </summary>
        ''' <param name="schemFeature">The ISchematicInMemoryFeature where the schematic attribute is defined</param>
        ''' <param name="AttributeName">The schematic attribute name</param>
        ''' <returns>The retrieved SchematicAttribute</returns>
        Public Function GetAttributeFromSchematicFeatureByName(ByVal schemFeature As ESRI.ArcGIS.Schematic.ISchematicInMemoryFeature, ByVal AttributeName As String) As ESRI.ArcGIS.Schematic.ISchematicAttribute
                ' cast SchematicInMemoryFeature.SchematicElementClass into ISchematicAttributeContainer
                Dim schAttribCont As ESRI.ArcGIS.Schematic.ISchematicAttributeContainer=TryCast(schemFeature.SchematicElementClass, ESRI.ArcGIS.Schematic.ISchematicAttributeContainer)

                ' the second parameter is set to True for recursive search
                Return schAttribCont.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