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


Get A SchematicDiagramClass In A Schematic Dataset Snippet (ArcObjects .NET 10.5 SDK)
ArcObjects Library Reference

Get A SchematicDiagramClass In A Schematic Dataset Snippet

Retrieve a schematic diagram class in a given schematic dataset from its name

[C#]
        /// <summary>
        /// Retrieve a SchematicDiagramClass in a given SchematicDataset
        /// </summary>
        /// <param name="schemDataset">The SchematicDataset containing the SchematicDiagramClass</param>
        /// <param name="DiagramClassName">The name of the SchematicDiagramClass to retrieve</param>
        /// <returns>ESRI.ArcGIS.Schematic.ISchematicDiagramClass</returns>
        public ESRI.ArcGIS.Schematic.ISchematicDiagramClass GetSchematicDiagramClassFromSchematicDatasetByName(ESRI.ArcGIS.Schematic.ISchematicDataset schemDataset, string DiagramClassName)
        {
           // cast SchematicDataset into ISchematicDiagramClassContainer
                ESRI.ArcGIS.Schematic.ISchematicDiagramClassContainer schDiagramClassCont=(ESRI.ArcGIS.Schematic.ISchematicDiagramClassContainer)schemDataset;

           // retrieve the desired SchematicDiagramClass in the schematic dataset container
                return schDiagramClassCont.GetSchematicDiagramClass(DiagramClassName);
        }
[Visual Basic .NET]
''' <summary>
''' Retrieve a SchematicDiagramClass in a given SchematicDataset
''' </summary>
''' <param name="schemDataset">The SchematicDataset containing the SchematicDiagramClass</param>
''' <param name="DiagramClassName">The name of the SchematicDiagramClass to retrieve</param>
''' <returns>ESRI.ArcGIS.Schematic.ISchematicDiagramClass</returns>
Public Function GetSchematicDiagramClassFromSchematicDatasetByName(ByVal schemDataset As ESRI.ArcGIS.Schematic.ISchematicDataset, ByVal DiagramClassName As String) As ESRI.ArcGIS.Schematic.ISchematicDiagramClass

       ' cast SchematicDataset into ISchematicDiagramClassContainer
        Dim schDiagramClassCont As ESRI.ArcGIS.Schematic.ISchematicDiagramClassContainer=TryCast(schemDataset, ESRI.ArcGIS.Schematic.ISchematicDiagramClassContainer)

       ' retrieve the desired SchematicDiagramClass in the schematic dataset container
        Return schDiagramClassCont.GetSchematicDiagramClass(DiagramClassName)
End Function


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