Unable to rotate features after programmatically selecting them


Selecting features in an edit session using the Select Features Tool or the Edit Tool activates the Rotate Tool on the Editor Toolbar, enabling the rotation of selected features. When the selection is made programmatically within an edit session the Rotate Tool activates, but features fail to rotate.


The ISelectionEvents::SelectionChanged event must be fired before the rotate tool is fully activated. The editor relies on the SelectionChanged event to union feature selection geometries, and set the selection anchor. If this event is not physically fired there will be no unioned geometry to rotate and there will not be an anchor location.

Solution or Workaround

The following code sample demonstrates how to fire the ISelectionEvents::SelectionChanged event.

Sub SelectionChanged()

Dim pDoc As IMxDocument
Dim pMap As IMap
Dim pLayer As IFeatureLayer
Dim pFc As IFeatureClass
Dim pSelSet As ISelectionSet
Dim pFSel As IFeatureSelection
Dim pSelEvents As ISelectionEvents

Set pDoc = ThisDocument
Set pMap = pDoc.FocusMap
Set pLayer = pMap.Layer(0)
Set pFc = pLayer.FeatureClass

'Get the selection set
Set pSelSet = pFc.Select(Nothing, 1, 1, Nothing)

'Update the layer with the seletion set
Set pFSel = pLayer
Set pFSel.SelectionSet = pSelSet

'Fire SelectionChanged event
Set pSelEvents = pMap


End Sub

    Article ID:000007130

    • ArcMap

    Get help from ArcGIS experts

    Contact technical support

    Download the Esri Support App

    Go to download options

    Discover more on this topic