2

I'm making an addin for ArcMap with ArcObjects and I want to detect when the user uses the split tool on a line feature. How can I achieve this?

    public StartUp()
    {
        var editor = MapHelpers.GetEditor(); //Returns the application's IEditor3
        var events = (editor as IEditEvents_Event);
        events.OnChangeFeature += (obj) =>
        {
        };
    }

So far all I can do is hook into the OnChangeFeature event and get the resulting IObject. I don't know where to go from here as the documentation is lacking.

1
  • I suspect split fires OnCreateFeature in addition to OnChangeFeature, so maybe test to be sure. Commented Aug 31, 2016 at 22:46

1 Answer 1

2

Get the current tool and check for the Splitting Tool ID. If the user is using third party splitting tools, you can also include those IDs in the splittingTools collection.

        events.OnChangeFeature += (obj) =>
        {
            var splittingTools = new List<string> { /*Default Tool:*/ "{5609B740-112F-11D2-84A9-0000F875B9C6}" };
            var currentToolID = ArcMap.Application.CurrentTool.ID.Value;
            var isSplit = splittingTools.Contains(currentToolID);
        }
1
  • Be aware of what happens when the line feature participates in a geometric network and a point that participates in the same network splits the line when placed on it. (not a tool doing the split)
    – Tim Sexton
    Commented Oct 17, 2016 at 20:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.