10

In an ArcMap extension, I need to flip multiple lines from a selection.

The ArcMap Flip button only allows you to flip one feature at a time.

What's the ArcObjects equivalent to ArcMap's Flip button?

enter image description here

7

ICurve.ReverseOrientation should do what you want.

Actually there is a full snippet Flip Line Direction Snippet , available in the ESRI online documentation.

Here is a small extract from it:

ESRI.ArcGIS.Geometry.ICurve curve = feature.Shape as ESRI.ArcGIS.Geometry.ICurve;
curve.ReverseOrientation();
feature.Shape = curve;
feature.Store();
  • Thanks! By the way, there's an error in the Flip Line snippet. the line "if(!(feature is ESRI.ArcGIS.Geometry.ICurve))" should be "if(!(feature.Shape is ESRI.ArcGIS.Geometry.ICurve))" – Goldorak84 Jan 9 '13 at 19:06
  • @Goldorak84 - yes thats correct..quite a few of them are lurking in the samples :) – vinayan Jan 10 '13 at 5:16
  • @vinayan I am trying to accomplish the same thing, but in VB.NET. Were you able to use ReverseOrientation while editing, that is, in an active edit session, not by starting an edit operation programatically? – Barbarossa Jun 19 '15 at 2:35
  • 1
    @Barbarossa I did use ReverseOrientation inside an active edit session. However, I "StartEditOperation" (which starts a bunch of edits within an actual edit session) on the Editor object is mandatory. Otherwise, it would mess up your undo stack. What prevents you to use that method? – Goldorak84 Jun 22 '15 at 17:46
  • Thank you for the response. I was not considering the undo stack. Everything is functioning properly now. – Barbarossa Jun 22 '15 at 21:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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