About the Implementing extended criteria for some predefined schematic rules Sample
[C#]
FeatureRemovalExt.cs
using System;
using System.Collections.Generic;
using System.Text;
namespace CustomExtCriteriaCS
{
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.None)]
[System.Runtime.InteropServices.Guid(FeatureRemovalExt.GUID)]
[System.Runtime.InteropServices.ProgId(FeatureRemovalExt.PROGID)]
public class FeatureRemovalExt : ESRI.ArcGIS.Schematic.ISchematicFeatureRemovalExtended
{
public const string GUID = "f1ff48de-93b1-4765-b943-d04284e63fb9";
public const string PROGID = "CustomExtCriteriaCS.FeatureRemovalExt";
#region Component Category Registration
[System.Runtime.InteropServices.ComRegisterFunction()]
public static void Register(string regKey)
{
ESRI.ArcGIS.ADF.CATIDs.SchematicRulesExtendedCriteria.Register(regKey);
}
[System.Runtime.InteropServices.ComUnregisterFunction()]
public static void Unregister(string regKey)
{
ESRI.ArcGIS.ADF.CATIDs.SchematicRulesExtendedCriteria.Unregister(regKey);
}
#endregion
#region ISchematicFeatureRemovalExtended Membres
public string Name
{
get { return "Remove cables with particular ID (C#)"; }
}
public bool Evaluate(ESRI.ArcGIS.Schematic.ISchematicInMemoryFeature schematicFeature)
{
// if not the right class do nothing
if (schematicFeature.SchematicElementClass.Name != "cables") return false;
// Remove specific schematic elements
if ((schematicFeature.Name == "5-7-0") || (schematicFeature.Name == "5-4-0"))
return true;
return false;
}
#endregion
}
}
[Visual Basic .NET]
FeatureRemovalExt.vb
Option Strict Off Option Explicit On <System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.None)> _ <System.Runtime.InteropServices.Guid(FeatureRemovalExt.GUID)> _ <System.Runtime.InteropServices.ProgId(FeatureRemovalExt.PROGID)> _ Public Class FeatureRemovalExt Implements ESRI.ArcGIS.Schematic.ISchematicFeatureRemovalExtended Public Const GUID As String = "EBBE13D2-0996-4bb9-BEB8-8781FD8A1A23" Public Const PROGID As String = "CustomExtCriteriaVB.FeatureRemovalExt" ' Register/unregister categories for this class #Region "Component Category Registration" <System.Runtime.InteropServices.ComRegisterFunction()> _ Public Shared Sub Register(ByVal regKey As String) ESRI.ArcGIS.ADF.CATIDs.SchematicRulesExtendedCriteria.Register(regKey) End Sub <System.Runtime.InteropServices.ComUnregisterFunction()> _ Public Shared Sub Unregister(ByVal regKey As String) ESRI.ArcGIS.ADF.CATIDs.SchematicRulesExtendedCriteria.Unregister(regKey) End Sub #End Region #Region "ISchematicFeatureRemovalExtended Implementations" Public Function Evaluate(ByVal schematicFeature As ESRI.ArcGIS.Schematic.ISchematicInMemoryFeature) As Boolean Implements ESRI.ArcGIS.Schematic.ISchematicFeatureRemovalExtended.Evaluate ' if not the right class do nothing If schematicFeature.SchematicElementClass.Name <> "cables" Then Return False ' Remove specific schematic elements If schematicFeature.Name = "5-7-0" Or schematicFeature.Name = "5-4-0" Then Return True Else Return False End If End Function Private ReadOnly Property Name() As String _ Implements ESRI.ArcGIS.Schematic.ISchematicFeatureRemovalExtended.Name Get Return "Remove cables with particular ID (VBNet)" End Get End Property #End Region End Class