Customizing schematic feature removal events


Purpose
This sample shows how to customize the BeforeRemoveFeature predefined schematic event used to manage the removal of schematic features contained in schematic diagrams. By default, when the Remove Schematic Features command is clicked, schematic features are graphically removed without being removed from the database.
In this sample, the BeforeRemoveFeature predefined event is customized so the related record in the database is definitively removed.

How to use

See How to use ArcGIS samples for help on compiling, setting up the debugger, and running the sample.

Data has been provided for your use with this sample. It can be found at <Your ArcGIS Developer Kit Install directory>/Samples/data/Schematics/RemovalSample.gdb.
If the sample has associated data, you will find that the sample's zip file includes a "data" folder alongside the language folders. However, you will need to update the sample to point to the location of the data once you have extracted all the files.

  1. Start Visual Studio, open the solution file, and build the project.
  2. Navigate to <ArcGIS DeveloperKit install location>\Samples\data\Schematics, and copy the SampleRemoval.gdb geodatabase in a folder for which you have full rights.
  3. Start ArcMap and open a new empty map.
  4. Click Customize and click Extension.
  5. Confirm that neither the Schematic Features Removal Events (C#) nor the Schematic Feature Removal Events (VBNet) extension is checked and close the Extensions dialog box.
  6. Open the Substation 08 schematic diagram contained in the SampleRemoval_Schematic schematic dataset in the SampleRemoval.gdb geodatabase you copied at step#2.
  7. Start an edit session on this schematic diagram.
  8. Select a set of schematic features in this diagram.
  9. Click Remove Schematic Features. The selected schematic features are graphically removed, but they are kept in the schematic feature classes.
  10. Close the edit session on the Substation 08 schematic diagram, and click Yes on the prompt message for saving.
  11. Click Update Diagram. The Update Diagram dialog box opens.
  12. Check the Synchronize against original selection/trace/query option and uncheck the Persist manually removed, reduced, or reconnected features option.
  13. Click OK. The diagram is updated and the schematic features removed in step 8 are restored and reappear in the diagram after updating.
  14. Click Customize and click Extension.
  15. Check the Schematic Features Removal Events (C#) or Schematic Feature Removal Events (VBNet) extension option and close the Extensions dialog box.
  16. Start an edit session on the Substation 08 schematic diagram.
  17. Select a set of schematic features in this diagram.
  18. Click Remove Schematic Features. The selected schematic features are graphically removed, but the associated records on the Inside_Nodes or Inside_Links tables from which they were queried (upon diagram generation) are also definitively removed. Updating the diagram will never restore the removed schematic features in the diagram regardless of the Persist manually removed, reduced, or reconnected features option that is used. They are no longer queried from the Inside_Nodes or Inside_Links tables because the related records have been removed.

FeatureRemovalMgmt.vb Customization of the BeforeRemoveFeature event.
Config.esriaddinx Add-in declarations in XML.
Download the VB.NET files
FeatureRemovalMgmt.cs Customization of the BeforeRemoveFeature event.
Config.esriaddinx Add-in declarations in XML.
Download the C# files

Download the files for all languages

See Also:

BeforeRemoveFeature Schematic event




Development licensing Deployment licensing
ArcGIS for Desktop Basic: Schematics ArcGIS for Desktop Basic: Schematics
ArcGIS for Desktop Standard: Schematics ArcGIS for Desktop Standard: Schematics
ArcGIS for Desktop Advanced: Schematics ArcGIS for Desktop Advanced: Schematics